Hello community, here is the log from the commit of package azure-cli-rdbms for openSUSE:Factory checked in at 2018-05-13 16:02:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/azure-cli-rdbms (Old) and /work/SRC/openSUSE:Factory/.azure-cli-rdbms.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "azure-cli-rdbms" Sun May 13 16:02:58 2018 rev:3 rq:600061 version:0.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/azure-cli-rdbms/azure-cli-rdbms.changes 2018-02-14 09:31:42.123305990 +0100 +++ /work/SRC/openSUSE:Factory/.azure-cli-rdbms.new/azure-cli-rdbms.changes 2018-05-13 16:03:00.594830542 +0200 @@ -1,0 +2,8 @@ +Thu Apr 19 12:33:01 UTC 2018 - adrian.glaub...@suse.com + +- New upstream release + + Version 0.2.1 +- Move LICENSE.txt from %doc to %license section +- Update Requires from setup.py + +------------------------------------------------------------------- Old: ---- azure-cli-rdbms-0.0.11.tar.gz New: ---- azure-cli-rdbms-0.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ azure-cli-rdbms.spec ++++++ --- /var/tmp/diff_new_pack.lHDacp/_old 2018-05-13 16:03:01.410800773 +0200 +++ /var/tmp/diff_new_pack.lHDacp/_new 2018-05-13 16:03:01.414800627 +0200 @@ -17,7 +17,7 @@ Name: azure-cli-rdbms -Version: 0.0.11 +Version: 0.2.1 Release: 0 Summary: Microsoft Azure CLI 'MySQL and PostgreSQL' Command Module License: MIT @@ -34,8 +34,9 @@ Requires: azure-cli-command-modules-nspkg Requires: azure-cli-core Requires: azure-cli-nspkg -Requires: python3-azure-mgmt-rdbms >= 0.1.0 +Requires: python3-azure-mgmt-rdbms >= 1.1.0 Requires: python3-azure-nspkg +Requires: python3-six Conflicts: azure-cli < 2.0.0 BuildArch: noarch @@ -65,7 +66,8 @@ %files %defattr(-,root,root,-) -%doc HISTORY.rst LICENSE.txt README.rst +%doc HISTORY.rst README.rst +%license LICENSE.txt %{python3_sitelib}/azure/cli/command_modules/rdbms %{python3_sitelib}/azure_cli_rdbms-*.egg-info ++++++ azure-cli-rdbms-0.0.11.tar.gz -> azure-cli-rdbms-0.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/HISTORY.rst new/azure-cli-rdbms-0.2.1/HISTORY.rst --- old/azure-cli-rdbms-0.0.11/HISTORY.rst 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/HISTORY.rst 2018-04-06 19:33:13.000000000 +0200 @@ -3,6 +3,28 @@ Release History =============== +0.2.1 ++++++ +* Introduce georestore command. +* Remove storage size restriction from create command. +* `sdist` is now compatible with wheel 0.31.0 + +0.2.0 ++++++ +* Release with new business model GA API version 2017-12-01. + +0.1.1 +++++++ +* Minor changes. + +0.1.0 +++++++ +* Preview release with new business model API 2017-12-01-preview. + +0.0.12 +++++++ +* Minor fixes. + 0.0.11 ++++++ * Minor fixes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/PKG-INFO new/azure-cli-rdbms-0.2.1/PKG-INFO --- old/azure-cli-rdbms-0.0.11/PKG-INFO 2018-01-12 18:25:36.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/PKG-INFO 2018-04-06 19:33:48.000000000 +0200 @@ -1,13 +1,16 @@ Metadata-Version: 1.1 Name: azure-cli-rdbms -Version: 0.0.11 +Version: 0.2.1 Summary: Microsoft Azure Command-Line Tools MySQL and PostgreSQL Command Module Home-page: https://github.com/Azure/azure-cli Author: Microsoft Corporation Author-email: azpy...@microsoft.com License: MIT +Description-Content-Type: UNKNOWN Description: Microsoft Azure CLI 'MySQL and PostgreSQL' Command Module ========================================================= + This package is for the 'rdbms' module. + i.e. 'az mysql' and 'az postgres' @@ -16,6 +19,28 @@ Release History =============== + 0.2.1 + +++++ + * Introduce georestore command. + * Remove storage size restriction from create command. + * `sdist` is now compatible with wheel 0.31.0 + + 0.2.0 + +++++ + * Release with new business model GA API version 2017-12-01. + + 0.1.1 + ++++++ + * Minor changes. + + 0.1.0 + ++++++ + * Preview release with new business model API 2017-12-01-preview. + + 0.0.12 + ++++++ + * Minor fixes. + 0.0.11 ++++++ * Minor fixes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/README.rst new/azure-cli-rdbms-0.2.1/README.rst --- old/azure-cli-rdbms-0.0.11/README.rst 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/README.rst 2018-04-06 19:33:13.000000000 +0200 @@ -1,3 +1,5 @@ Microsoft Azure CLI 'MySQL and PostgreSQL' Command Module ========================================================= +This package is for the 'rdbms' module. +i.e. 'az mysql' and 'az postgres' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/__init__.py new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/__init__.py --- old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/__init__.py 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/__init__.py 2018-04-06 19:33:13.000000000 +0200 @@ -11,13 +11,22 @@ class RdbmsCommandsLoader(AzCommandsLoader): def __init__(self, cli_ctx=None): + from azure.cli.core import ModExtensionSuppress from azure.cli.core.commands import CliCommandType from azure.cli.command_modules.rdbms._util import RdbmsArgumentContext + rdbms_custom = CliCommandType(operations_tmpl='azure.cli.command_modules.rdbms.custom#{}') - super(RdbmsCommandsLoader, self).__init__(cli_ctx=cli_ctx, - min_profile='2017-03-10-profile', - custom_command_type=rdbms_custom, - argument_context_cls=RdbmsArgumentContext) + super(RdbmsCommandsLoader, self).__init__( + cli_ctx=cli_ctx, + min_profile='2017-03-10-profile', + custom_command_type=rdbms_custom, + argument_context_cls=RdbmsArgumentContext, + suppress_extension=ModExtensionSuppress( + __name__, + 'rdbms', + '0.0.5', + reason='These commands are now in the CLI.', + recommend_remove=True)) def load_command_table(self, args): from azure.cli.command_modules.rdbms.commands import load_command_table diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/_client_factory.py new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/_client_factory.py --- old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/_client_factory.py 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/_client_factory.py 2018-04-06 19:33:13.000000000 +0200 @@ -31,7 +31,7 @@ secret=getenv(CLIENT_SECRET), tenant=getenv(TENANT_ID)) else: - from msrest.authentication import Authentication + from msrest.authentication import Authentication # pylint: disable=import-error credentials = Authentication() return MySQLManagementClient( @@ -60,7 +60,7 @@ secret=getenv(CLIENT_SECRET), tenant=getenv(TENANT_ID)) else: - from msrest.authentication import Authentication + from msrest.authentication import Authentication # pylint: disable=import-error credentials = Authentication() return PostgreSQLManagementClient( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/_help.py new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/_help.py --- old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/_help.py 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/_help.py 2018-04-06 19:33:13.000000000 +0200 @@ -23,13 +23,13 @@ examples: - name: Create a {0} server with only required paramaters in North Europe. text: az {1} server create -l northeurope -g testgroup -n testsvr -u username -p password - - name: Create a {0} server with a Standard performance tier and 100 compute units in North Europe. + - name: Create a {0} server with a Standard performance tier and 2 vcore in North Europe. text: az {1} server create -l northeurope -g testgroup -n testsvr -u username -p password \\ - --performance-tier Standard --compute-units 100 + --sku-name GP_Gen4_2 - name: Create a {0} server with all paramaters set. text: az {1} server create -l northeurope -g testgroup -n testsvr -u username -p password \\ - --performance-tier Basic --compute-units 100 --ssl-enforcement Disabled \\ - --storage-size 51200 --tags "key=value" --version <server_version> + --sku-name B_Gen4_2 --ssl-enforcement Disabled \\ + --storage-size 51200 --tags "key=value" --version {{server-version}} """.format(server_type, command_group) helps['{} server restore'.format(command_group)] = """ type: command @@ -43,12 +43,24 @@ -s "/subscriptions/${{SubID}}/resourceGroups/${{ResourceGroup}}/providers/Microsoft.DBfor{1}/servers/testsvr2" \\ --restore-point-in-time "2017-06-15T13:10:00Z" """.format(command_group, server_type) + helps['{} server georestore'.format(command_group)] = """ + type: command + short-summary: Georestore a server from backup. + examples: + - name: Georestore 'testsvr' as 'testsvrnew' where 'testsvrnew' is in same resource group as 'testsvr'. + text: az {0} server georestore -g testgroup -n testsvrnew --source-server testsvr -l westus2 + - name: Georestore 'testsvr2' to 'testsvrnew', where 'testsvrnew' is in the different resource group as the original server. + text: | + az {0} server georestore -g testgroup -n testsvrnew \\ + -s "/subscriptions/${{SubID}}/resourceGroups/${{ResourceGroup}}/providers/Microsoft.DBfor{1}/servers/testsvr2" + -l westus2 --sku-name GP_Gen5_2 + """.format(command_group, server_type) helps['{} server update'.format(command_group)] = """ type: command short-summary: Update a server. examples: - - name: Update a server's compute-units to 100. - text: az {0} server update -g testgroup -n testsvrnew --compute-units 100 + - name: Update a server's vcore to 2. + text: az {0} server update -g testgroup -n testsvrnew --vcore 2 - name: Update a server's tags. text: az {0} server update -g testgroup -n testsvrnew --tags "k1=v1" "k2=v2" """.format(command_group) @@ -110,9 +122,9 @@ short-summary: Update the configuration of a server. examples: - name: Set a new configuration value. - text: az {0} server configuration set -g testgroup -s testsvr -n <config_name> --value <config_value> + text: az {0} server configuration set -g testgroup -s testsvr -n {{config_name}} --value {{config_value}} - name: Set a configuration value to its default. - text: az {0} server configuration set -g testgroup -s testsvr -n <config_name> + text: az {0} server configuration set -g testgroup -s testsvr -n {{config_name}} """.format(command_group) helps['{} server configuration show'.format(command_group)] = """ type: command @@ -148,27 +160,36 @@ type: group short-summary: Manage {0} databases on a server. """.format(server_type) - # helps['{} db create'.format(command_group)] = """ - # type: command - # short-summary: Create a {0} database. - # examples: - # - name: Create database 'testdb' in the server 'testsvr' with the default parameters. - # text: az {1} db create -g testgroup -s testsvr -n testdb - # - name: Create database 'testdb' in server 'testsvr' with a given character set and collation rules. - # text: az {1} db create -g testgroup -s testsvr -n testdb --charset <valid_charset> --collation <valid_collation> - # """.format(server_type, command_group) - # helps['{} db delete'.format(command_group)] = """ - # type: command - # short-summary: Delete a database. - # """ - # helps['{} db show'.format(command_group)] = """ - # type: command - # short-summary: Show the details of a database. - # """ + helps['{} db create'.format(command_group)] = """ + type: command + short-summary: Create a {0} database. + examples: + - name: Create database 'testdb' in the server 'testsvr' with the default parameters. + text: az {1} db create -g testgroup -s testsvr -n testdb + - name: Create database 'testdb' in server 'testsvr' with a given character set and collation rules. + text: az {1} db create -g testgroup -s testsvr -n testdb --charset {{valid_charset}} --collation {{valid_collation}} + """.format(server_type, command_group) + helps['{} db delete'.format(command_group)] = """ + type: command + short-summary: Delete a database. + examples: + - name: Delete database 'testdb' in the server 'testsvr'. + text: az {0} db delete -g testgroup -s testsvr -n testdb + """.format(command_group) + helps['{} db show'.format(command_group)] = """ + type: command + short-summary: Show the details of a database. + examples: + - name: Show database 'testdb' in the server 'testsvr'. + text: az {0} db show -g testgroup -s testsvr -n testdb + """.format(command_group) helps['{} db list'.format(command_group)] = """ type: command short-summary: List the databases for a server. - """ + examples: + - name: List databases in the server 'testsvr'. + text: az {0} db list -g testgroup -s testsvr + """.format(command_group) add_helps("mysql", "MySQL") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/_params.py new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/_params.py --- old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/_params.py 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/_params.py 2018-04-06 19:33:13.000000000 +0200 @@ -2,77 +2,78 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -from azure.mgmt.rdbms import mysql -from azure.mgmt.rdbms import postgresql -from azure.cli.core.commands.parameters import ( - get_resource_name_completion_list, tags_type, get_location_type, get_enum_type) +# pylint: disable=line-too-long +from azure.cli.core.commands.parameters import get_resource_name_completion_list, tags_type, get_location_type, get_enum_type # pylint: disable=line-too-long from azure.cli.command_modules.rdbms.validators import configuration_value_validator -# pylint: disable=line-too-long - -def load_arguments(self, _): +def load_arguments(self, _): # pylint: disable=too-many-statements server_completers = { 'mysql': get_resource_name_completion_list('Microsoft.DBForMySQL/servers'), 'postgres': get_resource_name_completion_list('Microsoft.DBForPostgreSQL/servers') } - def _complex_params(command_group, engine): - + def _complex_params(command_group): with self.argument_context('{} server create'.format(command_group)) as c: - c.expand('sku', engine.models.Sku) - c.ignore('name', 'family', 'size') + c.argument('sku_name', options_list=['--sku-name'], required=True, help='The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.') + + c.argument('backup_retention', type=int, options_list=['--backup-retention'], help='The number of days a backup is retained.') + c.argument('geo_redundant_backup', options_list=['--geo-redundant-backup'], help='Enable Geo-redundant or not for server backup.') + c.argument('storage_mb', options_list=['--storage-size'], type=int, help='The max storage size of the server. Unit is megabytes.') - c.expand('properties', engine.models.ServerPropertiesForDefaultCreate) c.argument('administrator_login', required=True, arg_group='Authentication') c.argument('administrator_login_password', arg_group='Authentication') - c.expand('parameters', engine.models.ServerForCreate) - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False) + c.argument('version', help='Server version') with self.argument_context('{} server restore'. format(command_group)) as c: - c.expand('sku', engine.models.Sku) - c.ignore('name', 'family', 'size', 'tier', 'capacity') - - c.expand('properties', engine.models.ServerPropertiesForRestore) - c.ignore('version', 'ssl_enforcement', 'storage_mb') - - c.expand('parameters', engine.models.ServerForCreate) - c.ignore('tags', 'location') - - c.argument('source_server_id', options_list=['--source-server', '-s'], help='The name or ID of the source server to restore from.') + c.argument('source_server', options_list=['--source-server', '-s'], help='The name or ID of the source server to restore from.') c.argument('restore_point_in_time', help='The point in time to restore from (ISO8601 format), e.g., 2017-04-26T02:10:00+08:00') + with self.argument_context('{} server georestore'. format(command_group)) as c: + c.argument('location', arg_type=get_location_type(self.cli_ctx), required=True) + c.argument('sku_name', options_list=['--sku-name'], required=False, help='The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.') + c.argument('source_server', options_list=['--source-server', '-s'], required=True, help='The name or ID of the source server to restore from.') + c.argument('backup_retention', options_list=['--backup-retention'], type=int, help='The max days of retention, unit is days.') + c.argument('geo_redundant_backup', options_list=['--geo-redundant-backup'], help='Enable Geo-redundant or not for server backup.') + with self.argument_context('{} server configuration set'.format(command_group)) as c: c.argument('value', help='Value of the configuration. If not provided, configuration value will be set to default.', validator=configuration_value_validator) c.ignore('source') - _complex_params('mysql', mysql) - _complex_params('postgres', postgresql) + with self.argument_context('{} server wait'.format(command_group)) as c: + c.ignore('created', 'deleted', 'updated') + + _complex_params('mysql') + _complex_params('postgres') for scope in ['mysql', 'postgres']: with self.argument_context(scope) as c: - c.argument('name', options_list=['--sku-name']) + c.argument('name', options_list=['--sku-name'], required=True) c.argument('server_name', completer=server_completers[scope], options_list=['--server-name', '-s'], help='Name of the server.') for scope in ['mysql server', 'postgres server']: with self.argument_context(scope) as c: + c.ignore('size', 'family', 'capacity', 'tier') + c.argument('server_name', options_list=['--name', '-n'], id_part='name', help='Name of the server.') c.argument('administrator_login', options_list=['--admin-user', '-u']) - c.argument('administrator_login_password', options_list=['--admin-password', '-p'], required=False, help='The password of the administrator login.') + c.argument('administrator_login_password', options_list=['--admin-password', '-p'], help='The password of the administrator login.') c.argument('ssl_enforcement', arg_type=get_enum_type(['Enabled', 'Disabled']), options_list=['--ssl-enforcement'], help='Enable ssl enforcement or not when connect to server.') - c.argument('tier', arg_type=get_enum_type(['Basic', 'Standard']), options_list=['--performance-tier'], help='The performance tier of the server.') - c.argument('capacity', options_list=['--compute-units'], type=int, help='Number of compute units.') - c.argument('storage_mb', options_list=['--storage-size'], type=int, help='The max storage size of the server, unit is MB.') + c.argument('tier', arg_type=get_enum_type(['Basic', 'GeneralPurpose', 'MemoryOptimized']), options_list=['--performance-tier'], help='The performance tier of the server.') + c.argument('capacity', options_list=['--vcore'], type=int, help='Number of vcore.') + c.argument('family', options_list=['--family'], arg_type=get_enum_type(['Gen4', 'Gen5']), help='Hardware generation.') + c.argument('storage_mb', options_list=['--storage-size'], type=int, help='The max storage size of the server. Unit is megabytes.') + c.argument('backup_retention_days', options_list=['--backup-retention'], type=int, help='The number of days a backup is retained.') c.argument('tags', tags_type) for scope in ['mysql server-logs', 'postgres server-logs']: with self.argument_context(scope) as c: - c.argument('file_name', options_list=['--name', '-n'], nargs='+', help='Space separated list of log filenames on the server to download.') + c.argument('file_name', options_list=['--name', '-n'], nargs='+', help='Space-separated list of log filenames on the server to download.') c.argument('max_file_size', type=int, help='The file size limitation to filter files.') c.argument('file_last_written', type=int, help='Integer in hours to indicate file last modify time, default value is 72.') c.argument('filename_contains', help='The pattern that file name should match.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/_util.py new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/_util.py --- old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/_util.py 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/_util.py 2018-04-06 19:33:13.000000000 +0200 @@ -6,9 +6,9 @@ from azure.cli.core.commands import AzArgumentContext -class RdbmsArgumentContext(AzArgumentContext): +class RdbmsArgumentContext(AzArgumentContext): # pylint: disable=too-few-public-methods - def __init__(self, command_loader, scope, **kwargs): + def __init__(self, command_loader, scope, **kwargs): # pylint: disable=unused-argument super(RdbmsArgumentContext, self).__init__(command_loader, scope) self.validators = [] @@ -23,10 +23,12 @@ return self.validators.append(arg.settings['validator']) + dest_option = ['--__{}'.format(dest.upper())] if dest == 'parameters': from .validators import get_combined_validator self.argument(dest, arg_type=ignore_type, + options_list=dest_option, validator=get_combined_validator(self.validators)) else: - self.argument(dest, arg_type=ignore_type, validator=None) + self.argument(dest, options_list=dest_option, arg_type=ignore_type, validator=None) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/commands.py new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/commands.py --- old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/commands.py 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/commands.py 2018-04-06 19:33:13.000000000 +0200 @@ -6,8 +6,16 @@ from azure.cli.core.commands import CliCommandType from azure.cli.command_modules.rdbms._client_factory import ( - cf_mysql_servers, cf_postgres_servers, cf_mysql_firewall_rules, cf_postgres_firewall_rules, - cf_mysql_config, cf_postgres_config, cf_mysql_log, cf_postgres_log, cf_mysql_db, cf_postgres_db) + cf_mysql_servers, + cf_mysql_db, + cf_mysql_firewall_rules, + cf_mysql_config, + cf_mysql_log, + cf_postgres_servers, + cf_postgres_db, + cf_postgres_firewall_rules, + cf_postgres_config, + cf_postgres_log) # pylint: disable=too-many-locals, too-many-statements, line-too-long @@ -51,7 +59,7 @@ ) postgres_log_sdk = CliCommandType( - operations_tmpl='azure.mgmt.rdbms.postgres.operations.log_files_operations#LogFilesOperations.{}', + operations_tmpl='azure.mgmt.rdbms.postgresql.operations.log_files_operations#LogFilesOperations.{}', client_factory=cf_postgres_log ) @@ -66,36 +74,50 @@ ) with self.command_group('mysql server', mysql_servers_sdk, client_factory=cf_mysql_servers) as g: - g.command('create', 'create_or_update') - g.custom_command('restore', '_server_restore') + g.custom_command('create', '_server_create') + g.custom_command('restore', '_server_restore', supports_no_wait=True) + g.custom_command('georestore', '_server_georestore', supports_no_wait=True) g.command('delete', 'delete', confirmation=True) g.command('show', 'get') g.custom_command('list', '_server_list_custom_func') - g.generic_update_command('update', setter_name='update', + g.generic_update_command('update', + getter_name='_server_update_get', getter_type=rdbms_custom, + setter_name='_server_update_set', setter_type=rdbms_custom, setter_arg_name='parameters', custom_func_name='_server_update_custom_func') + g.generic_wait_command('wait', getter_name='_server_mysql_get', getter_type=rdbms_custom) with self.command_group('postgres server', postgres_servers_sdk, client_factory=cf_postgres_servers) as g: - g.command('create', 'create_or_update') - g.custom_command('restore', '_server_restore') + g.custom_command('create', '_server_create') + g.custom_command('restore', '_server_restore', supports_no_wait=True) + g.custom_command('georestore', '_server_georestore', supports_no_wait=True) g.command('delete', 'delete', confirmation=True) g.command('show', 'get') g.custom_command('list', '_server_list_custom_func') - g.generic_update_command('update', setter_name='update', + g.generic_update_command('update', + getter_name='_server_update_get', getter_type=rdbms_custom, + setter_name='_server_update_set', setter_type=rdbms_custom, setter_arg_name='parameters', custom_func_name='_server_update_custom_func') + g.generic_wait_command('wait', getter_name='_server_postgresql_get', getter_type=rdbms_custom) with self.command_group('mysql server firewall-rule', mysql_firewall_rule_sdk) as g: g.command('create', 'create_or_update') g.command('delete', 'delete', confirmation=True) g.command('show', 'get') g.command('list', 'list_by_server') - g.generic_update_command('update', setter_name='_firewall_rule_custom_setter', setter_type=rdbms_custom, custom_func_name='_firewall_rule_update_custom_func') + g.generic_update_command('update', + getter_name='_firewall_rule_custom_getter', getter_type=rdbms_custom, + setter_name='_firewall_rule_custom_setter', setter_type=rdbms_custom, setter_arg_name='parameters', + custom_func_name='_firewall_rule_update_custom_func') with self.command_group('postgres server firewall-rule', postgres_firewall_rule_sdk) as g: g.command('create', 'create_or_update') g.command('delete', 'delete', confirmation=True) g.command('show', 'get') g.command('list', 'list_by_server') - g.generic_update_command('update', setter_name='_firewall_rule_custom_setter', setter_type=rdbms_custom, custom_func_name='_firewall_rule_update_custom_func') + g.generic_update_command('update', + getter_name='_firewall_rule_custom_getter', getter_type=rdbms_custom, + setter_name='_firewall_rule_custom_setter', setter_type=rdbms_custom, setter_arg_name='parameters', + custom_func_name='_firewall_rule_update_custom_func') with self.command_group('mysql server configuration', mysql_config_sdk) as g: g.command('set', 'create_or_update') @@ -116,13 +138,13 @@ g.custom_command('download', '_download_log_files') with self.command_group('mysql db', mysql_db_sdk) as g: - # g.command('create', 'create_or_update') - # g.command('delete', 'delete', confirmation=True) - # g.command('show', 'get') + g.command('create', 'create_or_update') + g.command('delete', 'delete', confirmation=True) + g.command('show', 'get') g.command('list', 'list_by_server') with self.command_group('postgres db', postgres_db_sdk) as g: - # g.command('create', 'create_or_update') - # g.command('delete', 'delete', confirmation=True) - # g.command('show', 'get') + g.command('create', 'create_or_update') + g.command('delete', 'delete', confirmation=True) + g.command('show', 'get') g.command('list', 'list_by_server') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/custom.py new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/custom.py --- old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/custom.py 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/custom.py 2018-04-06 19:33:13.000000000 +0200 @@ -3,21 +3,127 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -from msrestazure.tools import ( - resource_id, is_valid_resource_id, parse_resource_id) +# pylint: disable=unused-argument, line-too-long +from msrestazure.tools import resource_id, is_valid_resource_id, parse_resource_id # pylint: disable=import-error +from azure.cli.core.commands.client_factory import get_subscription_id +from azure.cli.core.util import sdk_no_wait +from azure.mgmt.rdbms.mysql.operations.servers_operations import ServersOperations +from ._client_factory import get_mysql_management_client, get_postgresql_management_client + +SKU_TIER_MAP = {'Basic': 'b', 'GeneralPurpose': 'gp', 'MemoryOptimized': 'mo'} + + +def _server_create(cmd, client, resource_group_name, server_name, sku_name, no_wait=False, + location=None, administrator_login=None, administrator_login_password=None, backup_retention=None, + geo_redundant_backup=None, ssl_enforcement=None, storage_size=None, tags=None, version=None): + provider = 'Microsoft.DBForMySQL' if isinstance(client, ServersOperations) else 'Microsoft.DBforPostgreSQL' + parameters = None + if provider == 'Microsoft.DBForMySQL': + from azure.mgmt.rdbms import mysql + parameters = mysql.models.ServerForCreate( + sku=mysql.models.Sku(name=sku_name), + properties=mysql.models.ServerPropertiesForDefaultCreate( + administrator_login=administrator_login, + administrator_login_password=administrator_login_password, + version=version, + ssl_enforcement=ssl_enforcement, + storage_profile=mysql.models.StorageProfile( + backup_retention_days=backup_retention, + geo_redundant_backup=geo_redundant_backup, + storage_mb=storage_size)), + location=location, + tags=tags) + elif provider == 'Microsoft.DBforPostgreSQL': + from azure.mgmt.rdbms import postgresql + parameters = postgresql.models.ServerForCreate( + sku=postgresql.models.Sku(name=sku_name), + properties=postgresql.models.ServerPropertiesForDefaultCreate( + administrator_login=administrator_login, + administrator_login_password=administrator_login_password, + version=version, + ssl_enforcement=ssl_enforcement, + storage_profile=postgresql.models.StorageProfile( + backup_retention_days=backup_retention, + geo_redundant_backup=geo_redundant_backup, + storage_mb=storage_size)), + location=location, + tags=tags) -# need to replace source sever name with source server id, so customer server restore function + return client.create(resource_group_name, server_name, parameters) + + +# Need to replace source server name with source server id, so customer server restore function +# The parameter list should be the same as that in factory to use the ParametersContext +# arguments and validators +def _server_restore(cmd, client, resource_group_name, server_name, source_server, restore_point_in_time, no_wait=False): + provider = 'Microsoft.DBForMySQL' if isinstance(client, ServersOperations) else 'Microsoft.DBforPostgreSQL' + parameters = None + if provider == 'Microsoft.DBForMySQL': + from azure.mgmt.rdbms import mysql + parameters = mysql.models.ServerForCreate( + properties=mysql.models.ServerPropertiesForRestore()) + elif provider == 'Microsoft.DBforPostgreSQL': + from azure.mgmt.rdbms import postgresql + parameters = postgresql.models.ServerForCreate( + properties=postgresql.models.ServerPropertiesForRestore()) + + if not is_valid_resource_id(source_server): + if len(source_server.split('/')) == 1: + source_server = resource_id( + subscription=get_subscription_id(cmd.cli_ctx), + resource_group=resource_group_name, + namespace=provider, + type='servers', + name=source_server) + else: + raise ValueError('The provided source-server {} is invalid.'.format(source_server)) + + parameters.properties.source_server_id = source_server + parameters.properties.restore_point_in_time = restore_point_in_time + + # Here is a workaround that we don't support cross-region restore currently, + # so the location must be set as the same as source server (not the resource group) + id_parts = parse_resource_id(source_server) + try: + source_server_object = client.get(id_parts['resource_group'], id_parts['name']) + parameters.location = source_server_object.location + except Exception as e: + raise ValueError('Unable to get source server: {}.'.format(str(e))) + + return sdk_no_wait(no_wait, client.create, resource_group_name, server_name, parameters) + + +# need to replace source server name with source server id, so customer server georestore function # The parameter list should be the same as that in factory to use the ParametersContext # auguments and validators -def _server_restore(cmd, client, resource_group_name, server_name, parameters, **kwargs): - source_server = kwargs['source_server_id'] +def _server_georestore(cmd, client, resource_group_name, server_name, sku_name, location, source_server, + backup_retention=None, geo_redundant_backup=None, no_wait=False, **kwargs): + provider = 'Microsoft.DBForMySQL' if isinstance(client, ServersOperations) else 'Microsoft.DBforPostgreSQL' + parameters = None + if provider == 'Microsoft.DBForMySQL': + from azure.mgmt.rdbms import mysql + parameters = mysql.models.ServerForCreate( + sku=mysql.models.Sku(name=sku_name), + properties=mysql.models.ServerPropertiesForGeoRestore( + storage_profile=mysql.models.StorageProfile( + backup_retention_days=backup_retention, + geo_redundant_backup=geo_redundant_backup + )), + location=location) + elif provider == 'Microsoft.DBforPostgreSQL': + from azure.mgmt.rdbms import postgresql + parameters = postgresql.models.ServerForCreate( + sku=postgresql.models.Sku(name=sku_name), + properties=postgresql.models.ServerPropertiesForGeoRestore( + storage_profile=postgresql.models.StorageProfile( + backup_retention_days=backup_retention, + geo_redundant_backup=geo_redundant_backup + )), + location=location) if not is_valid_resource_id(source_server): if len(source_server.split('/')) == 1: - from azure.cli.core.commands.client_factory import get_subscription_id - from azure.mgmt.rdbms.mysql.operations.servers_operations import ServersOperations - provider = 'Microsoft.DBForMySQL' if isinstance(client, ServersOperations) else 'Microsoft.DBforPostgreSQL' source_server = resource_id(subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, namespace=provider, @@ -28,35 +134,44 @@ parameters.properties.source_server_id = source_server - # Here is a workaround that we don't support cross-region restore currently, - # so the location must be set as the same as source server (not the resource group) - id_parts = parse_resource_id(source_server) + source_server_id_parts = parse_resource_id(source_server) try: - source_server_object = client.get(id_parts['resource_group'], id_parts['name']) - parameters.location = source_server_object.location + source_server_object = client.get(source_server_id_parts['resource_group'], source_server_id_parts['name']) + if parameters.sku.name is None: + parameters.sku.name = source_server_object.sku.name except Exception as e: raise ValueError('Unable to get source server: {}.'.format(str(e))) - return client.create_or_update(resource_group_name, server_name, parameters) + return sdk_no_wait(no_wait, client.create, resource_group_name, server_name, parameters) def _server_update_custom_func(instance, capacity=None, + storage_mb=None, + backup_retention_days=None, administrator_login_password=None, ssl_enforcement=None, tags=None): + from azure.mgmt.rdbms.mysql.models import StorageProfile # pylint: disable=unused-variable from importlib import import_module server_module_path = instance.__module__ module = import_module(server_module_path.replace('server', 'server_update_parameters')) ServerUpdateParameters = getattr(module, 'ServerUpdateParameters') if capacity is not None: + instance.sku.name = _get_sku_name(instance.sku.tier, instance.sku.family, capacity) instance.sku.capacity = capacity else: instance.sku = None + if storage_mb is not None: + instance.storage_profile.storage_mb = storage_mb + + if backup_retention_days is not None: + instance.storage_profile.backup_retention_days = backup_retention_days + params = ServerUpdateParameters(sku=instance.sku, - storage_mb=None, + storage_profile=instance.storage_profile, administrator_login_password=administrator_login_password, version=None, ssl_enforcement=ssl_enforcement, @@ -65,15 +180,39 @@ return params -# define custom func for firewall rule update, because flatten make generic update not work -def _firewall_rule_custom_setter(client, resource_group_name, server_name, firewall_rule_name, - parameters): +def _server_mysql_get(cmd, resource_group_name, server_name): + client = get_mysql_management_client(cmd.cli_ctx) + return client.servers.get(resource_group_name, server_name) + + +def _server_postgresql_get(cmd, resource_group_name, server_name): + client = get_postgresql_management_client(cmd.cli_ctx) + return client.servers.get(resource_group_name, server_name) + + +def _server_update_get(client, resource_group_name, server_name): + return client.get(resource_group_name, server_name) + + +def _server_update_set(client, resource_group_name, server_name, parameters): + return client.update(resource_group_name, server_name, parameters) + + +def _get_sku_name(tier, family, capacity): + return '{}_{}_{}'.format(SKU_TIER_MAP[tier], family, str(capacity)) + + +def _firewall_rule_custom_getter(client, resource_group_name, server_name, firewall_rule_name): + return client.get(resource_group_name, server_name, firewall_rule_name) + + +def _firewall_rule_custom_setter(client, resource_group_name, server_name, firewall_rule_name, parameters): return client.create_or_update( - resource_group_name=resource_group_name, - server_name=server_name, - firewall_rule_name=firewall_rule_name, - start_ip_address=parameters.start_ip_address, - end_ip_address=parameters.end_ip_address) + resource_group_name, + server_name, + firewall_rule_name, + parameters.start_ip_address, + parameters.end_ip_address) def _firewall_rule_update_custom_func(instance, start_ip_address=None, end_ip_address=None): @@ -84,7 +223,7 @@ return instance -# Custom funcs for server logs # +# Custom functions for server logs def _download_log_files( client, resource_group_name, @@ -104,7 +243,7 @@ file_last_written=None, max_file_size=None): import re from datetime import datetime, timedelta - from dateutil.tz import tzutc + from dateutil.tz import tzutc # pylint: disable=import-error # list all files all_files = client.list_by_server(resource_group_name, server_name) @@ -128,7 +267,7 @@ return files -# Custom funcs for list servers # +# Custom functions for list servers def _server_list_custom_func(client, resource_group_name=None): if resource_group_name: return client.list_by_resource_group(resource_group_name) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/validators.py new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/validators.py --- old/azure-cli-rdbms-0.0.11/azure/cli/command_modules/rdbms/validators.py 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/azure/cli/command_modules/rdbms/validators.py 2018-04-06 19:33:13.000000000 +0200 @@ -15,7 +15,6 @@ # do additional creation validation verb = cmd.name.rsplit(' ', 1)[1] if verb == 'create': - storage_validator(namespace) password_validator(namespace) get_default_location_from_resource_group(cmd, namespace) @@ -24,11 +23,6 @@ for validator in validators: validator(namespace) - if namespace.sku.tier or namespace.sku.capacity: - namespace.sku.name = 'SkuName' - else: - namespace.parameters.sku = None - return _final_validator_impl @@ -45,8 +39,3 @@ ns.administrator_login_password = prompt_pass(msg='Admin Password: ') except NoTTYException: raise CLIError('Please specify password in non-interactive mode.') - - -def storage_validator(ns): - if ns.storage_mb and ns.storage_mb > 1023 * 1024: - raise ValueError('The size of storage cannot exceed 1023GB.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/azure_cli_rdbms.egg-info/PKG-INFO new/azure-cli-rdbms-0.2.1/azure_cli_rdbms.egg-info/PKG-INFO --- old/azure-cli-rdbms-0.0.11/azure_cli_rdbms.egg-info/PKG-INFO 2018-01-12 18:25:36.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/azure_cli_rdbms.egg-info/PKG-INFO 2018-04-06 19:33:48.000000000 +0200 @@ -1,13 +1,16 @@ Metadata-Version: 1.1 Name: azure-cli-rdbms -Version: 0.0.11 +Version: 0.2.1 Summary: Microsoft Azure Command-Line Tools MySQL and PostgreSQL Command Module Home-page: https://github.com/Azure/azure-cli Author: Microsoft Corporation Author-email: azpy...@microsoft.com License: MIT +Description-Content-Type: UNKNOWN Description: Microsoft Azure CLI 'MySQL and PostgreSQL' Command Module ========================================================= + This package is for the 'rdbms' module. + i.e. 'az mysql' and 'az postgres' @@ -16,6 +19,28 @@ Release History =============== + 0.2.1 + +++++ + * Introduce georestore command. + * Remove storage size restriction from create command. + * `sdist` is now compatible with wheel 0.31.0 + + 0.2.0 + +++++ + * Release with new business model GA API version 2017-12-01. + + 0.1.1 + ++++++ + * Minor changes. + + 0.1.0 + ++++++ + * Preview release with new business model API 2017-12-01-preview. + + 0.0.12 + ++++++ + * Minor fixes. + 0.0.11 ++++++ * Minor fixes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/azure_cli_rdbms.egg-info/requires.txt new/azure-cli-rdbms-0.2.1/azure_cli_rdbms.egg-info/requires.txt --- old/azure-cli-rdbms-0.0.11/azure_cli_rdbms.egg-info/requires.txt 2018-01-12 18:25:36.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/azure_cli_rdbms.egg-info/requires.txt 2018-04-06 19:33:48.000000000 +0200 @@ -1,3 +1,3 @@ azure-cli-core -azure-mgmt-rdbms==0.1.0 +azure-mgmt-rdbms==1.1.0 six diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/azure-cli-rdbms-0.0.11/setup.py new/azure-cli-rdbms-0.2.1/setup.py --- old/azure-cli-rdbms-0.0.11/setup.py 2018-01-12 18:25:22.000000000 +0100 +++ new/azure-cli-rdbms-0.2.1/setup.py 2018-04-06 19:33:13.000000000 +0200 @@ -12,7 +12,7 @@ logger.warn("Wheel is not available, disabling bdist_wheel hook") cmdclass = {} -VERSION = "0.0.11" +VERSION = "0.2.1" CLASSIFIERS = [ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', @@ -29,7 +29,7 @@ DEPENDENCIES = [ 'azure-cli-core', - 'azure-mgmt-rdbms==0.1.0', + 'azure-mgmt-rdbms==1.1.0', 'six' ]