From de115608f47bf186d9d070a8fcf0c3bb9737bd14 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Sat, 21 Mar 2020 23:33:08 -0700 Subject: [PATCH 01/54] added ltr mi policy to commands/params --- .../azure/cli/command_modules/sql/_params.py | 28 +++++++++++++++++++ .../azure/cli/command_modules/sql/commands.py | 11 ++++++++ 2 files changed, 39 insertions(+) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 453e8645f8d..9e13e4c461e 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1500,6 +1500,34 @@ def _configure_security_policy_storage_params(arg_ctx): help='If specified, shows retention days for a deleted database, instead of an existing database.' 'Must match the deleted time of a deleted database on the source Managed Instance.') + with self.argument_context('sql midb long-term-retention-policy set') as c: + create_args_for_complex_type( + c, 'parameters', ManagedDatabase, [ + 'weekly_retention', + 'monthly_retention', + 'yearly_retention', + 'week_of_year' + ]) + + c.argument('weekly_retention', + options_list=['--weekly-retention'], + help='The Weekly Retention. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') + + c.argument('monthly_retention', + options_list=['--monthly-retention'], + help='The Monthly Retention. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') + + c.argument('yearly_retention', + options_list=['--yearly-retention'], + help='The Yearly Retention. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.'' + 'There is a minimum of 7 days and a maximum of 10 years.) + + c.argument('week_of_year', + options_list=['--week-of-year'], + help='The Week of Year, 1 to 52, to save for the Yearly Retention.') + ############################################### # sql virtual cluster # ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 35eb947a699..42b1869a915 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -570,6 +570,17 @@ def load_command_table(self, _): g.custom_command('set', 'update_short_term_retention_mi', supports_no_wait=True) g.custom_command('show', 'get_short_term_retention_mi') + managed_instance_long_term_retention_policies_operations = CliCommandType( + operations_tmpl='azure.mgmt.sql.operations#ManagedInstanceLongTermRetentionPoliciesOperations.{}', + client_factory=get_sql_managed_instance_long_term_retention_policies_operations) + + with self.command_group('sql midb long-term-retention-policy', + managed_instance_long_term_retention_policies_operations, + client_factory=get_sql_managed_instance_long_term_retention_policies_operations) as g: + + g.custom_command('set', 'update_long_term_retention_mi', supports_no_wait=True) + g.custom_command('show', 'get_long_term_retention_mi') + ############################################### # sql virtual cluster # ############################################### From 3d2172d0b44f546e2e5cae32b229e20a68f6dfa2 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Sun, 22 Mar 2020 22:56:30 -0700 Subject: [PATCH 02/54] add custom commands/params for ltr mi backup APIs; updated params for ltr restore --- .../azure/cli/command_modules/sql/_params.py | 46 +++++- .../azure/cli/command_modules/sql/commands.py | 23 ++- .../azure/cli/command_modules/sql/custom.py | 149 ++++++++++++++++++ 3 files changed, 212 insertions(+), 6 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 9e13e4c461e..ce05a4f8aa5 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1476,6 +1476,39 @@ def _configure_security_policy_storage_params(arg_ctx): ' new database. Must be greater than or equal to the source database\'s' ' earliestRestoreDate value. ' + time_format_help) + with self.argument_context('sql midb ltr restore') as c: + create_args_for_complex_type( + c, 'parameters', ManagedDatabase, [ + 'target_managed_database_name', + 'target_managed_instance_name', + 'target_resource_group_name', + 'restore_long_term_retention_backup' + ]) + + c.argument('target_managed_database_name', + options_list=['--dest-name'], + required=True, + help='Name of the managed database that will be created as the restore destination.') + + c.argument('target_managed_instance_name', + options_list=['--dest-mi'], + help='Name of the managed instance to restore managed database to. ' + 'This can be same managed instance, or another managed instance on same subscription. ' + 'When not specified it defaults to source managed instance.') + + c.argument('target_resource_group_name', + options_list=['--dest-resource-group'], + help='Name of the resource group of the managed instance to restore managed database to. ' + 'When not specified it defaults to source resource group.') + + restore_ltr_backup_arg_group = 'Restore LTR Backup' + + c.argument('restore_long_term_retention_backup', + options_list['--ltr-backup'], + arg_group=restore_ltr_backup_arg_group, + required=True, + help='The long term retention managed instance backup object to restore.' + with self.argument_context('sql midb short-term-retention-policy set') as c: create_args_for_complex_type( c, 'parameters', ManagedDatabase, [ @@ -1510,24 +1543,29 @@ def _configure_security_policy_storage_params(arg_ctx): ]) c.argument('weekly_retention', - options_list=['--weekly-retention'], help='The Weekly Retention. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' 'There is a minimum of 7 days and a maximum of 10 years.') c.argument('monthly_retention', - options_list=['--monthly-retention'], help='The Monthly Retention. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' 'There is a minimum of 7 days and a maximum of 10 years.') c.argument('yearly_retention', - options_list=['--yearly-retention'], help='The Yearly Retention. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.'' 'There is a minimum of 7 days and a maximum of 10 years.) c.argument('week_of_year', - options_list=['--week-of-year'], help='The Week of Year, 1 to 52, to save for the Yearly Retention.') + with self.argument_context('sql midb long-term-retention-backup') as c: + c.argument('location_name', + arg_type=get_location_type(self.cli_ctx)) + + c.argument('resource_group_name', + required=False, + help='If specified, the resource group the for which a managed instance/database resource belongs to.') + + ############################################### # sql virtual cluster # ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 42b1869a915..3da61f03528 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -559,6 +559,11 @@ def load_command_table(self, _): g.command('list', 'list_by_instance') g.command('delete', 'delete', confirmation=True, supports_no_wait=True) + with self.command_group('sql midb ltr restore', + managed_databases_operations, + client_factory=get_sql_managed_databases_operations) as g: + g.custom_command('restore', 'managed_db_restore_ltr_backup', supports_no_wait=True) + managed_backup_short_term_retention_policies_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#ManagedBackupShortTermRetentionPoliciesOperations.{}', client_factory=get_sql_managed_backup_short_term_retention_policies_operations) @@ -570,7 +575,7 @@ def load_command_table(self, _): g.custom_command('set', 'update_short_term_retention_mi', supports_no_wait=True) g.custom_command('show', 'get_short_term_retention_mi') - managed_instance_long_term_retention_policies_operations = CliCommandType( + managed_database_long_term_retention_policies_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#ManagedInstanceLongTermRetentionPoliciesOperations.{}', client_factory=get_sql_managed_instance_long_term_retention_policies_operations) @@ -579,7 +584,21 @@ def load_command_table(self, _): client_factory=get_sql_managed_instance_long_term_retention_policies_operations) as g: g.custom_command('set', 'update_long_term_retention_mi', supports_no_wait=True) - g.custom_command('show', 'get_long_term_retention_mi') + g.show_command('show', 'get') + + managed_database_long_term_retention_backups_operations = CliCommandType( + operations_tmpl='azure.mgmt.sql.operations#LongTermRetentionManagedInstanceBackupsOperations.{}', + client_factory-get_sql_long_term_retention_managed_instance_backups_operations) + + with self.command_group('sql midb long-term-retention-backup', + long_term_retention_managed_instance_backups_operations, + client_factory=get_sql_long_term_retention_managed_instance_backups_operations) as g: + g.show_command('show', 'get') + g.custom_command('list-by-database', 'list_by_database_long_term_retention_mi_backup') + g.custom_command('list-by-instance', 'list_by_instance_long_term_retention_mi_backup') + g.custom_command('list-by-location', 'list_by_location_long_term_retention_mi_backup') + g.command('delete', 'delete') + ############################################### # sql virtual cluster # diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index eb38873d363..8637a5faf1d 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -21,6 +21,7 @@ FailoverGroupReadOnlyEndpoint, FailoverGroupReadWriteEndpoint, IdentityType, + LongTermRetentionManagedInstanceBackup, PartnerInfo, PerformanceLevelUnit, ReplicationRole, @@ -35,6 +36,7 @@ StorageKeyType, InstanceFailoverGroup, ManagedInstancePairInfo, + ManagedInstanceLongTermRetentionPolicy, PartnerRegionInfo, InstanceFailoverGroupReadOnlyEndpoint, InstanceFailoverGroupReadWriteEndpoint, @@ -2628,6 +2630,36 @@ def managed_db_restore( parameters=kwargs) +def managed_db_restore_ltr_backup( + cmd, + client, + target_managed_database_name, + target_managed_instance_name=None, + target_resource_group_name=None, + **kwargs): + ''' + Restores a managed db from an LTR backup (i.e. create with 'RestoreLongTermRetentionBackup' create mode.) + ''' + + kwargs['location'] = _get_managed_instance_location( + cmd.cli_ctx, + managed_instance_name=managed_instance_name, + resource_group_name=resource_group_name) + + kwargs['create_mode'] = CreateMode.restore_long_term_retention_backup.value + kwargs['long_term_retention_backup_resource_id'] = _get_managed_database_backup( + cmd.cli_ctx, + resource_group_name, + managed_instance_name, + database_name) + + return client.create_or_update( + database_name=target_managed_database_name, + managed_instance_name=target_managed_instance_name, + resource_group_name=target_resource_group_name, + parameters=kwargs) + + def update_short_term_retention_mi( cmd, client, @@ -2699,6 +2731,123 @@ def get_short_term_retention_mi( return policy +def update_long_term_retention_mi( + cmd, + client, + database_name, + managed_instance_name, + resource_group_name, + weekly_retention=None, + monthly_retention=None, + yearly_retention=None, + week_of_year=None): + ''' + Updates long term retention for managed database + ''' + if not (weekly_retention or monthly_retention or yearly_retention): + raise CLIError('Please specify retention setting(s).') + + if yearly_retention and not week_of_year + raise CLIError('Please specify week of year for yearly retention.') + + policy = client.create_or_update( + database_name=database_name, + managed_instance_name=managed_instance_name, + resource_group_name=resource_group_name, + weekly_retention=weekly_retention, + monthly_retention=monthly_retention, + yearly_retention=yearly_retention, + week_of_year=week_of_year) + + return policy + + +def list_by_database_long_term_retention_mi_backup( + cmd, + client, + location_name, + managed_instance_name, + database_name, + resource_group_name=None, + only_latest_per_database=None, + database_state=None) + ''' + Lists the long term retention backups for a Managed Database + ''' + + if resource_group_name: + backups = client.list_by_resource_group_database( + resource_group_name=resource_group_name, + location_name=location_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + only_latest_per_database=only_latest_per_database, + database_state=database_state) + else: + backups = client.list_by_database( + location_name=location_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + only_latest_per_database=only_latest_per_database, + database_state=database_state) + + return backups + + +def list_by_instance_long_term_retention_mi_backup( + cmd, + client, + location_name, + managed_instance_name, + resource_group_name=None, + only_latest_per_database=None, + database_state=None) + ''' + Lists the long term retention backups within a Managed Instance + ''' + + if resource_group_name: + backups = client.list_by_resource_group_instance( + resource_group_name=resource_group_name, + location_name=location_name, + managed_instance_name=managed_instance_name, + only_latest_per_database=only_latest_per_database, + database_state=database_state) + else: + backups = client.list_by_instance( + location_name=location_name, + managed_instance_name=managed_instance_name, + only_latest_per_database=only_latest_per_database, + database_state=database_state) + + return backups + + +def list_by_location_long_term_retention_mi_backup( + cmd, + client + location_name, + resource_group_name=None, + only_latest_per_database=None, + database_state=None) + ''' + Lists the long term retentionb backups within a specified region. + ''' + + if resource_group_name: + backups = client.list_by_resource_group_location( + resource_group_name=resource_groupname, + location_name=location_name, + only_latest_per_database=only_latest_per_database, + database_state=database_state) + else: + backups = client.list_by_location( + location_name=location_name, + only_latest_per_database=only_latest_per_database, + database_state=database_state) + + return backups + ############################################### # sql failover-group # ############################################### From 197c900619b2cec0f3fd1204b6acdfe72049b9d0 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Sun, 22 Mar 2020 23:15:35 -0700 Subject: [PATCH 03/54] added LTR Policy tests --- .../sql/tests/latest/test_sql_commands.py | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index e37df7ea035..fe5f54264e1 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3194,6 +3194,77 @@ def test_sql_managed_db_short_retention(self, resource_group, resource_group_loc self.check('retentionDays', '{retention_days_dec}')]) +class SqlManagedInstanceDbLongTermRetentionScenarioTest(ScenarioTest): + @ResourceGroupPreparer(random_name_length=17, name_prefix='clitest') + def test_sql_managed_db_long_term_retention(self, resource_group, resource_group_location): + + resource_prefix = 'MIDBLongTermRetention' + + self.kwargs.update({ + 'loc': resource_group_location, + 'managed_instance_name': self.create_random_name(managed_instance_name_prefix, managed_instance_name_max_length), + 'database_name': self.create_random_name(resource_prefix, 50), + 'vault_name': self.create_random_name(resource_prefix, 50), + 'admin_login': 'admin123', + 'admin_password': 'SecretPassword123', + 'license_type': 'LicenseIncluded', + 'v_cores': 8, + 'storage_size_in_gb': '32', + 'edition': 'GeneralPurpose', + 'family': 'Gen5', + 'collation': "Serbian_Cyrillic_100_CS_AS", + 'proxy_override': "Proxy", + 'weekly_retention': "P1W", + 'monthly_retention': "P1M", + 'yearly_retention': "P1Y", + 'week_of_year': 12 + }) + + # create sql managed_instance + self.cmd('sql mi create -g {rg} -n {managed_instance_name} -l {loc} ' + '-u {admin_login} -p {admin_password} --subnet {subnet_id} --license-type {license_type} ' + '--capacity {v_cores} --storage {storage_size_in_gb} --edition {edition} --family {family} ' + '--collation {collation} --proxy-override {proxy_override} --public-data-endpoint-enabled --assign-identity', + checks=[ + self.check('name', '{managed_instance_name}'), + self.check('resourceGroup', '{rg}'), + self.check('administratorLogin', '{admin_login}'), + self.check('vCores', '{v_cores}'), + self.check('storageSizeInGb', '{storage_size_in_gb}'), + self.check('licenseType', '{license_type}'), + self.check('sku.tier', '{edition}'), + self.check('sku.family', '{family}'), + self.check('sku.capacity', '{v_cores}'), + self.check('collation', '{collation}'), + self.check('proxyOverride', '{proxy_override}'), + self.check('publicDataEndpointEnabled', 'True')]).get_output_in_json() + + # create database + self.cmd('sql midb create -g {rg} --mi {managed_instance_name} -n {database_name} --collation {collation}', + checks=[ + self.check('resourceGroup', '{rg}'), + self.check('name', '{database_name}'), + self.check('location', '{loc}'), + self.check('collation', '{collation}'), + self.check('status', 'Online')]) + + # test update long term retention on live database + self.cmd('sql midb long-term-retention-policy set -g {rg} --mi {managed_instance_name} -n {database_name} --weekly_retention {weekly_retention} --monthly_retention {monthly_retention} --yearly_retention {yearly_retention} --week_of_year {week_of_year}', + checks=[ + self.check('resourceGroup', '{rg}'), + self.check('weeklyRetention', '{weekly_retention}'), + self.check('monthlyRetention', '{monthly_retention}'), + self.check('yearlyRetention', '{yearly_retention}')]) + + # test get long term retention on live database + self.cmd('sql midb long-term-retention-policy show -g {rg} --mi {managed_instance_name} -n {database_name}', + checks=[ + self.check('resourceGroup', '{rg}'), + self.check('weeklyRetention', '{weekly_retention}'), + self.check('monthlyRetention', '{monthly_retention}'), + self.check('yearlyRetention', '{yearly_retention}')]) + + class SqlManagedInstanceRestoreDeletedDbScenarioTest(ScenarioTest): @ResourceGroupPreparer(random_name_length=17, name_prefix='clitest') From 7fca0f73f1b7513539fafacf0c5848a80079b3a1 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 23 Mar 2020 02:07:07 -0700 Subject: [PATCH 04/54] fixing pylint --- .../azure/cli/command_modules/sql/_util.py | 8 ++++++ .../azure/cli/command_modules/sql/commands.py | 15 +++++------ .../azure/cli/command_modules/sql/custom.py | 25 ++++++++++--------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_util.py b/src/azure-cli/azure/cli/command_modules/sql/_util.py index acd177a3c2c..da25b9dafe1 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_util.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_util.py @@ -162,3 +162,11 @@ def get_sql_virtual_clusters_operations(cli_ctx, _): def get_sql_instance_failover_groups_operations(cli_ctx, _): return get_sql_management_client(cli_ctx).instance_failover_groups + + +def get_sql_managed_database_long_term_retention_policies_operations(cli_ctx, _): + return get_sql_management_client(cli_ctx).managed_instance_long_term_retention_policies + + +def get_sql_managed_database_long_term_retention_backups_operations(cli_ctx, _): + return get_sql_management_client(cli_ctx).long_term_retention_managed_instance_backups diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 3da61f03528..e21fe93589c 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -38,6 +38,8 @@ get_sql_firewall_rules_operations, get_sql_managed_databases_operations, get_sql_managed_backup_short_term_retention_policies_operations, + get_sql_managed_database_long_term_retention_policies_operations, + get_sql_managed_database_long_term_retention_backups_operations, get_sql_managed_instance_azure_ad_administrators_operations, get_sql_managed_instance_encryption_protectors_operations, get_sql_managed_instance_keys_operations, @@ -577,29 +579,28 @@ def load_command_table(self, _): managed_database_long_term_retention_policies_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#ManagedInstanceLongTermRetentionPoliciesOperations.{}', - client_factory=get_sql_managed_instance_long_term_retention_policies_operations) + client_factory=get_sql_managed_database_long_term_retention_policies_operations) with self.command_group('sql midb long-term-retention-policy', - managed_instance_long_term_retention_policies_operations, - client_factory=get_sql_managed_instance_long_term_retention_policies_operations) as g: + managed_database_long_term_retention_policies_operations, + client_factory=get_sql_managed_database_long_term_retention_policies_operations) as g: g.custom_command('set', 'update_long_term_retention_mi', supports_no_wait=True) g.show_command('show', 'get') managed_database_long_term_retention_backups_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#LongTermRetentionManagedInstanceBackupsOperations.{}', - client_factory-get_sql_long_term_retention_managed_instance_backups_operations) + client_factory=get_sql_managed_database_long_term_retention_backups_operations) with self.command_group('sql midb long-term-retention-backup', - long_term_retention_managed_instance_backups_operations, - client_factory=get_sql_long_term_retention_managed_instance_backups_operations) as g: + managed_database_long_term_retention_backups_operations, + client_factory=get_sql_managed_database_long_term_retention_backups_operations) as g: g.show_command('show', 'get') g.custom_command('list-by-database', 'list_by_database_long_term_retention_mi_backup') g.custom_command('list-by-instance', 'list_by_instance_long_term_retention_mi_backup') g.custom_command('list-by-location', 'list_by_location_long_term_retention_mi_backup') g.command('delete', 'delete') - ############################################### # sql virtual cluster # ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 8637a5faf1d..73f09f688d8 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -21,7 +21,7 @@ FailoverGroupReadOnlyEndpoint, FailoverGroupReadWriteEndpoint, IdentityType, - LongTermRetentionManagedInstanceBackup, + LongTermRetentionManagedInstanceBackup, PartnerInfo, PerformanceLevelUnit, ReplicationRole, @@ -36,7 +36,7 @@ StorageKeyType, InstanceFailoverGroup, ManagedInstancePairInfo, - ManagedInstanceLongTermRetentionPolicy, + ManagedInstanceLongTermRetentionPolicy, PartnerRegionInfo, InstanceFailoverGroupReadOnlyEndpoint, InstanceFailoverGroupReadWriteEndpoint, @@ -2633,6 +2633,10 @@ def managed_db_restore( def managed_db_restore_ltr_backup( cmd, client, + database_name, + managed_instance_name, + resource_group_name, + backup_id, target_managed_database_name, target_managed_instance_name=None, target_resource_group_name=None, @@ -2647,11 +2651,7 @@ def managed_db_restore_ltr_backup( resource_group_name=resource_group_name) kwargs['create_mode'] = CreateMode.restore_long_term_retention_backup.value - kwargs['long_term_retention_backup_resource_id'] = _get_managed_database_backup( - cmd.cli_ctx, - resource_group_name, - managed_instance_name, - database_name) + kwargs['long_term_retention_backup_resource_id'] = backup_id return client.create_or_update( database_name=target_managed_database_name, @@ -2747,7 +2747,7 @@ def update_long_term_retention_mi( if not (weekly_retention or monthly_retention or yearly_retention): raise CLIError('Please specify retention setting(s).') - if yearly_retention and not week_of_year + if yearly_retention and not week_of_year: raise CLIError('Please specify week of year for yearly retention.') policy = client.create_or_update( @@ -2770,7 +2770,7 @@ def list_by_database_long_term_retention_mi_backup( database_name, resource_group_name=None, only_latest_per_database=None, - database_state=None) + database_state=None): ''' Lists the long term retention backups for a Managed Database ''' @@ -2801,7 +2801,7 @@ def list_by_instance_long_term_retention_mi_backup( managed_instance_name, resource_group_name=None, only_latest_per_database=None, - database_state=None) + database_state=None): ''' Lists the long term retention backups within a Managed Instance ''' @@ -2825,11 +2825,11 @@ def list_by_instance_long_term_retention_mi_backup( def list_by_location_long_term_retention_mi_backup( cmd, - client + client, location_name, resource_group_name=None, only_latest_per_database=None, - database_state=None) + database_state=None): ''' Lists the long term retentionb backups within a specified region. ''' @@ -2852,6 +2852,7 @@ def list_by_location_long_term_retention_mi_backup( # sql failover-group # ############################################### + def failover_group_create( cmd, client, From 233c779547735cae75a6420c648af05931cb58e2 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 23 Mar 2020 11:20:33 -0700 Subject: [PATCH 05/54] fix pylint --- .../azure/cli/command_modules/sql/_params.py | 26 ++++++++++--------- .../azure/cli/command_modules/sql/custom.py | 17 +----------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index ce05a4f8aa5..b7aaa6a2d95 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1504,10 +1504,10 @@ def _configure_security_policy_storage_params(arg_ctx): restore_ltr_backup_arg_group = 'Restore LTR Backup' c.argument('restore_long_term_retention_backup', - options_list['--ltr-backup'], + options_list=['--ltr-backup'], arg_group=restore_ltr_backup_arg_group, required=True, - help='The long term retention managed instance backup object to restore.' + help='The long term retention managed instance backup object to restore.') with self.argument_context('sql midb short-term-retention-policy set') as c: create_args_for_complex_type( @@ -1543,28 +1543,30 @@ def _configure_security_policy_storage_params(arg_ctx): ]) c.argument('weekly_retention', - help='The Weekly Retention. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' - 'There is a minimum of 7 days and a maximum of 10 years.') + help='The Weekly Retention.' + 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') c.argument('monthly_retention', - help='The Monthly Retention. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' - 'There is a minimum of 7 days and a maximum of 10 years.') + help='The Monthly Retention.' + 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') c.argument('yearly_retention', - help='The Yearly Retention. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.'' - 'There is a minimum of 7 days and a maximum of 10 years.) + help='The Yearly Retention.' + 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') c.argument('week_of_year', - help='The Week of Year, 1 to 52, to save for the Yearly Retention.') + help='The Week of Year, 1 to 52, to save for the Yearly Retention.') with self.argument_context('sql midb long-term-retention-backup') as c: c.argument('location_name', - arg_type=get_location_type(self.cli_ctx)) + arg_type=get_location_type(self.cli_ctx)) c.argument('resource_group_name', required=False, - help='If specified, the resource group the for which a managed instance/database resource belongs to.') - + help='If specified, the resource group that the managed instance/database resource belongs to.') ############################################### # sql virtual cluster # diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 73f09f688d8..91df517b1c7 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -21,7 +21,6 @@ FailoverGroupReadOnlyEndpoint, FailoverGroupReadWriteEndpoint, IdentityType, - LongTermRetentionManagedInstanceBackup, PartnerInfo, PerformanceLevelUnit, ReplicationRole, @@ -36,7 +35,6 @@ StorageKeyType, InstanceFailoverGroup, ManagedInstancePairInfo, - ManagedInstanceLongTermRetentionPolicy, PartnerRegionInfo, InstanceFailoverGroupReadOnlyEndpoint, InstanceFailoverGroupReadWriteEndpoint, @@ -2631,11 +2629,7 @@ def managed_db_restore( def managed_db_restore_ltr_backup( - cmd, client, - database_name, - managed_instance_name, - resource_group_name, backup_id, target_managed_database_name, target_managed_instance_name=None, @@ -2645,11 +2639,6 @@ def managed_db_restore_ltr_backup( Restores a managed db from an LTR backup (i.e. create with 'RestoreLongTermRetentionBackup' create mode.) ''' - kwargs['location'] = _get_managed_instance_location( - cmd.cli_ctx, - managed_instance_name=managed_instance_name, - resource_group_name=resource_group_name) - kwargs['create_mode'] = CreateMode.restore_long_term_retention_backup.value kwargs['long_term_retention_backup_resource_id'] = backup_id @@ -2732,7 +2721,6 @@ def get_short_term_retention_mi( def update_long_term_retention_mi( - cmd, client, database_name, managed_instance_name, @@ -2763,7 +2751,6 @@ def update_long_term_retention_mi( def list_by_database_long_term_retention_mi_backup( - cmd, client, location_name, managed_instance_name, @@ -2795,7 +2782,6 @@ def list_by_database_long_term_retention_mi_backup( def list_by_instance_long_term_retention_mi_backup( - cmd, client, location_name, managed_instance_name, @@ -2824,7 +2810,6 @@ def list_by_instance_long_term_retention_mi_backup( def list_by_location_long_term_retention_mi_backup( - cmd, client, location_name, resource_group_name=None, @@ -2836,7 +2821,7 @@ def list_by_location_long_term_retention_mi_backup( if resource_group_name: backups = client.list_by_resource_group_location( - resource_group_name=resource_groupname, + resource_group_name=resource_group_name, location_name=location_name, only_latest_per_database=only_latest_per_database, database_state=database_state) From 89327428d21fc978b911180ff09ce6e9b563dea3 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 23 Mar 2020 17:38:53 -0700 Subject: [PATCH 06/54] updated commands --- azure-cli1.pyproj | 1535 +++++++++++++++++ instance.txt | Bin 0 -> 34064 bytes instance_rg.txt | Bin 0 -> 34064 bytes .../azure/cli/command_modules/sql/_params.py | 14 +- .../azure/cli/command_modules/sql/commands.py | 6 +- .../azure/cli/command_modules/sql/custom.py | 38 +- testcert.cer | 19 + testkey.pvk | 28 + 8 files changed, 1618 insertions(+), 22 deletions(-) create mode 100644 azure-cli1.pyproj create mode 100644 instance.txt create mode 100644 instance_rg.txt create mode 100644 testcert.cer create mode 100644 testkey.pvk diff --git a/azure-cli1.pyproj b/azure-cli1.pyproj new file mode 100644 index 00000000000..f0c00e07645 --- /dev/null +++ b/azure-cli1.pyproj @@ -0,0 +1,1535 @@ + + + + Debug + 2.0 + {7accd235-5a95-4102-b00d-154c427fc483} + + + + . + . + {888888a0-9f3d-457c-b088-3a5042f75d52} + Standard Python launcher + MSBuild|env|$(MSBuildProjectFullPath) + + + + + 10.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + env + env (Python 3.8 (64-bit)) + Scripts\python.exe + Scripts\pythonw.exe + 0.0 + X64 + PYTHONPATH + + + + \ No newline at end of file diff --git a/instance.txt b/instance.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbdffd83f7d35e8e88f15339476291a588166e32 GIT binary patch literal 34064 zcmeI5TW{k;7>4J1rTq_RZz0>956c}aLR>5tuy+WpoI_!uO+(YJK#0E%yw6NsPvX?6 z)v2v%N0DR4o{a4|J^oJP|Ni~SyfiP&XZrkoyTz|pW^OXGFu$8?voYV8KlT05Tx#Ey z))!`N-fMksR!aHCrth1sVd-cY=(}%5O4HN&jrR2P-Ph-HZFlXSuKxK&#W|1V-!s$N z`7iDDXZGHy1k5Ol7q&f9cni z&bHNeMYtbT|K|28x8_9mzA&dcI@K~(xpuT(=-*>)4b4Qk zQwLKs)3q(_*`_M@nU0)l87b{T-*e@3X|L!)=epFsmHAd{esLEk+H+<;*elM=FFMNh zN_l?Jkxx3lv8g}l`j*;%Y5()i-YvOowVdj@Uz;DzAIj-O%Z2_~v?9(ys%xeC)#gm; zWZL&p-!A=HXMS&UKQ}*UO&PBB?b_ixrCV#^>Xzm^ZMz)S_HJDMTrtNll!7{8d#(Ft zYjdx&yj2cd7rlZKAm97e^TY4rE1fm(i>_9tD%YuMvadCLj@H2aQ~OI>@6`T6zvkLE zP&(2s^}VodVyN}pd}-SW{c>je-Jyz^h5jT@jMRoz~ld_9vyc3)vH??{o{@K;kh{WxHV9VAF4l8 zw{f4vhkBIHU3yo+-TURgPqfG3V$QyD3ryUDDzR`cugCCQqbKx5t4t&RLL}g+=G0OQ zt_?Lt@l?aUsofe_&J1jtiH`R~xS7_wT$?E^&!&!XiEHlpexGY?mwn<|@njh%*9PJa zBtqUB*(bTM@*do*mwz){b8!v!6E&%C2$#71qb(nQ+mwjSg?5uOT$6S+% z)?yq~h8tQLu1@~Vux@MhcxWWAH4YUcB%@Q}9(s_NxmR7g;Tf1oa_fp(eM`25D7Un~ zhn9D+5gMZVM7Pb8Rabkaq8>6Ic7~OHO+0xI0*mKnC`ecisFG1Cv$np;o>48Hf%QSrL6GR$u><80g#b!ZWa5*(V0Z z%RuMjg7q5vIXX{A!mteN*3Q2f2JY)TlQ&E3vR}DI!^?YE^-d+1;kh)o5*@u}s0ICI zrhbIC%3Rvb(T%(}6T?>8gFY0dVaw}z@*d+Y+C21~iFH*v&$i1xu`YJjmF;`ofbt&t zntl7;vHaU%T|e3PBG+^7v#x(HAJ96!WG9wp__4q_*oO9!_6p(fwdhK3iEgti8e-qW z8`pVpats~jO6hiWn}vPPm+9C}a^0?6*S96xR@o=k#m+idgslO&&Uqz|g0c=D&3gGa z$-3&;h4NUF{5NUuvG{K~`c>C)c-ik%{m4Zt5Q#tp0I>-ZOF^v1P9Dr8#jSL_qrQhH zD6-*LWBE#-iPp;<*$;-|5rb^FOT=;;ea^PNw#z>8Fm@gi%jZbwV)^KmA!8Qsr>U2J zlRWhOT*@O$qF;RU^J_Fb>mU-eBPL;HCBB8_ne*dB&T|o)cz3RDSeIFu5A7!LWh?cD z%wrvzPvYT*$|w1?ROva}F8jo~*jWdQ@;C!*dU$1rWF3Ap_403qb$59_;Fpd@Dv|GL zdUxja8=iwmW#rDh1jI2gE5tw~b8+g7)M!J|iNZ@FAeL%pV=D`em2Ra4*{_J_Ljwv6 z$NEPeAD&Bo<@WiUWxlq{K5;N!4i^5MKBsv0497v|-&rsJ#KAOg%fshwIrf|r0|)VY zA<~^sk_W5g!SEccSN4g6@p8~Tv6gk8VQqnB-RH6Vo8jQTm&71RfKSZtW$*}oFL<+L zmP$k+Am5Fo&tw)CEPi;qIKP*r(h=P^*WRUQhBa`ZW5|3xeSDd((0wL5Ulr@xF8jo~ z*jeZ1CUbr-Lpz5{FQCkq&rMb*|7KWM*n^mj1DzGKOku-egkoMqH-7asK4G!JLmfK} z+N+V>hrNawJ@9d0hRw1zD%lC?9kF=Hgl`eycee5<$=0o1`CktR+XhYVgQm%m0*H^mEp)wq5p#wXw6-$$gH6E_N_1Yq2xtKBo7} zzZurvt$$-=I^@fq$QctkkJWE@4q_F=QaIF;7&0c$Y;$c-EeEj^LPX}7VQy?U%M8a| z90ryMq7ug*2gwmjCH9HL!77=v?XpiCjF*FjopF~_VPoi-N2Xr>iG#_`_?UJ^_nZ?0 z2O%IfM&!U0U*9YT>y>@tV7wf3c1Hib4ZJT29ZX1no4z>czmMs7{>^Z3*UnhhG9~FR zCh2dtHp4TH=s{xR-P~qwwru8zaXL?)TZpniD&b8%9UZ}=l$o;eH$|sUyWfo?Bz_Pn z5HDw6<9SFI@tk#@ZI^vwT=Os$<)G7f;scZGB=J!pswt$-)4fBYn4kN2{>^Z(@GkuAz?hOW zo-t`W{kjY<=Mg6{Qm;VHbKWaXZgZN?u9fQ0cM>;2WCe3;4J1rTq_RZz0>956c}aLR>5tuy+WpoI_!uO+(YJK#0E%yw6NsPvX?6 z)v2v%N0DR4o{a4|J^oJP|Ni~SyfiP&XZrkoyTz|pW^OXGFu$8?voYV8KlT05Tx#Ey z))!`N-fMksR!aHCrth1sVd-cY=(}%5O4HN&jrR2P-Ph-HZFlXSuKxK&#W|1V-!s$N z`7iDDXZGHy1k5Ol7q&f9cni z&bHNeMYtbT|K|28x8_9mzA&dcI@K~(xpuT(=-*>)4b4Qk zQwLKs)3q(_*`_M@nU0)l87b{T-*e@3X|L!)=epFsmHAd{esLEk+H+<;*elM=FFMNh zN_l?Jkxx3lv8g}l`j*;%Y5()i-YvOowVdj@Uz;DzAIj-O%Z2_~v?9(ys%xeC)#gm; zWZL&p-!A=HXMS&UKQ}*UO&PBB?b_ixrCV#^>Xzm^ZMz)S_HJDMTrtNll!7{8d#(Ft zYjdx&yj2cd7rlZKAm97e^TY4rE1fm(i>_9tD%YuMvadCLj@H2aQ~OI>@6`T6zvkLE zP&(2s^}VodVyN}pd}-SW{c>je-Jyz^h5jT@jMRoz~ld_9vyc3)vH??{o{@K;kh{WxHV9VAF4l8 zw{f4vhkBIHU3yo+-TURgPqfG3V$QyD3ryUDDzR`cugCCQqbKx5t4t&RLL}g+=G0OQ zt_?Lt@l?aUsofe_&J1jtiH`R~xS7_wT$?E^&!&!XiEHlpexGY?mwn<|@njh%*9PJa zBtqUB*(bTM@*do*mwz){b8!v!6E&%C2$#71qb(nQ+mwjSg?5uOT$6S+% z)?yq~h8tQLu1@~Vux@MhcxWWAH4YUcB%@Q}9(s_NxmR7g;Tf1oa_fp(eM`25D7Un~ zhn9D+5gMZVM7Pb8Rabkaq8>6Ic7~OHO+0xI0*mKnC`ecisFG1Cv$np;o>48Hf%QSrL6GR$u><80g#b!ZWa5*(V0Z z%RuMjg7q5vIXX{A!mteN*3Q2f2JY)TlQ&E3vR}DI!^?YE^-d+1;kh)o5*@u}s0ICI zrhbIC%3Rvb(T%(}6T?>8gFY0dVaw}z@*d+Y+C21~iFH*v&$i1xu`YJjmF;`ofbt&t zntl7;vHaU%T|e3PBG+^7v#x(HAJ96!WG9wp__4q_*oO9!_6p(fwdhK3iEgti8e-qW z8`pVpats~jO6hiWn}vPPm+9C}a^0?6*S96xR@o=k#m+idgslO&&Uqz|g0c=D&3gGa z$-3&;h4NUF{5NUuvG{K~`c>C)c-ik%{m4Zt5Q#tp0I>-ZOF^v1P9Dr8#jSL_qrQhH zD6-*LWBE#-iPp;<*$;-|5rb^FOT=;;ea^PNw#z>8Fm@gi%jZbwV)^KmA!8Qsr>U2J zlRWhOT*@O$qF;RU^J_Fb>mU-eBPL;HCBB8_ne*dB&T|o)cz3RDSeIFu5A7!LWh?cD z%wrvzPvYT*$|w1?ROva}F8jo~*jWdQ@;C!*dU$1rWF3Ap_403qb$59_;Fpd@Dv|GL zdUxja8=iwmW#rDh1jI2gE5tw~b8+g7)M!J|iNZ@FAeL%pV=D`em2Ra4*{_J_Ljwv6 z$NEPeAD&Bo<@WiUWxlq{K5;N!4i^5MKBsv0497v|-&rsJ#KAOg%fshwIrf|r0|)VY zA<~^sk_W5g!SEccSN4g6@p8~Tv6gk8VQqnB-RH6Vo8jQTm&71RfKSZtW$*}oFL<+L zmP$k+Am5Fo&tw)CEPi;qIKP*r(h=P^*WRUQhBa`ZW5|3xeSDd((0wL5Ulr@xF8jo~ z*jeZ1CUbr-Lpz5{FQCkq&rMb*|7KWM*n^mj1DzGKOku-egkoMqH-7asK4G!JLmfK} z+N+V>hrNawJ@9d0hRw1zD%lC?9kF=Hgl`eycee5<$=0o1`CktR+XhYVgQm%m0*H^mEp)wq5p#wXw6-$$gH6E_N_1Yq2xtKBo7} zzZurvt$$-=I^@fq$QctkkJWE@4q_F=QaIF;7&0c$Y;$c-EeEj^LPX}7VQy?U%M8a| z90ryMq7ug*2gwmjCH9HL!77=v?XpiCjF*FjopF~_VPoi-N2Xr>iG#_`_?UJ^_nZ?0 z2O%IfM&!U0U*9YT>y>@tV7wf3c1Hib4ZJT29ZX1no4z>czmMs7{>^Z3*UnhhG9~FR zCh2dtHp4TH=s{xR-P~qwwru8zaXL?)TZpniD&b8%9UZ}=l$o;eH$|sUyWfo?Bz_Pn z5HDw6<9SFI@tk#@ZI^vwT=Os$<)G7f;scZGB=J!pswt$-)4fBYn4kN2{>^Z(@GkuAz?hOW zo-t`W{kjY<=Mg6{Qm;VHbKWaXZgZN?u9fQ0cM>;2WCe3; Date: Mon, 23 Mar 2020 18:17:53 -0700 Subject: [PATCH 07/54] fix setting location for ltr restore --- .../azure/cli/command_modules/sql/custom.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 981bdb10bb6..c674431a0fa 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2629,6 +2629,7 @@ def managed_db_restore( def managed_db_restore_ltr_backup( + cmd, client, backup_id, target_managed_database_name, @@ -2638,20 +2639,10 @@ def managed_db_restore_ltr_backup( ''' Restores a managed database from a long term retention backup. ''' - backup_id_arr = backup_id.split("/") - if len(backup_id_arr) == 14: - # backup_id format: - # /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Sql/locations/{loc} - # /longTermRetentionManagedInstances/{mi}/longTermRetentionDatabases/{db} - # /longTermRetentionManagedInstanceBackups/{backup} - kwargs['location'] = backup_id_arr[7] - else: - # len(backup_id_arr) == 12 - # backup_id format: - # /subscriptions/{sub}/providers/Microsoft.Sql/locations/{loc} - # /longTermRetentionManagedInstances/{mi}/longTermRetentionDatabases/{db} - # /longTermRetentionManagedInstanceBackups/{backup} - kwargs['location'] = backup_id_arr[5] + kwargs['location'] = _get_managed_instance_location( + cmd.cli_ctx, + managed_instance_name=target_managed_instance_name, + resource_group_name=target_resource_group_name) kwargs['create_mode'] = CreateMode.restore_long_term_retention_backup.value kwargs['long_term_retention_backup_resource_id'] = backup_id From 32bdfd3110d02637a0a70ef2d5cfa8dc84ce4461 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Tue, 24 Mar 2020 03:23:04 -0700 Subject: [PATCH 08/54] adding test cases for all LTR MI functions --- .../azure/cli/command_modules/sql/_params.py | 777 +++++++++++------- .../azure/cli/command_modules/sql/commands.py | 42 +- .../azure/cli/command_modules/sql/custom.py | 4 +- ...st_sql_managed_db_long_term_retention.yaml | 346 ++++++++ .../sql/tests/latest/test_sql_commands.py | 154 +++- 5 files changed, 978 insertions(+), 345 deletions(-) create mode 100644 src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index e43fc4c35f0..21bea5dd860 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -82,8 +82,18 @@ def __init__( unit_map=None): self.unit = unit self.result_type = result_type - self.unit_map = unit_map or dict(B=1, kB=1024, MB=1024 * 1024, GB=1024 * 1024 * 1024, - TB=1024 * 1024 * 1024 * 1024) + self.unit_map = unit_map or dict( + B=1, + kB=1024, + MB=1024 * + 1024, + GB=1024 * + 1024 * + 1024, + TB=1024 * + 1024 * + 1024 * + 1024) def __call__(self, value): numeric_part = ''.join(itertools.takewhile(str.isdigit, value)) @@ -342,12 +352,15 @@ def _configure_db_dw_create_params( # *** Step 0: Validation *** - # DW does not support all create modes. Check that engine and create_mode are consistent. + # DW does not support all create modes. Check that engine and create_mode + # are consistent. if engine == Engine.dw and create_mode not in [ CreateMode.default, CreateMode.point_in_time_restore, CreateMode.restore]: - raise ValueError('Engine {} does not support create mode {}'.format(engine, create_mode)) + raise ValueError( + 'Engine {} does not support create mode {}'.format( + engine, create_mode)) # *** Step 1: Create extra params *** @@ -380,7 +393,8 @@ def _configure_db_dw_create_params( # az sql dw create -h >> $file # az sql dw update -h >> $file # - # Then compare 'help_original.txt' <-> 'help_updated.txt' in your favourite text diff tool. + # Then compare 'help_original.txt' <-> 'help_updated.txt' in your + # favourite text diff tool. create_args_for_complex_type( arg_ctx, 'parameters', Database, [ 'catalog_collation', @@ -420,8 +434,9 @@ def _configure_db_dw_create_params( help='The service objective for the new database. For example: ' + (db_service_objective_examples if engine == Engine.db else dw_service_objective_examples)) - arg_ctx.argument('elastic_pool_id', - help='The name or resource id of the elastic pool to create the database in.') + arg_ctx.argument( + 'elastic_pool_id', + help='The name or resource id of the elastic pool to create the database in.') # *** Step 3: Ignore params that are not applicable (based on engine & create mode) *** @@ -431,8 +446,12 @@ def _configure_db_dw_create_params( arg_ctx.ignore('catalog_collation') # Only applicable to point in time restore or deleted restore create mode. - if create_mode not in [CreateMode.restore, CreateMode.point_in_time_restore]: - arg_ctx.ignore('restore_point_in_time', 'source_database_deletion_date') + if create_mode not in [ + CreateMode.restore, + CreateMode.point_in_time_restore]: + arg_ctx.ignore( + 'restore_point_in_time', + 'source_database_deletion_date') # 'collation', 'tier', and 'max_size_bytes' are ignored (or rejected) when creating a copy # or secondary because their values are determined by the source db. @@ -487,8 +506,9 @@ def load_arguments(self, _): c.argument('location_name', arg_type=get_location_type(self.cli_ctx)) c.argument('usage_name', options_list=['--usage', '-u']) c.argument('tags', arg_type=tags_type) - c.argument('allow_data_loss', - help='If specified, the failover operation will allow data loss.') + c.argument( + 'allow_data_loss', + help='If specified, the failover operation will allow data loss.') with self.argument_context('sql db') as c: _configure_db_dw_params(c) @@ -499,26 +519,30 @@ def load_arguments(self, _): c.argument('database_name', options_list=['--name', '-n'], help='Name of the Azure SQL Database.', - # Allow --ids command line argument. id_part=child_name_1 is 2nd name in uri + # Allow --ids command line argument. id_part=child_name_1 is + # 2nd name in uri id_part='child_name_1') # SKU-related params are different from DB versus DW, so we want this configuration to apply here # in 'sql db' group but not in 'sql dw' group. If we wanted to apply to both, we would put the # configuration into _configure_db_dw_params(). - c.argument('tier', - arg_type=tier_param_type, - help='The edition component of the sku. Allowed values include: Basic, Standard, ' - 'Premium, GeneralPurpose, BusinessCritical, Hyperscale.') + c.argument( + 'tier', + arg_type=tier_param_type, + help='The edition component of the sku. Allowed values include: Basic, Standard, ' + 'Premium, GeneralPurpose, BusinessCritical, Hyperscale.') - c.argument('capacity', - arg_type=capacity_param_type, - arg_group=sku_component_arg_group, - help='The capacity component of the sku in integer number of DTUs or vcores.') + c.argument( + 'capacity', + arg_type=capacity_param_type, + arg_group=sku_component_arg_group, + help='The capacity component of the sku in integer number of DTUs or vcores.') - c.argument('family', - arg_type=family_param_type, - help='The compute generation component of the sku (for vcore skus only). ' - 'Allowed values include: Gen4, Gen5.') + c.argument( + 'family', + arg_type=family_param_type, + help='The compute generation component of the sku (for vcore skus only). ' + 'Allowed values include: Gen4, Gen5.') with self.argument_context('sql db create') as c: _configure_db_dw_create_params(c, Engine.db, CreateMode.default) @@ -526,8 +550,9 @@ def load_arguments(self, _): with self.argument_context('sql db copy') as c: _configure_db_dw_create_params(c, Engine.db, CreateMode.copy) - c.argument('dest_name', - help='Name of the database that will be created as the copy destination.') + c.argument( + 'dest_name', + help='Name of the database that will be created as the copy destination.') c.argument('dest_resource_group_name', options_list=['--dest-resource-group'], @@ -544,28 +569,34 @@ def load_arguments(self, _): help='The new name that the database will be renamed to.') with self.argument_context('sql db restore') as c: - _configure_db_dw_create_params(c, Engine.db, CreateMode.point_in_time_restore) + _configure_db_dw_create_params( + c, Engine.db, CreateMode.point_in_time_restore) - c.argument('dest_name', - help='Name of the database that will be created as the restore destination.') + c.argument( + 'dest_name', + help='Name of the database that will be created as the restore destination.') restore_point_arg_group = 'Restore Point' - c.argument('restore_point_in_time', - options_list=['--time', '-t'], - arg_group=restore_point_arg_group, - help='The point in time of the source database that will be restored to create the' - ' new database. Must be greater than or equal to the source database\'s' - ' earliestRestoreDate value. Either --time or --deleted-time (or both) must be specified. ' + - time_format_help) - - c.argument('source_database_deletion_date', - options_list=['--deleted-time'], - arg_group=restore_point_arg_group, - help='If specified, restore from a deleted database instead of from an existing database.' - ' Must match the deleted time of a deleted database in the same server.' - ' Either --time or --deleted-time (or both) must be specified. ' + - time_format_help) + c.argument( + 'restore_point_in_time', + options_list=[ + '--time', + '-t'], + arg_group=restore_point_arg_group, + help='The point in time of the source database that will be restored to create the' + ' new database. Must be greater than or equal to the source database\'s' + ' earliestRestoreDate value. Either --time or --deleted-time (or both) must be specified. ' + + time_format_help) + + c.argument( + 'source_database_deletion_date', + options_list=['--deleted-time'], + arg_group=restore_point_arg_group, + help='If specified, restore from a deleted database instead of from an existing database.' + ' Must match the deleted time of a deleted database in the same server.' + ' Either --time or --deleted-time (or both) must be specified. ' + + time_format_help) with self.argument_context('sql db show') as c: # Service tier advisors and transparent data encryption are not included in the first batch @@ -573,16 +604,20 @@ def load_arguments(self, _): c.ignore('expand') with self.argument_context('sql db list') as c: - c.argument('elastic_pool_name', - options_list=['--elastic-pool'], - help='If specified, lists only the databases in this elastic pool') + c.argument( + 'elastic_pool_name', + options_list=['--elastic-pool'], + help='If specified, lists only the databases in this elastic pool') with self.argument_context('sql db list-editions') as c: - c.argument('show_details', - options_list=['--show-details', '-d'], - help='List of additional details to include in output.', - nargs='+', - arg_type=get_enum_type(DatabaseCapabilitiesAdditionalDetails)) + c.argument( + 'show_details', + options_list=[ + '--show-details', + '-d'], + help='List of additional details to include in output.', + nargs='+', + arg_type=get_enum_type(DatabaseCapabilitiesAdditionalDetails)) c.argument('available', arg_type=available_param_type) @@ -591,34 +626,42 @@ def load_arguments(self, _): # We could used get_enum_type here, but that will validate the inputs which means there # will be no way to query for new editions/service objectives that are made available after # this version of CLI is released. - c.argument('edition', - arg_type=tier_param_type, - arg_group=search_arg_group, - help='Edition to search for. If unspecified, all editions are shown.') - - c.argument('service_objective', - arg_group=search_arg_group, - help='Service objective to search for. If unspecified, all service objectives are shown.') - - c.argument('dtu', - arg_group=search_arg_group, - help='Number of DTUs to search for. If unspecified, all DTU sizes are shown.') - - c.argument('vcores', - arg_group=search_arg_group, - help='Number of vcores to search for. If unspecified, all vcore sizes are shown.') + c.argument( + 'edition', + arg_type=tier_param_type, + arg_group=search_arg_group, + help='Edition to search for. If unspecified, all editions are shown.') + + c.argument( + 'service_objective', + arg_group=search_arg_group, + help='Service objective to search for. If unspecified, all service objectives are shown.') + + c.argument( + 'dtu', + arg_group=search_arg_group, + help='Number of DTUs to search for. If unspecified, all DTU sizes are shown.') + + c.argument( + 'vcores', + arg_group=search_arg_group, + help='Number of vcores to search for. If unspecified, all vcore sizes are shown.') with self.argument_context('sql db update') as c: - c.argument('service_objective', - arg_group=sku_arg_group, - help='The name of the new service objective. If this is a standalone db service' - ' objective and the db is currently in an elastic pool, then the db is removed from' - ' the pool.') - - c.argument('elastic_pool_id', - help='The name or resource id of the elastic pool to move the database into.') + c.argument( + 'service_objective', + arg_group=sku_arg_group, + help='The name of the new service objective. If this is a standalone db service' + ' objective and the db is currently in an elastic pool, then the db is removed from' + ' the pool.') + + c.argument( + 'elastic_pool_id', + help='The name or resource id of the elastic pool to move the database into.') - c.argument('max_size_bytes', help='The new maximum size of the database expressed in bytes.') + c.argument( + 'max_size_bytes', + help='The new maximum size of the database expressed in bytes.') with self.argument_context('sql db export') as c: # Create args that will be used to build up the ExportRequest object @@ -646,7 +689,8 @@ def load_arguments(self, _): arg_type=get_enum_type(StorageKeyType)) with self.argument_context('sql db import') as c: - # Create args that will be used to build up the ImportExtensionRequest object + # Create args that will be used to build up the ImportExtensionRequest + # object create_args_for_complex_type(c, 'parameters', ImportExtensionRequest, [ 'administrator_login', 'administrator_login_password', @@ -708,10 +752,11 @@ def load_arguments(self, _): with self.argument_context('sql db replica create') as c: _configure_db_dw_create_params(c, Engine.db, CreateMode.secondary) - c.argument('partner_resource_group_name', - options_list=['--partner-resource-group'], - help='Name of the resource group to create the new replica in.' - ' If unspecified, defaults to the origin resource group.') + c.argument( + 'partner_resource_group_name', + options_list=['--partner-resource-group'], + help='Name of the resource group to create the new replica in.' + ' If unspecified, defaults to the origin resource group.') c.argument('partner_server_name', options_list=['--partner-server'], @@ -721,23 +766,27 @@ def load_arguments(self, _): c.argument('database_name', help='Name of the database to fail over.') - c.argument('server_name', - help='Name of the server containing the secondary replica that will become' - ' the new primary. ' + server_configure_help) + c.argument( + 'server_name', + help='Name of the server containing the secondary replica that will become' + ' the new primary. ' + + server_configure_help) - c.argument('resource_group_name', - help='Name of the resource group containing the secondary replica that' - ' will become the new primary.') + c.argument( + 'resource_group_name', + help='Name of the resource group containing the secondary replica that' + ' will become the new primary.') with self.argument_context('sql db replica delete-link') as c: c.argument('partner_server_name', options_list=['--partner-server'], help='Name of the server that the other replica is in.') - c.argument('partner_resource_group_name', - options_list=['--partner-resource-group'], - help='Name of the resource group that the other replica is in. If unspecified,' - ' defaults to the first database\'s resource group.') + c.argument( + 'partner_resource_group_name', + options_list=['--partner-resource-group'], + help='Name of the resource group that the other replica is in. If unspecified,' + ' defaults to the first database\'s resource group.') ##### # sql db audit-policy & threat-policy @@ -806,11 +855,12 @@ def _configure_security_policy_storage_params(arg_ctx): help='List of email addresses that alerts are sent to.', nargs='+') - c.argument('email_account_admins', - arg_group=notification_arg_group, - options_list=['--email-account-admins'], - help='Whether the alert is sent to the account administrators.', - arg_type=get_enum_type(SecurityAlertPolicyEmailAccountAdmins)) + c.argument( + 'email_account_admins', + arg_group=notification_arg_group, + options_list=['--email-account-admins'], + help='Whether the alert is sent to the account administrators.', + arg_type=get_enum_type(SecurityAlertPolicyEmailAccountAdmins)) # TODO: use server default @@ -842,12 +892,14 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('database_name', options_list=['--name', '-n'], help='Name of the data warehouse.', - # Allow --ids command line argument. id_part=child_name_1 is 2nd name in uri + # Allow --ids command line argument. id_part=child_name_1 is + # 2nd name in uri id_part='child_name_1') - c.argument('service_objective', - help='The service objective of the data warehouse. For example: ' + - dw_service_objective_examples) + c.argument( + 'service_objective', + help='The service objective of the data warehouse. For example: ' + + dw_service_objective_examples) c.argument('collation', help='The collation of the data warehouse.') @@ -876,7 +928,8 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('elastic_pool_name', options_list=['--name', '-n'], help='The name of the elastic pool.', - # Allow --ids command line argument. id_part=child_name_1 is 2nd name in uri + # Allow --ids command line argument. id_part=child_name_1 is + # 2nd name in uri id_part='child_name_1') # --db-dtu-max and --db-dtu-min were the original param names, which is consistent with the @@ -885,13 +938,21 @@ def _configure_security_policy_storage_params(arg_ctx): # list-editions --show-details db-max-dtu db-min-dtu` parameter values. These are more # consistent with other az sql commands, but the original can't be removed due to # compatibility. - c.argument('max_capacity', - options_list=['--db-dtu-max', '--db-max-dtu', '--db-max-capacity'], - help='The maximum capacity (in DTUs or vcores) any one database can consume.') - - c.argument('min_capacity', - options_list=['--db-dtu-min', '--db-min-dtu', '--db-min-capacity'], - help='The minumum capacity (in DTUs or vcores) each database is guaranteed.') + c.argument( + 'max_capacity', + options_list=[ + '--db-dtu-max', + '--db-max-dtu', + '--db-max-capacity'], + help='The maximum capacity (in DTUs or vcores) any one database can consume.') + + c.argument( + 'min_capacity', + options_list=[ + '--db-dtu-min', + '--db-min-dtu', + '--db-min-capacity'], + help='The minumum capacity (in DTUs or vcores) each database is guaranteed.') # --storage was the original param name, which is consistent with the underlying REST API. # --max-size is an alias which is consistent with the `sql elastic-pool list-editions @@ -906,19 +967,22 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('zone_redundant', arg_type=zone_redundant_param_type) - c.argument('tier', - arg_type=tier_param_type, - help='The edition component of the sku. Allowed values include: Basic, Standard, ' - 'Premium, GeneralPurpose, BusinessCritical.') + c.argument( + 'tier', + arg_type=tier_param_type, + help='The edition component of the sku. Allowed values include: Basic, Standard, ' + 'Premium, GeneralPurpose, BusinessCritical.') - c.argument('capacity', - arg_type=capacity_or_dtu_param_type, - help='The capacity component of the sku in integer number of DTUs or vcores.') + c.argument( + 'capacity', + arg_type=capacity_or_dtu_param_type, + help='The capacity component of the sku in integer number of DTUs or vcores.') - c.argument('family', - arg_type=family_param_type, - help='The compute generation component of the sku (for vcore skus only). ' - 'Allowed values include: Gen4, Gen5.') + c.argument( + 'family', + arg_type=family_param_type, + help='The compute generation component of the sku (for vcore skus only). ' + 'Allowed values include: Gen4, Gen5.') with self.argument_context('sql elastic-pool create') as c: # Create args that will be used to build up the ElasticPool object @@ -932,7 +996,8 @@ def _configure_security_policy_storage_params(arg_ctx): 'zone_redundant', ]) - # Create args that will be used to build up the ElasticPoolPerDatabaseSettings object + # Create args that will be used to build up the + # ElasticPoolPerDatabaseSettings object create_args_for_complex_type( c, 'per_database_settings', ElasticPoolPerDatabaseSettings, [ 'max_capacity', @@ -952,12 +1017,16 @@ def _configure_security_policy_storage_params(arg_ctx): with self.argument_context('sql elastic-pool list-editions') as c: # Note that `ElasticPoolCapabilitiesAdditionalDetails` intentionally match param names to - # other commands, such as `sql elastic-pool create --db-max-dtu --db-min-dtu --max-size`. - c.argument('show_details', - options_list=['--show-details', '-d'], - help='List of additional details to include in output.', - nargs='+', - arg_type=get_enum_type(ElasticPoolCapabilitiesAdditionalDetails)) + # other commands, such as `sql elastic-pool create --db-max-dtu + # --db-min-dtu --max-size`. + c.argument( + 'show_details', + options_list=[ + '--show-details', + '-d'], + help='List of additional details to include in output.', + nargs='+', + arg_type=get_enum_type(ElasticPoolCapabilitiesAdditionalDetails)) c.argument('available', arg_type=available_param_type) @@ -967,18 +1036,21 @@ def _configure_security_policy_storage_params(arg_ctx): # We could used 'arg_type=get_enum_type' here, but that will validate the inputs which means there # will be no way to query for new editions that are made available after # this version of CLI is released. - c.argument('edition', - arg_type=tier_param_type, - arg_group=search_arg_group, - help='Edition to search for. If unspecified, all editions are shown.') - - c.argument('dtu', - arg_group=search_arg_group, - help='Number of DTUs to search for. If unspecified, all DTU sizes are shown.') - - c.argument('vcores', - arg_group=search_arg_group, - help='Number of vcores to search for. If unspecified, all vcore sizes are shown.') + c.argument( + 'edition', + arg_type=tier_param_type, + arg_group=search_arg_group, + help='Edition to search for. If unspecified, all editions are shown.') + + c.argument( + 'dtu', + arg_group=search_arg_group, + help='Number of DTUs to search for. If unspecified, all DTU sizes are shown.') + + c.argument( + 'vcores', + arg_group=search_arg_group, + help='Number of vcores to search for. If unspecified, all vcore sizes are shown.') with self.argument_context('sql elastic-pool update') as c: c.argument('database_dtu_max', @@ -1007,12 +1079,23 @@ def _configure_security_policy_storage_params(arg_ctx): ############################################### with self.argument_context('sql failover-group') as c: - c.argument('failover_group_name', options_list=['--name', '-n'], help="The name of the Failover Group") + c.argument( + 'failover_group_name', + options_list=[ + '--name', + '-n'], + help="The name of the Failover Group") c.argument('server_name', arg_type=server_param_type) - c.argument('partner_server', help="The name of the partner server of a Failover Group") - c.argument('partner_resource_group', help="The name of the resource group of the partner server") - c.argument('failover_policy', help="The failover policy of the Failover Group", - arg_type=get_enum_type(FailoverPolicyType)) + c.argument( + 'partner_server', + help="The name of the partner server of a Failover Group") + c.argument( + 'partner_resource_group', + help="The name of the resource group of the partner server") + c.argument( + 'failover_policy', + help="The failover policy of the Failover Group", + arg_type=get_enum_type(FailoverPolicyType)) c.argument('grace_period', arg_type=grace_period_param_type) c.argument('add_db', nargs='+', @@ -1036,25 +1119,34 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('administrator_login_password', options_list=['--admin-password', '-p']) - c.argument('assign_identity', - options_list=['--assign_identity', '-i'], - help='Generate and assign an Azure Active Directory Identity for this server' - 'for use with key management services like Azure KeyVault.') - - c.argument('minimal_tls_version', - arg_type=get_enum_type(SqlServerMinimalTlsVersionType), - help='The minimal TLS version enforced by the sql server for inbound connections.') - - c.argument('enable_public_network', - options_list=['--enable-public-network', '-e'], - arg_type=get_three_state_flag(), - help='Set whether public network access to server is allowed or not. When false,' - 'only connections made through Private Links can reach this server.', - is_preview=True) + c.argument( + 'assign_identity', + options_list=[ + '--assign_identity', + '-i'], + help='Generate and assign an Azure Active Directory Identity for this server' + 'for use with key management services like Azure KeyVault.') + + c.argument( + 'minimal_tls_version', + arg_type=get_enum_type(SqlServerMinimalTlsVersionType), + help='The minimal TLS version enforced by the sql server for inbound connections.') + + c.argument( + 'enable_public_network', + options_list=[ + '--enable-public-network', + '-e'], + arg_type=get_three_state_flag(), + help='Set whether public network access to server is allowed or not. When false,' + 'only connections made through Private Links can reach this server.', + is_preview=True) with self.argument_context('sql server create') as c: - c.argument('location', - arg_type=get_location_type_with_default_from_resource_group(self.cli_ctx)) + c.argument( + 'location', + arg_type=get_location_type_with_default_from_resource_group( + self.cli_ctx)) # Create args that will be used to build up the Server object create_args_for_complex_type( @@ -1071,10 +1163,13 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('administrator_login_password', required=True) - c.argument('assign_identity', - options_list=['--assign-identity', '-i'], - help='Generate and assign an Azure Active Directory Identity for this server' - 'for use with key management services like Azure KeyVault.') + c.argument( + 'assign_identity', + options_list=[ + '--assign-identity', + '-i'], + help='Generate and assign an Azure Active Directory Identity for this server' + 'for use with key management services like Azure KeyVault.') with self.argument_context('sql server update') as c: c.argument('administrator_login_password', @@ -1098,7 +1193,8 @@ def _configure_security_policy_storage_params(arg_ctx): c.ignore('tenant_id') with self.argument_context('sql server ad-admin create') as c: - # Create args that will be used to build up the ServerAzureADAdministrator object + # Create args that will be used to build up the + # ServerAzureADAdministrator object create_args_for_complex_type( c, 'parameters', ServerAzureADAdministrator, [ 'login', @@ -1127,9 +1223,10 @@ def _configure_security_policy_storage_params(arg_ctx): options_list=('--name', '-n'), help='Name of the DNS alias.') - c.argument('original_server_name', - options_list=('--original-server'), - help='The name of the server to which alias is currently pointing') + c.argument( + 'original_server_name', + options_list=('--original-server'), + help='The name of the server to which alias is currently pointing') c.argument('original_resource_group_name', options_list=('--original-resource-group'), @@ -1151,18 +1248,21 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('firewall_rule_name', options_list=['--name', '-n'], help='The name of the firewall rule.', - # Allow --ids command line argument. id_part=child_name_1 is 2nd name in uri + # Allow --ids command line argument. id_part=child_name_1 is + # 2nd name in uri id_part='child_name_1') - c.argument('start_ip_address', - options_list=['--start-ip-address'], - help='The start IP address of the firewall rule. Must be IPv4 format. Use value' - ' \'0.0.0.0\' to represent all Azure-internal IP addresses.') + c.argument( + 'start_ip_address', + options_list=['--start-ip-address'], + help='The start IP address of the firewall rule. Must be IPv4 format. Use value' + ' \'0.0.0.0\' to represent all Azure-internal IP addresses.') - c.argument('end_ip_address', - options_list=['--end-ip-address'], - help='The end IP address of the firewall rule. Must be IPv4 format. Use value' - ' \'0.0.0.0\' to represent all Azure-internal IP addresses.') + c.argument( + 'end_ip_address', + options_list=['--end-ip-address'], + help='The end IP address of the firewall rule. Must be IPv4 format. Use value' + ' \'0.0.0.0\' to represent all Azure-internal IP addresses.') ##### # sql server key @@ -1204,15 +1304,19 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('virtual_network_rule_name', options_list=['--name', '-n']) - c.argument('virtual_network_subnet_id', - options_list=['--subnet'], - help='Name or ID of the subnet that allows access to an Azure Sql Server. ' - 'If subnet name is provided, --vnet-name must be provided.') + c.argument( + 'virtual_network_subnet_id', + options_list=['--subnet'], + help='Name or ID of the subnet that allows access to an Azure Sql Server. ' + 'If subnet name is provided, --vnet-name must be provided.') - c.argument('ignore_missing_vnet_service_endpoint', - options_list=['--ignore-missing-endpoint', '-i'], - help='Create firewall rule before the virtual network has vnet service endpoint enabled', - arg_type=get_three_state_flag()) + c.argument( + 'ignore_missing_vnet_service_endpoint', + options_list=[ + '--ignore-missing-endpoint', + '-i'], + help='Create firewall rule before the virtual network has vnet service endpoint enabled', + arg_type=get_three_state_flag()) with self.argument_context('sql server vnet-rule create') as c: c.extra('vnet_name', @@ -1226,13 +1330,15 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('managed_instance_name', help='The managed instance name', options_list=['--name', '-n'], - # Allow --ids command line argument. id_part=name is 1st name in uri + # Allow --ids command line argument. id_part=name is 1st + # name in uri id_part='name') - c.argument('tier', - arg_type=tier_param_type, - help='The edition component of the sku. Allowed values include: ' - 'GeneralPurpose, BusinessCritical.') + c.argument( + 'tier', + arg_type=tier_param_type, + help='The edition component of the sku. Allowed values include: ' + 'GeneralPurpose, BusinessCritical.') c.argument('family', arg_type=family_param_type, @@ -1249,33 +1355,37 @@ def _configure_security_policy_storage_params(arg_ctx): arg_type=get_enum_type(DatabaseLicenseType), help='The license type to apply for this managed instance.') - c.argument('vcores', - arg_type=capacity_param_type, - help='The capacity of the managed instance in integer number of vcores.') + c.argument( + 'vcores', + arg_type=capacity_param_type, + help='The capacity of the managed instance in integer number of vcores.') c.argument('collation', help='The collation of the managed instance.') - c.argument('proxy_override', - arg_type=get_enum_type(ServerConnectionType), - help='The connection type used for connecting to the instance.') + c.argument( + 'proxy_override', + arg_type=get_enum_type(ServerConnectionType), + help='The connection type used for connecting to the instance.') - c.argument('minimal_tls_version', - arg_type=get_enum_type(SqlManagedInstanceMinimalTlsVersionType), - help='The minimal TLS version enforced by the managed instance for inbound connections.', - is_preview=True) + c.argument( + 'minimal_tls_version', + arg_type=get_enum_type(SqlManagedInstanceMinimalTlsVersionType), + help='The minimal TLS version enforced by the managed instance for inbound connections.', + is_preview=True) - c.argument('public_data_endpoint_enabled', - arg_type=get_three_state_flag(), - help='Whether or not the public data endpoint is enabled for the instance.') + c.argument('public_data_endpoint_enabled', arg_type=get_three_state_flag( + ), help='Whether or not the public data endpoint is enabled for the instance.') - c.argument('timezone_id', - help='The time zone id for the instance to set. ' - 'A list of time zone ids is exposed through the sys.time_zone_info (Transact-SQL) view.') + c.argument( + 'timezone_id', help='The time zone id for the instance to set. ' + 'A list of time zone ids is exposed through the sys.time_zone_info (Transact-SQL) view.') with self.argument_context('sql mi create') as c: - c.argument('location', - arg_type=get_location_type_with_default_from_resource_group(self.cli_ctx)) + c.argument( + 'location', + arg_type=get_location_type_with_default_from_resource_group( + self.cli_ctx)) # Create args that will be used to build up the ManagedInstance object create_args_for_complex_type( @@ -1293,7 +1403,8 @@ def _configure_security_policy_storage_params(arg_ctx): 'timezone_id', ]) - # Create args that will be used to build up the Managed Instance's Sku object + # Create args that will be used to build up the Managed Instance's Sku + # object create_args_for_complex_type( c, 'sku', Sku, [ 'family', @@ -1316,16 +1427,20 @@ def _configure_security_policy_storage_params(arg_ctx): help='The virtual network name', validator=validate_subnet) - c.argument('virtual_network_subnet_id', - options_list=['--subnet'], - required=True, - help='Name or ID of the subnet that allows access to an Azure Sql Managed Instance. ' - 'If subnet name is provided, --vnet-name must be provided.') - - c.argument('assign_identity', - options_list=['--assign-identity', '-i'], - help='Generate and assign an Azure Active Directory Identity for this managed instance ' - 'for use with key management services like Azure KeyVault.') + c.argument( + 'virtual_network_subnet_id', + options_list=['--subnet'], + required=True, + help='Name or ID of the subnet that allows access to an Azure Sql Managed Instance. ' + 'If subnet name is provided, --vnet-name must be provided.') + + c.argument( + 'assign_identity', + options_list=[ + '--assign-identity', + '-i'], + help='Generate and assign an Azure Active Directory Identity for this managed instance ' + 'for use with key management services like Azure KeyVault.') with self.argument_context('sql mi update') as c: # Create args that will be used to build up the ManagedInstance object @@ -1337,13 +1452,17 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('administrator_login_password', options_list=['--admin-password', '-p']) - c.argument('assign_identity', - options_list=['--assign-identity', '-i'], - help='Generate and assign an Azure Active Directory Identity for this managed instance ' - 'for use with key management services like Azure KeyVault. ' - 'If identity is already assigned - do nothing.') - - # Create args that will be used to build up the Managed Instance's Sku object + c.argument( + 'assign_identity', + options_list=[ + '--assign-identity', + '-i'], + help='Generate and assign an Azure Active Directory Identity for this managed instance ' + 'for use with key management services like Azure KeyVault. ' + 'If identity is already assigned - do nothing.') + + # Create args that will be used to build up the Managed Instance's Sku + # object create_args_for_complex_type( c, 'sku', Sku, [ 'family', @@ -1381,7 +1500,8 @@ def _configure_security_policy_storage_params(arg_ctx): arg_type=aad_admin_sid_param_type) with self.argument_context('sql mi ad-admin create') as c: - # Create args that will be used to build up the ManagedInstanceAdministrator object + # Create args that will be used to build up the + # ManagedInstanceAdministrator object create_args_for_complex_type( c, 'properties', ManagedInstanceAdministrator, [ 'login', @@ -1389,7 +1509,8 @@ def _configure_security_policy_storage_params(arg_ctx): ]) with self.argument_context('sql mi ad-admin update') as c: - # Create args that will be used to build up the ManagedInstanceAdministrator object + # Create args that will be used to build up the + # ManagedInstanceAdministrator object create_args_for_complex_type( c, 'properties', ManagedInstanceAdministrator, [ 'login', @@ -1416,13 +1537,15 @@ def _configure_security_policy_storage_params(arg_ctx): with self.argument_context('sql midb') as c: c.argument('managed_instance_name', arg_type=managed_instance_param_type, - # Allow --ids command line argument. id_part=name is 1st name in uri + # Allow --ids command line argument. id_part=name is 1st + # name in uri id_part='name') c.argument('database_name', options_list=['--name', '-n'], help='The name of the Azure SQL Managed Database.', - # Allow --ids command line argument. id_part=child_name_1 is 2nd name in uri + # Allow --ids command line argument. id_part=child_name_1 is + # 2nd name in uri id_part='child_name_1') with self.argument_context('sql midb create') as c: @@ -1431,10 +1554,11 @@ def _configure_security_policy_storage_params(arg_ctx): 'collation', ]) - c.argument('collation', - required=False, - help='The collation of the Azure SQL Managed Database collation to use, ' - 'e.g.: SQL_Latin1_General_CP1_CI_AS or Latin1_General_100_CS_AS_SC') + c.argument( + 'collation', + required=False, + help='The collation of the Azure SQL Managed Database collation to use, ' + 'e.g.: SQL_Latin1_General_CP1_CI_AS or Latin1_General_100_CS_AS_SC') with self.argument_context('sql midb restore') as c: create_args_for_complex_type( @@ -1445,36 +1569,44 @@ def _configure_security_policy_storage_params(arg_ctx): 'restore_point_in_time' ]) - c.argument('deleted_time', - options_list=['--deleted-time'], - help='If specified, restore from a deleted database instead of from an existing database.' - ' Must match the deleted time of a deleted database on the source Managed Instance.') - - c.argument('target_managed_database_name', - options_list=['--dest-name'], - required=True, - help='Name of the managed database that will be created as the restore destination.') - - c.argument('target_managed_instance_name', - options_list=['--dest-mi'], - help='Name of the managed instance to restore managed database to. ' - 'This can be same managed instance, or another managed instance on same subscription. ' - 'When not specified it defaults to source managed instance.') - - c.argument('target_resource_group_name', - options_list=['--dest-resource-group'], - help='Name of the resource group of the managed instance to restore managed database to. ' - 'When not specified it defaults to source resource group.') + c.argument( + 'deleted_time', + options_list=['--deleted-time'], + help='If specified, restore from a deleted database instead of from an existing database.' + ' Must match the deleted time of a deleted database on the source Managed Instance.') + + c.argument( + 'target_managed_database_name', + options_list=['--dest-name'], + required=True, + help='Name of the managed database that will be created as the restore destination.') + + c.argument( + 'target_managed_instance_name', + options_list=['--dest-mi'], + help='Name of the managed instance to restore managed database to. ' + 'This can be same managed instance, or another managed instance on same subscription. ' + 'When not specified it defaults to source managed instance.') + + c.argument( + 'target_resource_group_name', + options_list=['--dest-resource-group'], + help='Name of the resource group of the managed instance to restore managed database to. ' + 'When not specified it defaults to source resource group.') restore_point_arg_group = 'Restore Point' - c.argument('restore_point_in_time', - options_list=['--time', '-t'], - arg_group=restore_point_arg_group, - required=True, - help='The point in time of the source database that will be restored to create the' - ' new database. Must be greater than or equal to the source database\'s' - ' earliestRestoreDate value. ' + time_format_help) + c.argument( + 'restore_point_in_time', + options_list=[ + '--time', + '-t'], + arg_group=restore_point_arg_group, + required=True, + help='The point in time of the source database that will be restored to create the' + ' new database. Must be greater than or equal to the source database\'s' + ' earliestRestoreDate value. ' + + time_format_help) with self.argument_context('sql midb ltr restore') as c: create_args_for_complex_type( @@ -1484,24 +1616,29 @@ def _configure_security_policy_storage_params(arg_ctx): 'target_resource_group_name' ]) - c.argument('backup_id', - help='The resource id of the long term retention backup to be restored.') - - c.argument('target_managed_database_name', - options_list=['--dest-name'], - required=True, - help='Name of the managed database that will be created as the restore destination.') - - c.argument('target_managed_instance_name', - options_list=['--dest-mi'], - help='Name of the managed instance to restore managed database to. ' - 'This can be same managed instance, or another managed instance on same subscription. ' - 'When not specified it defaults to source managed instance.') - - c.argument('target_resource_group_name', - options_list=['--dest-resource-group'], - help='Name of the resource group of the managed instance to restore managed database to. ' - 'When not specified it defaults to source resource group.') + c.argument( + 'long_term_retention_backup_resource_id', + options_list=['--backup-id'], + help='The resource id of the long term retention backup to be restored.') + + c.argument( + 'target_managed_database_name', + options_list=['--dest-name'], + required=True, + help='Name of the managed database that will be created as the restore destination.') + + c.argument( + 'target_managed_instance_name', + options_list=['--dest-mi'], + help='Name of the managed instance to restore managed database to. ' + 'This can be same managed instance, or another managed instance on same subscription. ' + 'When not specified it defaults to source managed instance.') + + c.argument( + 'target_resource_group_name', + options_list=['--dest-resource-group'], + help='Name of the resource group of the managed instance to restore managed database to. ' + 'When not specified it defaults to source resource group.') with self.argument_context('sql midb short-term-retention-policy set') as c: create_args_for_complex_type( @@ -1510,22 +1647,25 @@ def _configure_security_policy_storage_params(arg_ctx): 'retention_days' ]) - c.argument('deleted_time', - options_list=['--deleted-time'], - help='If specified, updates retention days for a deleted database, instead of an existing database.' - 'Must match the deleted time of a deleted database on the source Managed Instance.') + c.argument( + 'deleted_time', + options_list=['--deleted-time'], + help='If specified, updates retention days for a deleted database, instead of an existing database.' + 'Must match the deleted time of a deleted database on the source Managed Instance.') - c.argument('retention_days', - options_list=['--retention-days'], - required=True, - help='New backup short term retention policy in days.' - 'Valid policy for live database is 7-35 days, valid policy for dropped databases is 0-35 days.') + c.argument( + 'retention_days', + options_list=['--retention-days'], + required=True, + help='New backup short term retention policy in days.' + 'Valid policy for live database is 7-35 days, valid policy for dropped databases is 0-35 days.') with self.argument_context('sql midb short-term-retention-policy show') as c: - c.argument('deleted_time', - options_list=['--deleted-time'], - help='If specified, shows retention days for a deleted database, instead of an existing database.' - 'Must match the deleted time of a deleted database on the source Managed Instance.') + c.argument( + 'deleted_time', + options_list=['--deleted-time'], + help='If specified, shows retention days for a deleted database, instead of an existing database.' + 'Must match the deleted time of a deleted database on the source Managed Instance.') with self.argument_context('sql midb long-term-retention-policy set') as c: create_args_for_complex_type( @@ -1536,31 +1676,33 @@ def _configure_security_policy_storage_params(arg_ctx): 'week_of_year' ]) - c.argument('weekly_retention', - help='The Weekly Retention.' - 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' - 'There is a minimum of 7 days and a maximum of 10 years.') + c.argument( + 'weekly_retention', help='The Weekly Retention.' + 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') - c.argument('monthly_retention', - help='The Monthly Retention.' - 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' - 'There is a minimum of 7 days and a maximum of 10 years.') + c.argument( + 'monthly_retention', help='The Monthly Retention.' + 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') - c.argument('yearly_retention', - help='The Yearly Retention.' - 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' - 'There is a minimum of 7 days and a maximum of 10 years.') + c.argument( + 'yearly_retention', help='The Yearly Retention.' + 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') - c.argument('week_of_year', - help='The Week of Year, 1 to 52, to save for the Yearly Retention.') + c.argument( + 'week_of_year', + help='The Week of Year, 1 to 52, to save for the Yearly Retention.') with self.argument_context('sql midb long-term-retention-backup') as c: c.argument('location_name', arg_type=get_location_type(self.cli_ctx)) - c.argument('resource_group_name', - required=False, - help='If specified, the resource group that the managed instance/database resource belongs to.') + c.argument( + 'resource_group_name', + required=False, + help='If specified, the resource group that the managed instance/database resource belongs to.') ############################################### # sql virtual cluster # @@ -1569,7 +1711,8 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('virtual_cluster_name', help='The virtual cluster name', options_list=['--name', '-n'], - # Allow --ids command line argument. id_part=name is 1st name in uri + # Allow --ids command line argument. id_part=name is 1st + # name in uri id_part='name') c.argument('resource_group_name', arg_type=resource_group_name_type) @@ -1587,12 +1730,14 @@ def _configure_security_policy_storage_params(arg_ctx): arg_type=managed_instance_param_type, options_list=['--source-mi', '--mi']) - c.argument('partner_managed_instance', - help="The name of the partner managed instance of a Instance Failover Group", - options_list=['--partner-mi']) + c.argument( + 'partner_managed_instance', + help="The name of the partner managed instance of a Instance Failover Group", + options_list=['--partner-mi']) - c.argument('partner_resource_group', - help="The name of the resource group of the partner managed instance") + c.argument( + 'partner_resource_group', + help="The name of the resource group of the partner managed instance") c.argument('failover_policy', help="The failover policy of the Instance Failover Group", diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 77b47a7cec9..448fb31061e 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -276,8 +276,8 @@ def load_command_table(self, _): client_factory=get_sql_database_threat_detection_policies_operations) as g: g.show_command('show', 'get') - g.generic_update_command('update', - custom_func_name='db_threat_detection_policy_update') + g.generic_update_command( + 'update', custom_func_name='db_threat_detection_policy_update') database_usages_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#DatabaseUsagesOperations.{}', @@ -355,7 +355,8 @@ def load_command_table(self, _): g.command('show', 'get') g.command('list', 'list_by_server') g.custom_command('create', 'failover_group_create') - g.generic_update_command('update', custom_func_name='failover_group_update') + g.generic_update_command( + 'update', custom_func_name='failover_group_update') g.command('delete', 'delete') g.custom_command('set-primary', 'failover_group_failover') @@ -500,11 +501,17 @@ def load_command_table(self, _): managed_instances_operations, client_factory=get_sql_managed_instances_operations) as g: - g.custom_command('create', 'managed_instance_create', supports_no_wait=True) + g.custom_command( + 'create', + 'managed_instance_create', + supports_no_wait=True) g.command('delete', 'delete', confirmation=True, supports_no_wait=True) g.show_command('show', 'get') g.custom_command('list', 'managed_instance_list') - g.generic_update_command('update', custom_func_name='managed_instance_update', supports_no_wait=True) + g.generic_update_command( + 'update', + custom_func_name='managed_instance_update', + supports_no_wait=True) managed_instance_keys_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#ManagedInstanceKeysOperations.{}', @@ -556,7 +563,10 @@ def load_command_table(self, _): client_factory=get_sql_managed_databases_operations) as g: g.custom_command('create', 'managed_db_create', supports_no_wait=True) - g.custom_command('restore', 'managed_db_restore', supports_no_wait=True) + g.custom_command( + 'restore', + 'managed_db_restore', + supports_no_wait=True) g.show_command('show', 'get') g.command('list', 'list_by_instance') g.command('delete', 'delete', confirmation=True, supports_no_wait=True) @@ -574,7 +584,10 @@ def load_command_table(self, _): managed_backup_short_term_retention_policies_operations, client_factory=get_sql_managed_backup_short_term_retention_policies_operations) as g: - g.custom_command('set', 'update_short_term_retention_mi', supports_no_wait=True) + g.custom_command( + 'set', + 'update_short_term_retention_mi', + supports_no_wait=True) g.custom_command('show', 'get_short_term_retention_mi') managed_database_long_term_retention_policies_operations = CliCommandType( @@ -596,9 +609,15 @@ def load_command_table(self, _): managed_database_long_term_retention_backups_operations, client_factory=get_sql_managed_database_long_term_retention_backups_operations) as g: g.show_command('show', 'get') - g.custom_command('list-by-database', 'list_by_database_long_term_retention_mi_backup') - g.custom_command('list-by-instance', 'list_by_instance_long_term_retention_mi_backup') - g.custom_command('list-by-location', 'list_by_location_long_term_retention_mi_backup') + g.custom_command( + 'list-by-database', + 'list_by_database_long_term_retention_mi_backup') + g.custom_command( + 'list-by-instance', + 'list_by_instance_long_term_retention_mi_backup') + g.custom_command( + 'list-by-location', + 'list_by_location_long_term_retention_mi_backup') g.command('delete', 'delete') ############################################### @@ -627,6 +646,7 @@ def load_command_table(self, _): with self.command_group('sql instance-failover-group', instance_failover_groups_operations, client_factory=get_sql_instance_failover_groups_operations) as g: g.command('show', 'get') g.custom_command('create', 'instance_failover_group_create') - g.generic_update_command('update', custom_func_name='instance_failover_group_update') + g.generic_update_command( + 'update', custom_func_name='instance_failover_group_update') g.command('delete', 'delete') g.custom_command('set-primary', 'instance_failover_group_failover') diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index c674431a0fa..ac09819a0b8 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2631,7 +2631,7 @@ def managed_db_restore( def managed_db_restore_ltr_backup( cmd, client, - backup_id, + long_term_retention_backup_resource_id, target_managed_database_name, target_managed_instance_name, target_resource_group_name, @@ -2645,7 +2645,7 @@ def managed_db_restore_ltr_backup( resource_group_name=target_resource_group_name) kwargs['create_mode'] = CreateMode.restore_long_term_retention_backup.value - kwargs['long_term_retention_backup_resource_id'] = backup_id + kwargs['long_term_retention_backup_resource_id'] = long_term_retention_backup_resource_id return client.create_or_update( database_name=target_managed_database_name, diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml new file mode 100644 index 00000000000..73d1ede4258 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -0,0 +1,346 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.23.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.2 + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff435658b-a8c3-4460-adf2-84617caef396%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f435658b-a8c3-4460-adf2-84617caef396/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - private, max-age=86400 + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 24 Mar 2020 10:21:57 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AhPWqvAXF_5Ik978RKVWWj0; expires=Thu, 23-Apr-2020 10:21:57 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAAm-06blBE1TpVMil8KPQ41JrhX1g8paZo3CIyWCerAZfKS7FwungIAfE3KxkfabpMLdBDpICjB9p6RXa_4s8yu7Zo8orfYRPqBmLsyyjMZycwdMB3dtbmJrBQO0_WaVnzyX5LVqmz_zsqcnF2_XrifwRN06uYS4-11ELmruUz5-oHVO1l8ugu0Bo76lEyPCDcgAA; + domain=.login.windows.net; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=corp; path=/; SameSite=None; secure; HttpOnly + - stsservicecookie=estscorp; path=/; SameSite=None; secure; HttpOnly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.10244.21 - SAN ProdSlices + status: + code: 200 + message: OK +- request: + body: grant_type=client_credentials&client_id=6af90d67-c2b6-4a20-b068-fb64a342136c&resource=https%3A%2F%2Fmanagement.core.windows.net%2F&client_secret=7%5DuaW%3D%3AOQ%3Ar2lyVRB81%3A3hMB6bG-%5DM%5Dl + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '191' + User-Agent: + - python-requests/2.23.0 + content-type: + - application/x-www-form-urlencoded + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.2 + method: POST + uri: https://login.windows-ppe.net/f435658b-a8c3-4460-adf2-84617caef396/oauth2/token + response: + body: + string: '{"token_type":"Bearer","expires_in":"3599","ext_expires_in":"3599","expires_on":"1585048917","not_before":"1585045017","resource":"https://management.core.windows.net/","access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imp4eHJRenI0cTg2YkQxdnVZbGFVd0FJN2JUYyIsImtpZCI6Imp4eHJRenI0cTg2YkQxdnVZbGFVd0FJN2JUYyJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLXBwZS5uZXQvZjQzNTY1OGItYThjMy00NDYwLWFkZjItODQ2MTdjYWVmMzk2LyIsImlhdCI6MTU4NTA0NTAxNywibmJmIjoxNTg1MDQ1MDE3LCJleHAiOjE1ODUwNDg5MTcsImFpbyI6IkUySmdZRkJKemJQTnpwanN0SGh1bmVIYlMrdUZBUT09IiwiYXBwaWQiOiI2YWY5MGQ2Ny1jMmI2LTRhMjAtYjA2OC1mYjY0YTM0MjEzNmMiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLXBwZS5uZXQvZjQzNTY1OGItYThjMy00NDYwLWFkZjItODQ2MTdjYWVmMzk2LyIsIm9pZCI6ImIyYTFlYmI1LTUxM2YtNDgxZi1iYjk3LWM1ZDU2OGQxMTkzOCIsInN1YiI6ImIyYTFlYmI1LTUxM2YtNDgxZi1iYjk3LWM1ZDU2OGQxMTkzOCIsInRpZCI6ImY0MzU2NThiLWE4YzMtNDQ2MC1hZGYyLTg0NjE3Y2FlZjM5NiIsInV0aSI6IjJ4NFJ1c1JicFVXQlZFeFFpNTBNQUEiLCJ2ZXIiOiIxLjAifQ.jOfErH4pUxaqhAbIhTZbzF14y43htVMHc6Khe0mRQIMFR00fwlZiRzWOET8QdQBy1xuYcIThOFQoGbibYFJEHJTJxZC2OgwLcVcMJHDhVSiJ9BwzRh4lpLNqybKUT22FWdpqO1rU16t14NhgVwMU8KoFP5euXeWloXJJslAD37iFbfmHXAXtlzQ6DNx8s2sZIti38rhQ2kOrErL-egUWj43jdUBxN40ZfauxquXwC98_YKsX_t-aT1PHSMFy8yJgbWNDPBWVM_bXxSay30DXOrqOXs7l6ITYY1pc9agJwgv0FcvEF1ma7ol5CB8dUlYp9mXWf_QU8rfdUzPMyTcH6A"}' + headers: + cache-control: + - no-cache, no-store + content-length: + - '1365' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 24 Mar 2020 10:21:56 GMT + expires: + - '-1' + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + pragma: + - no-cache + set-cookie: + - fpc=AhwYKBMrNBJJvVjJQNbOgH8OmtngAQAAAEXWC9YOAAAA; expires=Thu, 23-Apr-2020 + 10:21:57 GMT; path=/; secure; HttpOnly; SameSite=None + - stsservicecookie=estsppe; path=/; SameSite=None; secure; HttpOnly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-clitelem: + - 1,0,0,, + x-ms-ests-server: + - 2.1.10333.0 - CHY PPE + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network route-table create + Connection: + - keep-alive + ParameterSetName: + - -g -n + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-resource/8.0.1 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2019-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001","name":"clitest000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-03-24T10:21:53Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '312' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 24 Mar 2020 10:21:57 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.23.0 + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.2 + method: GET + uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff435658b-a8c3-4460-adf2-84617caef396%2Foauth2%2Fauthorize&api-version=1.0 + response: + body: + string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f435658b-a8c3-4460-adf2-84617caef396/.well-known/openid-configuration"}' + headers: + access-control-allow-methods: + - GET, OPTIONS + access-control-allow-origin: + - '*' + cache-control: + - private, max-age=86400 + content-length: + - '131' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 24 Mar 2020 10:21:58 GMT + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + set-cookie: + - fpc=AvpuLZ7Y0eFGmjLQ-oq8w_A; expires=Thu, 23-Apr-2020 10:21:58 GMT; path=/; + secure; HttpOnly; SameSite=None + - esctx=AQABAAAAAAAm-06blBE1TpVMil8KPQ41T7rSIfcNetfGrFUsuaetP_9gulQkFSXXtg4-fwQtlQFDV5SgGEetr5zR1amSJU-48w34ISwNeueDLSB2G-vBizk6tQ_TMQpqxATcOyNOjOkkcxBh5usq3i_XtCcz4k1UkBlr3z8h647rQNZ-wiBzVqiMUvgiopIjzOOazv_d9ssgAA; + domain=.login.windows.net; path=/; secure; HttpOnly; SameSite=None + - x-ms-gateway-slice=corp; path=/; SameSite=None; secure; HttpOnly + - stsservicecookie=estscorp; path=/; SameSite=None; secure; HttpOnly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ests-server: + - 2.1.10244.21 - SAN ProdSlices + status: + code: 200 + message: OK +- request: + body: grant_type=client_credentials&client_id=6af90d67-c2b6-4a20-b068-fb64a342136c&resource=https%3A%2F%2Fmanagement.core.windows.net%2F&client_secret=7%5DuaW%3D%3AOQ%3Ar2lyVRB81%3A3hMB6bG-%5DM%5Dl + headers: + Accept: + - '*/*' + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '191' + User-Agent: + - python-requests/2.23.0 + content-type: + - application/x-www-form-urlencoded + return-client-request-id: + - 'true' + x-client-CPU: + - x64 + x-client-OS: + - win32 + x-client-SKU: + - Python + x-client-Ver: + - 1.2.2 + method: POST + uri: https://login.windows-ppe.net/f435658b-a8c3-4460-adf2-84617caef396/oauth2/token + response: + body: + string: '{"token_type":"Bearer","expires_in":"3599","ext_expires_in":"3599","expires_on":"1585048918","not_before":"1585045018","resource":"https://management.core.windows.net/","access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imp4eHJRenI0cTg2YkQxdnVZbGFVd0FJN2JUYyIsImtpZCI6Imp4eHJRenI0cTg2YkQxdnVZbGFVd0FJN2JUYyJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLXBwZS5uZXQvZjQzNTY1OGItYThjMy00NDYwLWFkZjItODQ2MTdjYWVmMzk2LyIsImlhdCI6MTU4NTA0NTAxOCwibmJmIjoxNTg1MDQ1MDE4LCJleHAiOjE1ODUwNDg5MTgsImFpbyI6IkUySmdZQ2lVTCtIUVBYUTBhUVhYMWNrYnF1WXVBUUE9IiwiYXBwaWQiOiI2YWY5MGQ2Ny1jMmI2LTRhMjAtYjA2OC1mYjY0YTM0MjEzNmMiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLXBwZS5uZXQvZjQzNTY1OGItYThjMy00NDYwLWFkZjItODQ2MTdjYWVmMzk2LyIsIm9pZCI6ImIyYTFlYmI1LTUxM2YtNDgxZi1iYjk3LWM1ZDU2OGQxMTkzOCIsInN1YiI6ImIyYTFlYmI1LTUxM2YtNDgxZi1iYjk3LWM1ZDU2OGQxMTkzOCIsInRpZCI6ImY0MzU2NThiLWE4YzMtNDQ2MC1hZGYyLTg0NjE3Y2FlZjM5NiIsInV0aSI6ImJ1dUlPeXhncmsyM0t0b2JONnNNQUEiLCJ2ZXIiOiIxLjAifQ.EN5peMECtla0WDh7bk5W5sQaZMOCyd-xmJiF1My68pennlbhCnttKhM9Tk1Pnn8JhqUaPYTmpJ-LWO40CugLKnp49-PWROh7c4_mWcS7T1X0rSxWxsGS7eXJVjJsqz053Au29mhzXMCCgeHTGcDL8ZT2qZzwOO4_cQCMHc9x0bB22zr2xc1VVkhcrFH8tp2uyiJuD4Qreyd7WNti3WFLG_Zc1g1H00XOR_gEmxEM3h-5T-hS054HUajBqPF6mAo4k8Yj2OMVvjZAdCC_qQfqF3Civ1znMlc0khS6EbG5dZSLL2WlBzpGL6K9Ch7yZGROcAJAQV33RIl5nmfpLn_P2g"}' + headers: + cache-control: + - no-cache, no-store + content-length: + - '1365' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 24 Mar 2020 10:21:58 GMT + expires: + - '-1' + p3p: + - CP="DSP CUR OTPi IND OTRi ONL FIN" + pragma: + - no-cache + set-cookie: + - fpc=AjVrL0tJfixPtWMDW4-X7NwOmtngAQAAAEbWC9YOAAAA; expires=Thu, 23-Apr-2020 + 10:21:59 GMT; path=/; secure; HttpOnly; SameSite=None + - stsservicecookie=estsppe; path=/; SameSite=None; secure; HttpOnly + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-clitelem: + - 1,0,0,, + x-ms-ests-server: + - 2.1.10333.0 - CHY PPE + status: + code: 200 + message: OK +- request: + body: '{"location": "westus"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - network route-table create + Connection: + - keep-alive + Content-Length: + - '22' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g -n + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-network/9.0.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: PUT + uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/routeTables/vcCliTestRouteTable?api-version=2019-11-01 + response: + body: + string: '{"error":{"code":"NoRegisteredProviderFound","message":"No registered + resource provider found for location ''westus'' and API version ''2019-11-01'' + for type ''routeTables''. The supported api-versions are ''2014-12-01-preview, + 2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-06-01, 2016-07-01, 2016-08-01, + 2016-09-01, 2016-10-01, 2016-11-01, 2016-12-01, 2017-03-01, 2017-04-01, 2017-06-01, + 2017-08-01, 2017-09-01, 2017-10-01, 2017-11-01, 2018-01-01, 2018-02-01, 2018-03-01, + 2018-04-01, 2018-05-01, 2018-06-01, 2018-07-01, 2018-08-01, 2018-10-01, 2018-11-01, + 2018-12-01, 2019-02-01''. The supported locations are ''westeurope, centralus, + westus, eastus, northcentralus, southcentralus, eastus2, northeurope''."}}' + headers: + cache-control: + - no-cache + content-length: + - '703' + content-type: + - application/json; charset=utf-8 + date: + - Tue, 24 Mar 2020 10:21:59 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-failure-cause: + - gateway + status: + code: 400 + message: Bad Request +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index fe5f54264e1..09121324318 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3196,12 +3196,19 @@ def test_sql_managed_db_short_retention(self, resource_group, resource_group_loc class SqlManagedInstanceDbLongTermRetentionScenarioTest(ScenarioTest): @ResourceGroupPreparer(random_name_length=17, name_prefix='clitest') - def test_sql_managed_db_long_term_retention(self, resource_group, resource_group_location): + @record_only() + def test_sql_managed_db_long_term_retention( + self, resource_group, resource_group_location): resource_prefix = 'MIDBLongTermRetention' self.kwargs.update({ 'loc': resource_group_location, + 'vnet_name': 'vcCliTestVnet', + 'subnet_name': 'vcCliTestSubnet', + 'route_table_name': 'vcCliTestRouteTable', + 'route_name_internet': 'vcCliTestRouteInternet', + 'route_name_vnetlocal': 'vcCliTestRouteVnetLoc', 'managed_instance_name': self.create_random_name(managed_instance_name_prefix, managed_instance_name_max_length), 'database_name': self.create_random_name(resource_prefix, 50), 'vault_name': self.create_random_name(resource_prefix, 50), @@ -3214,12 +3221,29 @@ def test_sql_managed_db_long_term_retention(self, resource_group, resource_group 'family': 'Gen5', 'collation': "Serbian_Cyrillic_100_CS_AS", 'proxy_override': "Proxy", - 'weekly_retention': "P1W", - 'monthly_retention': "P1M", - 'yearly_retention': "P1Y", + 'weekly_retention': 'P1W', + 'monthly_retention': 'P1M', + 'yearly_retention': 'P2M', 'week_of_year': 12 }) + # Create and prepare VNet and subnet for new virtual cluster + self.cmd('network route-table create -g {rg} -n {route_table_name}') + self.cmd( + 'network route-table route create -g {rg} --route-table-name {route_table_name} -n {route_name_internet} --next-hop-type Internet --address-prefix 0.0.0.0/0') + self.cmd( + 'network route-table route create -g {rg} --route-table-name {route_table_name} -n {route_name_vnetlocal} --next-hop-type VnetLocal --address-prefix 10.0.0.0/24') + self.cmd( + 'network vnet create -g {rg} -n {vnet_name} --location {loc} --address-prefix 10.0.0.0/16') + self.cmd( + 'network vnet subnet create -g {rg} --vnet-name {vnet_name} -n {subnet_name} --address-prefix 10.0.0.0/24 --route-table {route_table_name}') + subnet = self.cmd( + 'network vnet subnet show -g {rg} --vnet-name {vnet_name} -n {subnet_name}').get_output_in_json() + + self.kwargs.update({ + 'subnet_id': subnet['id'] + }) + # create sql managed_instance self.cmd('sql mi create -g {rg} -n {managed_instance_name} -l {loc} ' '-u {admin_login} -p {admin_password} --subnet {subnet_id} --license-type {license_type} ' @@ -3249,20 +3273,118 @@ def test_sql_managed_db_long_term_retention(self, resource_group, resource_group self.check('status', 'Online')]) # test update long term retention on live database - self.cmd('sql midb long-term-retention-policy set -g {rg} --mi {managed_instance_name} -n {database_name} --weekly_retention {weekly_retention} --monthly_retention {monthly_retention} --yearly_retention {yearly_retention} --week_of_year {week_of_year}', - checks=[ - self.check('resourceGroup', '{rg}'), - self.check('weeklyRetention', '{weekly_retention}'), - self.check('monthlyRetention', '{monthly_retention}'), - self.check('yearlyRetention', '{yearly_retention}')]) + print( + 'sql midb long-term-retention-policy set -g {rg} --mi {managed_instance_name} -n {database_name} --weekly-retention {weekly_retention} --monthly-retention {monthly_retention} --yearly-retention {yearly_retention} --week-of-year {week_of_year}') + self.cmd( + 'sql midb long-term-retention-policy set -g {rg} --mi {managed_instance_name} -n {database_name} --weekly-retention {weekly_retention} --monthly-retention {monthly_retention} --yearly-retention {yearly_retention} --week-of-year {week_of_year}', + checks=[ + self.check( + 'resourceGroup', + '{rg}'), + self.check( + 'weeklyRetention', + '{weekly_retention}'), + self.check( + 'monthlyRetention', + '{monthly_retention}'), + self.check( + 'yearlyRetention', + '{yearly_retention}')]) + + # test get long term retention policy on live database + self.cmd( + 'sql midb long-term-retention-policy show -g {rg} --mi {managed_instance_name} -n {database_name}', + checks=[ + self.check('resourceGroup', '{rg}'), + self.check('weeklyRetention', '{weekly_retention}'), + self.check('monthlyRetention', '{monthly_retention}'), + self.check('yearlyRetention', '{yearly_retention}')]) + + # Wait for first backup before dropping + _wait_until_first_backup_midb(self) + + # test list long term retention backups for location + # with resource group + self.cmd( + 'sql midb long-term-retention-backup list-by-location -l {loc} -g {rg}', + checks=[ + self.check('resourceGroup', '{rg}'), + self.check('location', '{loc}')]) + # without resource group + self.cmd( + 'sql midb long-term-retention-backup list-by-location -l {loc}', + checks=[ + self.check('location', '{loc}')]) + + # test list long term retention backups for instance + # with resource group + self.cmd( + 'sql midb long-term-retention-backup list-by-instance -l {loc} --mi {managed_instance_name} -g {rg}', + checks=[ + self.check('resourceGroup', '{rg}'), + self.check('location', '{loc}'), + self.check('managedInstance', '{managed_instance_name}')]) + + # without resource group + self.cmd( + 'sql midb long-term-retention-backup list-by-instance -l {loc} --mi {managed_instance_name}', + checks=[ + self.check('location', '{loc}'), + self.check('managedInstance', '{managed_instance_name}')]) + + # test list long term retention backups for database + # with resource group + self.cmd( + 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} -g {rg}', + checks=[ + self.check('resourceGroup', '{rg}'), + self.check('location', '{loc}'), + self.check('managedInstance', '{managed_instance_name}'), + self.check('database', '{database_name}')]) + + # without resource group + self.cmd( + 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}', + checks=[ + self.check('location', '{loc}'), + self.check('managedInstance', '{managed_instance_name}'), + self.check('database', '{database_name}')]) + + # test show long term retention backup + backup = self.cmd( + 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} --only-latest-per-database True').get_output_in_json() + + self.kwargs.update({ + 'backup_name': backup['name'], + 'backup_id': backup['id'] + }) + + self.cmd( + 'sql midb long-term-retention-backup show -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name {backup_name}', + checks=[ + self.check('resourceGroup', '{rg}'), + self.check('location', '{loc}'), + self.check('managedInstance', '{managed_instance_name}'), + self.check('database', '{database_name}')]) - # test get long term retention on live database - self.cmd('sql midb long-term-retention-policy show -g {rg} --mi {managed_instance_name} -n {database_name}', + # test restore managed database from LTR backup + self.kwargs.update({ + 'dest_database_name': '{database_name}_dest' + }) + + self.cmd( + 'sql midb ltr restore --backup-id {backup_id} --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}', + checks=[ + self.check('resourceGroup', '{rg}'), + self.check('managedInstance', '{managed_instance_name}'), + self.check('database', '{database_name}')]) + + # test delete long term retention backup + self.cmd( + 'sql midb long-term-retention-backup delete -l {loc} -g {rg} --mi {managed_database_name} -n {database_name} --backup-name {backup_name}') + self.cmd('sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}', checks=[ - self.check('resourceGroup', '{rg}'), - self.check('weeklyRetention', '{weekly_retention}'), - self.check('monthlyRetention', '{monthly_retention}'), - self.check('yearlyRetention', '{yearly_retention}')]) + self.check(self, None)]) class SqlManagedInstanceRestoreDeletedDbScenarioTest(ScenarioTest): From 756738c88a5c78964da8cb3d4cd339037ae7142c Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Tue, 24 Mar 2020 03:46:58 -0700 Subject: [PATCH 09/54] removing unrelated files --- testcert.cer | 19 ------------------- testkey.pvk | 28 ---------------------------- 2 files changed, 47 deletions(-) delete mode 100644 testcert.cer delete mode 100644 testkey.pvk diff --git a/testcert.cer b/testcert.cer deleted file mode 100644 index fea63f5ff68..00000000000 --- a/testcert.cer +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDCTCCAfGgAwIBAgIIc89yLAC8SxswDQYJKoZIhvcNAQELBQAwGTEXMBUGA1UE -AwwOVEVTVENFUlQwMDAwMDEwHhcNMjAwMzIwMTkyNjEzWhcNMjAwMzI0MTkyNjEz -WjAZMRcwFQYDVQQDDA5URVNUQ0VSVDAwMDAwMTCCASEwDQYJKoZIhvcNAQEBBQAD -ggEOADCCAQkCggEALufCJsUfTD5X31Z2ONDNmK+QIbTzz/Z77ad59CYD1pLAXSWv -LLy3kNuP5/Zq8Sm51rEzKKrKUIymd06ZcBmA96ef9fQrEj4vYbcKkGTzvEaR22vg -KmFkfL0Wn8Xf3psCwnji4qlYf6NFhUgEL3RwNySbFqk5hgRN13TaM9188sQPydif -0GYJN/o5uUPc+3LVrzsiffHsT6Z1GE9SMctf2Yo2bcPePoBowUkIiYNyySm86TO5 -OnGS2ht5K+AeCUhGPgSOoesnhZZlhxR2hBaLVnDDvT3Wu7j19fgWClQZqRgwa98o -5fKrlMbjMuhaYZMVIrvIk+HUjiCHlI0ALelipwIDAQABo1YwVDASBgNVHRMBAf8E -CDAGAQH/AgEBMB0GA1UdDgQWBBTaOaPuXmtLDTJVv++VYBiQr9gHCTAfBgNVHSME -GDAWgBTaOaPuXmtLDTJVv++VYBiQr9gHCTANBgkqhkiG9w0BAQsFAAOCAQEAJiko -3F3aYX5FgrySRnVhT8cILsO4yxQ0kS2sMywsgwZwTLLrvr9KP3I7lYJaM1fUNWmX -6PrMVT7yDFy6a7aNz/qe1dKZNiB5oE5bNkdz5yFTdcVTMW2GzV4TW3obLPgyzQ8P -vL3bK787V5SCgZq0CNm4owxxdZ7WqAqDKv6gOQhxM26n8hC+vlBrmdP0FRevMY/S -sEeoNwhqD84xk1+mQC+QdGB+mXiwTQ+2/qSGtNPb+5ncbExH2yEbHShXuAOEislB -3AGOZEmlilOKCu+mMFXSxHu9mDySp6rRfmWa2OsudGDO5lX5KMQk5FH+BpYNWq7S -TavnavFwOnxCAiGQ0w== ------END CERTIFICATE----- diff --git a/testkey.pvk b/testkey.pvk deleted file mode 100644 index 15876aa245b..00000000000 --- a/testkey.pvk +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEuQIBADANBgkqhkiG9w0BAQEFAASCBKMwggSfAgEAAoIBAC7nwibFH0w+V99W -djjQzZivkCG088/2e+2nefQmA9aSwF0lryy8t5Dbj+f2avEpudaxMyiqylCMpndO -mXAZgPenn/X0KxI+L2G3CpBk87xGkdtr4CphZHy9Fp/F396bAsJ44uKpWH+jRYVI -BC90cDckmxapOYYETdd02jPdfPLED8nYn9BmCTf6OblD3Pty1a87In3x7E+mdRhP -UjHLX9mKNm3D3j6AaMFJCImDcskpvOkzuTpxktobeSvgHglIRj4EjqHrJ4WWZYcU -doQWi1Zww7091ru49fX4FgpUGakYMGvfKOXyq5TG4zLoWmGTFSK7yJPh1I4gh5SN -AC3pYqcCAwEAAQKCAQApGgTTnGB0mxy9JDKsTqwaY51VLA+J6F9oPR1sh/NND4Np -HCCIf0YLtZpAlXnYocurCdPeiuqF8vncChACXxbX7RcKm08yyTMT2SV0qkG6dcxS -DhF8kaNQexFcKDSoCAU/DFckb2iRUC0XQagJPWsnpvgPv3IcsaDUcBzU3f0jbVKr -xyNzUlwZ4hWTO5AC9Y+9XjvnbWF7QuepraN765gBmSZUTe+nJ0Q+VvXgdTCeO+cC -lO7VEi4yj2aM5ZSltW9pATVxWJr0yTiKIquSn2uZPNql7qfpb0bGWVwNZ+CygErP -NdXfJrjloWI9J8bDJYt9oJY+/35lGFrxBpFGFN0BAoGAbkYoDvNV5OwQWzwn+0ex -78P3R3ZGskqiZkc+UZIUgdaJj0vfF3H6ATYDjwDDYwpTZ3xZ/MNZweS/UCCjRpfZ -kq4y1B8NiPK4J1txVj9m89YnL34lUsApFps1t4v+9v9iUoOL3TlRRWSB6mgpOMXg -pI5l3HAeo7ZI4jId6KlznAcCgYBs4+FInnxlgOXJx/DOJeslRwPD5U2AsuuLhjS7 -Ck/yZ7T/A9jiKikY8A5N+b/lb1yvVgJd5frKZLCV1GOLvFle2oK56VBKFYh4P7x9 -8l1Tz8aumytaz3gxI2AglvUfsT+fm69MggweHS4YYJJbopik8+1qVOoy6K4wUVPI -RgGcYQKBgDmZe6MTh3IjvAdrzJZ8RH0wpyE0rojCY0F5RRvmab/IB+JJhyX/6s5n -IES56VT6N8Z+NaLJh0C38xYvdhmRh5wOUY5rCe7WmUo1gWXDiEslOSKdiXFH3i5o -tA5DmdH6Y6kl/RB4t/K/JP0Dm0SEV2qc1qfmCJsKw9cixmyY1kJRAoGAAuk0pJRY -Dv6bJgHKVjh9SMnVN+9xWvdthJVZ44YrDPfoxsh7i9BEuP3x4/PBRYjsmWNbPNdh -FPgMIHVFE/89BGQjCoVKODDLLSvHBjbsd8keLpzHU+4n8GhZsYVXmDlM0h9/WDRB -zqxJBy3Nu9Vk70P2HNmYSTQfM/t4meoFMQECgYBMpfyrWNEc35ZW/fUb4xNV8wFr -UliF2sQv3rprhMUmCSxdJyG0TfpRrfDfVqW3tyWvZE0LoGyAi6YJU2fIuXq3/8+X -7xi1bCXL483daXeUTVgp72CAaF7SkbxhWWhzAbhhJKlP2tuhC+1E8L7HEsBh+yHo -9mejZwoGfnMpTbd7nQ== ------END PRIVATE KEY----- From 59e19c4eb22e4908d4e80785a41902a88c90339d Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Tue, 24 Mar 2020 17:06:01 -0700 Subject: [PATCH 10/54] added help, some fixes to parameters --- .../azure/cli/command_modules/sql/_help.py | 78 +++++++++++++++++++ .../azure/cli/command_modules/sql/_params.py | 52 ++++++++----- 2 files changed, 111 insertions(+), 19 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index eb401a59c59..e90aaaefe36 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -621,6 +621,14 @@ text: az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --dest-mi targetmi --dest-resource-group targetrg """ +helps['sql midb ltr restore'] = """ +type: command +short-summary: Restore a managed database from a long term retentionb backup. +examples: + - name: Restore a managed database using a LTR backup. + text: az sql midb ltr restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" +""" + helps['sql midb show'] = """ type: command short-summary: Get the details for a managed database. @@ -654,6 +662,76 @@ text: az sql midb short-term-retention-policy show -g mygroup --mi myinstance -n mymanageddb --deleted-time "2018-05-20T05:34:22" """ +helps['sql midb long-term-retention-policy'] = """ +type: group +short-summary: SQL Managed Instance database long term retention policy. +""" + +helps['sql midb long-term-retention-policy set'] = """ +type: command +short-summary: Update long term retention settings for a managed database. +examples: + - name: Set long term retention for a managed database. + text: az sql midb long-term-retention-policy set -g mygroup --mi myinstance -n mymanageddb --weekly-retention "P1W" --monthly-retntion "P6M" --yearly-retention "P1Y" --week-of-year 26 +""" + +helps['sql midb long-term-retention-policy show'] = """ +type: command +short-summary: Show the long term retention policy for a managed database. +examples: + - name: Show long term retention policy for a managed database. + text: az sql midb long-term-retention-policy show -g mygroup --mi myinstance -n mymanageddb +""" + +helps['sql midb long-term-retention-backup'] = """ +type: group +short-summary: SQL Managed Instance database long term retention backups. +""" + +helps['sql midb long-term-retention-backup show'] = """ +type: command +short-summary: Get a long term retention backup for a managed database. +examples: + - name: Show long term retention backup for a managed database. + text: az sql midb long-term-retention-backup show -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" +""" + +helps['sql midb long-term-retention-backup list-by-database'] = """ +type: command +short-summary: Get all long term retention backups for a managed database. +examples: + - name: List long term retention backups for a managed database. + text: az sql midb long-term-retention-backup list-by-database -l southeastasia --mi myinstance -n mymanageddb --database-state Deleted +""" + +helps['sql midb long-term-retention-backup list-by-instance'] = """ +type: command +short-summary: Get all long term retention backups for a managed instance. +examples: + - name: List long term retention backups for a managed instance. + text: az sql midb long-term-retention-backup list-by-instance -l southeastasia --mi myinstance --database-state Live --only-latest-per-database True + - name: List long term retention backups for a managed instance (with resource group argument). + text: az sql midb long-term-retention-backup list-by-instance -l southeastasia -g mygroup --mi myinstance +""" + +helps['sql midb long-term-retention-backup list-by-location'] = """ +type: command +short-summary: Get all long term retention backups for location. +examples: + - name: List long term retention backups for a location. + text: az sql midb long-term-retention-backup list-by-location -l southeastasia --database-state Live --only-latest-per-database True + - name: List long term retention backups for a location (with resource group argument). + text: az sql midb long-term-retention-backup list-by-instance -l southeastasia -g mygroup +""" + +helps['sql midb long-term-retention-backup delete'] = """ +type: command +short-summary: Delete a long term retention backup. +examples: + - name: Delete long term retention backup for a managed database. + text: az sql midb long-term-retention-backup delete -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" +""" + helps['sql server'] = """ type: group short-summary: Manage SQL servers. diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 21bea5dd860..b9389d23add 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1676,33 +1676,47 @@ def _configure_security_policy_storage_params(arg_ctx): 'week_of_year' ]) - c.argument( - 'weekly_retention', help='The Weekly Retention.' - 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' - 'There is a minimum of 7 days and a maximum of 10 years.') + c.argument('weekly_retention', + help='The Weekly Retention.' + 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') - c.argument( - 'monthly_retention', help='The Monthly Retention.' - 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' - 'There is a minimum of 7 days and a maximum of 10 years.') + c.argument('monthly_retention', + help='The Monthly Retention.' + 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') - c.argument( - 'yearly_retention', help='The Yearly Retention.' - 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' - 'There is a minimum of 7 days and a maximum of 10 years.') + c.argument('yearly_retention', + help='The Yearly Retention.' + 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' + 'There is a minimum of 7 days and a maximum of 10 years.') - c.argument( - 'week_of_year', - help='The Week of Year, 1 to 52, to save for the Yearly Retention.') + c.argument('week_of_year', + help='The Week of Year, 1 to 52, to save for the Yearly Retention.') with self.argument_context('sql midb long-term-retention-backup') as c: c.argument('location_name', + required=True, arg_type=get_location_type(self.cli_ctx)) - c.argument( - 'resource_group_name', - required=False, - help='If specified, the resource group that the managed instance/database resource belongs to.') + c.argument('resource_group_name', + required=False, + help='If specified, the resource group that the managed instance/database resource belongs to.') + + with self.argument_context('sql midb long-term-retention-backup show') as c: + c.argument('backup_name', + options_list=['--backup-name', '-b'], + required=True, + help='The long term retention backup name.') + + with self.argument_context('sql midb long-term-retention-backup list-by-database') as c: + c.argument('database_state', + required=False, + help='\'All\', \'Live\', or \'Deleted\'') + + c.argument('only_latest_per_database', + required=False, + help='If true, will only return the latest backup for each database') ############################################### # sql virtual cluster # From 9f9aee5c9ea7209856b1dd47b98aa316598b186d Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Wed, 25 Mar 2020 01:18:38 -0700 Subject: [PATCH 11/54] edit test cases --- .../sql/tests/latest/test_sql_commands.py | 92 +++++++------------ 1 file changed, 31 insertions(+), 61 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 09121324318..5492c636f10 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3195,11 +3195,13 @@ def test_sql_managed_db_short_retention(self, resource_group, resource_group_loc class SqlManagedInstanceDbLongTermRetentionScenarioTest(ScenarioTest): + @ResourceGroupPreparer(random_name_length=17, name_prefix='clitest') - @record_only() def test_sql_managed_db_long_term_retention( self, resource_group, resource_group_location): + print("FUNCTION") + resource_prefix = 'MIDBLongTermRetention' self.kwargs.update({ @@ -3229,16 +3231,11 @@ def test_sql_managed_db_long_term_retention( # Create and prepare VNet and subnet for new virtual cluster self.cmd('network route-table create -g {rg} -n {route_table_name}') - self.cmd( - 'network route-table route create -g {rg} --route-table-name {route_table_name} -n {route_name_internet} --next-hop-type Internet --address-prefix 0.0.0.0/0') - self.cmd( - 'network route-table route create -g {rg} --route-table-name {route_table_name} -n {route_name_vnetlocal} --next-hop-type VnetLocal --address-prefix 10.0.0.0/24') - self.cmd( - 'network vnet create -g {rg} -n {vnet_name} --location {loc} --address-prefix 10.0.0.0/16') - self.cmd( - 'network vnet subnet create -g {rg} --vnet-name {vnet_name} -n {subnet_name} --address-prefix 10.0.0.0/24 --route-table {route_table_name}') - subnet = self.cmd( - 'network vnet subnet show -g {rg} --vnet-name {vnet_name} -n {subnet_name}').get_output_in_json() + self.cmd('network route-table route create -g {rg} --route-table-name {route_table_name} -n {route_name_internet} --next-hop-type Internet --address-prefix 0.0.0.0/0') + self.cmd('network route-table route create -g {rg} --route-table-name {route_table_name} -n {route_name_vnetlocal} --next-hop-type VnetLocal --address-prefix 10.0.0.0/24') + self.cmd('network vnet create -g {rg} -n {vnet_name} --location {loc} --address-prefix 10.0.0.0/16') + self.cmd('network vnet subnet create -g {rg} --vnet-name {vnet_name} -n {subnet_name} --address-prefix 10.0.0.0/24 --route-table {route_table_name}') + subnet = self.cmd('network vnet subnet show -g {rg} --vnet-name {vnet_name} -n {subnet_name}').get_output_in_json() self.kwargs.update({ 'subnet_id': subnet['id'] @@ -3273,23 +3270,13 @@ def test_sql_managed_db_long_term_retention( self.check('status', 'Online')]) # test update long term retention on live database - print( - 'sql midb long-term-retention-policy set -g {rg} --mi {managed_instance_name} -n {database_name} --weekly-retention {weekly_retention} --monthly-retention {monthly_retention} --yearly-retention {yearly_retention} --week-of-year {week_of_year}') self.cmd( 'sql midb long-term-retention-policy set -g {rg} --mi {managed_instance_name} -n {database_name} --weekly-retention {weekly_retention} --monthly-retention {monthly_retention} --yearly-retention {yearly_retention} --week-of-year {week_of_year}', checks=[ - self.check( - 'resourceGroup', - '{rg}'), - self.check( - 'weeklyRetention', - '{weekly_retention}'), - self.check( - 'monthlyRetention', - '{monthly_retention}'), - self.check( - 'yearlyRetention', - '{yearly_retention}')]) + self.check('resourceGroup', '{rg}'), + self.check('weeklyRetention', '{weekly_retention}'), + self.check('monthlyRetention', '{monthly_retention}'), + self.check('yearlyRetention', '{yearly_retention}')]) # test get long term retention policy on live database self.cmd( @@ -3306,51 +3293,32 @@ def test_sql_managed_db_long_term_retention( # test list long term retention backups for location # with resource group self.cmd( - 'sql midb long-term-retention-backup list-by-location -l {loc} -g {rg}', - checks=[ - self.check('resourceGroup', '{rg}'), - self.check('location', '{loc}')]) + 'sql midb long-term-retention-backup list-by-location -l {loc} -g {rg}') # without resource group self.cmd( - 'sql midb long-term-retention-backup list-by-location -l {loc}', - checks=[ - self.check('location', '{loc}')]) + 'sql midb long-term-retention-backup list-by-location -l {loc}') # test list long term retention backups for instance + # should assert 1 result # with resource group self.cmd( - 'sql midb long-term-retention-backup list-by-instance -l {loc} --mi {managed_instance_name} -g {rg}', - checks=[ - self.check('resourceGroup', '{rg}'), - self.check('location', '{loc}'), - self.check('managedInstance', '{managed_instance_name}')]) + 'sql midb long-term-retention-backup list-by-instance -l {loc} --mi {managed_instance_name} -g {rg}') # without resource group self.cmd( - 'sql midb long-term-retention-backup list-by-instance -l {loc} --mi {managed_instance_name}', - checks=[ - self.check('location', '{loc}'), - self.check('managedInstance', '{managed_instance_name}')]) + 'sql midb long-term-retention-backup list-by-instance -l {loc} --mi {managed_instance_name}') # test list long term retention backups for database + # should assert 1 result # with resource group self.cmd( - 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} -g {rg}', - checks=[ - self.check('resourceGroup', '{rg}'), - self.check('location', '{loc}'), - self.check('managedInstance', '{managed_instance_name}'), - self.check('database', '{database_name}')]) + 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} -g {rg}') # without resource group self.cmd( - 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}', - checks=[ - self.check('location', '{loc}'), - self.check('managedInstance', '{managed_instance_name}'), - self.check('database', '{database_name}')]) + 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}') - # test show long term retention backup + # setup for test show long term retention backup backup = self.cmd( 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} --only-latest-per-database True').get_output_in_json() @@ -3359,13 +3327,15 @@ def test_sql_managed_db_long_term_retention( 'backup_id': backup['id'] }) + # test show long term retention backup self.cmd( - 'sql midb long-term-retention-backup show -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name {backup_name}', + 'sql midb long-term-retention-backup show -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name \'{backup_name}\'', checks=[ self.check('resourceGroup', '{rg}'), self.check('location', '{loc}'), self.check('managedInstance', '{managed_instance_name}'), - self.check('database', '{database_name}')]) + self.check('database', '{database_name}'), + self.check('name', '{backup_name}')]) # test restore managed database from LTR backup self.kwargs.update({ @@ -3373,18 +3343,18 @@ def test_sql_managed_db_long_term_retention( }) self.cmd( - 'sql midb ltr restore --backup-id {backup_id} --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}', + 'sql midb ltr restore --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}', checks=[ self.check('resourceGroup', '{rg}'), self.check('managedInstance', '{managed_instance_name}'), - self.check('database', '{database_name}')]) + self.check('name', '{dest_database_name}')]) # test delete long term retention backup self.cmd( - 'sql midb long-term-retention-backup delete -l {loc} -g {rg} --mi {managed_database_name} -n {database_name} --backup-name {backup_name}') - self.cmd('sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}', - checks=[ - self.check(self, None)]) + 'sql midb long-term-retention-backup delete -l {loc} -g {rg} --mi {managed_database_name} -n {database_name} --backup-name \'{backup_name}\'') + # assert no backpus + self.cmd( + 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}') class SqlManagedInstanceRestoreDeletedDbScenarioTest(ScenarioTest): From e3a393d30ad49e3f0b76ddb09fbe5658d097dc34 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Wed, 25 Mar 2020 02:53:56 -0700 Subject: [PATCH 12/54] removed print line --- .../cli/command_modules/sql/tests/latest/test_sql_commands.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 5492c636f10..09646aa7e39 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3195,13 +3195,10 @@ def test_sql_managed_db_short_retention(self, resource_group, resource_group_loc class SqlManagedInstanceDbLongTermRetentionScenarioTest(ScenarioTest): - @ResourceGroupPreparer(random_name_length=17, name_prefix='clitest') def test_sql_managed_db_long_term_retention( self, resource_group, resource_group_location): - print("FUNCTION") - resource_prefix = 'MIDBLongTermRetention' self.kwargs.update({ From 0ec14bbfcaac4160b7b4c2b1fad33461a8ad837e Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Wed, 25 Mar 2020 12:20:33 -0700 Subject: [PATCH 13/54] removing unneeded files; removing whitespace fixes --- azure-cli1.pyproj | 1535 ----------------- instance.txt | Bin 34064 -> 0 bytes instance_rg.txt | Bin 34064 -> 0 bytes .../azure/cli/command_modules/sql/_params.py | 757 ++++---- .../azure/cli/command_modules/sql/commands.py | 42 +- 5 files changed, 310 insertions(+), 2024 deletions(-) delete mode 100644 azure-cli1.pyproj delete mode 100644 instance.txt delete mode 100644 instance_rg.txt diff --git a/azure-cli1.pyproj b/azure-cli1.pyproj deleted file mode 100644 index f0c00e07645..00000000000 --- a/azure-cli1.pyproj +++ /dev/null @@ -1,1535 +0,0 @@ - - - - Debug - 2.0 - {7accd235-5a95-4102-b00d-154c427fc483} - - - - . - . - {888888a0-9f3d-457c-b088-3a5042f75d52} - Standard Python launcher - MSBuild|env|$(MSBuildProjectFullPath) - - - - - 10.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - env - env (Python 3.8 (64-bit)) - Scripts\python.exe - Scripts\pythonw.exe - 0.0 - X64 - PYTHONPATH - - - - \ No newline at end of file diff --git a/instance.txt b/instance.txt deleted file mode 100644 index cbdffd83f7d35e8e88f15339476291a588166e32..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34064 zcmeI5TW{k;7>4J1rTq_RZz0>956c}aLR>5tuy+WpoI_!uO+(YJK#0E%yw6NsPvX?6 z)v2v%N0DR4o{a4|J^oJP|Ni~SyfiP&XZrkoyTz|pW^OXGFu$8?voYV8KlT05Tx#Ey z))!`N-fMksR!aHCrth1sVd-cY=(}%5O4HN&jrR2P-Ph-HZFlXSuKxK&#W|1V-!s$N z`7iDDXZGHy1k5Ol7q&f9cni z&bHNeMYtbT|K|28x8_9mzA&dcI@K~(xpuT(=-*>)4b4Qk zQwLKs)3q(_*`_M@nU0)l87b{T-*e@3X|L!)=epFsmHAd{esLEk+H+<;*elM=FFMNh zN_l?Jkxx3lv8g}l`j*;%Y5()i-YvOowVdj@Uz;DzAIj-O%Z2_~v?9(ys%xeC)#gm; zWZL&p-!A=HXMS&UKQ}*UO&PBB?b_ixrCV#^>Xzm^ZMz)S_HJDMTrtNll!7{8d#(Ft zYjdx&yj2cd7rlZKAm97e^TY4rE1fm(i>_9tD%YuMvadCLj@H2aQ~OI>@6`T6zvkLE zP&(2s^}VodVyN}pd}-SW{c>je-Jyz^h5jT@jMRoz~ld_9vyc3)vH??{o{@K;kh{WxHV9VAF4l8 zw{f4vhkBIHU3yo+-TURgPqfG3V$QyD3ryUDDzR`cugCCQqbKx5t4t&RLL}g+=G0OQ zt_?Lt@l?aUsofe_&J1jtiH`R~xS7_wT$?E^&!&!XiEHlpexGY?mwn<|@njh%*9PJa zBtqUB*(bTM@*do*mwz){b8!v!6E&%C2$#71qb(nQ+mwjSg?5uOT$6S+% z)?yq~h8tQLu1@~Vux@MhcxWWAH4YUcB%@Q}9(s_NxmR7g;Tf1oa_fp(eM`25D7Un~ zhn9D+5gMZVM7Pb8Rabkaq8>6Ic7~OHO+0xI0*mKnC`ecisFG1Cv$np;o>48Hf%QSrL6GR$u><80g#b!ZWa5*(V0Z z%RuMjg7q5vIXX{A!mteN*3Q2f2JY)TlQ&E3vR}DI!^?YE^-d+1;kh)o5*@u}s0ICI zrhbIC%3Rvb(T%(}6T?>8gFY0dVaw}z@*d+Y+C21~iFH*v&$i1xu`YJjmF;`ofbt&t zntl7;vHaU%T|e3PBG+^7v#x(HAJ96!WG9wp__4q_*oO9!_6p(fwdhK3iEgti8e-qW z8`pVpats~jO6hiWn}vPPm+9C}a^0?6*S96xR@o=k#m+idgslO&&Uqz|g0c=D&3gGa z$-3&;h4NUF{5NUuvG{K~`c>C)c-ik%{m4Zt5Q#tp0I>-ZOF^v1P9Dr8#jSL_qrQhH zD6-*LWBE#-iPp;<*$;-|5rb^FOT=;;ea^PNw#z>8Fm@gi%jZbwV)^KmA!8Qsr>U2J zlRWhOT*@O$qF;RU^J_Fb>mU-eBPL;HCBB8_ne*dB&T|o)cz3RDSeIFu5A7!LWh?cD z%wrvzPvYT*$|w1?ROva}F8jo~*jWdQ@;C!*dU$1rWF3Ap_403qb$59_;Fpd@Dv|GL zdUxja8=iwmW#rDh1jI2gE5tw~b8+g7)M!J|iNZ@FAeL%pV=D`em2Ra4*{_J_Ljwv6 z$NEPeAD&Bo<@WiUWxlq{K5;N!4i^5MKBsv0497v|-&rsJ#KAOg%fshwIrf|r0|)VY zA<~^sk_W5g!SEccSN4g6@p8~Tv6gk8VQqnB-RH6Vo8jQTm&71RfKSZtW$*}oFL<+L zmP$k+Am5Fo&tw)CEPi;qIKP*r(h=P^*WRUQhBa`ZW5|3xeSDd((0wL5Ulr@xF8jo~ z*jeZ1CUbr-Lpz5{FQCkq&rMb*|7KWM*n^mj1DzGKOku-egkoMqH-7asK4G!JLmfK} z+N+V>hrNawJ@9d0hRw1zD%lC?9kF=Hgl`eycee5<$=0o1`CktR+XhYVgQm%m0*H^mEp)wq5p#wXw6-$$gH6E_N_1Yq2xtKBo7} zzZurvt$$-=I^@fq$QctkkJWE@4q_F=QaIF;7&0c$Y;$c-EeEj^LPX}7VQy?U%M8a| z90ryMq7ug*2gwmjCH9HL!77=v?XpiCjF*FjopF~_VPoi-N2Xr>iG#_`_?UJ^_nZ?0 z2O%IfM&!U0U*9YT>y>@tV7wf3c1Hib4ZJT29ZX1no4z>czmMs7{>^Z3*UnhhG9~FR zCh2dtHp4TH=s{xR-P~qwwru8zaXL?)TZpniD&b8%9UZ}=l$o;eH$|sUyWfo?Bz_Pn z5HDw6<9SFI@tk#@ZI^vwT=Os$<)G7f;scZGB=J!pswt$-)4fBYn4kN2{>^Z(@GkuAz?hOW zo-t`W{kjY<=Mg6{Qm;VHbKWaXZgZN?u9fQ0cM>;2WCe3;4J1rTq_RZz0>956c}aLR>5tuy+WpoI_!uO+(YJK#0E%yw6NsPvX?6 z)v2v%N0DR4o{a4|J^oJP|Ni~SyfiP&XZrkoyTz|pW^OXGFu$8?voYV8KlT05Tx#Ey z))!`N-fMksR!aHCrth1sVd-cY=(}%5O4HN&jrR2P-Ph-HZFlXSuKxK&#W|1V-!s$N z`7iDDXZGHy1k5Ol7q&f9cni z&bHNeMYtbT|K|28x8_9mzA&dcI@K~(xpuT(=-*>)4b4Qk zQwLKs)3q(_*`_M@nU0)l87b{T-*e@3X|L!)=epFsmHAd{esLEk+H+<;*elM=FFMNh zN_l?Jkxx3lv8g}l`j*;%Y5()i-YvOowVdj@Uz;DzAIj-O%Z2_~v?9(ys%xeC)#gm; zWZL&p-!A=HXMS&UKQ}*UO&PBB?b_ixrCV#^>Xzm^ZMz)S_HJDMTrtNll!7{8d#(Ft zYjdx&yj2cd7rlZKAm97e^TY4rE1fm(i>_9tD%YuMvadCLj@H2aQ~OI>@6`T6zvkLE zP&(2s^}VodVyN}pd}-SW{c>je-Jyz^h5jT@jMRoz~ld_9vyc3)vH??{o{@K;kh{WxHV9VAF4l8 zw{f4vhkBIHU3yo+-TURgPqfG3V$QyD3ryUDDzR`cugCCQqbKx5t4t&RLL}g+=G0OQ zt_?Lt@l?aUsofe_&J1jtiH`R~xS7_wT$?E^&!&!XiEHlpexGY?mwn<|@njh%*9PJa zBtqUB*(bTM@*do*mwz){b8!v!6E&%C2$#71qb(nQ+mwjSg?5uOT$6S+% z)?yq~h8tQLu1@~Vux@MhcxWWAH4YUcB%@Q}9(s_NxmR7g;Tf1oa_fp(eM`25D7Un~ zhn9D+5gMZVM7Pb8Rabkaq8>6Ic7~OHO+0xI0*mKnC`ecisFG1Cv$np;o>48Hf%QSrL6GR$u><80g#b!ZWa5*(V0Z z%RuMjg7q5vIXX{A!mteN*3Q2f2JY)TlQ&E3vR}DI!^?YE^-d+1;kh)o5*@u}s0ICI zrhbIC%3Rvb(T%(}6T?>8gFY0dVaw}z@*d+Y+C21~iFH*v&$i1xu`YJjmF;`ofbt&t zntl7;vHaU%T|e3PBG+^7v#x(HAJ96!WG9wp__4q_*oO9!_6p(fwdhK3iEgti8e-qW z8`pVpats~jO6hiWn}vPPm+9C}a^0?6*S96xR@o=k#m+idgslO&&Uqz|g0c=D&3gGa z$-3&;h4NUF{5NUuvG{K~`c>C)c-ik%{m4Zt5Q#tp0I>-ZOF^v1P9Dr8#jSL_qrQhH zD6-*LWBE#-iPp;<*$;-|5rb^FOT=;;ea^PNw#z>8Fm@gi%jZbwV)^KmA!8Qsr>U2J zlRWhOT*@O$qF;RU^J_Fb>mU-eBPL;HCBB8_ne*dB&T|o)cz3RDSeIFu5A7!LWh?cD z%wrvzPvYT*$|w1?ROva}F8jo~*jWdQ@;C!*dU$1rWF3Ap_403qb$59_;Fpd@Dv|GL zdUxja8=iwmW#rDh1jI2gE5tw~b8+g7)M!J|iNZ@FAeL%pV=D`em2Ra4*{_J_Ljwv6 z$NEPeAD&Bo<@WiUWxlq{K5;N!4i^5MKBsv0497v|-&rsJ#KAOg%fshwIrf|r0|)VY zA<~^sk_W5g!SEccSN4g6@p8~Tv6gk8VQqnB-RH6Vo8jQTm&71RfKSZtW$*}oFL<+L zmP$k+Am5Fo&tw)CEPi;qIKP*r(h=P^*WRUQhBa`ZW5|3xeSDd((0wL5Ulr@xF8jo~ z*jeZ1CUbr-Lpz5{FQCkq&rMb*|7KWM*n^mj1DzGKOku-egkoMqH-7asK4G!JLmfK} z+N+V>hrNawJ@9d0hRw1zD%lC?9kF=Hgl`eycee5<$=0o1`CktR+XhYVgQm%m0*H^mEp)wq5p#wXw6-$$gH6E_N_1Yq2xtKBo7} zzZurvt$$-=I^@fq$QctkkJWE@4q_F=QaIF;7&0c$Y;$c-EeEj^LPX}7VQy?U%M8a| z90ryMq7ug*2gwmjCH9HL!77=v?XpiCjF*FjopF~_VPoi-N2Xr>iG#_`_?UJ^_nZ?0 z2O%IfM&!U0U*9YT>y>@tV7wf3c1Hib4ZJT29ZX1no4z>czmMs7{>^Z3*UnhhG9~FR zCh2dtHp4TH=s{xR-P~qwwru8zaXL?)TZpniD&b8%9UZ}=l$o;eH$|sUyWfo?Bz_Pn z5HDw6<9SFI@tk#@ZI^vwT=Os$<)G7f;scZGB=J!pswt$-)4fBYn4kN2{>^Z(@GkuAz?hOW zo-t`W{kjY<=Mg6{Qm;VHbKWaXZgZN?u9fQ0cM>;2WCe3;> $file # az sql dw update -h >> $file # - # Then compare 'help_original.txt' <-> 'help_updated.txt' in your - # favourite text diff tool. + # Then compare 'help_original.txt' <-> 'help_updated.txt' in your favourite text diff tool. create_args_for_complex_type( arg_ctx, 'parameters', Database, [ 'catalog_collation', @@ -434,9 +420,8 @@ def _configure_db_dw_create_params( help='The service objective for the new database. For example: ' + (db_service_objective_examples if engine == Engine.db else dw_service_objective_examples)) - arg_ctx.argument( - 'elastic_pool_id', - help='The name or resource id of the elastic pool to create the database in.') + arg_ctx.argument('elastic_pool_id', + help='The name or resource id of the elastic pool to create the database in.') # *** Step 3: Ignore params that are not applicable (based on engine & create mode) *** @@ -446,12 +431,8 @@ def _configure_db_dw_create_params( arg_ctx.ignore('catalog_collation') # Only applicable to point in time restore or deleted restore create mode. - if create_mode not in [ - CreateMode.restore, - CreateMode.point_in_time_restore]: - arg_ctx.ignore( - 'restore_point_in_time', - 'source_database_deletion_date') + if create_mode not in [CreateMode.restore, CreateMode.point_in_time_restore]: + arg_ctx.ignore('restore_point_in_time', 'source_database_deletion_date') # 'collation', 'tier', and 'max_size_bytes' are ignored (or rejected) when creating a copy # or secondary because their values are determined by the source db. @@ -506,9 +487,8 @@ def load_arguments(self, _): c.argument('location_name', arg_type=get_location_type(self.cli_ctx)) c.argument('usage_name', options_list=['--usage', '-u']) c.argument('tags', arg_type=tags_type) - c.argument( - 'allow_data_loss', - help='If specified, the failover operation will allow data loss.') + c.argument('allow_data_loss', + help='If specified, the failover operation will allow data loss.') with self.argument_context('sql db') as c: _configure_db_dw_params(c) @@ -519,30 +499,26 @@ def load_arguments(self, _): c.argument('database_name', options_list=['--name', '-n'], help='Name of the Azure SQL Database.', - # Allow --ids command line argument. id_part=child_name_1 is - # 2nd name in uri + # Allow --ids command line argument. id_part=child_name_1 is 2nd name in uri id_part='child_name_1') # SKU-related params are different from DB versus DW, so we want this configuration to apply here # in 'sql db' group but not in 'sql dw' group. If we wanted to apply to both, we would put the # configuration into _configure_db_dw_params(). - c.argument( - 'tier', - arg_type=tier_param_type, - help='The edition component of the sku. Allowed values include: Basic, Standard, ' - 'Premium, GeneralPurpose, BusinessCritical, Hyperscale.') + c.argument('tier', + arg_type=tier_param_type, + help='The edition component of the sku. Allowed values include: Basic, Standard, ' + 'Premium, GeneralPurpose, BusinessCritical, Hyperscale.') - c.argument( - 'capacity', - arg_type=capacity_param_type, - arg_group=sku_component_arg_group, - help='The capacity component of the sku in integer number of DTUs or vcores.') + c.argument('capacity', + arg_type=capacity_param_type, + arg_group=sku_component_arg_group, + help='The capacity component of the sku in integer number of DTUs or vcores.') - c.argument( - 'family', - arg_type=family_param_type, - help='The compute generation component of the sku (for vcore skus only). ' - 'Allowed values include: Gen4, Gen5.') + c.argument('family', + arg_type=family_param_type, + help='The compute generation component of the sku (for vcore skus only). ' + 'Allowed values include: Gen4, Gen5.') with self.argument_context('sql db create') as c: _configure_db_dw_create_params(c, Engine.db, CreateMode.default) @@ -550,9 +526,8 @@ def load_arguments(self, _): with self.argument_context('sql db copy') as c: _configure_db_dw_create_params(c, Engine.db, CreateMode.copy) - c.argument( - 'dest_name', - help='Name of the database that will be created as the copy destination.') + c.argument('dest_name', + help='Name of the database that will be created as the copy destination.') c.argument('dest_resource_group_name', options_list=['--dest-resource-group'], @@ -569,34 +544,28 @@ def load_arguments(self, _): help='The new name that the database will be renamed to.') with self.argument_context('sql db restore') as c: - _configure_db_dw_create_params( - c, Engine.db, CreateMode.point_in_time_restore) + _configure_db_dw_create_params(c, Engine.db, CreateMode.point_in_time_restore) - c.argument( - 'dest_name', - help='Name of the database that will be created as the restore destination.') + c.argument('dest_name', + help='Name of the database that will be created as the restore destination.') restore_point_arg_group = 'Restore Point' - c.argument( - 'restore_point_in_time', - options_list=[ - '--time', - '-t'], - arg_group=restore_point_arg_group, - help='The point in time of the source database that will be restored to create the' - ' new database. Must be greater than or equal to the source database\'s' - ' earliestRestoreDate value. Either --time or --deleted-time (or both) must be specified. ' + - time_format_help) - - c.argument( - 'source_database_deletion_date', - options_list=['--deleted-time'], - arg_group=restore_point_arg_group, - help='If specified, restore from a deleted database instead of from an existing database.' - ' Must match the deleted time of a deleted database in the same server.' - ' Either --time or --deleted-time (or both) must be specified. ' + - time_format_help) + c.argument('restore_point_in_time', + options_list=['--time', '-t'], + arg_group=restore_point_arg_group, + help='The point in time of the source database that will be restored to create the' + ' new database. Must be greater than or equal to the source database\'s' + ' earliestRestoreDate value. Either --time or --deleted-time (or both) must be specified. ' + + time_format_help) + + c.argument('source_database_deletion_date', + options_list=['--deleted-time'], + arg_group=restore_point_arg_group, + help='If specified, restore from a deleted database instead of from an existing database.' + ' Must match the deleted time of a deleted database in the same server.' + ' Either --time or --deleted-time (or both) must be specified. ' + + time_format_help) with self.argument_context('sql db show') as c: # Service tier advisors and transparent data encryption are not included in the first batch @@ -604,20 +573,16 @@ def load_arguments(self, _): c.ignore('expand') with self.argument_context('sql db list') as c: - c.argument( - 'elastic_pool_name', - options_list=['--elastic-pool'], - help='If specified, lists only the databases in this elastic pool') + c.argument('elastic_pool_name', + options_list=['--elastic-pool'], + help='If specified, lists only the databases in this elastic pool') with self.argument_context('sql db list-editions') as c: - c.argument( - 'show_details', - options_list=[ - '--show-details', - '-d'], - help='List of additional details to include in output.', - nargs='+', - arg_type=get_enum_type(DatabaseCapabilitiesAdditionalDetails)) + c.argument('show_details', + options_list=['--show-details', '-d'], + help='List of additional details to include in output.', + nargs='+', + arg_type=get_enum_type(DatabaseCapabilitiesAdditionalDetails)) c.argument('available', arg_type=available_param_type) @@ -626,42 +591,34 @@ def load_arguments(self, _): # We could used get_enum_type here, but that will validate the inputs which means there # will be no way to query for new editions/service objectives that are made available after # this version of CLI is released. - c.argument( - 'edition', - arg_type=tier_param_type, - arg_group=search_arg_group, - help='Edition to search for. If unspecified, all editions are shown.') - - c.argument( - 'service_objective', - arg_group=search_arg_group, - help='Service objective to search for. If unspecified, all service objectives are shown.') - - c.argument( - 'dtu', - arg_group=search_arg_group, - help='Number of DTUs to search for. If unspecified, all DTU sizes are shown.') - - c.argument( - 'vcores', - arg_group=search_arg_group, - help='Number of vcores to search for. If unspecified, all vcore sizes are shown.') + c.argument('edition', + arg_type=tier_param_type, + arg_group=search_arg_group, + help='Edition to search for. If unspecified, all editions are shown.') + + c.argument('service_objective', + arg_group=search_arg_group, + help='Service objective to search for. If unspecified, all service objectives are shown.') + + c.argument('dtu', + arg_group=search_arg_group, + help='Number of DTUs to search for. If unspecified, all DTU sizes are shown.') + + c.argument('vcores', + arg_group=search_arg_group, + help='Number of vcores to search for. If unspecified, all vcore sizes are shown.') with self.argument_context('sql db update') as c: - c.argument( - 'service_objective', - arg_group=sku_arg_group, - help='The name of the new service objective. If this is a standalone db service' - ' objective and the db is currently in an elastic pool, then the db is removed from' - ' the pool.') - - c.argument( - 'elastic_pool_id', - help='The name or resource id of the elastic pool to move the database into.') + c.argument('service_objective', + arg_group=sku_arg_group, + help='The name of the new service objective. If this is a standalone db service' + ' objective and the db is currently in an elastic pool, then the db is removed from' + ' the pool.') - c.argument( - 'max_size_bytes', - help='The new maximum size of the database expressed in bytes.') + c.argument('elastic_pool_id', + help='The name or resource id of the elastic pool to move the database into.') + + c.argument('max_size_bytes', help='The new maximum size of the database expressed in bytes.') with self.argument_context('sql db export') as c: # Create args that will be used to build up the ExportRequest object @@ -689,8 +646,7 @@ def load_arguments(self, _): arg_type=get_enum_type(StorageKeyType)) with self.argument_context('sql db import') as c: - # Create args that will be used to build up the ImportExtensionRequest - # object + # Create args that will be used to build up the ImportExtensionRequest object create_args_for_complex_type(c, 'parameters', ImportExtensionRequest, [ 'administrator_login', 'administrator_login_password', @@ -752,11 +708,10 @@ def load_arguments(self, _): with self.argument_context('sql db replica create') as c: _configure_db_dw_create_params(c, Engine.db, CreateMode.secondary) - c.argument( - 'partner_resource_group_name', - options_list=['--partner-resource-group'], - help='Name of the resource group to create the new replica in.' - ' If unspecified, defaults to the origin resource group.') + c.argument('partner_resource_group_name', + options_list=['--partner-resource-group'], + help='Name of the resource group to create the new replica in.' + ' If unspecified, defaults to the origin resource group.') c.argument('partner_server_name', options_list=['--partner-server'], @@ -766,27 +721,23 @@ def load_arguments(self, _): c.argument('database_name', help='Name of the database to fail over.') - c.argument( - 'server_name', - help='Name of the server containing the secondary replica that will become' - ' the new primary. ' + - server_configure_help) + c.argument('server_name', + help='Name of the server containing the secondary replica that will become' + ' the new primary. ' + server_configure_help) - c.argument( - 'resource_group_name', - help='Name of the resource group containing the secondary replica that' - ' will become the new primary.') + c.argument('resource_group_name', + help='Name of the resource group containing the secondary replica that' + ' will become the new primary.') with self.argument_context('sql db replica delete-link') as c: c.argument('partner_server_name', options_list=['--partner-server'], help='Name of the server that the other replica is in.') - c.argument( - 'partner_resource_group_name', - options_list=['--partner-resource-group'], - help='Name of the resource group that the other replica is in. If unspecified,' - ' defaults to the first database\'s resource group.') + c.argument('partner_resource_group_name', + options_list=['--partner-resource-group'], + help='Name of the resource group that the other replica is in. If unspecified,' + ' defaults to the first database\'s resource group.') ##### # sql db audit-policy & threat-policy @@ -855,12 +806,11 @@ def _configure_security_policy_storage_params(arg_ctx): help='List of email addresses that alerts are sent to.', nargs='+') - c.argument( - 'email_account_admins', - arg_group=notification_arg_group, - options_list=['--email-account-admins'], - help='Whether the alert is sent to the account administrators.', - arg_type=get_enum_type(SecurityAlertPolicyEmailAccountAdmins)) + c.argument('email_account_admins', + arg_group=notification_arg_group, + options_list=['--email-account-admins'], + help='Whether the alert is sent to the account administrators.', + arg_type=get_enum_type(SecurityAlertPolicyEmailAccountAdmins)) # TODO: use server default @@ -892,14 +842,12 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('database_name', options_list=['--name', '-n'], help='Name of the data warehouse.', - # Allow --ids command line argument. id_part=child_name_1 is - # 2nd name in uri + # Allow --ids command line argument. id_part=child_name_1 is 2nd name in uri id_part='child_name_1') - c.argument( - 'service_objective', - help='The service objective of the data warehouse. For example: ' + - dw_service_objective_examples) + c.argument('service_objective', + help='The service objective of the data warehouse. For example: ' + + dw_service_objective_examples) c.argument('collation', help='The collation of the data warehouse.') @@ -928,8 +876,7 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('elastic_pool_name', options_list=['--name', '-n'], help='The name of the elastic pool.', - # Allow --ids command line argument. id_part=child_name_1 is - # 2nd name in uri + # Allow --ids command line argument. id_part=child_name_1 is 2nd name in uri id_part='child_name_1') # --db-dtu-max and --db-dtu-min were the original param names, which is consistent with the @@ -938,21 +885,13 @@ def _configure_security_policy_storage_params(arg_ctx): # list-editions --show-details db-max-dtu db-min-dtu` parameter values. These are more # consistent with other az sql commands, but the original can't be removed due to # compatibility. - c.argument( - 'max_capacity', - options_list=[ - '--db-dtu-max', - '--db-max-dtu', - '--db-max-capacity'], - help='The maximum capacity (in DTUs or vcores) any one database can consume.') - - c.argument( - 'min_capacity', - options_list=[ - '--db-dtu-min', - '--db-min-dtu', - '--db-min-capacity'], - help='The minumum capacity (in DTUs or vcores) each database is guaranteed.') + c.argument('max_capacity', + options_list=['--db-dtu-max', '--db-max-dtu', '--db-max-capacity'], + help='The maximum capacity (in DTUs or vcores) any one database can consume.') + + c.argument('min_capacity', + options_list=['--db-dtu-min', '--db-min-dtu', '--db-min-capacity'], + help='The minumum capacity (in DTUs or vcores) each database is guaranteed.') # --storage was the original param name, which is consistent with the underlying REST API. # --max-size is an alias which is consistent with the `sql elastic-pool list-editions @@ -967,22 +906,19 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('zone_redundant', arg_type=zone_redundant_param_type) - c.argument( - 'tier', - arg_type=tier_param_type, - help='The edition component of the sku. Allowed values include: Basic, Standard, ' - 'Premium, GeneralPurpose, BusinessCritical.') + c.argument('tier', + arg_type=tier_param_type, + help='The edition component of the sku. Allowed values include: Basic, Standard, ' + 'Premium, GeneralPurpose, BusinessCritical.') - c.argument( - 'capacity', - arg_type=capacity_or_dtu_param_type, - help='The capacity component of the sku in integer number of DTUs or vcores.') + c.argument('capacity', + arg_type=capacity_or_dtu_param_type, + help='The capacity component of the sku in integer number of DTUs or vcores.') - c.argument( - 'family', - arg_type=family_param_type, - help='The compute generation component of the sku (for vcore skus only). ' - 'Allowed values include: Gen4, Gen5.') + c.argument('family', + arg_type=family_param_type, + help='The compute generation component of the sku (for vcore skus only). ' + 'Allowed values include: Gen4, Gen5.') with self.argument_context('sql elastic-pool create') as c: # Create args that will be used to build up the ElasticPool object @@ -996,8 +932,7 @@ def _configure_security_policy_storage_params(arg_ctx): 'zone_redundant', ]) - # Create args that will be used to build up the - # ElasticPoolPerDatabaseSettings object + # Create args that will be used to build up the ElasticPoolPerDatabaseSettings object create_args_for_complex_type( c, 'per_database_settings', ElasticPoolPerDatabaseSettings, [ 'max_capacity', @@ -1017,16 +952,12 @@ def _configure_security_policy_storage_params(arg_ctx): with self.argument_context('sql elastic-pool list-editions') as c: # Note that `ElasticPoolCapabilitiesAdditionalDetails` intentionally match param names to - # other commands, such as `sql elastic-pool create --db-max-dtu - # --db-min-dtu --max-size`. - c.argument( - 'show_details', - options_list=[ - '--show-details', - '-d'], - help='List of additional details to include in output.', - nargs='+', - arg_type=get_enum_type(ElasticPoolCapabilitiesAdditionalDetails)) + # other commands, such as `sql elastic-pool create --db-max-dtu --db-min-dtu --max-size`. + c.argument('show_details', + options_list=['--show-details', '-d'], + help='List of additional details to include in output.', + nargs='+', + arg_type=get_enum_type(ElasticPoolCapabilitiesAdditionalDetails)) c.argument('available', arg_type=available_param_type) @@ -1036,21 +967,18 @@ def _configure_security_policy_storage_params(arg_ctx): # We could used 'arg_type=get_enum_type' here, but that will validate the inputs which means there # will be no way to query for new editions that are made available after # this version of CLI is released. - c.argument( - 'edition', - arg_type=tier_param_type, - arg_group=search_arg_group, - help='Edition to search for. If unspecified, all editions are shown.') - - c.argument( - 'dtu', - arg_group=search_arg_group, - help='Number of DTUs to search for. If unspecified, all DTU sizes are shown.') - - c.argument( - 'vcores', - arg_group=search_arg_group, - help='Number of vcores to search for. If unspecified, all vcore sizes are shown.') + c.argument('edition', + arg_type=tier_param_type, + arg_group=search_arg_group, + help='Edition to search for. If unspecified, all editions are shown.') + + c.argument('dtu', + arg_group=search_arg_group, + help='Number of DTUs to search for. If unspecified, all DTU sizes are shown.') + + c.argument('vcores', + arg_group=search_arg_group, + help='Number of vcores to search for. If unspecified, all vcore sizes are shown.') with self.argument_context('sql elastic-pool update') as c: c.argument('database_dtu_max', @@ -1079,23 +1007,12 @@ def _configure_security_policy_storage_params(arg_ctx): ############################################### with self.argument_context('sql failover-group') as c: - c.argument( - 'failover_group_name', - options_list=[ - '--name', - '-n'], - help="The name of the Failover Group") + c.argument('failover_group_name', options_list=['--name', '-n'], help="The name of the Failover Group") c.argument('server_name', arg_type=server_param_type) - c.argument( - 'partner_server', - help="The name of the partner server of a Failover Group") - c.argument( - 'partner_resource_group', - help="The name of the resource group of the partner server") - c.argument( - 'failover_policy', - help="The failover policy of the Failover Group", - arg_type=get_enum_type(FailoverPolicyType)) + c.argument('partner_server', help="The name of the partner server of a Failover Group") + c.argument('partner_resource_group', help="The name of the resource group of the partner server") + c.argument('failover_policy', help="The failover policy of the Failover Group", + arg_type=get_enum_type(FailoverPolicyType)) c.argument('grace_period', arg_type=grace_period_param_type) c.argument('add_db', nargs='+', @@ -1119,34 +1036,25 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('administrator_login_password', options_list=['--admin-password', '-p']) - c.argument( - 'assign_identity', - options_list=[ - '--assign_identity', - '-i'], - help='Generate and assign an Azure Active Directory Identity for this server' - 'for use with key management services like Azure KeyVault.') - - c.argument( - 'minimal_tls_version', - arg_type=get_enum_type(SqlServerMinimalTlsVersionType), - help='The minimal TLS version enforced by the sql server for inbound connections.') - - c.argument( - 'enable_public_network', - options_list=[ - '--enable-public-network', - '-e'], - arg_type=get_three_state_flag(), - help='Set whether public network access to server is allowed or not. When false,' - 'only connections made through Private Links can reach this server.', - is_preview=True) + c.argument('assign_identity', + options_list=['--assign_identity', '-i'], + help='Generate and assign an Azure Active Directory Identity for this server' + 'for use with key management services like Azure KeyVault.') + + c.argument('minimal_tls_version', + arg_type=get_enum_type(SqlServerMinimalTlsVersionType), + help='The minimal TLS version enforced by the sql server for inbound connections.') + + c.argument('enable_public_network', + options_list=['--enable-public-network', '-e'], + arg_type=get_three_state_flag(), + help='Set whether public network access to server is allowed or not. When false,' + 'only connections made through Private Links can reach this server.', + is_preview=True) with self.argument_context('sql server create') as c: - c.argument( - 'location', - arg_type=get_location_type_with_default_from_resource_group( - self.cli_ctx)) + c.argument('location', + arg_type=get_location_type_with_default_from_resource_group(self.cli_ctx)) # Create args that will be used to build up the Server object create_args_for_complex_type( @@ -1163,13 +1071,10 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('administrator_login_password', required=True) - c.argument( - 'assign_identity', - options_list=[ - '--assign-identity', - '-i'], - help='Generate and assign an Azure Active Directory Identity for this server' - 'for use with key management services like Azure KeyVault.') + c.argument('assign_identity', + options_list=['--assign-identity', '-i'], + help='Generate and assign an Azure Active Directory Identity for this server' + 'for use with key management services like Azure KeyVault.') with self.argument_context('sql server update') as c: c.argument('administrator_login_password', @@ -1193,8 +1098,7 @@ def _configure_security_policy_storage_params(arg_ctx): c.ignore('tenant_id') with self.argument_context('sql server ad-admin create') as c: - # Create args that will be used to build up the - # ServerAzureADAdministrator object + # Create args that will be used to build up the ServerAzureADAdministrator object create_args_for_complex_type( c, 'parameters', ServerAzureADAdministrator, [ 'login', @@ -1223,10 +1127,9 @@ def _configure_security_policy_storage_params(arg_ctx): options_list=('--name', '-n'), help='Name of the DNS alias.') - c.argument( - 'original_server_name', - options_list=('--original-server'), - help='The name of the server to which alias is currently pointing') + c.argument('original_server_name', + options_list=('--original-server'), + help='The name of the server to which alias is currently pointing') c.argument('original_resource_group_name', options_list=('--original-resource-group'), @@ -1248,21 +1151,18 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('firewall_rule_name', options_list=['--name', '-n'], help='The name of the firewall rule.', - # Allow --ids command line argument. id_part=child_name_1 is - # 2nd name in uri + # Allow --ids command line argument. id_part=child_name_1 is 2nd name in uri id_part='child_name_1') - c.argument( - 'start_ip_address', - options_list=['--start-ip-address'], - help='The start IP address of the firewall rule. Must be IPv4 format. Use value' - ' \'0.0.0.0\' to represent all Azure-internal IP addresses.') + c.argument('start_ip_address', + options_list=['--start-ip-address'], + help='The start IP address of the firewall rule. Must be IPv4 format. Use value' + ' \'0.0.0.0\' to represent all Azure-internal IP addresses.') - c.argument( - 'end_ip_address', - options_list=['--end-ip-address'], - help='The end IP address of the firewall rule. Must be IPv4 format. Use value' - ' \'0.0.0.0\' to represent all Azure-internal IP addresses.') + c.argument('end_ip_address', + options_list=['--end-ip-address'], + help='The end IP address of the firewall rule. Must be IPv4 format. Use value' + ' \'0.0.0.0\' to represent all Azure-internal IP addresses.') ##### # sql server key @@ -1304,19 +1204,15 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('virtual_network_rule_name', options_list=['--name', '-n']) - c.argument( - 'virtual_network_subnet_id', - options_list=['--subnet'], - help='Name or ID of the subnet that allows access to an Azure Sql Server. ' - 'If subnet name is provided, --vnet-name must be provided.') + c.argument('virtual_network_subnet_id', + options_list=['--subnet'], + help='Name or ID of the subnet that allows access to an Azure Sql Server. ' + 'If subnet name is provided, --vnet-name must be provided.') - c.argument( - 'ignore_missing_vnet_service_endpoint', - options_list=[ - '--ignore-missing-endpoint', - '-i'], - help='Create firewall rule before the virtual network has vnet service endpoint enabled', - arg_type=get_three_state_flag()) + c.argument('ignore_missing_vnet_service_endpoint', + options_list=['--ignore-missing-endpoint', '-i'], + help='Create firewall rule before the virtual network has vnet service endpoint enabled', + arg_type=get_three_state_flag()) with self.argument_context('sql server vnet-rule create') as c: c.extra('vnet_name', @@ -1330,15 +1226,13 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('managed_instance_name', help='The managed instance name', options_list=['--name', '-n'], - # Allow --ids command line argument. id_part=name is 1st - # name in uri + # Allow --ids command line argument. id_part=name is 1st name in uri id_part='name') - c.argument( - 'tier', - arg_type=tier_param_type, - help='The edition component of the sku. Allowed values include: ' - 'GeneralPurpose, BusinessCritical.') + c.argument('tier', + arg_type=tier_param_type, + help='The edition component of the sku. Allowed values include: ' + 'GeneralPurpose, BusinessCritical.') c.argument('family', arg_type=family_param_type, @@ -1355,37 +1249,33 @@ def _configure_security_policy_storage_params(arg_ctx): arg_type=get_enum_type(DatabaseLicenseType), help='The license type to apply for this managed instance.') - c.argument( - 'vcores', - arg_type=capacity_param_type, - help='The capacity of the managed instance in integer number of vcores.') + c.argument('vcores', + arg_type=capacity_param_type, + help='The capacity of the managed instance in integer number of vcores.') c.argument('collation', help='The collation of the managed instance.') - c.argument( - 'proxy_override', - arg_type=get_enum_type(ServerConnectionType), - help='The connection type used for connecting to the instance.') + c.argument('proxy_override', + arg_type=get_enum_type(ServerConnectionType), + help='The connection type used for connecting to the instance.') - c.argument( - 'minimal_tls_version', - arg_type=get_enum_type(SqlManagedInstanceMinimalTlsVersionType), - help='The minimal TLS version enforced by the managed instance for inbound connections.', - is_preview=True) + c.argument('minimal_tls_version', + arg_type=get_enum_type(SqlManagedInstanceMinimalTlsVersionType), + help='The minimal TLS version enforced by the managed instance for inbound connections.', + is_preview=True) - c.argument('public_data_endpoint_enabled', arg_type=get_three_state_flag( - ), help='Whether or not the public data endpoint is enabled for the instance.') + c.argument('public_data_endpoint_enabled', + arg_type=get_three_state_flag(), + help='Whether or not the public data endpoint is enabled for the instance.') - c.argument( - 'timezone_id', help='The time zone id for the instance to set. ' - 'A list of time zone ids is exposed through the sys.time_zone_info (Transact-SQL) view.') + c.argument('timezone_id', + help='The time zone id for the instance to set. ' + 'A list of time zone ids is exposed through the sys.time_zone_info (Transact-SQL) view.') with self.argument_context('sql mi create') as c: - c.argument( - 'location', - arg_type=get_location_type_with_default_from_resource_group( - self.cli_ctx)) + c.argument('location', + arg_type=get_location_type_with_default_from_resource_group(self.cli_ctx)) # Create args that will be used to build up the ManagedInstance object create_args_for_complex_type( @@ -1403,8 +1293,7 @@ def _configure_security_policy_storage_params(arg_ctx): 'timezone_id', ]) - # Create args that will be used to build up the Managed Instance's Sku - # object + # Create args that will be used to build up the Managed Instance's Sku object create_args_for_complex_type( c, 'sku', Sku, [ 'family', @@ -1427,20 +1316,16 @@ def _configure_security_policy_storage_params(arg_ctx): help='The virtual network name', validator=validate_subnet) - c.argument( - 'virtual_network_subnet_id', - options_list=['--subnet'], - required=True, - help='Name or ID of the subnet that allows access to an Azure Sql Managed Instance. ' - 'If subnet name is provided, --vnet-name must be provided.') - - c.argument( - 'assign_identity', - options_list=[ - '--assign-identity', - '-i'], - help='Generate and assign an Azure Active Directory Identity for this managed instance ' - 'for use with key management services like Azure KeyVault.') + c.argument('virtual_network_subnet_id', + options_list=['--subnet'], + required=True, + help='Name or ID of the subnet that allows access to an Azure Sql Managed Instance. ' + 'If subnet name is provided, --vnet-name must be provided.') + + c.argument('assign_identity', + options_list=['--assign-identity', '-i'], + help='Generate and assign an Azure Active Directory Identity for this managed instance ' + 'for use with key management services like Azure KeyVault.') with self.argument_context('sql mi update') as c: # Create args that will be used to build up the ManagedInstance object @@ -1452,17 +1337,13 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('administrator_login_password', options_list=['--admin-password', '-p']) - c.argument( - 'assign_identity', - options_list=[ - '--assign-identity', - '-i'], - help='Generate and assign an Azure Active Directory Identity for this managed instance ' - 'for use with key management services like Azure KeyVault. ' - 'If identity is already assigned - do nothing.') - - # Create args that will be used to build up the Managed Instance's Sku - # object + c.argument('assign_identity', + options_list=['--assign-identity', '-i'], + help='Generate and assign an Azure Active Directory Identity for this managed instance ' + 'for use with key management services like Azure KeyVault. ' + 'If identity is already assigned - do nothing.') + + # Create args that will be used to build up the Managed Instance's Sku object create_args_for_complex_type( c, 'sku', Sku, [ 'family', @@ -1500,8 +1381,7 @@ def _configure_security_policy_storage_params(arg_ctx): arg_type=aad_admin_sid_param_type) with self.argument_context('sql mi ad-admin create') as c: - # Create args that will be used to build up the - # ManagedInstanceAdministrator object + # Create args that will be used to build up the ManagedInstanceAdministrator object create_args_for_complex_type( c, 'properties', ManagedInstanceAdministrator, [ 'login', @@ -1509,8 +1389,7 @@ def _configure_security_policy_storage_params(arg_ctx): ]) with self.argument_context('sql mi ad-admin update') as c: - # Create args that will be used to build up the - # ManagedInstanceAdministrator object + # Create args that will be used to build up the ManagedInstanceAdministrator object create_args_for_complex_type( c, 'properties', ManagedInstanceAdministrator, [ 'login', @@ -1537,15 +1416,13 @@ def _configure_security_policy_storage_params(arg_ctx): with self.argument_context('sql midb') as c: c.argument('managed_instance_name', arg_type=managed_instance_param_type, - # Allow --ids command line argument. id_part=name is 1st - # name in uri + # Allow --ids command line argument. id_part=name is 1st name in uri id_part='name') c.argument('database_name', options_list=['--name', '-n'], help='The name of the Azure SQL Managed Database.', - # Allow --ids command line argument. id_part=child_name_1 is - # 2nd name in uri + # Allow --ids command line argument. id_part=child_name_1 is 2nd name in uri id_part='child_name_1') with self.argument_context('sql midb create') as c: @@ -1554,11 +1431,10 @@ def _configure_security_policy_storage_params(arg_ctx): 'collation', ]) - c.argument( - 'collation', - required=False, - help='The collation of the Azure SQL Managed Database collation to use, ' - 'e.g.: SQL_Latin1_General_CP1_CI_AS or Latin1_General_100_CS_AS_SC') + c.argument('collation', + required=False, + help='The collation of the Azure SQL Managed Database collation to use, ' + 'e.g.: SQL_Latin1_General_CP1_CI_AS or Latin1_General_100_CS_AS_SC') with self.argument_context('sql midb restore') as c: create_args_for_complex_type( @@ -1569,44 +1445,36 @@ def _configure_security_policy_storage_params(arg_ctx): 'restore_point_in_time' ]) - c.argument( - 'deleted_time', - options_list=['--deleted-time'], - help='If specified, restore from a deleted database instead of from an existing database.' - ' Must match the deleted time of a deleted database on the source Managed Instance.') - - c.argument( - 'target_managed_database_name', - options_list=['--dest-name'], - required=True, - help='Name of the managed database that will be created as the restore destination.') - - c.argument( - 'target_managed_instance_name', - options_list=['--dest-mi'], - help='Name of the managed instance to restore managed database to. ' - 'This can be same managed instance, or another managed instance on same subscription. ' - 'When not specified it defaults to source managed instance.') - - c.argument( - 'target_resource_group_name', - options_list=['--dest-resource-group'], - help='Name of the resource group of the managed instance to restore managed database to. ' - 'When not specified it defaults to source resource group.') + c.argument('deleted_time', + options_list=['--deleted-time'], + help='If specified, restore from a deleted database instead of from an existing database.' + ' Must match the deleted time of a deleted database on the source Managed Instance.') + + c.argument('target_managed_database_name', + options_list=['--dest-name'], + required=True, + help='Name of the managed database that will be created as the restore destination.') + + c.argument('target_managed_instance_name', + options_list=['--dest-mi'], + help='Name of the managed instance to restore managed database to. ' + 'This can be same managed instance, or another managed instance on same subscription. ' + 'When not specified it defaults to source managed instance.') + + c.argument('target_resource_group_name', + options_list=['--dest-resource-group'], + help='Name of the resource group of the managed instance to restore managed database to. ' + 'When not specified it defaults to source resource group.') restore_point_arg_group = 'Restore Point' - c.argument( - 'restore_point_in_time', - options_list=[ - '--time', - '-t'], - arg_group=restore_point_arg_group, - required=True, - help='The point in time of the source database that will be restored to create the' - ' new database. Must be greater than or equal to the source database\'s' - ' earliestRestoreDate value. ' + - time_format_help) + c.argument('restore_point_in_time', + options_list=['--time', '-t'], + arg_group=restore_point_arg_group, + required=True, + help='The point in time of the source database that will be restored to create the' + ' new database. Must be greater than or equal to the source database\'s' + ' earliestRestoreDate value. ' + time_format_help) with self.argument_context('sql midb ltr restore') as c: create_args_for_complex_type( @@ -1616,29 +1484,24 @@ def _configure_security_policy_storage_params(arg_ctx): 'target_resource_group_name' ]) - c.argument( - 'long_term_retention_backup_resource_id', - options_list=['--backup-id'], - help='The resource id of the long term retention backup to be restored.') - - c.argument( - 'target_managed_database_name', - options_list=['--dest-name'], - required=True, - help='Name of the managed database that will be created as the restore destination.') - - c.argument( - 'target_managed_instance_name', - options_list=['--dest-mi'], - help='Name of the managed instance to restore managed database to. ' - 'This can be same managed instance, or another managed instance on same subscription. ' - 'When not specified it defaults to source managed instance.') - - c.argument( - 'target_resource_group_name', - options_list=['--dest-resource-group'], - help='Name of the resource group of the managed instance to restore managed database to. ' - 'When not specified it defaults to source resource group.') + c.argument('backup_id', + help='The resource id of the long term retention backup to be restored.') + + c.argument('target_managed_database_name', + options_list=['--dest-name'], + required=True, + help='Name of the managed database that will be created as the restore destination.') + + c.argument('target_managed_instance_name', + options_list=['--dest-mi'], + help='Name of the managed instance to restore managed database to. ' + 'This can be same managed instance, or another managed instance on same subscription. ' + 'When not specified it defaults to source managed instance.') + + c.argument('target_resource_group_name', + options_list=['--dest-resource-group'], + help='Name of the resource group of the managed instance to restore managed database to. ' + 'When not specified it defaults to source resource group.') with self.argument_context('sql midb short-term-retention-policy set') as c: create_args_for_complex_type( @@ -1647,25 +1510,22 @@ def _configure_security_policy_storage_params(arg_ctx): 'retention_days' ]) - c.argument( - 'deleted_time', - options_list=['--deleted-time'], - help='If specified, updates retention days for a deleted database, instead of an existing database.' - 'Must match the deleted time of a deleted database on the source Managed Instance.') + c.argument('deleted_time', + options_list=['--deleted-time'], + help='If specified, updates retention days for a deleted database, instead of an existing database.' + 'Must match the deleted time of a deleted database on the source Managed Instance.') - c.argument( - 'retention_days', - options_list=['--retention-days'], - required=True, - help='New backup short term retention policy in days.' - 'Valid policy for live database is 7-35 days, valid policy for dropped databases is 0-35 days.') + c.argument('retention_days', + options_list=['--retention-days'], + required=True, + help='New backup short term retention policy in days.' + 'Valid policy for live database is 7-35 days, valid policy for dropped databases is 0-35 days.') with self.argument_context('sql midb short-term-retention-policy show') as c: - c.argument( - 'deleted_time', - options_list=['--deleted-time'], - help='If specified, shows retention days for a deleted database, instead of an existing database.' - 'Must match the deleted time of a deleted database on the source Managed Instance.') + c.argument('deleted_time', + options_list=['--deleted-time'], + help='If specified, shows retention days for a deleted database, instead of an existing database.' + 'Must match the deleted time of a deleted database on the source Managed Instance.') with self.argument_context('sql midb long-term-retention-policy set') as c: create_args_for_complex_type( @@ -1696,28 +1556,12 @@ def _configure_security_policy_storage_params(arg_ctx): with self.argument_context('sql midb long-term-retention-backup') as c: c.argument('location_name', - required=True, arg_type=get_location_type(self.cli_ctx)) c.argument('resource_group_name', required=False, help='If specified, the resource group that the managed instance/database resource belongs to.') - with self.argument_context('sql midb long-term-retention-backup show') as c: - c.argument('backup_name', - options_list=['--backup-name', '-b'], - required=True, - help='The long term retention backup name.') - - with self.argument_context('sql midb long-term-retention-backup list-by-database') as c: - c.argument('database_state', - required=False, - help='\'All\', \'Live\', or \'Deleted\'') - - c.argument('only_latest_per_database', - required=False, - help='If true, will only return the latest backup for each database') - ############################################### # sql virtual cluster # ############################################### @@ -1725,8 +1569,7 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('virtual_cluster_name', help='The virtual cluster name', options_list=['--name', '-n'], - # Allow --ids command line argument. id_part=name is 1st - # name in uri + # Allow --ids command line argument. id_part=name is 1st name in uri id_part='name') c.argument('resource_group_name', arg_type=resource_group_name_type) @@ -1744,14 +1587,12 @@ def _configure_security_policy_storage_params(arg_ctx): arg_type=managed_instance_param_type, options_list=['--source-mi', '--mi']) - c.argument( - 'partner_managed_instance', - help="The name of the partner managed instance of a Instance Failover Group", - options_list=['--partner-mi']) + c.argument('partner_managed_instance', + help="The name of the partner managed instance of a Instance Failover Group", + options_list=['--partner-mi']) - c.argument( - 'partner_resource_group', - help="The name of the resource group of the partner managed instance") + c.argument('partner_resource_group', + help="The name of the resource group of the partner managed instance") c.argument('failover_policy', help="The failover policy of the Instance Failover Group", diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 448fb31061e..77b47a7cec9 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -276,8 +276,8 @@ def load_command_table(self, _): client_factory=get_sql_database_threat_detection_policies_operations) as g: g.show_command('show', 'get') - g.generic_update_command( - 'update', custom_func_name='db_threat_detection_policy_update') + g.generic_update_command('update', + custom_func_name='db_threat_detection_policy_update') database_usages_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#DatabaseUsagesOperations.{}', @@ -355,8 +355,7 @@ def load_command_table(self, _): g.command('show', 'get') g.command('list', 'list_by_server') g.custom_command('create', 'failover_group_create') - g.generic_update_command( - 'update', custom_func_name='failover_group_update') + g.generic_update_command('update', custom_func_name='failover_group_update') g.command('delete', 'delete') g.custom_command('set-primary', 'failover_group_failover') @@ -501,17 +500,11 @@ def load_command_table(self, _): managed_instances_operations, client_factory=get_sql_managed_instances_operations) as g: - g.custom_command( - 'create', - 'managed_instance_create', - supports_no_wait=True) + g.custom_command('create', 'managed_instance_create', supports_no_wait=True) g.command('delete', 'delete', confirmation=True, supports_no_wait=True) g.show_command('show', 'get') g.custom_command('list', 'managed_instance_list') - g.generic_update_command( - 'update', - custom_func_name='managed_instance_update', - supports_no_wait=True) + g.generic_update_command('update', custom_func_name='managed_instance_update', supports_no_wait=True) managed_instance_keys_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#ManagedInstanceKeysOperations.{}', @@ -563,10 +556,7 @@ def load_command_table(self, _): client_factory=get_sql_managed_databases_operations) as g: g.custom_command('create', 'managed_db_create', supports_no_wait=True) - g.custom_command( - 'restore', - 'managed_db_restore', - supports_no_wait=True) + g.custom_command('restore', 'managed_db_restore', supports_no_wait=True) g.show_command('show', 'get') g.command('list', 'list_by_instance') g.command('delete', 'delete', confirmation=True, supports_no_wait=True) @@ -584,10 +574,7 @@ def load_command_table(self, _): managed_backup_short_term_retention_policies_operations, client_factory=get_sql_managed_backup_short_term_retention_policies_operations) as g: - g.custom_command( - 'set', - 'update_short_term_retention_mi', - supports_no_wait=True) + g.custom_command('set', 'update_short_term_retention_mi', supports_no_wait=True) g.custom_command('show', 'get_short_term_retention_mi') managed_database_long_term_retention_policies_operations = CliCommandType( @@ -609,15 +596,9 @@ def load_command_table(self, _): managed_database_long_term_retention_backups_operations, client_factory=get_sql_managed_database_long_term_retention_backups_operations) as g: g.show_command('show', 'get') - g.custom_command( - 'list-by-database', - 'list_by_database_long_term_retention_mi_backup') - g.custom_command( - 'list-by-instance', - 'list_by_instance_long_term_retention_mi_backup') - g.custom_command( - 'list-by-location', - 'list_by_location_long_term_retention_mi_backup') + g.custom_command('list-by-database', 'list_by_database_long_term_retention_mi_backup') + g.custom_command('list-by-instance', 'list_by_instance_long_term_retention_mi_backup') + g.custom_command('list-by-location', 'list_by_location_long_term_retention_mi_backup') g.command('delete', 'delete') ############################################### @@ -646,7 +627,6 @@ def load_command_table(self, _): with self.command_group('sql instance-failover-group', instance_failover_groups_operations, client_factory=get_sql_instance_failover_groups_operations) as g: g.command('show', 'get') g.custom_command('create', 'instance_failover_group_create') - g.generic_update_command( - 'update', custom_func_name='instance_failover_group_update') + g.generic_update_command('update', custom_func_name='instance_failover_group_update') g.command('delete', 'delete') g.custom_command('set-primary', 'instance_failover_group_failover') From 3f45a7809ade66027446cda81bd96d12a2d89f15 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Wed, 25 Mar 2020 12:37:20 -0700 Subject: [PATCH 14/54] whitespace fixing; adding some details to params --- .../azure/cli/command_modules/sql/_params.py | 86 ++++++++++++------- .../azure/cli/command_modules/sql/commands.py | 18 ++-- 2 files changed, 68 insertions(+), 36 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index e43fc4c35f0..3b872a7d422 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1484,24 +1484,29 @@ def _configure_security_policy_storage_params(arg_ctx): 'target_resource_group_name' ]) - c.argument('backup_id', - help='The resource id of the long term retention backup to be restored.') - - c.argument('target_managed_database_name', - options_list=['--dest-name'], - required=True, - help='Name of the managed database that will be created as the restore destination.') - - c.argument('target_managed_instance_name', - options_list=['--dest-mi'], - help='Name of the managed instance to restore managed database to. ' - 'This can be same managed instance, or another managed instance on same subscription. ' - 'When not specified it defaults to source managed instance.') - - c.argument('target_resource_group_name', - options_list=['--dest-resource-group'], - help='Name of the resource group of the managed instance to restore managed database to. ' - 'When not specified it defaults to source resource group.') + c.argument( + 'long_term_retention_backup_resource_id', + options_list=['--backup-id'], + help='The resource id of the long term retention backup to be restored.') + + c.argument( + 'target_managed_database_name', + options_list=['--dest-name'], + required=True, + help='Name of the managed database that will be created as the restore destination.') + + c.argument( + 'target_managed_instance_name', + options_list=['--dest-mi'], + help='Name of the managed instance to restore managed database to. ' + 'This can be same managed instance, or another managed instance on same subscription. ' + 'When not specified it defaults to source managed instance.') + + c.argument( + 'target_resource_group_name', + options_list=['--dest-resource-group'], + help='Name of the resource group of the managed instance to restore managed database to. ' + 'When not specified it defaults to source resource group.') with self.argument_context('sql midb short-term-retention-policy set') as c: create_args_for_complex_type( @@ -1510,22 +1515,25 @@ def _configure_security_policy_storage_params(arg_ctx): 'retention_days' ]) - c.argument('deleted_time', - options_list=['--deleted-time'], - help='If specified, updates retention days for a deleted database, instead of an existing database.' - 'Must match the deleted time of a deleted database on the source Managed Instance.') + c.argument( + 'deleted_time', + options_list=['--deleted-time'], + help='If specified, updates retention days for a deleted database, instead of an existing database.' + 'Must match the deleted time of a deleted database on the source Managed Instance.') - c.argument('retention_days', - options_list=['--retention-days'], - required=True, - help='New backup short term retention policy in days.' - 'Valid policy for live database is 7-35 days, valid policy for dropped databases is 0-35 days.') + c.argument( + 'retention_days', + options_list=['--retention-days'], + required=True, + help='New backup short term retention policy in days.' + 'Valid policy for live database is 7-35 days, valid policy for dropped databases is 0-35 days.') with self.argument_context('sql midb short-term-retention-policy show') as c: - c.argument('deleted_time', - options_list=['--deleted-time'], - help='If specified, shows retention days for a deleted database, instead of an existing database.' - 'Must match the deleted time of a deleted database on the source Managed Instance.') + c.argument( + 'deleted_time', + options_list=['--deleted-time'], + help='If specified, shows retention days for a deleted database, instead of an existing database.' + 'Must match the deleted time of a deleted database on the source Managed Instance.') with self.argument_context('sql midb long-term-retention-policy set') as c: create_args_for_complex_type( @@ -1556,12 +1564,28 @@ def _configure_security_policy_storage_params(arg_ctx): with self.argument_context('sql midb long-term-retention-backup') as c: c.argument('location_name', + required=True, arg_type=get_location_type(self.cli_ctx)) c.argument('resource_group_name', required=False, help='If specified, the resource group that the managed instance/database resource belongs to.') + with self.argument_context('sql midb long-term-retention-backup show') as c: + c.argument('backup_name', + options_list=['--backup-name', '-b'], + required=True, + help='The long term retention backup name.') + + with self.argument_context('sql midb long-term-retention-backup list-by-database') as c: + c.argument('database_state', + required=False, + help='\'All\', \'Live\', or \'Deleted\'') + + c.argument('only_latest_per_database', + required=False, + help='If true, will only return the latest backup for each database') + ############################################### # sql virtual cluster # ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 77b47a7cec9..34f43ccda13 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -574,7 +574,10 @@ def load_command_table(self, _): managed_backup_short_term_retention_policies_operations, client_factory=get_sql_managed_backup_short_term_retention_policies_operations) as g: - g.custom_command('set', 'update_short_term_retention_mi', supports_no_wait=True) + g.custom_command( + 'set', + 'update_short_term_retention_mi', + supports_no_wait=True) g.custom_command('show', 'get_short_term_retention_mi') managed_database_long_term_retention_policies_operations = CliCommandType( @@ -596,11 +599,16 @@ def load_command_table(self, _): managed_database_long_term_retention_backups_operations, client_factory=get_sql_managed_database_long_term_retention_backups_operations) as g: g.show_command('show', 'get') - g.custom_command('list-by-database', 'list_by_database_long_term_retention_mi_backup') - g.custom_command('list-by-instance', 'list_by_instance_long_term_retention_mi_backup') - g.custom_command('list-by-location', 'list_by_location_long_term_retention_mi_backup') + g.custom_command( + 'list-by-database', + 'list_by_database_long_term_retention_mi_backup') + g.custom_command( + 'list-by-instance', + 'list_by_instance_long_term_retention_mi_backup') + g.custom_command( + 'list-by-location', + 'list_by_location_long_term_retention_mi_backup') g.command('delete', 'delete') - ############################################### # sql virtual cluster # ############################################### From bd9f71c32df956ba55f5ac02802cb413d28d15b5 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Wed, 25 Mar 2020 12:45:38 -0700 Subject: [PATCH 15/54] updating help/params, some typos --- .../azure/cli/command_modules/sql/_help.py | 2 +- .../azure/cli/command_modules/sql/_params.py | 18 ++++++++++++++++++ .../azure/cli/command_modules/sql/commands.py | 1 + .../azure/cli/command_modules/sql/custom.py | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index e90aaaefe36..bdf0d65b22d 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -672,7 +672,7 @@ short-summary: Update long term retention settings for a managed database. examples: - name: Set long term retention for a managed database. - text: az sql midb long-term-retention-policy set -g mygroup --mi myinstance -n mymanageddb --weekly-retention "P1W" --monthly-retntion "P6M" --yearly-retention "P1Y" --week-of-year 26 + text: az sql midb long-term-retention-policy set -g mygroup --mi myinstance -n mymanageddb --weekly-retention "P1W" --monthly-retention "P6M" --yearly-retention "P1Y" --week-of-year 26 """ helps['sql midb long-term-retention-policy show'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 3b872a7d422..ab041ce5d41 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1586,6 +1586,24 @@ def _configure_security_policy_storage_params(arg_ctx): required=False, help='If true, will only return the latest backup for each database') + with self.argument_context('sql midb long-term-retention-backup list-by-instance') as c: + c.argument('database_state', + required=False, + help='\'All\', \'Live\', or \'Deleted\'') + + c.argument('only_latest_per_database', + required=False, + help='If true, will only return the latest backup for each database') + + with self.argument_context('sql midb long-term-retention-backup list-by-location') as c: + c.argument('database_state', + required=False, + help='\'All\', \'Live\', or \'Deleted\'') + + c.argument('only_latest_per_database', + required=False, + help='If true, will only return the latest backup for each database') + ############################################### # sql virtual cluster # ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 34f43ccda13..5fe2396dd4e 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -609,6 +609,7 @@ def load_command_table(self, _): 'list-by-location', 'list_by_location_long_term_retention_mi_backup') g.command('delete', 'delete') + ############################################### # sql virtual cluster # ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index ac09819a0b8..004c2025bca 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2827,7 +2827,7 @@ def list_by_location_long_term_retention_mi_backup( only_latest_per_database=None, database_state=None): ''' - Lists the long term retentionb backups within a specified region. + Lists the long term retention backups within a specified region. ''' if resource_group_name: From 2382a1f525540d33e733aecba18c1159480e368f Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Wed, 25 Mar 2020 12:59:33 -0700 Subject: [PATCH 16/54] updated help --- .../azure/cli/command_modules/sql/_help.py | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index bdf0d65b22d..ecddeba795f 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -621,14 +621,6 @@ text: az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --dest-mi targetmi --dest-resource-group targetrg """ -helps['sql midb ltr restore'] = """ -type: command -short-summary: Restore a managed database from a long term retentionb backup. -examples: - - name: Restore a managed database using a LTR backup. - text: az sql midb ltr restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" -""" - helps['sql midb show'] = """ type: command short-summary: Get the details for a managed database. @@ -637,9 +629,22 @@ text: az sql midb show -g mygroup --mi myinstance -n mymanageddb """ +helps['sql midb ltr '] = """ +type: group +short-summary: Managed SQL Managed Instance databases long term retention. +""" + +helps['sql midb ltr restore'] = """ +type: command +short-summary: Restore a managed database from a long term retention backup. +examples: + - name: Restore a managed database using a LTR backup. + text: az sql midb ltr restore --dest-name targetmidb --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" +""" + helps['sql midb short-term-retention-policy'] = """ type: group -short-summary: Manage SQL managed instance database backup short term retention policy. +short-summary: Manage SQL Managed Instance database short term retention policy. """ helps['sql midb short-term-retention-policy set'] = """ @@ -664,7 +669,7 @@ helps['sql midb long-term-retention-policy'] = """ type: group -short-summary: SQL Managed Instance database long term retention policy. +short-summary: Manage SQL Managed Instance database long term retention policy. """ helps['sql midb long-term-retention-policy set'] = """ @@ -685,7 +690,7 @@ helps['sql midb long-term-retention-backup'] = """ type: group -short-summary: SQL Managed Instance database long term retention backups. +short-summary: Manage SQL Managed Instance database long term retention backups. """ helps['sql midb long-term-retention-backup show'] = """ @@ -701,14 +706,14 @@ short-summary: Get all long term retention backups for a managed database. examples: - name: List long term retention backups for a managed database. - text: az sql midb long-term-retention-backup list-by-database -l southeastasia --mi myinstance -n mymanageddb --database-state Deleted + text: az sql midb long-term-retention-backup list-by-database -l southeastasia --mi myinstance -n mymanageddb """ helps['sql midb long-term-retention-backup list-by-instance'] = """ type: command short-summary: Get all long term retention backups for a managed instance. examples: - - name: List long term retention backups for a managed instance. + - name: List long term retention backups for a managed instance (list only the latest LTR backups, which belong to live databases). text: az sql midb long-term-retention-backup list-by-instance -l southeastasia --mi myinstance --database-state Live --only-latest-per-database True - name: List long term retention backups for a managed instance (with resource group argument). text: az sql midb long-term-retention-backup list-by-instance -l southeastasia -g mygroup --mi myinstance @@ -718,7 +723,7 @@ type: command short-summary: Get all long term retention backups for location. examples: - - name: List long term retention backups for a location. + - name: List long term retention backups for a location (list only the latest LTR backups, which belong to live databases). text: az sql midb long-term-retention-backup list-by-location -l southeastasia --database-state Live --only-latest-per-database True - name: List long term retention backups for a location (with resource group argument). text: az sql midb long-term-retention-backup list-by-instance -l southeastasia -g mygroup From 4ebae7bcad056d845bcb9ef7a5da81629485e85f Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Wed, 25 Mar 2020 13:21:41 -0700 Subject: [PATCH 17/54] more changes to help --- src/azure-cli/azure/cli/command_modules/sql/_help.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index ecddeba795f..2554d152bb2 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -629,7 +629,7 @@ text: az sql midb show -g mygroup --mi myinstance -n mymanageddb """ -helps['sql midb ltr '] = """ +helps['sql midb ltr'] = """ type: group short-summary: Managed SQL Managed Instance databases long term retention. """ @@ -726,7 +726,7 @@ - name: List long term retention backups for a location (list only the latest LTR backups, which belong to live databases). text: az sql midb long-term-retention-backup list-by-location -l southeastasia --database-state Live --only-latest-per-database True - name: List long term retention backups for a location (with resource group argument). - text: az sql midb long-term-retention-backup list-by-instance -l southeastasia -g mygroup + text: az sql midb long-term-retention-backup list-by-location -l southeastasia -g mygroup """ helps['sql midb long-term-retention-backup delete'] = """ From 60a1cfabd6ba1530cfaa034b3388c4afb5c6a60c Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 26 Mar 2020 14:46:59 -0700 Subject: [PATCH 18/54] recording file --- ...st_sql_managed_db_long_term_retention.yaml | 1117 ++++++++++++++--- .../sql/tests/latest/test_sql_commands.py | 87 +- 2 files changed, 963 insertions(+), 241 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml index 73d1ede4258..7d0003916fa 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -1,122 +1,744 @@ interactions: +- request: + body: '{"properties": {"weeklyRetention": "P1W", "monthlyRetention": "P1M", "yearlyRetention": + "P2M", "weekOfYear": 12}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-policy set + Connection: + - keep-alive + Content-Length: + - '113' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - -g --mi -n --weekly-retention --monthly-retention --yearly-retention --week-of-year + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + response: + body: + string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-03-26T21:40:37.797Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/8945b3a0-54cf-4bdb-8a14-e0b0aba22ae5?api-version=2018-06-01-preview + cache-control: + - no-cache + content-length: + - '91' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:36 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/8945b3a0-54cf-4bdb-8a14-e0b0aba22ae5?api-version=2018-06-01-preview + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-policy set + Connection: + - keep-alive + ParameterSetName: + - -g --mi -n --weekly-retention --monthly-retention --yearly-retention --week-of-year + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/8945b3a0-54cf-4bdb-8a14-e0b0aba22ae5?api-version=2018-06-01-preview + response: + body: + string: '{"name":"8945b3a0-54cf-4bdb-8a14-e0b0aba22ae5","status":"Succeeded","startTime":"2020-03-26T21:40:37.797Z"}' + headers: + cache-control: + - no-cache + content-length: + - '107' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:52 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-policy set + Connection: + - keep-alive + ParameterSetName: + - -g --mi -n --weekly-retention --monthly-retention --yearly-retention --week-of-year + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + response: + body: + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/test-db-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + headers: + cache-control: + - no-cache + content-length: + - '401' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:52 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-policy show + Connection: + - keep-alive + ParameterSetName: + - -g --mi -n + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + response: + body: + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/test-db-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + headers: + cache-control: + - no-cache + content-length: + - '401' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:53 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-backup list-by-location + Connection: + - keep-alive + ParameterSetName: + - -l -g + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + response: + body: + string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:54 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-backup list-by-location + Connection: + - keep-alive + ParameterSetName: + - -l + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + response: + body: + string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:54 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-backup list-by-instance + Connection: + - keep-alive + ParameterSetName: + - -l --mi -g + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + response: + body: + string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-backup list-by-instance + Connection: + - keep-alive + ParameterSetName: + - -l --mi + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + response: + body: + string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-backup list-by-database + Connection: + - keep-alive + ParameterSetName: + - -l --mi -n -g + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + response: + body: + string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-backup list-by-database + Connection: + - keep-alive + ParameterSetName: + - -l --mi -n + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + response: + body: + string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:57 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-backup list-by-database + Connection: + - keep-alive + ParameterSetName: + - -l --mi -n --only-latest-per-database + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview + response: + body: + string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + headers: + cache-control: + - no-cache + content-length: + - '727' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:56 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-backup show + Connection: + - keep-alive + ParameterSetName: + - -l --mi -n --backup-name + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422%3B132297215180000000?api-version=2018-06-01-preview + response: + body: + string: '{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' + headers: + cache-control: + - no-cache + content-length: + - '715' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:58 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK - request: body: null headers: Accept: - - '*/*' - Accept-Charset: - - utf-8 + - application/json Accept-Encoding: - gzip, deflate + CommandName: + - sql midb ltr restore Connection: - keep-alive + ParameterSetName: + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - - python-requests/2.23.0 - return-client-request-id: - - 'true' - x-client-CPU: - - x64 - x-client-OS: - - win32 - x-client-SKU: - - Python - x-client-Ver: - - 1.2.2 + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US method: GET - uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff435658b-a8c3-4460-adf2-84617caef396%2Foauth2%2Fauthorize&api-version=1.0 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr?api-version=2018-06-01-preview response: body: - string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f435658b-a8c3-4460-adf2-84617caef396/.well-known/openid-configuration"}' + string: '{"identity":{"principalId":"1cb932bf-850a-4f49-8ff1-75dec7ab388a","type":"SystemAssigned","tenantId":"0c1edf5d-e5c5-4aca-ab69-ef194134f44b"},"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":8},"properties":{"fullyQualifiedDomainName":"cli-ltr.4a50e5aa3565.database.windows.net","administratorLogin":"cloudSA","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Network/virtualNetworks/vnet-cli-ltr/subnets/ManagedInstance","state":"Ready","licenseType":"LicenseIncluded","vCores":8,"storageSizeInGB":256,"collation":"SQL_Latin1_General_CP1_CI_AS","dnsZone":"4a50e5aa3565","publicDataEndpointEnabled":false,"proxyOverride":"Proxy","timezoneId":"UTC"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr","name":"cli-ltr","type":"Microsoft.Sql/managedInstances"}' headers: - access-control-allow-methods: - - GET, OPTIONS - access-control-allow-origin: - - '*' cache-control: - - private, max-age=86400 + - no-cache content-length: - - '131' + - '951' content-type: - application/json; charset=utf-8 date: - - Tue, 24 Mar 2020 10:21:57 GMT - p3p: - - CP="DSP CUR OTPi IND OTRi ONL FIN" - set-cookie: - - fpc=AhPWqvAXF_5Ik978RKVWWj0; expires=Thu, 23-Apr-2020 10:21:57 GMT; path=/; - secure; HttpOnly; SameSite=None - - esctx=AQABAAAAAAAm-06blBE1TpVMil8KPQ41JrhX1g8paZo3CIyWCerAZfKS7FwungIAfE3KxkfabpMLdBDpICjB9p6RXa_4s8yu7Zo8orfYRPqBmLsyyjMZycwdMB3dtbmJrBQO0_WaVnzyX5LVqmz_zsqcnF2_XrifwRN06uYS4-11ELmruUz5-oHVO1l8ugu0Bo76lEyPCDcgAA; - domain=.login.windows.net; path=/; secure; HttpOnly; SameSite=None - - x-ms-gateway-slice=corp; path=/; SameSite=None; secure; HttpOnly - - stsservicecookie=estscorp; path=/; SameSite=None; secure; HttpOnly + - Thu, 26 Mar 2020 21:40:58 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff - x-ms-ests-server: - - 2.1.10244.21 - SAN ProdSlices status: code: 200 message: OK - request: - body: grant_type=client_credentials&client_id=6af90d67-c2b6-4a20-b068-fb64a342136c&resource=https%3A%2F%2Fmanagement.core.windows.net%2F&client_secret=7%5DuaW%3D%3AOQ%3Ar2lyVRB81%3A3hMB6bG-%5DM%5Dl + body: '{"location": "westus", "properties": {"createMode": "RestoreLongTermRetentionBackup", + "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000"}}' headers: Accept: - - '*/*' - Accept-Charset: - - utf-8 + - application/json Accept-Encoding: - gzip, deflate + CommandName: + - sql midb ltr restore Connection: - keep-alive Content-Length: - - '191' + - '425' + Content-Type: + - application/json; charset=utf-8 + ParameterSetName: + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - - python-requests/2.23.0 + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/cli-restore-dest?api-version=2019-06-01-preview + response: + body: + string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-03-26T21:40:59.217Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + cache-control: + - no-cache + content-length: + - '95' content-type: - - application/x-www-form-urlencoded - return-client-request-id: - - 'true' - x-client-CPU: - - x64 - x-client-OS: - - win32 - x-client-SKU: - - Python - x-client-Ver: - - 1.2.2 - method: POST - uri: https://login.windows-ppe.net/f435658b-a8c3-4460-adf2-84617caef396/oauth2/token + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:40:59 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1198' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb ltr restore + Connection: + - keep-alive + ParameterSetName: + - --backup-id --dest-name --dest-mi --dest-resource-group + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview response: body: - string: '{"token_type":"Bearer","expires_in":"3599","ext_expires_in":"3599","expires_on":"1585048917","not_before":"1585045017","resource":"https://management.core.windows.net/","access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imp4eHJRenI0cTg2YkQxdnVZbGFVd0FJN2JUYyIsImtpZCI6Imp4eHJRenI0cTg2YkQxdnVZbGFVd0FJN2JUYyJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLXBwZS5uZXQvZjQzNTY1OGItYThjMy00NDYwLWFkZjItODQ2MTdjYWVmMzk2LyIsImlhdCI6MTU4NTA0NTAxNywibmJmIjoxNTg1MDQ1MDE3LCJleHAiOjE1ODUwNDg5MTcsImFpbyI6IkUySmdZRkJKemJQTnpwanN0SGh1bmVIYlMrdUZBUT09IiwiYXBwaWQiOiI2YWY5MGQ2Ny1jMmI2LTRhMjAtYjA2OC1mYjY0YTM0MjEzNmMiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLXBwZS5uZXQvZjQzNTY1OGItYThjMy00NDYwLWFkZjItODQ2MTdjYWVmMzk2LyIsIm9pZCI6ImIyYTFlYmI1LTUxM2YtNDgxZi1iYjk3LWM1ZDU2OGQxMTkzOCIsInN1YiI6ImIyYTFlYmI1LTUxM2YtNDgxZi1iYjk3LWM1ZDU2OGQxMTkzOCIsInRpZCI6ImY0MzU2NThiLWE4YzMtNDQ2MC1hZGYyLTg0NjE3Y2FlZjM5NiIsInV0aSI6IjJ4NFJ1c1JicFVXQlZFeFFpNTBNQUEiLCJ2ZXIiOiIxLjAifQ.jOfErH4pUxaqhAbIhTZbzF14y43htVMHc6Khe0mRQIMFR00fwlZiRzWOET8QdQBy1xuYcIThOFQoGbibYFJEHJTJxZC2OgwLcVcMJHDhVSiJ9BwzRh4lpLNqybKUT22FWdpqO1rU16t14NhgVwMU8KoFP5euXeWloXJJslAD37iFbfmHXAXtlzQ6DNx8s2sZIti38rhQ2kOrErL-egUWj43jdUBxN40ZfauxquXwC98_YKsX_t-aT1PHSMFy8yJgbWNDPBWVM_bXxSay30DXOrqOXs7l6ITYY1pc9agJwgv0FcvEF1ma7ol5CB8dUlYp9mXWf_QU8rfdUzPMyTcH6A"}' + string: '{"name":"44f74e18-7496-4f73-ac2b-eeae3b068db3","status":"InProgress","startTime":"2020-03-26T21:40:59.217Z"}' headers: cache-control: - - no-cache, no-store + - no-cache content-length: - - '1365' + - '108' content-type: - application/json; charset=utf-8 date: - - Tue, 24 Mar 2020 10:21:56 GMT + - Thu, 26 Mar 2020 21:41:14 GMT expires: - '-1' - p3p: - - CP="DSP CUR OTPi IND OTRi ONL FIN" pragma: - no-cache - set-cookie: - - fpc=AhwYKBMrNBJJvVjJQNbOgH8OmtngAQAAAEXWC9YOAAAA; expires=Thu, 23-Apr-2020 - 10:21:57 GMT; path=/; secure; HttpOnly; SameSite=None - - stsservicecookie=estsppe; path=/; SameSite=None; secure; HttpOnly + server: + - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff - x-ms-clitelem: - - 1,0,0,, - x-ms-ests-server: - - 2.1.10333.0 - CHY PPE status: code: 200 message: OK @@ -128,36 +750,38 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - network route-table create + - sql midb ltr restore Connection: - keep-alive ParameterSetName: - - -g -n + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-resource/8.0.1 Azure-SDK-For-Python AZURECLI/2.2.0 - accept-language: - - en-US + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2019-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001","name":"clitest000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2020-03-24T10:21:53Z"},"properties":{"provisioningState":"Succeeded"}}' + string: '{"name":"44f74e18-7496-4f73-ac2b-eeae3b068db3","status":"InProgress","startTime":"2020-03-26T21:40:59.217Z"}' headers: cache-control: - no-cache content-length: - - '312' + - '108' content-type: - application/json; charset=utf-8 date: - - Tue, 24 Mar 2020 10:21:57 GMT + - Thu, 26 Mar 2020 21:41:29 GMT expires: - '-1' pragma: - no-cache + server: + - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked vary: - Accept-Encoding x-content-type-options: @@ -169,178 +793,337 @@ interactions: body: null headers: Accept: - - '*/*' - Accept-Charset: - - utf-8 + - application/json Accept-Encoding: - gzip, deflate + CommandName: + - sql midb ltr restore Connection: - keep-alive + ParameterSetName: + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - - python-requests/2.23.0 - return-client-request-id: - - 'true' - x-client-CPU: - - x64 - x-client-OS: - - win32 - x-client-SKU: - - Python - x-client-Ver: - - 1.2.2 + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://login.windows.net/common/discovery/instance?authorization_endpoint=https%3A%2F%2Flogin.windows-ppe.net%2Ff435658b-a8c3-4460-adf2-84617caef396%2Foauth2%2Fauthorize&api-version=1.0 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview response: body: - string: '{"tenant_discovery_endpoint":"https://login.windows-ppe.net/f435658b-a8c3-4460-adf2-84617caef396/.well-known/openid-configuration"}' + string: '{"name":"44f74e18-7496-4f73-ac2b-eeae3b068db3","status":"InProgress","startTime":"2020-03-26T21:40:59.217Z"}' headers: - access-control-allow-methods: - - GET, OPTIONS - access-control-allow-origin: - - '*' cache-control: - - private, max-age=86400 + - no-cache content-length: - - '131' + - '108' content-type: - application/json; charset=utf-8 date: - - Tue, 24 Mar 2020 10:21:58 GMT - p3p: - - CP="DSP CUR OTPi IND OTRi ONL FIN" - set-cookie: - - fpc=AvpuLZ7Y0eFGmjLQ-oq8w_A; expires=Thu, 23-Apr-2020 10:21:58 GMT; path=/; - secure; HttpOnly; SameSite=None - - esctx=AQABAAAAAAAm-06blBE1TpVMil8KPQ41T7rSIfcNetfGrFUsuaetP_9gulQkFSXXtg4-fwQtlQFDV5SgGEetr5zR1amSJU-48w34ISwNeueDLSB2G-vBizk6tQ_TMQpqxATcOyNOjOkkcxBh5usq3i_XtCcz4k1UkBlr3z8h647rQNZ-wiBzVqiMUvgiopIjzOOazv_d9ssgAA; - domain=.login.windows.net; path=/; secure; HttpOnly; SameSite=None - - x-ms-gateway-slice=corp; path=/; SameSite=None; secure; HttpOnly - - stsservicecookie=estscorp; path=/; SameSite=None; secure; HttpOnly + - Thu, 26 Mar 2020 21:41:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff - x-ms-ests-server: - - 2.1.10244.21 - SAN ProdSlices status: code: 200 message: OK - request: - body: grant_type=client_credentials&client_id=6af90d67-c2b6-4a20-b068-fb64a342136c&resource=https%3A%2F%2Fmanagement.core.windows.net%2F&client_secret=7%5DuaW%3D%3AOQ%3Ar2lyVRB81%3A3hMB6bG-%5DM%5Dl + body: null headers: Accept: - - '*/*' - Accept-Charset: - - utf-8 + - application/json Accept-Encoding: - gzip, deflate + CommandName: + - sql midb ltr restore Connection: - keep-alive - Content-Length: - - '191' + ParameterSetName: + - --backup-id --dest-name --dest-mi --dest-resource-group + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + response: + body: + string: '{"name":"44f74e18-7496-4f73-ac2b-eeae3b068db3","status":"InProgress","startTime":"2020-03-26T21:40:59.217Z"}' + headers: + cache-control: + - no-cache + content-length: + - '108' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:41:59 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb ltr restore + Connection: + - keep-alive + ParameterSetName: + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - - python-requests/2.23.0 + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + response: + body: + string: '{"name":"44f74e18-7496-4f73-ac2b-eeae3b068db3","status":"Succeeded","startTime":"2020-03-26T21:40:59.217Z"}' + headers: + cache-control: + - no-cache + content-length: + - '107' content-type: - - application/x-www-form-urlencoded - return-client-request-id: - - 'true' - x-client-CPU: - - x64 - x-client-OS: - - win32 - x-client-SKU: - - Python - x-client-Ver: - - 1.2.2 - method: POST - uri: https://login.windows-ppe.net/f435658b-a8c3-4460-adf2-84617caef396/oauth2/token + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:42:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb ltr restore + Connection: + - keep-alive + ParameterSetName: + - --backup-id --dest-name --dest-mi --dest-resource-group + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"token_type":"Bearer","expires_in":"3599","ext_expires_in":"3599","expires_on":"1585048918","not_before":"1585045018","resource":"https://management.core.windows.net/","access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imp4eHJRenI0cTg2YkQxdnVZbGFVd0FJN2JUYyIsImtpZCI6Imp4eHJRenI0cTg2YkQxdnVZbGFVd0FJN2JUYyJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLXBwZS5uZXQvZjQzNTY1OGItYThjMy00NDYwLWFkZjItODQ2MTdjYWVmMzk2LyIsImlhdCI6MTU4NTA0NTAxOCwibmJmIjoxNTg1MDQ1MDE4LCJleHAiOjE1ODUwNDg5MTgsImFpbyI6IkUySmdZQ2lVTCtIUVBYUTBhUVhYMWNrYnF1WXVBUUE9IiwiYXBwaWQiOiI2YWY5MGQ2Ny1jMmI2LTRhMjAtYjA2OC1mYjY0YTM0MjEzNmMiLCJhcHBpZGFjciI6IjEiLCJpZHAiOiJodHRwczovL3N0cy53aW5kb3dzLXBwZS5uZXQvZjQzNTY1OGItYThjMy00NDYwLWFkZjItODQ2MTdjYWVmMzk2LyIsIm9pZCI6ImIyYTFlYmI1LTUxM2YtNDgxZi1iYjk3LWM1ZDU2OGQxMTkzOCIsInN1YiI6ImIyYTFlYmI1LTUxM2YtNDgxZi1iYjk3LWM1ZDU2OGQxMTkzOCIsInRpZCI6ImY0MzU2NThiLWE4YzMtNDQ2MC1hZGYyLTg0NjE3Y2FlZjM5NiIsInV0aSI6ImJ1dUlPeXhncmsyM0t0b2JONnNNQUEiLCJ2ZXIiOiIxLjAifQ.EN5peMECtla0WDh7bk5W5sQaZMOCyd-xmJiF1My68pennlbhCnttKhM9Tk1Pnn8JhqUaPYTmpJ-LWO40CugLKnp49-PWROh7c4_mWcS7T1X0rSxWxsGS7eXJVjJsqz053Au29mhzXMCCgeHTGcDL8ZT2qZzwOO4_cQCMHc9x0bB22zr2xc1VVkhcrFH8tp2uyiJuD4Qreyd7WNti3WFLG_Zc1g1H00XOR_gEmxEM3h-5T-hS054HUajBqPF6mAo4k8Yj2OMVvjZAdCC_qQfqF3Civ1znMlc0khS6EbG5dZSLL2WlBzpGL6K9Ch7yZGROcAJAQV33RIl5nmfpLn_P2g"}' + string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-03-26T21:40:59.543Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' headers: cache-control: - - no-cache, no-store + - no-cache content-length: - - '1365' + - '417' content-type: - application/json; charset=utf-8 date: - - Tue, 24 Mar 2020 10:21:58 GMT + - Thu, 26 Mar 2020 21:42:14 GMT expires: - '-1' - p3p: - - CP="DSP CUR OTPi IND OTRi ONL FIN" pragma: - no-cache - set-cookie: - - fpc=AjVrL0tJfixPtWMDW4-X7NwOmtngAQAAAEbWC9YOAAAA; expires=Thu, 23-Apr-2020 - 10:21:59 GMT; path=/; secure; HttpOnly; SameSite=None - - stsservicecookie=estsppe; path=/; SameSite=None; secure; HttpOnly + server: + - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff - x-ms-clitelem: - - 1,0,0,, - x-ms-ests-server: - - 2.1.10333.0 - CHY PPE status: code: 200 message: OK - request: - body: '{"location": "westus"}' + body: null headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - network route-table create + - sql midb long-term-retention-backup delete Connection: - keep-alive Content-Length: - - '22' - Content-Type: + - '0' + ParameterSetName: + - -l --mi -n --backup-name + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422%3B132297215180000000?api-version=2018-06-01-preview + response: + body: + string: '{"operation":"DeleteLTRBackup","startTime":"2020-03-26T21:42:15.973Z"}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/becdd262-7caf-4672-9b3c-784b3d970e25?api-version=2018-06-01-preview + cache-control: + - no-cache + content-length: + - '70' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:42:15 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/becdd262-7caf-4672-9b3c-784b3d970e25?api-version=2018-06-01-preview + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-backup delete + Connection: + - keep-alive + ParameterSetName: + - -l --mi -n --backup-name + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/becdd262-7caf-4672-9b3c-784b3d970e25?api-version=2018-06-01-preview + response: + body: + string: '{"name":"becdd262-7caf-4672-9b3c-784b3d970e25","status":"Succeeded","startTime":"2020-03-26T21:42:15.973Z"}' + headers: + cache-control: + - no-cache + content-length: + - '107' + content-type: - application/json; charset=utf-8 + date: + - Thu, 26 Mar 2020 21:42:30 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb long-term-retention-backup list-by-database + Connection: + - keep-alive ParameterSetName: - - -g -n + - -l --mi -n User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-network/9.0.0 Azure-SDK-For-Python AZURECLI/2.2.0 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 accept-language: - en-US - method: PUT - uri: https://api-dogfood.resources.windows-int.net/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/routeTables/vcCliTestRouteTable?api-version=2019-11-01 + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"error":{"code":"NoRegisteredProviderFound","message":"No registered - resource provider found for location ''westus'' and API version ''2019-11-01'' - for type ''routeTables''. The supported api-versions are ''2014-12-01-preview, - 2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-06-01, 2016-07-01, 2016-08-01, - 2016-09-01, 2016-10-01, 2016-11-01, 2016-12-01, 2017-03-01, 2017-04-01, 2017-06-01, - 2017-08-01, 2017-09-01, 2017-10-01, 2017-11-01, 2018-01-01, 2018-02-01, 2018-03-01, - 2018-04-01, 2018-05-01, 2018-06-01, 2018-07-01, 2018-08-01, 2018-10-01, 2018-11-01, - 2018-12-01, 2019-02-01''. The supported locations are ''westeurope, centralus, - westus, eastus, northcentralus, southcentralus, eastus2, northeurope''."}}' + string: '{"value":[]}' headers: cache-control: - no-cache content-length: - - '703' + - '12' content-type: - application/json; charset=utf-8 date: - - Tue, 24 Mar 2020 10:21:59 GMT + - Thu, 26 Mar 2020 21:42:32 GMT expires: - '-1' pragma: - no-cache + server: + - Microsoft-HTTPAPI/2.0 strict-transport-security: - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding x-content-type-options: - nosniff - x-ms-failure-cause: - - gateway status: - code: 400 - message: Bad Request + code: 200 + message: OK version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 09646aa7e39..a05a13b26f6 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3195,77 +3195,21 @@ def test_sql_managed_db_short_retention(self, resource_group, resource_group_loc class SqlManagedInstanceDbLongTermRetentionScenarioTest(ScenarioTest): - @ResourceGroupPreparer(random_name_length=17, name_prefix='clitest') + @record_only() def test_sql_managed_db_long_term_retention( - self, resource_group, resource_group_location): - - resource_prefix = 'MIDBLongTermRetention' + self): self.kwargs.update({ - 'loc': resource_group_location, - 'vnet_name': 'vcCliTestVnet', - 'subnet_name': 'vcCliTestSubnet', - 'route_table_name': 'vcCliTestRouteTable', - 'route_name_internet': 'vcCliTestRouteInternet', - 'route_name_vnetlocal': 'vcCliTestRouteVnetLoc', - 'managed_instance_name': self.create_random_name(managed_instance_name_prefix, managed_instance_name_max_length), - 'database_name': self.create_random_name(resource_prefix, 50), - 'vault_name': self.create_random_name(resource_prefix, 50), - 'admin_login': 'admin123', - 'admin_password': 'SecretPassword123', - 'license_type': 'LicenseIncluded', - 'v_cores': 8, - 'storage_size_in_gb': '32', - 'edition': 'GeneralPurpose', - 'family': 'Gen5', - 'collation': "Serbian_Cyrillic_100_CS_AS", - 'proxy_override': "Proxy", + 'rg': 'clitest4vtazvlqbo', + 'loc': 'westus', + 'managed_instance_name': 'cli-ltr', + 'database_name': 'test-db-1', 'weekly_retention': 'P1W', 'monthly_retention': 'P1M', 'yearly_retention': 'P2M', 'week_of_year': 12 }) - # Create and prepare VNet and subnet for new virtual cluster - self.cmd('network route-table create -g {rg} -n {route_table_name}') - self.cmd('network route-table route create -g {rg} --route-table-name {route_table_name} -n {route_name_internet} --next-hop-type Internet --address-prefix 0.0.0.0/0') - self.cmd('network route-table route create -g {rg} --route-table-name {route_table_name} -n {route_name_vnetlocal} --next-hop-type VnetLocal --address-prefix 10.0.0.0/24') - self.cmd('network vnet create -g {rg} -n {vnet_name} --location {loc} --address-prefix 10.0.0.0/16') - self.cmd('network vnet subnet create -g {rg} --vnet-name {vnet_name} -n {subnet_name} --address-prefix 10.0.0.0/24 --route-table {route_table_name}') - subnet = self.cmd('network vnet subnet show -g {rg} --vnet-name {vnet_name} -n {subnet_name}').get_output_in_json() - - self.kwargs.update({ - 'subnet_id': subnet['id'] - }) - - # create sql managed_instance - self.cmd('sql mi create -g {rg} -n {managed_instance_name} -l {loc} ' - '-u {admin_login} -p {admin_password} --subnet {subnet_id} --license-type {license_type} ' - '--capacity {v_cores} --storage {storage_size_in_gb} --edition {edition} --family {family} ' - '--collation {collation} --proxy-override {proxy_override} --public-data-endpoint-enabled --assign-identity', - checks=[ - self.check('name', '{managed_instance_name}'), - self.check('resourceGroup', '{rg}'), - self.check('administratorLogin', '{admin_login}'), - self.check('vCores', '{v_cores}'), - self.check('storageSizeInGb', '{storage_size_in_gb}'), - self.check('licenseType', '{license_type}'), - self.check('sku.tier', '{edition}'), - self.check('sku.family', '{family}'), - self.check('sku.capacity', '{v_cores}'), - self.check('collation', '{collation}'), - self.check('proxyOverride', '{proxy_override}'), - self.check('publicDataEndpointEnabled', 'True')]).get_output_in_json() - - # create database - self.cmd('sql midb create -g {rg} --mi {managed_instance_name} -n {database_name} --collation {collation}', - checks=[ - self.check('resourceGroup', '{rg}'), - self.check('name', '{database_name}'), - self.check('location', '{loc}'), - self.check('collation', '{collation}'), - self.check('status', 'Online')]) - # test update long term retention on live database self.cmd( 'sql midb long-term-retention-policy set -g {rg} --mi {managed_instance_name} -n {database_name} --weekly-retention {weekly_retention} --monthly-retention {monthly_retention} --yearly-retention {yearly_retention} --week-of-year {week_of_year}', @@ -3284,9 +3228,6 @@ def test_sql_managed_db_long_term_retention( self.check('monthlyRetention', '{monthly_retention}'), self.check('yearlyRetention', '{yearly_retention}')]) - # Wait for first backup before dropping - _wait_until_first_backup_midb(self) - # test list long term retention backups for location # with resource group self.cmd( @@ -3320,35 +3261,33 @@ def test_sql_managed_db_long_term_retention( 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} --only-latest-per-database True').get_output_in_json() self.kwargs.update({ - 'backup_name': backup['name'], - 'backup_id': backup['id'] + 'backup_name': backup[0]['name'], + 'backup_id': backup[0]['id'] }) # test show long term retention backup self.cmd( - 'sql midb long-term-retention-backup show -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name \'{backup_name}\'', + 'sql midb long-term-retention-backup show -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name {backup_name}', checks=[ self.check('resourceGroup', '{rg}'), - self.check('location', '{loc}'), - self.check('managedInstance', '{managed_instance_name}'), - self.check('database', '{database_name}'), + self.check('managedInstanceName', '{managed_instance_name}'), + self.check('databaseName', '{database_name}'), self.check('name', '{backup_name}')]) # test restore managed database from LTR backup self.kwargs.update({ - 'dest_database_name': '{database_name}_dest' + 'dest_database_name': 'cli-restore-dest' }) self.cmd( 'sql midb ltr restore --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}', checks=[ self.check('resourceGroup', '{rg}'), - self.check('managedInstance', '{managed_instance_name}'), self.check('name', '{dest_database_name}')]) # test delete long term retention backup self.cmd( - 'sql midb long-term-retention-backup delete -l {loc} -g {rg} --mi {managed_database_name} -n {database_name} --backup-name \'{backup_name}\'') + 'sql midb long-term-retention-backup delete -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name \'{backup_name}\'') # assert no backpus self.cmd( 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}') From 01d1bb16e2a7733ecd5859983ac32ea7459e1d3d Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 26 Mar 2020 16:21:07 -0700 Subject: [PATCH 19/54] switch back resource names --- src/azure-cli/azure/cli/command_modules/sql/_help.py | 2 +- .../recordings/test_sql_managed_db_long_term_retention.yaml | 2 +- .../cli/command_modules/sql/tests/latest/test_sql_commands.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index 2554d152bb2..95110fc6e16 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -644,7 +644,7 @@ helps['sql midb short-term-retention-policy'] = """ type: group -short-summary: Manage SQL Managed Instance database short term retention policy. +short-summary: Manage SQL Managed Instance database backup short term retention policy. """ helps['sql midb short-term-retention-policy set'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml index 7d0003916fa..ac6eee7f8ce 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -318,7 +318,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index a05a13b26f6..095b5b3178b 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3202,7 +3202,7 @@ def test_sql_managed_db_long_term_retention( self.kwargs.update({ 'rg': 'clitest4vtazvlqbo', 'loc': 'westus', - 'managed_instance_name': 'cli-ltr', + 'managed_instance_name': 'ayang', 'database_name': 'test-db-1', 'weekly_retention': 'P1W', 'monthly_retention': 'P1M', From d0d2f6a423b2e0478a4d62c6b249346c123adec9 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 26 Mar 2020 16:47:05 -0700 Subject: [PATCH 20/54] test resource names --- ...st_sql_managed_db_long_term_retention.yaml | 54 +++++++++---------- .../sql/tests/latest/test_sql_commands.py | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml index ac6eee7f8ce..bf8bea51cfd 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -23,7 +23,7 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-03-26T21:40:37.797Z"}' @@ -119,10 +119,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/test-db-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/test-db-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache @@ -168,10 +168,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/test-db-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/test-db-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache @@ -220,7 +220,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -269,7 +269,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -315,10 +315,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -364,10 +364,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -413,10 +413,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -462,10 +462,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -511,10 +511,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -560,10 +560,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422%3B132297215180000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422%3B132297215180000000?api-version=2018-06-01-preview response: body: - string: '{"properties":{"managedInstanceName":"cli-ltr","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' + string: '{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' headers: cache-control: - no-cache @@ -609,10 +609,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang?api-version=2018-06-01-preview response: body: - string: '{"identity":{"principalId":"1cb932bf-850a-4f49-8ff1-75dec7ab388a","type":"SystemAssigned","tenantId":"0c1edf5d-e5c5-4aca-ab69-ef194134f44b"},"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":8},"properties":{"fullyQualifiedDomainName":"cli-ltr.4a50e5aa3565.database.windows.net","administratorLogin":"cloudSA","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Network/virtualNetworks/vnet-cli-ltr/subnets/ManagedInstance","state":"Ready","licenseType":"LicenseIncluded","vCores":8,"storageSizeInGB":256,"collation":"SQL_Latin1_General_CP1_CI_AS","dnsZone":"4a50e5aa3565","publicDataEndpointEnabled":false,"proxyOverride":"Proxy","timezoneId":"UTC"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr","name":"cli-ltr","type":"Microsoft.Sql/managedInstances"}' + string: '{"identity":{"principalId":"1cb932bf-850a-4f49-8ff1-75dec7ab388a","type":"SystemAssigned","tenantId":"0c1edf5d-e5c5-4aca-ab69-ef194134f44b"},"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":8},"properties":{"fullyQualifiedDomainName":"ayang.4a50e5aa3565.database.windows.net","administratorLogin":"cloudSA","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Network/virtualNetworks/vnet-ayang/subnets/ManagedInstance","state":"Ready","licenseType":"LicenseIncluded","vCores":8,"storageSizeInGB":256,"collation":"SQL_Latin1_General_CP1_CI_AS","dnsZone":"4a50e5aa3565","publicDataEndpointEnabled":false,"proxyOverride":"Proxy","timezoneId":"UTC"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang","name":"ayang","type":"Microsoft.Sql/managedInstances"}' headers: cache-control: - no-cache @@ -641,7 +641,7 @@ interactions: message: OK - request: body: '{"location": "westus", "properties": {"createMode": "RestoreLongTermRetentionBackup", - "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000"}}' + "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000"}}' headers: Accept: - application/json @@ -663,7 +663,7 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/cli-restore-dest?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-03-26T21:40:59.217Z"}' @@ -947,10 +947,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/cli-restore-dest?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-03-26T21:40:59.543Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/cli-ltr/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' + string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-03-26T21:40:59.543Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' headers: cache-control: - no-cache @@ -998,7 +998,7 @@ interactions: accept-language: - en-US method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422%3B132297215180000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422%3B132297215180000000?api-version=2018-06-01-preview response: body: string: '{"operation":"DeleteLTRBackup","startTime":"2020-03-26T21:42:15.973Z"}' @@ -1096,7 +1096,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/cli-ltr/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: string: '{"value":[]}' diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 095b5b3178b..96f24022e27 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3276,7 +3276,7 @@ def test_sql_managed_db_long_term_retention( # test restore managed database from LTR backup self.kwargs.update({ - 'dest_database_name': 'cli-restore-dest' + 'dest_database_name': 'cli-dest' }) self.cmd( From dcf401fb9e6522463b06d8e2999ae39c68704fcd Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 26 Mar 2020 17:00:37 -0700 Subject: [PATCH 21/54] fix a db name --- .../cli/command_modules/sql/tests/latest/test_sql_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 96f24022e27..095b5b3178b 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3276,7 +3276,7 @@ def test_sql_managed_db_long_term_retention( # test restore managed database from LTR backup self.kwargs.update({ - 'dest_database_name': 'cli-dest' + 'dest_database_name': 'cli-restore-dest' }) self.cmd( From b5b74a08545c5eceb7d2815d739b8c199728d6a9 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 30 Mar 2020 03:26:07 -0700 Subject: [PATCH 22/54] shorten 'long-term-retention' and '--only-latest-per-database' --- .../azure/cli/command_modules/sql/_help.py | 36 +++++++++---------- .../azure/cli/command_modules/sql/_params.py | 17 +++++---- .../azure/cli/command_modules/sql/commands.py | 4 +-- .../azure/cli/command_modules/sql/custom.py | 2 +- .../sql/tests/latest/test_sql_commands.py | 24 ++++++------- 5 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index 95110fc6e16..e6efa42ba9a 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -667,74 +667,74 @@ text: az sql midb short-term-retention-policy show -g mygroup --mi myinstance -n mymanageddb --deleted-time "2018-05-20T05:34:22" """ -helps['sql midb long-term-retention-policy'] = """ +helps['sql midb ltr-policy'] = """ type: group short-summary: Manage SQL Managed Instance database long term retention policy. """ -helps['sql midb long-term-retention-policy set'] = """ +helps['sql midb ltr-policy set'] = """ type: command short-summary: Update long term retention settings for a managed database. examples: - name: Set long term retention for a managed database. - text: az sql midb long-term-retention-policy set -g mygroup --mi myinstance -n mymanageddb --weekly-retention "P1W" --monthly-retention "P6M" --yearly-retention "P1Y" --week-of-year 26 + text: az sql midb ltr-policy set -g mygroup --mi myinstance -n mymanageddb --weekly-retention "P1W" --monthly-retention "P6M" --yearly-retention "P1Y" --week-of-year 26 """ -helps['sql midb long-term-retention-policy show'] = """ +helps['sql midb ltr-policy show'] = """ type: command short-summary: Show the long term retention policy for a managed database. examples: - name: Show long term retention policy for a managed database. - text: az sql midb long-term-retention-policy show -g mygroup --mi myinstance -n mymanageddb + text: az sql midb ltr-policy show -g mygroup --mi myinstance -n mymanageddb """ -helps['sql midb long-term-retention-backup'] = """ +helps['sql midb ltr-backup'] = """ type: group short-summary: Manage SQL Managed Instance database long term retention backups. """ -helps['sql midb long-term-retention-backup show'] = """ +helps['sql midb ltr-backup show'] = """ type: command short-summary: Get a long term retention backup for a managed database. examples: - name: Show long term retention backup for a managed database. - text: az sql midb long-term-retention-backup show -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + text: az sql midb ltr-backup show -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ -helps['sql midb long-term-retention-backup list-by-database'] = """ +helps['sql midb ltr-backup list-by-database'] = """ type: command short-summary: Get all long term retention backups for a managed database. examples: - name: List long term retention backups for a managed database. - text: az sql midb long-term-retention-backup list-by-database -l southeastasia --mi myinstance -n mymanageddb + text: az sql midb ltr-backup list-by-database -l southeastasia --mi myinstance -n mymanageddb """ -helps['sql midb long-term-retention-backup list-by-instance'] = """ +helps['sql midb ltr-backup list-by-instance'] = """ type: command short-summary: Get all long term retention backups for a managed instance. examples: - name: List long term retention backups for a managed instance (list only the latest LTR backups, which belong to live databases). - text: az sql midb long-term-retention-backup list-by-instance -l southeastasia --mi myinstance --database-state Live --only-latest-per-database True + text: az sql midb ltr-backup list-by-instance -l southeastasia --mi myinstance --database-state Live --only-latest-per-database True - name: List long term retention backups for a managed instance (with resource group argument). - text: az sql midb long-term-retention-backup list-by-instance -l southeastasia -g mygroup --mi myinstance + text: az sql midb ltr-backup list-by-instance -l southeastasia -g mygroup --mi myinstance """ -helps['sql midb long-term-retention-backup list-by-location'] = """ +helps['sql midb ltr-backup list-by-location'] = """ type: command short-summary: Get all long term retention backups for location. examples: - name: List long term retention backups for a location (list only the latest LTR backups, which belong to live databases). - text: az sql midb long-term-retention-backup list-by-location -l southeastasia --database-state Live --only-latest-per-database True + text: az sql midb ltr-backup list-by-location -l southeastasia --database-state Live --only-latest-per-database True - name: List long term retention backups for a location (with resource group argument). - text: az sql midb long-term-retention-backup list-by-location -l southeastasia -g mygroup + text: az sql midb ltr-backup list-by-location -l southeastasia -g mygroup """ -helps['sql midb long-term-retention-backup delete'] = """ +helps['sql midb ltr-backup delete'] = """ type: command short-summary: Delete a long term retention backup. examples: - name: Delete long term retention backup for a managed database. - text: az sql midb long-term-retention-backup delete -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + text: az sql midb ltr-backup delete -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ helps['sql server'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index ab041ce5d41..8670404fc12 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1535,7 +1535,8 @@ def _configure_security_policy_storage_params(arg_ctx): help='If specified, shows retention days for a deleted database, instead of an existing database.' 'Must match the deleted time of a deleted database on the source Managed Instance.') - with self.argument_context('sql midb long-term-retention-policy set') as c: + # LTR + with self.argument_context('sql midb ltr-policy set') as c: create_args_for_complex_type( c, 'parameters', ManagedDatabase, [ 'weekly_retention', @@ -1562,7 +1563,7 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('week_of_year', help='The Week of Year, 1 to 52, to save for the Yearly Retention.') - with self.argument_context('sql midb long-term-retention-backup') as c: + with self.argument_context('sql midb ltr-backup') as c: c.argument('location_name', required=True, arg_type=get_location_type(self.cli_ctx)) @@ -1571,36 +1572,38 @@ def _configure_security_policy_storage_params(arg_ctx): required=False, help='If specified, the resource group that the managed instance/database resource belongs to.') - with self.argument_context('sql midb long-term-retention-backup show') as c: + with self.argument_context('sql midb ltr-backup show') as c: c.argument('backup_name', options_list=['--backup-name', '-b'], - required=True, help='The long term retention backup name.') - with self.argument_context('sql midb long-term-retention-backup list-by-database') as c: + with self.argument_context('sql midb ltr-backup list-by-database') as c: c.argument('database_state', required=False, help='\'All\', \'Live\', or \'Deleted\'') c.argument('only_latest_per_database', + options_list=['--only-latest-per-database', '--latest'], required=False, help='If true, will only return the latest backup for each database') - with self.argument_context('sql midb long-term-retention-backup list-by-instance') as c: + with self.argument_context('sql midb ltr-backup list-by-instance') as c: c.argument('database_state', required=False, help='\'All\', \'Live\', or \'Deleted\'') c.argument('only_latest_per_database', + options_list=['--only-latest-per-database', '--latest'], required=False, help='If true, will only return the latest backup for each database') - with self.argument_context('sql midb long-term-retention-backup list-by-location') as c: + with self.argument_context('sql midb ltr-backup list-by-location') as c: c.argument('database_state', required=False, help='\'All\', \'Live\', or \'Deleted\'') c.argument('only_latest_per_database', + options_list=['--only-latest-per-database', '--latest'], required=False, help='If true, will only return the latest backup for each database') diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 5fe2396dd4e..03aea4377ee 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -584,7 +584,7 @@ def load_command_table(self, _): operations_tmpl='azure.mgmt.sql.operations#ManagedInstanceLongTermRetentionPoliciesOperations.{}', client_factory=get_sql_managed_database_long_term_retention_policies_operations) - with self.command_group('sql midb long-term-retention-policy', + with self.command_group('sql midb ltr-policy', managed_database_long_term_retention_policies_operations, client_factory=get_sql_managed_database_long_term_retention_policies_operations) as g: @@ -595,7 +595,7 @@ def load_command_table(self, _): operations_tmpl='azure.mgmt.sql.operations#LongTermRetentionManagedInstanceBackupsOperations.{}', client_factory=get_sql_managed_database_long_term_retention_backups_operations) - with self.command_group('sql midb long-term-retention-backup', + with self.command_group('sql midb ltr-backup', managed_database_long_term_retention_backups_operations, client_factory=get_sql_managed_database_long_term_retention_backups_operations) as g: g.show_command('show', 'get') diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 004c2025bca..2d02ec49141 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2739,7 +2739,7 @@ def update_long_term_retention_mi( Updates long term retention for managed database ''' if not (weekly_retention or monthly_retention or yearly_retention): - raise CLIError('Please specify retention setting(s).') + raise CLIError('Please specify retention setting(s). See \'--help\' for more details.') if yearly_retention and not week_of_year: raise CLIError('Please specify week of year for yearly retention.') diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 095b5b3178b..a6c7448894b 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3212,7 +3212,7 @@ def test_sql_managed_db_long_term_retention( # test update long term retention on live database self.cmd( - 'sql midb long-term-retention-policy set -g {rg} --mi {managed_instance_name} -n {database_name} --weekly-retention {weekly_retention} --monthly-retention {monthly_retention} --yearly-retention {yearly_retention} --week-of-year {week_of_year}', + 'sql midb ltr-policy set -g {rg} --mi {managed_instance_name} -n {database_name} --weekly-retention {weekly_retention} --monthly-retention {monthly_retention} --yearly-retention {yearly_retention} --week-of-year {week_of_year}', checks=[ self.check('resourceGroup', '{rg}'), self.check('weeklyRetention', '{weekly_retention}'), @@ -3221,7 +3221,7 @@ def test_sql_managed_db_long_term_retention( # test get long term retention policy on live database self.cmd( - 'sql midb long-term-retention-policy show -g {rg} --mi {managed_instance_name} -n {database_name}', + 'sql midb ltr-policy show -g {rg} --mi {managed_instance_name} -n {database_name}', checks=[ self.check('resourceGroup', '{rg}'), self.check('weeklyRetention', '{weekly_retention}'), @@ -3231,34 +3231,34 @@ def test_sql_managed_db_long_term_retention( # test list long term retention backups for location # with resource group self.cmd( - 'sql midb long-term-retention-backup list-by-location -l {loc} -g {rg}') + 'sql midb ltr-backup list-by-location -l {loc} -g {rg}') # without resource group self.cmd( - 'sql midb long-term-retention-backup list-by-location -l {loc}') + 'sql midb ltr-backup list-by-location -l {loc}') # test list long term retention backups for instance # should assert 1 result # with resource group self.cmd( - 'sql midb long-term-retention-backup list-by-instance -l {loc} --mi {managed_instance_name} -g {rg}') + 'sql midb ltr-backup list-by-instance -l {loc} --mi {managed_instance_name} -g {rg}') # without resource group self.cmd( - 'sql midb long-term-retention-backup list-by-instance -l {loc} --mi {managed_instance_name}') + 'sql midb ltr-backup list-by-instance -l {loc} --mi {managed_instance_name}') # test list long term retention backups for database # should assert 1 result # with resource group self.cmd( - 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} -g {rg}') + 'sql midb ltr-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} -g {rg}') # without resource group self.cmd( - 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}') + 'sql midb ltr-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}') # setup for test show long term retention backup backup = self.cmd( - 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} --only-latest-per-database True').get_output_in_json() + 'sql midb ltr-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} --latest True').get_output_in_json() self.kwargs.update({ 'backup_name': backup[0]['name'], @@ -3267,7 +3267,7 @@ def test_sql_managed_db_long_term_retention( # test show long term retention backup self.cmd( - 'sql midb long-term-retention-backup show -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name {backup_name}', + 'sql midb ltr-backup show -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name {backup_name}', checks=[ self.check('resourceGroup', '{rg}'), self.check('managedInstanceName', '{managed_instance_name}'), @@ -3287,10 +3287,10 @@ def test_sql_managed_db_long_term_retention( # test delete long term retention backup self.cmd( - 'sql midb long-term-retention-backup delete -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name \'{backup_name}\'') + 'sql midb ltr-backup delete -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name \'{backup_name}\'') # assert no backpus self.cmd( - 'sql midb long-term-retention-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}') + 'sql midb ltr-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}') class SqlManagedInstanceRestoreDeletedDbScenarioTest(ScenarioTest): From 72989c16ec7b8e16f081b951e243fd11d3e1b406 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 30 Mar 2020 03:34:49 -0700 Subject: [PATCH 23/54] updated recording --- ...st_sql_managed_db_long_term_retention.yaml | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml index bf8bea51cfd..ffce9de18aa 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -8,7 +8,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-policy set + - sql midb ltr-policy set Connection: - keep-alive Content-Length: @@ -63,7 +63,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-policy set + - sql midb ltr-policy set Connection: - keep-alive ParameterSetName: @@ -110,7 +110,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-policy set + - sql midb ltr-policy set Connection: - keep-alive ParameterSetName: @@ -157,7 +157,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-policy show + - sql midb ltr-policy show Connection: - keep-alive ParameterSetName: @@ -206,7 +206,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup list-by-location + - sql midb ltr-backup list-by-location Connection: - keep-alive ParameterSetName: @@ -255,7 +255,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup list-by-location + - sql midb ltr-backup list-by-location Connection: - keep-alive ParameterSetName: @@ -304,7 +304,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup list-by-instance + - sql midb ltr-backup list-by-instance Connection: - keep-alive ParameterSetName: @@ -353,7 +353,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup list-by-instance + - sql midb ltr-backup list-by-instance Connection: - keep-alive ParameterSetName: @@ -402,7 +402,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup list-by-database + - sql midb ltr-backup list-by-database Connection: - keep-alive ParameterSetName: @@ -451,7 +451,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup list-by-database + - sql midb ltr-backup list-by-database Connection: - keep-alive ParameterSetName: @@ -500,7 +500,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup list-by-database + - sql midb ltr-backup list-by-database Connection: - keep-alive ParameterSetName: @@ -549,7 +549,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup show + - sql midb ltr-backup show Connection: - keep-alive ParameterSetName: @@ -985,7 +985,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup delete + - sql midb ltr-backup delete Connection: - keep-alive Content-Length: @@ -1038,7 +1038,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup delete + - sql midb ltr-backup delete Connection: - keep-alive ParameterSetName: @@ -1085,7 +1085,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb long-term-retention-backup list-by-database + - sql midb ltr-backup list-by-database Connection: - keep-alive ParameterSetName: From ccf3da9ce5e6033539a1b5ef331f5172bf793cc1 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Tue, 31 Mar 2020 16:22:20 -0700 Subject: [PATCH 24/54] - consolidate all list-by-* to list - added ltr restore to pitr restore under managed db restore --- .../azure/cli/command_modules/sql/_help.py | 24 +-- .../azure/cli/command_modules/sql/_params.py | 108 +++++------- .../azure/cli/command_modules/sql/commands.py | 10 +- .../azure/cli/command_modules/sql/custom.py | 159 ++++++++++++------ 4 files changed, 157 insertions(+), 144 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index e6efa42ba9a..b3b5488d2fe 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -614,11 +614,13 @@ short-summary: Restore a managed database. examples: - name: Restore a live managed database using Point in time restore - text: az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" + text: az sql midb restore --mode PITR -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" - name: Restore a dropped managed database using Point in time restore - text: az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --deleted-time "2018-05-20T05:34:22" + text: az sql midb restore --mode PITR -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --deleted-time "2018-05-20T05:34:22" - name: Restore a live managed database from another instance using Point in time restore - text: az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --dest-mi targetmi --dest-resource-group targetrg + text: az sql midb restore --mode PITR -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --dest-mi targetmi --dest-resource-group targetrg + - name: Restore a managed database using a LTR backup. + text: az sql midb restore --mode LTR --dest-name targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ helps['sql midb show'] = """ @@ -701,28 +703,16 @@ text: az sql midb ltr-backup show -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ -helps['sql midb ltr-backup list-by-database'] = """ +helps['sql midb ltr-backup list'] = """ type: command -short-summary: Get all long term retention backups for a managed database. +short-summary: List the long term retention backups for a location, instance or database. examples: - name: List long term retention backups for a managed database. text: az sql midb ltr-backup list-by-database -l southeastasia --mi myinstance -n mymanageddb -""" - -helps['sql midb ltr-backup list-by-instance'] = """ -type: command -short-summary: Get all long term retention backups for a managed instance. -examples: - name: List long term retention backups for a managed instance (list only the latest LTR backups, which belong to live databases). text: az sql midb ltr-backup list-by-instance -l southeastasia --mi myinstance --database-state Live --only-latest-per-database True - name: List long term retention backups for a managed instance (with resource group argument). text: az sql midb ltr-backup list-by-instance -l southeastasia -g mygroup --mi myinstance -""" - -helps['sql midb ltr-backup list-by-location'] = """ -type: command -short-summary: Get all long term retention backups for location. -examples: - name: List long term retention backups for a location (list only the latest LTR backups, which belong to live databases). text: az sql midb ltr-backup list-by-location -l southeastasia --database-state Live --only-latest-per-database True - name: List long term retention backups for a location (with resource group argument). diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 8670404fc12..6d679145805 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1442,13 +1442,27 @@ def _configure_security_policy_storage_params(arg_ctx): 'deleted_time', 'target_managed_database_name', 'target_managed_instance_name', - 'restore_point_in_time' + 'restore_point_in_time', + 'long_term_retention_backup_resource_id', + 'restore_mode' ]) - c.argument('deleted_time', - options_list=['--deleted-time'], - help='If specified, restore from a deleted database instead of from an existing database.' - ' Must match the deleted time of a deleted database on the source Managed Instance.') + c.argument( + 'restore_mode', + options_list=['--restore-mode', '--mode'], + required=True, + help='Restore mode. ' + '\'PITR\' (point in time restore) or \'LTR\' (restore long term retention backup)') + + c.argument('database-name', + help='The name of the Azure SQL Managed Database. Required for PITR.') + + c.argument('managed_instance_name', + help='Name of the Azure SQL managed instance. Required for PITR.') + + c.argument('resource_group_name', + help='Name of resource group. You can configure the default group ' + 'using `az configure --defaults group=`. Required for PITR.') c.argument('target_managed_database_name', options_list=['--dest-name'], @@ -1459,54 +1473,39 @@ def _configure_security_policy_storage_params(arg_ctx): options_list=['--dest-mi'], help='Name of the managed instance to restore managed database to. ' 'This can be same managed instance, or another managed instance on same subscription. ' - 'When not specified it defaults to source managed instance.') + 'When not specified for PITR it defaults to source managed instance. ' + 'Required for LTR.') c.argument('target_resource_group_name', options_list=['--dest-resource-group'], help='Name of the resource group of the managed instance to restore managed database to. ' - 'When not specified it defaults to source resource group.') + 'When not specified for PITR it defaults to source resource group. ' + 'Required for LTR.') restore_point_arg_group = 'Restore Point' c.argument('restore_point_in_time', options_list=['--time', '-t'], arg_group=restore_point_arg_group, - required=True, help='The point in time of the source database that will be restored to create the' ' new database. Must be greater than or equal to the source database\'s' ' earliestRestoreDate value. ' + time_format_help) - with self.argument_context('sql midb ltr restore') as c: - create_args_for_complex_type( - c, 'parameters', ManagedDatabase, [ - 'target_managed_database_name', - 'target_managed_instance_name', - 'target_resource_group_name' - ]) - - c.argument( - 'long_term_retention_backup_resource_id', - options_list=['--backup-id'], - help='The resource id of the long term retention backup to be restored.') + c.argument('deleted_time', + options_list=['--deleted-time'], + arg_group=restore_point_arg_group, + help='If specified, restore from a deleted database instead of from an existing database.' + ' Must match the deleted time of a deleted database on the source Managed Instance.') - c.argument( - 'target_managed_database_name', - options_list=['--dest-name'], - required=True, - help='Name of the managed database that will be created as the restore destination.') + restore_ltr_backup_arg_group = 'Restore LTR Backup' - c.argument( - 'target_managed_instance_name', - options_list=['--dest-mi'], - help='Name of the managed instance to restore managed database to. ' - 'This can be same managed instance, or another managed instance on same subscription. ' - 'When not specified it defaults to source managed instance.') + c.argument('long_term_retention_backup_resource_id', + options_list=['--backup-id'], + arg_group=restore_ltr_backup_arg_group, + required=False, + help='The resource id of the long term retention backup to be restored. ' + 'Use az sql midb ltr-backup show or az sql midb ltr-backup list for backup id.') - c.argument( - 'target_resource_group_name', - options_list=['--dest-resource-group'], - help='Name of the resource group of the managed instance to restore managed database to. ' - 'When not specified it defaults to source resource group.') with self.argument_context('sql midb short-term-retention-policy set') as c: create_args_for_complex_type( @@ -1535,7 +1534,6 @@ def _configure_security_policy_storage_params(arg_ctx): help='If specified, shows retention days for a deleted database, instead of an existing database.' 'Must match the deleted time of a deleted database on the source Managed Instance.') - # LTR with self.argument_context('sql midb ltr-policy set') as c: create_args_for_complex_type( c, 'parameters', ManagedDatabase, [ @@ -1569,35 +1567,19 @@ def _configure_security_policy_storage_params(arg_ctx): arg_type=get_location_type(self.cli_ctx)) c.argument('resource_group_name', - required=False, - help='If specified, the resource group that the managed instance/database resource belongs to.') - - with self.argument_context('sql midb ltr-backup show') as c: - c.argument('backup_name', - options_list=['--backup-name', '-b'], - help='The long term retention backup name.') + required=False) - with self.argument_context('sql midb ltr-backup list-by-database') as c: - c.argument('database_state', - required=False, - help='\'All\', \'Live\', or \'Deleted\'') - - c.argument('only_latest_per_database', - options_list=['--only-latest-per-database', '--latest'], - required=False, - help='If true, will only return the latest backup for each database') - - with self.argument_context('sql midb ltr-backup list-by-instance') as c: - c.argument('database_state', - required=False, - help='\'All\', \'Live\', or \'Deleted\'') + with self.argument_context('sql midb ltr-backup list') as c: + c.argument('managed_instance_name', + options_list=['--managed-instance', '--mi'], + help='Name of the Azure SQL managed instance. ' + 'If specified, retrieves all requested backups under this managed instance.') - c.argument('only_latest_per_database', - options_list=['--only-latest-per-database', '--latest'], - required=False, - help='If true, will only return the latest backup for each database') + c.argument('database_name', + options_list=['--name', '-n'], + help='The name of the Azure SQL Managed Database. ' + 'If specified (along with instance name), retrieves all requested backups under this database.') - with self.argument_context('sql midb ltr-backup list-by-location') as c: c.argument('database_state', required=False, help='\'All\', \'Live\', or \'Deleted\'') diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 03aea4377ee..2d6189e9204 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -600,14 +600,8 @@ def load_command_table(self, _): client_factory=get_sql_managed_database_long_term_retention_backups_operations) as g: g.show_command('show', 'get') g.custom_command( - 'list-by-database', - 'list_by_database_long_term_retention_mi_backup') - g.custom_command( - 'list-by-instance', - 'list_by_instance_long_term_retention_mi_backup') - g.custom_command( - 'list-by-location', - 'list_by_location_long_term_retention_mi_backup') + 'list', + 'list_long_term_retention_mi_backups') g.command('delete', 'delete') ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 2d02ec49141..579dbb0d8d7 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2580,78 +2580,84 @@ def managed_db_create( def managed_db_restore( cmd, client, - database_name, - managed_instance_name, - resource_group_name, + restore_mode, target_managed_database_name, target_managed_instance_name=None, target_resource_group_name=None, + database_name=None, + managed_instance_name=None, + resource_group_name=None, deleted_time=None, + long_term_retention_backup_resource_id=None, **kwargs): ''' - Restores an existing managed DB (i.e. create with 'PointInTimeRestore' create mode.) + Restores a managed database. Custom function makes create mode more convenient. ''' - if not target_managed_instance_name: - target_managed_instance_name = managed_instance_name + if restore_mode == 'PITR': + if not resource_group_name or not managed_instance_name or not database_name: + raise CLIError('Please specify source resource(s). ' + 'Resource group, instance, and database are all required for point in time restore.') - if not target_resource_group_name: - target_resource_group_name = resource_group_name + if not target_managed_instance_name: + target_managed_instance_name = managed_instance_name - kwargs['location'] = _get_managed_instance_location( - cmd.cli_ctx, - managed_instance_name=managed_instance_name, - resource_group_name=resource_group_name) - - kwargs['create_mode'] = CreateMode.point_in_time_restore.value + if not target_resource_group_name: + target_resource_group_name = resource_group_name - if deleted_time: - kwargs['restorable_dropped_database_id'] = _get_managed_dropped_db_resource_id( - cmd.cli_ctx, - resource_group_name, - managed_instance_name, - database_name, - deleted_time) - else: - kwargs['source_database_id'] = _get_managed_db_resource_id( + kwargs['location'] = _get_managed_instance_location( cmd.cli_ctx, - resource_group_name, - managed_instance_name, - database_name) + managed_instance_name=managed_instance_name, + resource_group_name=resource_group_name) - return client.create_or_update( - database_name=target_managed_database_name, - managed_instance_name=target_managed_instance_name, - resource_group_name=target_resource_group_name, - parameters=kwargs) + kwargs['create_mode'] = CreateMode.point_in_time_restore.value + if deleted_time: + kwargs['restorable_dropped_database_id'] = _get_managed_dropped_db_resource_id( + cmd.cli_ctx, + resource_group_name, + managed_instance_name, + database_name, + deleted_time) + else: + kwargs['source_database_id'] = _get_managed_db_resource_id( + cmd.cli_ctx, + resource_group_name, + managed_instance_name, + database_name) + + return client.create_or_update( + database_name=target_managed_database_name, + managed_instance_name=target_managed_instance_name, + resource_group_name=target_resource_group_name, + parameters=kwargs) + + if restore_mode == 'LTR': + if not target_resource_group_name or not target_managed_instance_name or not target_managed_database_name: + raise CLIError('Please specify target resource(s). ' + 'Target resource group, target instance, and target database ' + 'are all required for restore LTR backup.') + + if not long_term_retention_backup_resource_id: + raise CLIError('Please specify a long term retention backup.') + + kwargs['location'] = _get_managed_instance_location( + cmd.cli_ctx, + managed_instance_name=target_managed_instance_name, + resource_group_name=target_resource_group_name) -def managed_db_restore_ltr_backup( - cmd, - client, - long_term_retention_backup_resource_id, - target_managed_database_name, - target_managed_instance_name, - target_resource_group_name, - **kwargs): - ''' - Restores a managed database from a long term retention backup. - ''' - kwargs['location'] = _get_managed_instance_location( - cmd.cli_ctx, - managed_instance_name=target_managed_instance_name, - resource_group_name=target_resource_group_name) + kwargs['create_mode'] = CreateMode.restore_long_term_retention_backup.value + kwargs['long_term_retention_backup_resource_id'] = long_term_retention_backup_resource_id - kwargs['create_mode'] = CreateMode.restore_long_term_retention_backup.value - kwargs['long_term_retention_backup_resource_id'] = long_term_retention_backup_resource_id + return client.create_or_update( + database_name=target_managed_database_name, + managed_instance_name=target_managed_instance_name, + resource_group_name=target_resource_group_name, + parameters=kwargs) - return client.create_or_update( - database_name=target_managed_database_name, - managed_instance_name=target_managed_instance_name, - resource_group_name=target_resource_group_name, - parameters=kwargs) + raise CLIError('Please specify valid restore mode.') def update_short_term_retention_mi( @@ -2761,7 +2767,7 @@ def update_long_term_retention_mi( return policy -def list_by_database_long_term_retention_mi_backup( +def list_by_database_long_term_retention_mi_backups( client, location_name, managed_instance_name, @@ -2792,7 +2798,7 @@ def list_by_database_long_term_retention_mi_backup( return backups -def list_by_instance_long_term_retention_mi_backup( +def list_by_instance_long_term_retention_mi_backups( client, location_name, managed_instance_name, @@ -2820,7 +2826,7 @@ def list_by_instance_long_term_retention_mi_backup( return backups -def list_by_location_long_term_retention_mi_backup( +def list_by_location_long_term_retention_mi_backups( client, location_name, resource_group_name=None, @@ -2844,6 +2850,47 @@ def list_by_location_long_term_retention_mi_backup( return backups + +def list_long_term_retention_mi_backups( + client, + location_name, + managed_instance_name=None, + database_name=None, + resource_group_name=None, + only_latest_per_database=None, + database_state=None): + ''' + List the long term retention backups for a specified location, instance, or database. + ''' + + if managed_instance_name: + if database_name: + backups = list_by_database_long_term_retention_mi_backups( + client, + location_name, + managed_instance_name, + database_name, + resource_group_name, + only_latest_per_database, + database_state) + else: + backups = list_by_instance_long_term_retention_mi_backups( + client, + location_name, + managed_instance_name, + resource_group_name, + only_latest_per_database, + database_state) + else: + backups = list_by_location_long_term_retention_mi_backups( + client, + location_name, + resource_group_name, + only_latest_per_database, + database_state) + + return backups + ############################################### # sql failover-group # ############################################### From 561da9fe8fc4ef564bc4076c357e4fec0b5e735c Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Tue, 31 Mar 2020 16:24:25 -0700 Subject: [PATCH 25/54] remove ltr restore from help --- .../azure/cli/command_modules/sql/_help.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index b3b5488d2fe..44c4f1aeb12 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -631,19 +631,6 @@ text: az sql midb show -g mygroup --mi myinstance -n mymanageddb """ -helps['sql midb ltr'] = """ -type: group -short-summary: Managed SQL Managed Instance databases long term retention. -""" - -helps['sql midb ltr restore'] = """ -type: command -short-summary: Restore a managed database from a long term retention backup. -examples: - - name: Restore a managed database using a LTR backup. - text: az sql midb ltr restore --dest-name targetmidb --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" -""" - helps['sql midb short-term-retention-policy'] = """ type: group short-summary: Manage SQL Managed Instance database backup short term retention policy. From eb981f15f51de9226774aec8765c4b742190da78 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Tue, 31 Mar 2020 16:46:49 -0700 Subject: [PATCH 26/54] updated test recording for ltr --- ...st_sql_managed_db_long_term_retention.yaml | 226 +++++++++--------- .../sql/tests/latest/test_sql_commands.py | 28 +-- 2 files changed, 126 insertions(+), 128 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml index ffce9de18aa..7ee600466dd 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -23,13 +23,13 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-03-26T21:40:37.797Z"}' + string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-03-31T23:38:39.313Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/8945b3a0-54cf-4bdb-8a14-e0b0aba22ae5?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/31e82697-e84c-4c92-918b-bbfd6efd6529?api-version=2018-06-01-preview cache-control: - no-cache content-length: @@ -37,11 +37,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:36 GMT + - Tue, 31 Mar 2020 23:38:38 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/8945b3a0-54cf-4bdb-8a14-e0b0aba22ae5?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/31e82697-e84c-4c92-918b-bbfd6efd6529?api-version=2018-06-01-preview pragma: - no-cache server: @@ -72,10 +72,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/8945b3a0-54cf-4bdb-8a14-e0b0aba22ae5?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/31e82697-e84c-4c92-918b-bbfd6efd6529?api-version=2018-06-01-preview response: body: - string: '{"name":"8945b3a0-54cf-4bdb-8a14-e0b0aba22ae5","status":"Succeeded","startTime":"2020-03-26T21:40:37.797Z"}' + string: '{"name":"31e82697-e84c-4c92-918b-bbfd6efd6529","status":"Succeeded","startTime":"2020-03-31T23:38:39.313Z"}' headers: cache-control: - no-cache @@ -84,7 +84,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:52 GMT + - Tue, 31 Mar 2020 23:38:54 GMT expires: - '-1' pragma: @@ -119,19 +119,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/test-db-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache content-length: - - '401' + - '408' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:52 GMT + - Tue, 31 Mar 2020 23:38:54 GMT expires: - '-1' pragma: @@ -168,19 +168,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/test-db-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/test-db-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache content-length: - - '401' + - '408' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:53 GMT + - Tue, 31 Mar 2020 23:38:55 GMT expires: - '-1' pragma: @@ -206,7 +206,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr-backup list-by-location + - sql midb ltr-backup list Connection: - keep-alive ParameterSetName: @@ -220,16 +220,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-1","backupTime":"2020-03-30T07:03:02Z","backupExpirationTime":"2020-04-06T07:03:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-1/longTermRetentionManagedInstanceBackups/9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","name":"9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '727' + - '2209' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:54 GMT + - Tue, 31 Mar 2020 23:38:56 GMT expires: - '-1' pragma: @@ -255,7 +255,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr-backup list-by-location + - sql midb ltr-backup list Connection: - keep-alive ParameterSetName: @@ -269,16 +269,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-1","backupTime":"2020-03-30T07:03:02Z","backupExpirationTime":"2020-04-06T07:03:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-1/longTermRetentionManagedInstanceBackups/9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","name":"9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '727' + - '2209' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:54 GMT + - Tue, 31 Mar 2020 23:38:57 GMT expires: - '-1' pragma: @@ -304,7 +304,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr-backup list-by-instance + - sql midb ltr-backup list Connection: - keep-alive ParameterSetName: @@ -315,19 +315,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-1","backupTime":"2020-03-30T07:03:02Z","backupExpirationTime":"2020-04-06T07:03:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-1/longTermRetentionManagedInstanceBackups/9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","name":"9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '727' + - '2209' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:55 GMT + - Tue, 31 Mar 2020 23:38:56 GMT expires: - '-1' pragma: @@ -353,7 +353,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr-backup list-by-instance + - sql midb ltr-backup list Connection: - keep-alive ParameterSetName: @@ -364,19 +364,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-1","backupTime":"2020-03-30T07:03:02Z","backupExpirationTime":"2020-04-06T07:03:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-1/longTermRetentionManagedInstanceBackups/9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","name":"9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '727' + - '2209' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:55 GMT + - Tue, 31 Mar 2020 23:38:57 GMT expires: - '-1' pragma: @@ -402,7 +402,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr-backup list-by-database + - sql midb ltr-backup list Connection: - keep-alive ParameterSetName: @@ -413,19 +413,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '727' + - '741' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:55 GMT + - Tue, 31 Mar 2020 23:38:57 GMT expires: - '-1' pragma: @@ -451,7 +451,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr-backup list-by-database + - sql midb ltr-backup list Connection: - keep-alive ParameterSetName: @@ -462,19 +462,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '727' + - '741' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:57 GMT + - Tue, 31 Mar 2020 23:38:58 GMT expires: - '-1' pragma: @@ -500,30 +500,30 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr-backup list-by-database + - sql midb ltr-backup list Connection: - keep-alive ParameterSetName: - - -l --mi -n --only-latest-per-database + - -l --mi -n --latest User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '727' + - '741' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:56 GMT + - Tue, 31 Mar 2020 23:38:59 GMT expires: - '-1' pragma: @@ -560,19 +560,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422%3B132297215180000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3%3B132300226820000000?api-version=2018-06-01-preview response: body: - string: '{"properties":{"managedInstanceName":"ayang","managedInstanceCreateTime":"2020-03-25T18:23:46.447Z","databaseName":"test-db-1","backupTime":"2020-03-26T18:38:38Z","backupExpirationTime":"2020-04-02T18:38:38Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","name":"d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' + string: '{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' headers: cache-control: - no-cache content-length: - - '715' + - '729' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:58 GMT + - Tue, 31 Mar 2020 23:38:59 GMT expires: - '-1' pragma: @@ -598,30 +598,30 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb restore Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --mode --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr?api-version=2018-06-01-preview response: body: - string: '{"identity":{"principalId":"1cb932bf-850a-4f49-8ff1-75dec7ab388a","type":"SystemAssigned","tenantId":"0c1edf5d-e5c5-4aca-ab69-ef194134f44b"},"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":8},"properties":{"fullyQualifiedDomainName":"ayang.4a50e5aa3565.database.windows.net","administratorLogin":"cloudSA","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Network/virtualNetworks/vnet-ayang/subnets/ManagedInstance","state":"Ready","licenseType":"LicenseIncluded","vCores":8,"storageSizeInGB":256,"collation":"SQL_Latin1_General_CP1_CI_AS","dnsZone":"4a50e5aa3565","publicDataEndpointEnabled":false,"proxyOverride":"Proxy","timezoneId":"UTC"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang","name":"ayang","type":"Microsoft.Sql/managedInstances"}' + string: '{"identity":{"principalId":"b00ec781-bbe4-48c9-a0e5-b404e3f40ddc","type":"SystemAssigned","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47"},"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":4},"properties":{"fullyQualifiedDomainName":"ayang-ltr.8ca2b7c55495.database.windows.net","administratorLogin":"cloudSA","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Network/virtualNetworks/vnet-ayang-ltr/subnets/ManagedInstance","state":"Ready","licenseType":"LicenseIncluded","vCores":4,"storageSizeInGB":32,"collation":"SQL_Latin1_General_CP1_CI_AS","dnsZone":"8ca2b7c55495","publicDataEndpointEnabled":false,"proxyOverride":"Proxy","timezoneId":"UTC"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr","name":"ayang-ltr","type":"Microsoft.Sql/managedInstances"}' headers: cache-control: - no-cache content-length: - - '951' + - '966' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:58 GMT + - Tue, 31 Mar 2020 23:39:00 GMT expires: - '-1' pragma: @@ -641,35 +641,35 @@ interactions: message: OK - request: body: '{"location": "westus", "properties": {"createMode": "RestoreLongTermRetentionBackup", - "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422;132297215180000000"}}' + "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000"}}' headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb restore Connection: - keep-alive Content-Length: - - '425' + - '432' Content-Type: - application/json; charset=utf-8 ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --mode --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/cli-restore-dest?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-03-26T21:40:59.217Z"}' + string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-03-31T23:39:01.553Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview cache-control: - no-cache content-length: @@ -677,11 +677,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:40:59 GMT + - Tue, 31 Mar 2020 23:39:01 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview pragma: - no-cache server: @@ -691,7 +691,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1198' + - '1199' status: code: 202 message: Accepted @@ -703,19 +703,19 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb restore Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --mode --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview response: body: - string: '{"name":"44f74e18-7496-4f73-ac2b-eeae3b068db3","status":"InProgress","startTime":"2020-03-26T21:40:59.217Z"}' + string: '{"name":"2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f","status":"InProgress","startTime":"2020-03-31T23:39:01.553Z"}' headers: cache-control: - no-cache @@ -724,7 +724,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:41:14 GMT + - Tue, 31 Mar 2020 23:39:16 GMT expires: - '-1' pragma: @@ -750,19 +750,19 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb restore Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --mode --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview response: body: - string: '{"name":"44f74e18-7496-4f73-ac2b-eeae3b068db3","status":"InProgress","startTime":"2020-03-26T21:40:59.217Z"}' + string: '{"name":"2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f","status":"InProgress","startTime":"2020-03-31T23:39:01.553Z"}' headers: cache-control: - no-cache @@ -771,7 +771,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:41:29 GMT + - Tue, 31 Mar 2020 23:39:31 GMT expires: - '-1' pragma: @@ -797,19 +797,19 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb restore Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --mode --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview response: body: - string: '{"name":"44f74e18-7496-4f73-ac2b-eeae3b068db3","status":"InProgress","startTime":"2020-03-26T21:40:59.217Z"}' + string: '{"name":"2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f","status":"InProgress","startTime":"2020-03-31T23:39:01.553Z"}' headers: cache-control: - no-cache @@ -818,7 +818,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:41:44 GMT + - Tue, 31 Mar 2020 23:39:46 GMT expires: - '-1' pragma: @@ -844,19 +844,19 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb restore Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --mode --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview response: body: - string: '{"name":"44f74e18-7496-4f73-ac2b-eeae3b068db3","status":"InProgress","startTime":"2020-03-26T21:40:59.217Z"}' + string: '{"name":"2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f","status":"InProgress","startTime":"2020-03-31T23:39:01.553Z"}' headers: cache-control: - no-cache @@ -865,7 +865,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:41:59 GMT + - Tue, 31 Mar 2020 23:40:01 GMT expires: - '-1' pragma: @@ -891,19 +891,19 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb restore Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --mode --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/44f74e18-7496-4f73-ac2b-eeae3b068db3?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview response: body: - string: '{"name":"44f74e18-7496-4f73-ac2b-eeae3b068db3","status":"Succeeded","startTime":"2020-03-26T21:40:59.217Z"}' + string: '{"name":"2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f","status":"Succeeded","startTime":"2020-03-31T23:39:01.553Z"}' headers: cache-control: - no-cache @@ -912,7 +912,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:42:14 GMT + - Tue, 31 Mar 2020 23:40:16 GMT expires: - '-1' pragma: @@ -938,28 +938,28 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb restore Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --mode --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/cli-restore-dest?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-03-26T21:40:59.543Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' + string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-03-31T23:39:01.88Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' headers: cache-control: - no-cache content-length: - - '417' + - '420' content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:42:14 GMT + - Tue, 31 Mar 2020 23:40:16 GMT expires: - '-1' pragma: @@ -998,13 +998,13 @@ interactions: accept-language: - en-US method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups/d6474865-3e44-488e-9e38-7e23d1559422%3B132297215180000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3%3B132300226820000000?api-version=2018-06-01-preview response: body: - string: '{"operation":"DeleteLTRBackup","startTime":"2020-03-26T21:42:15.973Z"}' + string: '{"operation":"DeleteLTRBackup","startTime":"2020-03-31T23:40:18.543Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/becdd262-7caf-4672-9b3c-784b3d970e25?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/4390b149-73fc-419c-83ab-f46f0ff2b3fb?api-version=2018-06-01-preview cache-control: - no-cache content-length: @@ -1012,11 +1012,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:42:15 GMT + - Tue, 31 Mar 2020 23:40:17 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/becdd262-7caf-4672-9b3c-784b3d970e25?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/4390b149-73fc-419c-83ab-f46f0ff2b3fb?api-version=2018-06-01-preview pragma: - no-cache server: @@ -1026,7 +1026,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-deletes: - - '14998' + - '14999' status: code: 202 message: Accepted @@ -1047,10 +1047,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/becdd262-7caf-4672-9b3c-784b3d970e25?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/4390b149-73fc-419c-83ab-f46f0ff2b3fb?api-version=2018-06-01-preview response: body: - string: '{"name":"becdd262-7caf-4672-9b3c-784b3d970e25","status":"Succeeded","startTime":"2020-03-26T21:42:15.973Z"}' + string: '{"name":"4390b149-73fc-419c-83ab-f46f0ff2b3fb","status":"Succeeded","startTime":"2020-03-31T23:40:18.543Z"}' headers: cache-control: - no-cache @@ -1059,7 +1059,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:42:30 GMT + - Tue, 31 Mar 2020 23:40:32 GMT expires: - '-1' pragma: @@ -1085,7 +1085,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr-backup list-by-database + - sql midb ltr-backup list Connection: - keep-alive ParameterSetName: @@ -1096,7 +1096,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang/longTermRetentionDatabases/test-db-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: string: '{"value":[]}' @@ -1108,7 +1108,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 26 Mar 2020 21:42:32 GMT + - Tue, 31 Mar 2020 23:40:34 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index a6c7448894b..bffc90c00e8 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3202,8 +3202,8 @@ def test_sql_managed_db_long_term_retention( self.kwargs.update({ 'rg': 'clitest4vtazvlqbo', 'loc': 'westus', - 'managed_instance_name': 'ayang', - 'database_name': 'test-db-1', + 'managed_instance_name': 'ayang-ltr', + 'database_name': 'ayang-ltr-db', 'weekly_retention': 'P1W', 'monthly_retention': 'P1M', 'yearly_retention': 'P2M', @@ -3231,34 +3231,32 @@ def test_sql_managed_db_long_term_retention( # test list long term retention backups for location # with resource group self.cmd( - 'sql midb ltr-backup list-by-location -l {loc} -g {rg}') + 'sql midb ltr-backup list -l {loc} -g {rg}') # without resource group self.cmd( - 'sql midb ltr-backup list-by-location -l {loc}') + 'sql midb ltr-backup list -l {loc}') # test list long term retention backups for instance - # should assert 1 result # with resource group self.cmd( - 'sql midb ltr-backup list-by-instance -l {loc} --mi {managed_instance_name} -g {rg}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -g {rg}') # without resource group self.cmd( - 'sql midb ltr-backup list-by-instance -l {loc} --mi {managed_instance_name}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name}') # test list long term retention backups for database - # should assert 1 result # with resource group self.cmd( - 'sql midb ltr-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} -g {rg}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -n {database_name} -g {rg}') # without resource group self.cmd( - 'sql midb ltr-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -n {database_name}') # setup for test show long term retention backup backup = self.cmd( - 'sql midb ltr-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name} --latest True').get_output_in_json() + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -n {database_name} --latest True').get_output_in_json() self.kwargs.update({ 'backup_name': backup[0]['name'], @@ -3280,7 +3278,7 @@ def test_sql_managed_db_long_term_retention( }) self.cmd( - 'sql midb ltr restore --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}', + 'sql midb restore --mode LTR --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}', checks=[ self.check('resourceGroup', '{rg}'), self.check('name', '{dest_database_name}')]) @@ -3290,7 +3288,7 @@ def test_sql_managed_db_long_term_retention( 'sql midb ltr-backup delete -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name \'{backup_name}\'') # assert no backpus self.cmd( - 'sql midb ltr-backup list-by-database -l {loc} --mi {managed_instance_name} -n {database_name}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -n {database_name}') class SqlManagedInstanceRestoreDeletedDbScenarioTest(ScenarioTest): @@ -3381,7 +3379,7 @@ def test_sql_managed_deleted_db_restore(self, resource_group, resource_group_loc }) # test restore deleted database - self.cmd('sql midb restore -g {rg} --mi {managed_instance_name} -n {database_name} --dest-name {restored_database_name} --deleted-time {deleted_time} --time {deleted_time}', + self.cmd('sql midb restore --mode PITR -g {rg} --mi {managed_instance_name} -n {database_name} --dest-name {restored_database_name} --deleted-time {deleted_time} --time {deleted_time}', checks=[ self.check('resourceGroup', '{rg}'), self.check('name', '{restored_database_name}'), @@ -3444,7 +3442,7 @@ def test_sql_managed_db_mgmt(self): time.sleep(300) # Sleeping 5 minutes should be enough for the restore to be possible (Skipped under playback mode) # test sql db restore command - db1 = self.cmd('sql midb restore -g {} --mi {} -n {} --dest-name {} --time {}' + db1 = self.cmd('sql midb restore --mode PITR -g {} --mi {} -n {} --dest-name {} --time {}' .format(resource_group_1, managed_instance_name_1, database_name, database_name_restored, datetime.utcnow().isoformat()), checks=[ JMESPathCheck('resourceGroup', resource_group_1), From 7534e97a338fc2ad22f89d789391078c010758cd Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Tue, 31 Mar 2020 16:58:53 -0700 Subject: [PATCH 27/54] remove managed_db_restore_ltr_backup from commands --- src/azure-cli/azure/cli/command_modules/sql/commands.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 2d6189e9204..80f1b244626 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -561,11 +561,6 @@ def load_command_table(self, _): g.command('list', 'list_by_instance') g.command('delete', 'delete', confirmation=True, supports_no_wait=True) - with self.command_group('sql midb ltr', - managed_databases_operations, - client_factory=get_sql_managed_databases_operations) as g: - g.custom_command('restore', 'managed_db_restore_ltr_backup') - managed_backup_short_term_retention_policies_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#ManagedBackupShortTermRetentionPoliciesOperations.{}', client_factory=get_sql_managed_backup_short_term_retention_policies_operations) From 57277e58f9cf5927d220fe829dcb274bae5bee92 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Tue, 31 Mar 2020 17:08:59 -0700 Subject: [PATCH 28/54] replace "list-by-*" with "list" in help --- src/azure-cli/azure/cli/command_modules/sql/_help.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index 44c4f1aeb12..2b08f599516 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -695,15 +695,15 @@ short-summary: List the long term retention backups for a location, instance or database. examples: - name: List long term retention backups for a managed database. - text: az sql midb ltr-backup list-by-database -l southeastasia --mi myinstance -n mymanageddb + text: az sql midb ltr-backup list -l southeastasia --mi myinstance -n mymanageddb - name: List long term retention backups for a managed instance (list only the latest LTR backups, which belong to live databases). - text: az sql midb ltr-backup list-by-instance -l southeastasia --mi myinstance --database-state Live --only-latest-per-database True + text: az sql midb ltr-backup list -l southeastasia --mi myinstance --database-state Live --only-latest-per-database True - name: List long term retention backups for a managed instance (with resource group argument). - text: az sql midb ltr-backup list-by-instance -l southeastasia -g mygroup --mi myinstance + text: az sql midb ltr-backup list -l southeastasia -g mygroup --mi myinstance - name: List long term retention backups for a location (list only the latest LTR backups, which belong to live databases). - text: az sql midb ltr-backup list-by-location -l southeastasia --database-state Live --only-latest-per-database True + text: az sql midb ltr-backup list -l southeastasia --database-state Live --only-latest-per-database True - name: List long term retention backups for a location (with resource group argument). - text: az sql midb ltr-backup list-by-location -l southeastasia -g mygroup + text: az sql midb ltr-backup list -l southeastasia -g mygroup """ helps['sql midb ltr-backup delete'] = """ From 5ad302f41d9f61a6fe8ac9b62011d9304151b76e Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Tue, 31 Mar 2020 17:46:36 -0700 Subject: [PATCH 29/54] remove blank lines from params --- src/azure-cli/azure/cli/command_modules/sql/_params.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 6d679145805..3f805d309e0 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1506,7 +1506,6 @@ def _configure_security_policy_storage_params(arg_ctx): help='The resource id of the long term retention backup to be restored. ' 'Use az sql midb ltr-backup show or az sql midb ltr-backup list for backup id.') - with self.argument_context('sql midb short-term-retention-policy set') as c: create_args_for_complex_type( c, 'parameters', ManagedDatabase, [ From c935c15246f21e5282d38e9affa63ce0e716eebd Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Fri, 3 Apr 2020 16:08:46 -0700 Subject: [PATCH 30/54] revert restore ltr backup command to be separate from PITR --- .../azure/cli/command_modules/sql/_help.py | 22 ++- .../azure/cli/command_modules/sql/_params.py | 64 ++++---- .../azure/cli/command_modules/sql/commands.py | 8 + .../azure/cli/command_modules/sql/custom.py | 147 +++++++++--------- .../sql/tests/latest/test_sql_commands.py | 5 +- 5 files changed, 134 insertions(+), 112 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index 2b08f599516..7316d1cc9fd 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -614,13 +614,11 @@ short-summary: Restore a managed database. examples: - name: Restore a live managed database using Point in time restore - text: az sql midb restore --mode PITR -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" + text: az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" - name: Restore a dropped managed database using Point in time restore - text: az sql midb restore --mode PITR -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --deleted-time "2018-05-20T05:34:22" + text: az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --deleted-time "2018-05-20T05:34:22" - name: Restore a live managed database from another instance using Point in time restore - text: az sql midb restore --mode PITR -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --dest-mi targetmi --dest-resource-group targetrg - - name: Restore a managed database using a LTR backup. - text: az sql midb restore --mode LTR --dest-name targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + text: az sql midb restore -g mygroup --mi myinstance -n mymanageddb --dest-name targetmidb --time "2018-05-20T05:34:22" --dest-mi targetmi --dest-resource-group targetrg """ helps['sql midb show'] = """ @@ -706,6 +704,20 @@ text: az sql midb ltr-backup list -l southeastasia -g mygroup """ +helps['sql midb ltr'] = """ +type: group +short-summary: Managed SQL Managed Instance database long term retention. +""" + +helps['sql midb ltr restore'] = """ +type: command +short-summary: Restore a long term retention backup to a new database. +examples: + - name: Restore a managed database using LTR backup. + text: az sql midb restore --dest-name targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" +""" + + helps['sql midb ltr-backup delete'] = """ type: command short-summary: Delete a long term retention backup. diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 3f805d309e0..57b0025753c 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1442,27 +1442,13 @@ def _configure_security_policy_storage_params(arg_ctx): 'deleted_time', 'target_managed_database_name', 'target_managed_instance_name', - 'restore_point_in_time', - 'long_term_retention_backup_resource_id', - 'restore_mode' + 'restore_point_in_time' ]) - c.argument( - 'restore_mode', - options_list=['--restore-mode', '--mode'], - required=True, - help='Restore mode. ' - '\'PITR\' (point in time restore) or \'LTR\' (restore long term retention backup)') - - c.argument('database-name', - help='The name of the Azure SQL Managed Database. Required for PITR.') - - c.argument('managed_instance_name', - help='Name of the Azure SQL managed instance. Required for PITR.') - - c.argument('resource_group_name', - help='Name of resource group. You can configure the default group ' - 'using `az configure --defaults group=`. Required for PITR.') + c.argument('deleted_time', + options_list=['--deleted-time'], + help='If specified, restore from a deleted database instead of from an existing database.' + ' Must match the deleted time of a deleted database on the source Managed Instance.') c.argument('target_managed_database_name', options_list=['--dest-name'], @@ -1473,13 +1459,12 @@ def _configure_security_policy_storage_params(arg_ctx): options_list=['--dest-mi'], help='Name of the managed instance to restore managed database to. ' 'This can be same managed instance, or another managed instance on same subscription. ' - 'When not specified for PITR it defaults to source managed instance. ' - 'Required for LTR.') + 'When not specified it defaults to source managed instance. ') c.argument('target_resource_group_name', options_list=['--dest-resource-group'], help='Name of the resource group of the managed instance to restore managed database to. ' - 'When not specified for PITR it defaults to source resource group. ' + 'When not specified it defaults to source resource group. ' 'Required for LTR.') restore_point_arg_group = 'Restore Point' @@ -1487,6 +1472,7 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('restore_point_in_time', options_list=['--time', '-t'], arg_group=restore_point_arg_group, + required=True, help='The point in time of the source database that will be restored to create the' ' new database. Must be greater than or equal to the source database\'s' ' earliestRestoreDate value. ' + time_format_help) @@ -1497,15 +1483,6 @@ def _configure_security_policy_storage_params(arg_ctx): help='If specified, restore from a deleted database instead of from an existing database.' ' Must match the deleted time of a deleted database on the source Managed Instance.') - restore_ltr_backup_arg_group = 'Restore LTR Backup' - - c.argument('long_term_retention_backup_resource_id', - options_list=['--backup-id'], - arg_group=restore_ltr_backup_arg_group, - required=False, - help='The resource id of the long term retention backup to be restored. ' - 'Use az sql midb ltr-backup show or az sql midb ltr-backup list for backup id.') - with self.argument_context('sql midb short-term-retention-policy set') as c: create_args_for_complex_type( c, 'parameters', ManagedDatabase, [ @@ -1588,6 +1565,31 @@ def _configure_security_policy_storage_params(arg_ctx): required=False, help='If true, will only return the latest backup for each database') + with self.argument_context('sql midb ltr restore') as c: + c.argument('target_managed_database_name', + options_list=['--dest-name'], + required=True, + help='Name of the managed database that will be created as the restore destination.') + + c.argument('target_managed_instance_name', + options_list=['--dest-mi'], + help='Name of the managed instance to restore managed database to. ' + 'This can be same managed instance, or another managed instance on same subscription. ' + 'When not specified it defaults to source managed instance. ') + + c.argument('target_resource_group_name', + options_list=['--dest-resource-group'], + help='Name of the resource group of the managed instance to restore managed database to. ' + 'When not specified it defaults to source resource group. ' + 'Required for LTR.') + + c.argument('long_term_retention_backup_resource_id', + options_list=['--backup-id'], + required=True, + help='The resource id of the long term retention backup to be restored. ' + 'Use \'az sql midb ltr-backup show\' or \'az sql midb ltr-backup list\' for backup id.') + + ############################################### # sql virtual cluster # ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 80f1b244626..b891750a44c 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -599,6 +599,14 @@ def load_command_table(self, _): 'list_long_term_retention_mi_backups') g.command('delete', 'delete') + with self.command_group('sql midb ltr', + managed_databases_operations, + client_factory=get_sql_managed_databases_operations) as g: + g.custom_command( + 'restore', + 'restore_long_term_retention_backup', + supports_no_wait=True) + ############################################### # sql virtual cluster # ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 579dbb0d8d7..d9a3aa9287f 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2580,84 +2580,52 @@ def managed_db_create( def managed_db_restore( cmd, client, - restore_mode, + database_name, + managed_instance_name, + resource_group_name, target_managed_database_name, target_managed_instance_name=None, target_resource_group_name=None, - database_name=None, - managed_instance_name=None, - resource_group_name=None, deleted_time=None, - long_term_retention_backup_resource_id=None, **kwargs): ''' - Restores a managed database. + Restores an existing managed DB (i.e. create with 'PointInTimeRestore' create mode.) Custom function makes create mode more convenient. ''' - if restore_mode == 'PITR': - if not resource_group_name or not managed_instance_name or not database_name: - raise CLIError('Please specify source resource(s). ' - 'Resource group, instance, and database are all required for point in time restore.') - - if not target_managed_instance_name: - target_managed_instance_name = managed_instance_name + if not target_managed_instance_name: + target_managed_instance_name = managed_instance_name - if not target_resource_group_name: - target_resource_group_name = resource_group_name + if not target_resource_group_name: + target_resource_group_name = resource_group_name - kwargs['location'] = _get_managed_instance_location( - cmd.cli_ctx, - managed_instance_name=managed_instance_name, - resource_group_name=resource_group_name) - - kwargs['create_mode'] = CreateMode.point_in_time_restore.value - - if deleted_time: - kwargs['restorable_dropped_database_id'] = _get_managed_dropped_db_resource_id( - cmd.cli_ctx, - resource_group_name, - managed_instance_name, - database_name, - deleted_time) - else: - kwargs['source_database_id'] = _get_managed_db_resource_id( - cmd.cli_ctx, - resource_group_name, - managed_instance_name, - database_name) - - return client.create_or_update( - database_name=target_managed_database_name, - managed_instance_name=target_managed_instance_name, - resource_group_name=target_resource_group_name, - parameters=kwargs) - - if restore_mode == 'LTR': - if not target_resource_group_name or not target_managed_instance_name or not target_managed_database_name: - raise CLIError('Please specify target resource(s). ' - 'Target resource group, target instance, and target database ' - 'are all required for restore LTR backup.') + kwargs['location'] = _get_managed_instance_location( + cmd.cli_ctx, + managed_instance_name=managed_instance_name, + resource_group_name=resource_group_name) - if not long_term_retention_backup_resource_id: - raise CLIError('Please specify a long term retention backup.') + kwargs['create_mode'] = CreateMode.point_in_time_restore.value - kwargs['location'] = _get_managed_instance_location( + if deleted_time: + kwargs['restorable_dropped_database_id'] = _get_managed_dropped_db_resource_id( cmd.cli_ctx, - managed_instance_name=target_managed_instance_name, - resource_group_name=target_resource_group_name) - - kwargs['create_mode'] = CreateMode.restore_long_term_retention_backup.value - kwargs['long_term_retention_backup_resource_id'] = long_term_retention_backup_resource_id - - return client.create_or_update( - database_name=target_managed_database_name, - managed_instance_name=target_managed_instance_name, - resource_group_name=target_resource_group_name, - parameters=kwargs) + resource_group_name, + managed_instance_name, + database_name, + deleted_time) + else: + kwargs['source_database_id'] = _get_managed_db_resource_id( + cmd.cli_ctx, + resource_group_name, + managed_instance_name, + database_name) - raise CLIError('Please specify valid restore mode.') + return client.create_or_update( + database_name=target_managed_database_name, + managed_instance_name=target_managed_instance_name, + resource_group_name=target_resource_group_name, + parameters=kwargs) def update_short_term_retention_mi( @@ -2767,7 +2735,7 @@ def update_long_term_retention_mi( return policy -def list_by_database_long_term_retention_mi_backups( +def _list_by_database_long_term_retention_mi_backups( client, location_name, managed_instance_name, @@ -2776,7 +2744,7 @@ def list_by_database_long_term_retention_mi_backups( only_latest_per_database=None, database_state=None): ''' - Lists the long term retention backups for a Managed Database + Gets the long term retention backups for a Managed Database ''' if resource_group_name: @@ -2798,7 +2766,7 @@ def list_by_database_long_term_retention_mi_backups( return backups -def list_by_instance_long_term_retention_mi_backups( +def _list_by_instance_long_term_retention_mi_backups( client, location_name, managed_instance_name, @@ -2806,7 +2774,7 @@ def list_by_instance_long_term_retention_mi_backups( only_latest_per_database=None, database_state=None): ''' - Lists the long term retention backups within a Managed Instance + Gets the long term retention backups within a Managed Instance ''' if resource_group_name: @@ -2826,14 +2794,14 @@ def list_by_instance_long_term_retention_mi_backups( return backups -def list_by_location_long_term_retention_mi_backups( +def _list_by_location_long_term_retention_mi_backups( client, location_name, resource_group_name=None, only_latest_per_database=None, database_state=None): ''' - Lists the long term retention backups within a specified region. + Gets the long term retention backups within a specified region. ''' if resource_group_name: @@ -2860,12 +2828,12 @@ def list_long_term_retention_mi_backups( only_latest_per_database=None, database_state=None): ''' - List the long term retention backups for a specified location, instance, or database. + Lists the long term retention backups for a specified location, instance, or database. ''' if managed_instance_name: if database_name: - backups = list_by_database_long_term_retention_mi_backups( + backups = _list_by_database_long_term_retention_mi_backups( client, location_name, managed_instance_name, @@ -2873,16 +2841,20 @@ def list_long_term_retention_mi_backups( resource_group_name, only_latest_per_database, database_state) + else: - backups = list_by_instance_long_term_retention_mi_backups( + backups = _list_by_instance_long_term_retention_mi_backups( client, location_name, managed_instance_name, resource_group_name, only_latest_per_database, + database_name, + resource_group_name, + only_latest_per_database, database_state) else: - backups = list_by_location_long_term_retention_mi_backups( + backups = _list_by_location_long_term_retention_mi_backups( client, location_name, resource_group_name, @@ -2891,6 +2863,37 @@ def list_long_term_retention_mi_backups( return backups +def restore_long_term_retention_backup( + cmd, + client, + long_term_retention_backup_resource_id, + target_managed_database_name, + target_managed_instance_name, + target_resource_group_name, + **kwargs): + + if not target_resource_group_name or not target_managed_instance_name or not target_managed_database_name: + raise CLIError('Please specify target resource(s). ' + 'Target resource group, target instance, and target database ' + 'are all required for restore LTR backup.') + + if not long_term_retention_backup_resource_id: + raise CLIError('Please specify a long term retention backup.') + + kwargs['location'] = _get_managed_instance_location( + cmd.cli_ctx, + managed_instance_name=target_managed_instance_name, + resource_group_name=target_resource_group_name) + + kwargs['create_mode'] = CreateMode.restore_long_term_retention_backup.value + kwargs['long_term_retention_backup_resource_id'] = long_term_retention_backup_resource_id + + return client.create_or_update( + database_name=target_managed_database_name, + managed_instance_name=target_managed_instance_name, + resource_group_name=target_resource_group_name, + parameters=kwargs) + ############################################### # sql failover-group # ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index bffc90c00e8..1e52a990091 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3278,10 +3278,7 @@ def test_sql_managed_db_long_term_retention( }) self.cmd( - 'sql midb restore --mode LTR --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}', - checks=[ - self.check('resourceGroup', '{rg}'), - self.check('name', '{dest_database_name}')]) + 'sql midb ltr restore --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg} --no-wait') # test delete long term retention backup self.cmd( From 687e9bb7b02339fa200b006b118ab29a746bcc65 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Fri, 3 Apr 2020 17:09:39 -0700 Subject: [PATCH 31/54] re-recorded --- .../azure/cli/command_modules/sql/_help.py | 1 - .../azure/cli/command_modules/sql/custom.py | 3 - ...st_sql_managed_db_long_term_retention.yaml | 206 +++++++++--------- .../sql/tests/latest/test_sql_commands.py | 4 +- 4 files changed, 105 insertions(+), 109 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index 7316d1cc9fd..401c014fbe2 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -717,7 +717,6 @@ text: az sql midb restore --dest-name targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ - helps['sql midb ltr-backup delete'] = """ type: command short-summary: Delete a long term retention backup. diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index d9a3aa9287f..8b0348bfb72 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2849,9 +2849,6 @@ def list_long_term_retention_mi_backups( managed_instance_name, resource_group_name, only_latest_per_database, - database_name, - resource_group_name, - only_latest_per_database, database_state) else: backups = _list_by_location_long_term_retention_mi_backups( diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml index 7ee600466dd..00f51ddd095 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -23,25 +23,25 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-03-31T23:38:39.313Z"}' + string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-04-04T00:04:34.51Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/31e82697-e84c-4c92-918b-bbfd6efd6529?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/f9105993-983e-4ad4-8184-10d8317a8d36?api-version=2018-06-01-preview cache-control: - no-cache content-length: - - '91' + - '90' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:38 GMT + - Sat, 04 Apr 2020 00:04:34 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/31e82697-e84c-4c92-918b-bbfd6efd6529?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/f9105993-983e-4ad4-8184-10d8317a8d36?api-version=2018-06-01-preview pragma: - no-cache server: @@ -72,19 +72,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/31e82697-e84c-4c92-918b-bbfd6efd6529?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/f9105993-983e-4ad4-8184-10d8317a8d36?api-version=2018-06-01-preview response: body: - string: '{"name":"31e82697-e84c-4c92-918b-bbfd6efd6529","status":"Succeeded","startTime":"2020-03-31T23:38:39.313Z"}' + string: '{"name":"f9105993-983e-4ad4-8184-10d8317a8d36","status":"Succeeded","startTime":"2020-04-04T00:04:34.51Z"}' headers: cache-control: - no-cache content-length: - - '107' + - '106' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:54 GMT + - Sat, 04 Apr 2020 00:04:49 GMT expires: - '-1' pragma: @@ -119,19 +119,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db-2/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache content-length: - - '408' + - '410' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:54 GMT + - Sat, 04 Apr 2020 00:04:49 GMT expires: - '-1' pragma: @@ -168,19 +168,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db-2/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache content-length: - - '408' + - '410' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:55 GMT + - Sat, 04 Apr 2020 00:04:50 GMT expires: - '-1' pragma: @@ -220,16 +220,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-1","backupTime":"2020-03-30T07:03:02Z","backupExpirationTime":"2020-04-06T07:03:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-1/longTermRetentionManagedInstanceBackups/9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","name":"9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2209' + - '745' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:56 GMT + - Sat, 04 Apr 2020 00:04:51 GMT expires: - '-1' pragma: @@ -269,16 +269,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-1","backupTime":"2020-03-30T07:03:02Z","backupExpirationTime":"2020-04-06T07:03:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-1/longTermRetentionManagedInstanceBackups/9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","name":"9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2209' + - '745' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:57 GMT + - Sat, 04 Apr 2020 00:04:51 GMT expires: - '-1' pragma: @@ -318,16 +318,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-1","backupTime":"2020-03-30T07:03:02Z","backupExpirationTime":"2020-04-06T07:03:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-1/longTermRetentionManagedInstanceBackups/9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","name":"9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2209' + - '745' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:56 GMT + - Sat, 04 Apr 2020 00:04:51 GMT expires: - '-1' pragma: @@ -367,16 +367,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-1","backupTime":"2020-03-30T07:03:02Z","backupExpirationTime":"2020-04-06T07:03:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-1/longTermRetentionManagedInstanceBackups/9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","name":"9073ec00-8c06-4642-bcec-9d546458541e;132300253820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2209' + - '745' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:57 GMT + - Sat, 04 Apr 2020 00:04:52 GMT expires: - '-1' pragma: @@ -413,19 +413,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '741' + - '745' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:57 GMT + - Sat, 04 Apr 2020 00:04:53 GMT expires: - '-1' pragma: @@ -462,19 +462,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '741' + - '745' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:58 GMT + - Sat, 04 Apr 2020 00:04:53 GMT expires: - '-1' pragma: @@ -511,19 +511,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '741' + - '745' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:59 GMT + - Sat, 04 Apr 2020 00:04:54 GMT expires: - '-1' pragma: @@ -560,19 +560,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3%3B132300226820000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a%3B132300259830000000?api-version=2018-06-01-preview response: body: - string: '{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db","backupTime":"2020-03-30T06:18:02Z","backupExpirationTime":"2020-04-06T06:18:02Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","name":"d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' + string: '{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' headers: cache-control: - no-cache content-length: - - '729' + - '733' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:38:59 GMT + - Sat, 04 Apr 2020 00:04:54 GMT expires: - '-1' pragma: @@ -598,11 +598,11 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb restore + - sql midb ltr restore Connection: - keep-alive ParameterSetName: - - --mode --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 @@ -621,7 +621,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:39:00 GMT + - Sat, 04 Apr 2020 00:04:55 GMT expires: - '-1' pragma: @@ -641,22 +641,22 @@ interactions: message: OK - request: body: '{"location": "westus", "properties": {"createMode": "RestoreLongTermRetentionBackup", - "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3;132300226820000000"}}' + "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000"}}' headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - sql midb restore + - sql midb ltr restore Connection: - keep-alive Content-Length: - - '432' + - '434' Content-Type: - application/json; charset=utf-8 ParameterSetName: - - --mode --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 @@ -666,22 +666,22 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-03-31T23:39:01.553Z"}' + string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-04-04T00:04:56.47Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview cache-control: - no-cache content-length: - - '95' + - '94' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:39:01 GMT + - Sat, 04 Apr 2020 00:04:55 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview pragma: - no-cache server: @@ -703,28 +703,28 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb restore + - sql midb ltr restore Connection: - keep-alive ParameterSetName: - - --mode --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview response: body: - string: '{"name":"2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f","status":"InProgress","startTime":"2020-03-31T23:39:01.553Z"}' + string: '{"name":"1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70","status":"InProgress","startTime":"2020-04-04T00:04:56.47Z"}' headers: cache-control: - no-cache content-length: - - '108' + - '107' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:39:16 GMT + - Sat, 04 Apr 2020 00:05:11 GMT expires: - '-1' pragma: @@ -750,28 +750,28 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb restore + - sql midb ltr restore Connection: - keep-alive ParameterSetName: - - --mode --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview response: body: - string: '{"name":"2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f","status":"InProgress","startTime":"2020-03-31T23:39:01.553Z"}' + string: '{"name":"1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70","status":"InProgress","startTime":"2020-04-04T00:04:56.47Z"}' headers: cache-control: - no-cache content-length: - - '108' + - '107' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:39:31 GMT + - Sat, 04 Apr 2020 00:05:26 GMT expires: - '-1' pragma: @@ -797,28 +797,28 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb restore + - sql midb ltr restore Connection: - keep-alive ParameterSetName: - - --mode --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview response: body: - string: '{"name":"2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f","status":"InProgress","startTime":"2020-03-31T23:39:01.553Z"}' + string: '{"name":"1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70","status":"InProgress","startTime":"2020-04-04T00:04:56.47Z"}' headers: cache-control: - no-cache content-length: - - '108' + - '107' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:39:46 GMT + - Sat, 04 Apr 2020 00:05:41 GMT expires: - '-1' pragma: @@ -844,28 +844,28 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb restore + - sql midb ltr restore Connection: - keep-alive ParameterSetName: - - --mode --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview response: body: - string: '{"name":"2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f","status":"InProgress","startTime":"2020-03-31T23:39:01.553Z"}' + string: '{"name":"1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70","status":"InProgress","startTime":"2020-04-04T00:04:56.47Z"}' headers: cache-control: - no-cache content-length: - - '108' + - '107' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:40:01 GMT + - Sat, 04 Apr 2020 00:05:56 GMT expires: - '-1' pragma: @@ -891,28 +891,28 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb restore + - sql midb ltr restore Connection: - keep-alive ParameterSetName: - - --mode --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview response: body: - string: '{"name":"2a8f5afd-d6ac-49cb-acc6-fc7fdb3c930f","status":"Succeeded","startTime":"2020-03-31T23:39:01.553Z"}' + string: '{"name":"1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70","status":"Succeeded","startTime":"2020-04-04T00:04:56.47Z"}' headers: cache-control: - no-cache content-length: - - '107' + - '106' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:40:16 GMT + - Sat, 04 Apr 2020 00:06:11 GMT expires: - '-1' pragma: @@ -938,11 +938,11 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb restore + - sql midb ltr restore Connection: - keep-alive ParameterSetName: - - --mode --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-name --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 @@ -950,16 +950,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-03-31T23:39:01.88Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' + string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-04-04T00:04:56.847Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' headers: cache-control: - no-cache content-length: - - '420' + - '421' content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:40:16 GMT + - Sat, 04 Apr 2020 00:06:11 GMT expires: - '-1' pragma: @@ -998,13 +998,13 @@ interactions: accept-language: - en-US method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups/d7c7e78f-3719-4ff8-af0a-76743cc620a3%3B132300226820000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a%3B132300259830000000?api-version=2018-06-01-preview response: body: - string: '{"operation":"DeleteLTRBackup","startTime":"2020-03-31T23:40:18.543Z"}' + string: '{"operation":"DeleteLTRBackup","startTime":"2020-04-04T00:06:13.237Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/4390b149-73fc-419c-83ab-f46f0ff2b3fb?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/6eb9acc1-d891-4c54-8bfd-08fa1bbea8b5?api-version=2018-06-01-preview cache-control: - no-cache content-length: @@ -1012,11 +1012,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:40:17 GMT + - Sat, 04 Apr 2020 00:06:13 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/4390b149-73fc-419c-83ab-f46f0ff2b3fb?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/6eb9acc1-d891-4c54-8bfd-08fa1bbea8b5?api-version=2018-06-01-preview pragma: - no-cache server: @@ -1047,10 +1047,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/4390b149-73fc-419c-83ab-f46f0ff2b3fb?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/6eb9acc1-d891-4c54-8bfd-08fa1bbea8b5?api-version=2018-06-01-preview response: body: - string: '{"name":"4390b149-73fc-419c-83ab-f46f0ff2b3fb","status":"Succeeded","startTime":"2020-03-31T23:40:18.543Z"}' + string: '{"name":"6eb9acc1-d891-4c54-8bfd-08fa1bbea8b5","status":"Succeeded","startTime":"2020-04-04T00:06:13.237Z"}' headers: cache-control: - no-cache @@ -1059,7 +1059,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:40:32 GMT + - Sat, 04 Apr 2020 00:06:28 GMT expires: - '-1' pragma: @@ -1096,7 +1096,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: string: '{"value":[]}' @@ -1108,7 +1108,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 31 Mar 2020 23:40:34 GMT + - Sat, 04 Apr 2020 00:06:29 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 1e52a990091..2f31ec6f3af 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3203,7 +3203,7 @@ def test_sql_managed_db_long_term_retention( 'rg': 'clitest4vtazvlqbo', 'loc': 'westus', 'managed_instance_name': 'ayang-ltr', - 'database_name': 'ayang-ltr-db', + 'database_name': 'ayang-ltr-db-2', 'weekly_retention': 'P1W', 'monthly_retention': 'P1M', 'yearly_retention': 'P2M', @@ -3278,7 +3278,7 @@ def test_sql_managed_db_long_term_retention( }) self.cmd( - 'sql midb ltr restore --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg} --no-wait') + 'sql midb ltr restore --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}') # test delete long term retention backup self.cmd( From 9661b272c2eaff327cc8b5034bcbaf576dc84bc4 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Fri, 3 Apr 2020 17:17:46 -0700 Subject: [PATCH 32/54] change help to use ltr restore --- .../azure/cli/command_modules/sql/_help.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index 401c014fbe2..7d807c9e968 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -704,6 +704,14 @@ text: az sql midb ltr-backup list -l southeastasia -g mygroup """ +helps['sql midb ltr-backup delete'] = """ +type: command +short-summary: Delete a long term retention backup. +examples: + - name: Delete long term retention backup for a managed database. + text: az sql midb ltr-backup delete -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" +""" + helps['sql midb ltr'] = """ type: group short-summary: Managed SQL Managed Instance database long term retention. @@ -714,15 +722,7 @@ short-summary: Restore a long term retention backup to a new database. examples: - name: Restore a managed database using LTR backup. - text: az sql midb restore --dest-name targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" -""" - -helps['sql midb ltr-backup delete'] = """ -type: command -short-summary: Delete a long term retention backup. -examples: - - name: Delete long term retention backup for a managed database. - text: az sql midb ltr-backup delete -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + text: az sql midb ltr restore --dest-name targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ helps['sql server'] = """ From 920401f09f2d0936a67f5591f61373d93e626e36 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Fri, 3 Apr 2020 19:05:14 -0700 Subject: [PATCH 33/54] undo changes for restore (pitr) --- .../azure/cli/command_modules/sql/_params.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 57b0025753c..629ae05b578 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1459,13 +1459,12 @@ def _configure_security_policy_storage_params(arg_ctx): options_list=['--dest-mi'], help='Name of the managed instance to restore managed database to. ' 'This can be same managed instance, or another managed instance on same subscription. ' - 'When not specified it defaults to source managed instance. ') + 'When not specified it defaults to source managed instance.') c.argument('target_resource_group_name', options_list=['--dest-resource-group'], help='Name of the resource group of the managed instance to restore managed database to. ' - 'When not specified it defaults to source resource group. ' - 'Required for LTR.') + 'When not specified it defaults to source resource group.') restore_point_arg_group = 'Restore Point' @@ -1477,12 +1476,6 @@ def _configure_security_policy_storage_params(arg_ctx): ' new database. Must be greater than or equal to the source database\'s' ' earliestRestoreDate value. ' + time_format_help) - c.argument('deleted_time', - options_list=['--deleted-time'], - arg_group=restore_point_arg_group, - help='If specified, restore from a deleted database instead of from an existing database.' - ' Must match the deleted time of a deleted database on the source Managed Instance.') - with self.argument_context('sql midb short-term-retention-policy set') as c: create_args_for_complex_type( c, 'parameters', ManagedDatabase, [ From 4d3935180ce3ab7fed04eda26613277c43b6c646 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 6 Apr 2020 00:34:10 -0700 Subject: [PATCH 34/54] revert changes in PITR restore tests --- .../cli/command_modules/sql/tests/latest/test_sql_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 2f31ec6f3af..0f6d7ec287c 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3376,7 +3376,7 @@ def test_sql_managed_deleted_db_restore(self, resource_group, resource_group_loc }) # test restore deleted database - self.cmd('sql midb restore --mode PITR -g {rg} --mi {managed_instance_name} -n {database_name} --dest-name {restored_database_name} --deleted-time {deleted_time} --time {deleted_time}', + self.cmd('sql midb restore -g {rg} --mi {managed_instance_name} -n {database_name} --dest-name {restored_database_name} --deleted-time {deleted_time} --time {deleted_time}', checks=[ self.check('resourceGroup', '{rg}'), self.check('name', '{restored_database_name}'), @@ -3439,7 +3439,7 @@ def test_sql_managed_db_mgmt(self): time.sleep(300) # Sleeping 5 minutes should be enough for the restore to be possible (Skipped under playback mode) # test sql db restore command - db1 = self.cmd('sql midb restore --mode PITR -g {} --mi {} -n {} --dest-name {} --time {}' + db1 = self.cmd('sql midb restore -g {} --mi {} -n {} --dest-name {} --time {}' .format(resource_group_1, managed_instance_name_1, database_name, database_name_restored, datetime.utcnow().isoformat()), checks=[ JMESPathCheck('resourceGroup', resource_group_1), From dd0eb2de0ee0b22409da7422759ff7c86a2a932a Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 6 Apr 2020 00:55:11 -0700 Subject: [PATCH 35/54] style/pylint --- .../azure/cli/command_modules/sql/_params.py | 1 - .../azure/cli/command_modules/sql/custom.py | 22 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 629ae05b578..e1b30a7140f 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1582,7 +1582,6 @@ def _configure_security_policy_storage_params(arg_ctx): help='The resource id of the long term retention backup to be restored. ' 'Use \'az sql midb ltr-backup show\' or \'az sql midb ltr-backup list\' for backup id.') - ############################################### # sql virtual cluster # ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 8b0348bfb72..3c3a917c537 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2860,19 +2860,23 @@ def list_long_term_retention_mi_backups( return backups + def restore_long_term_retention_backup( - cmd, - client, - long_term_retention_backup_resource_id, - target_managed_database_name, - target_managed_instance_name, - target_resource_group_name, - **kwargs): + cmd, + client, + long_term_retention_backup_resource_id, + target_managed_database_name, + target_managed_instance_name, + target_resource_group_name, + **kwargs): + ''' + Restores an existing managed DB (i.e. create with 'RestoreLongTermRetentionBackup' create mode.) + ''' if not target_resource_group_name or not target_managed_instance_name or not target_managed_database_name: raise CLIError('Please specify target resource(s). ' - 'Target resource group, target instance, and target database ' - 'are all required for restore LTR backup.') + 'Target resource group, target instance, and target database ' + 'are all required for restore LTR backup.') if not long_term_retention_backup_resource_id: raise CLIError('Please specify a long term retention backup.') From 223b945b239e17fde8bebefae1681a6dc88e0099 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 6 Apr 2020 15:35:47 -0700 Subject: [PATCH 36/54] moved restore under ltr-backup --- .../azure/cli/command_modules/sql/_help.py | 7 +- .../azure/cli/command_modules/sql/_params.py | 13 +- .../azure/cli/command_modules/sql/commands.py | 3 +- ...st_sql_managed_db_long_term_retention.yaml | 194 +++++++++--------- .../sql/tests/latest/test_sql_commands.py | 8 +- 5 files changed, 111 insertions(+), 114 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index 7d807c9e968..d9cb36d711c 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -712,12 +712,7 @@ text: az sql midb ltr-backup delete -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ -helps['sql midb ltr'] = """ -type: group -short-summary: Managed SQL Managed Instance database long term retention. -""" - -helps['sql midb ltr restore'] = """ +helps['sql midb ltr-backup restore'] = """ type: command short-summary: Restore a long term retention backup to a new database. examples: diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index e1b30a7140f..5e12031912b 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1533,10 +1533,8 @@ def _configure_security_policy_storage_params(arg_ctx): with self.argument_context('sql midb ltr-backup') as c: c.argument('location_name', required=True, - arg_type=get_location_type(self.cli_ctx)) - - c.argument('resource_group_name', - required=False) + arg_type=get_location_type(self.cli_ctx), + help='The location of the desired backups.') with self.argument_context('sql midb ltr-backup list') as c: c.argument('managed_instance_name', @@ -1551,14 +1549,17 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('database_state', required=False, - help='\'All\', \'Live\', or \'Deleted\'') + options_list=['--database-state', '--state'], + help='\'All\', \'Live\', or \'Deleted\'. ' + 'Will fetch backups only from databases of specified state. ' + 'If no state provied, defaults to \'All\'.') c.argument('only_latest_per_database', options_list=['--only-latest-per-database', '--latest'], required=False, help='If true, will only return the latest backup for each database') - with self.argument_context('sql midb ltr restore') as c: + with self.argument_context('sql midb ltr-backup restore') as c: c.argument('target_managed_database_name', options_list=['--dest-name'], required=True, diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index b891750a44c..96b2886a65d 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -599,13 +599,14 @@ def load_command_table(self, _): 'list_long_term_retention_mi_backups') g.command('delete', 'delete') - with self.command_group('sql midb ltr', + with self.command_group('sql midb ltr-backup', managed_databases_operations, client_factory=get_sql_managed_databases_operations) as g: g.custom_command( 'restore', 'restore_long_term_retention_backup', supports_no_wait=True) + g.wait_command('wait') ############################################### # sql virtual cluster # diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml index 00f51ddd095..92b58f3b8a7 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -23,25 +23,25 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-04-04T00:04:34.51Z"}' + string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-04-06T22:03:11.813Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/f9105993-983e-4ad4-8184-10d8317a8d36?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/66025821-1bf1-47f2-9c07-eb00389fed0b?api-version=2018-06-01-preview cache-control: - no-cache content-length: - - '90' + - '91' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:34 GMT + - Mon, 06 Apr 2020 22:03:11 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/f9105993-983e-4ad4-8184-10d8317a8d36?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/66025821-1bf1-47f2-9c07-eb00389fed0b?api-version=2018-06-01-preview pragma: - no-cache server: @@ -72,19 +72,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/f9105993-983e-4ad4-8184-10d8317a8d36?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/66025821-1bf1-47f2-9c07-eb00389fed0b?api-version=2018-06-01-preview response: body: - string: '{"name":"f9105993-983e-4ad4-8184-10d8317a8d36","status":"Succeeded","startTime":"2020-04-04T00:04:34.51Z"}' + string: '{"name":"66025821-1bf1-47f2-9c07-eb00389fed0b","status":"Succeeded","startTime":"2020-04-06T22:03:11.813Z"}' headers: cache-control: - no-cache content-length: - - '106' + - '107' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:49 GMT + - Mon, 06 Apr 2020 22:03:26 GMT expires: - '-1' pragma: @@ -119,19 +119,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db-2/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache content-length: - - '410' + - '405' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:49 GMT + - Mon, 06 Apr 2020 22:03:26 GMT expires: - '-1' pragma: @@ -168,19 +168,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/ayang-ltr-db-2/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache content-length: - - '410' + - '405' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:50 GMT + - Mon, 06 Apr 2020 22:03:27 GMT expires: - '-1' pragma: @@ -217,19 +217,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '745' + - '2183' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:51 GMT + - Mon, 06 Apr 2020 22:03:29 GMT expires: - '-1' pragma: @@ -269,16 +269,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '745' + - '2183' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:51 GMT + - Mon, 06 Apr 2020 22:03:29 GMT expires: - '-1' pragma: @@ -315,19 +315,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '745' + - '2183' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:51 GMT + - Mon, 06 Apr 2020 22:03:30 GMT expires: - '-1' pragma: @@ -364,19 +364,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '745' + - '2183' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:52 GMT + - Mon, 06 Apr 2020 22:03:30 GMT expires: - '-1' pragma: @@ -413,19 +413,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '745' + - '735' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:53 GMT + - Mon, 06 Apr 2020 22:03:31 GMT expires: - '-1' pragma: @@ -462,19 +462,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '745' + - '735' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:53 GMT + - Mon, 06 Apr 2020 22:03:31 GMT expires: - '-1' pragma: @@ -511,19 +511,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '745' + - '735' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:54 GMT + - Mon, 06 Apr 2020 22:03:31 GMT expires: - '-1' pragma: @@ -560,19 +560,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a%3B132300259830000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79%3B132306732710000000?api-version=2018-06-01-preview response: body: - string: '{"properties":{"managedInstanceName":"ayang-ltr","managedInstanceCreateTime":"2020-03-29T05:19:19.827Z","databaseName":"ayang-ltr-db-2","backupTime":"2020-03-30T07:13:03Z","backupExpirationTime":"2020-04-06T07:13:03Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","name":"028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' + string: '{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' headers: cache-control: - no-cache content-length: - - '733' + - '723' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:54 GMT + - Mon, 06 Apr 2020 22:03:32 GMT expires: - '-1' pragma: @@ -598,7 +598,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb ltr-backup restore Connection: - keep-alive ParameterSetName: @@ -609,19 +609,19 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi?api-version=2018-06-01-preview response: body: - string: '{"identity":{"principalId":"b00ec781-bbe4-48c9-a0e5-b404e3f40ddc","type":"SystemAssigned","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47"},"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":4},"properties":{"fullyQualifiedDomainName":"ayang-ltr.8ca2b7c55495.database.windows.net","administratorLogin":"cloudSA","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Network/virtualNetworks/vnet-ayang-ltr/subnets/ManagedInstance","state":"Ready","licenseType":"LicenseIncluded","vCores":4,"storageSizeInGB":32,"collation":"SQL_Latin1_General_CP1_CI_AS","dnsZone":"8ca2b7c55495","publicDataEndpointEnabled":false,"proxyOverride":"Proxy","timezoneId":"UTC"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr","name":"ayang-ltr","type":"Microsoft.Sql/managedInstances"}' + string: '{"identity":{"principalId":"66add4ab-8fc1-4f17-a3c4-17f0bf047c39","type":"SystemAssigned","tenantId":"0c1edf5d-e5c5-4aca-ab69-ef194134f44b"},"sku":{"name":"GP_Gen5","tier":"GeneralPurpose","family":"Gen5","capacity":4},"properties":{"fullyQualifiedDomainName":"ayang-ltr-mi.fbeedfe5d4a7.database.windows.net","administratorLogin":"cloudSA","subnetId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Network/virtualNetworks/vnet-ayang-ltr-mi/subnets/ManagedInstance","state":"Ready","licenseType":"LicenseIncluded","vCores":4,"storageSizeInGB":32,"collation":"SQL_Latin1_General_CP1_CI_AS","dnsZone":"fbeedfe5d4a7","publicDataEndpointEnabled":false,"proxyOverride":"Proxy","timezoneId":"UTC"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi","name":"ayang-ltr-mi","type":"Microsoft.Sql/managedInstances"}' headers: cache-control: - no-cache content-length: - - '966' + - '978' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:55 GMT + - Mon, 06 Apr 2020 22:03:33 GMT expires: - '-1' pragma: @@ -641,18 +641,18 @@ interactions: message: OK - request: body: '{"location": "westus", "properties": {"createMode": "RestoreLongTermRetentionBackup", - "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a;132300259830000000"}}' + "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000"}}' headers: Accept: - application/json Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb ltr-backup restore Connection: - keep-alive Content-Length: - - '434' + - '429' Content-Type: - application/json; charset=utf-8 ParameterSetName: @@ -663,13 +663,13 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/cli-restore-dest?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-04-04T00:04:56.47Z"}' + string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-04-06T22:03:34.19Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview cache-control: - no-cache content-length: @@ -677,11 +677,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:04:55 GMT + - Mon, 06 Apr 2020 22:03:33 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview pragma: - no-cache server: @@ -703,7 +703,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb ltr-backup restore Connection: - keep-alive ParameterSetName: @@ -712,10 +712,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview response: body: - string: '{"name":"1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70","status":"InProgress","startTime":"2020-04-04T00:04:56.47Z"}' + string: '{"name":"63db05af-a5f2-4fc0-a7f2-08186d80dcab","status":"InProgress","startTime":"2020-04-06T22:03:34.19Z"}' headers: cache-control: - no-cache @@ -724,7 +724,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:05:11 GMT + - Mon, 06 Apr 2020 22:03:48 GMT expires: - '-1' pragma: @@ -750,7 +750,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb ltr-backup restore Connection: - keep-alive ParameterSetName: @@ -759,10 +759,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview response: body: - string: '{"name":"1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70","status":"InProgress","startTime":"2020-04-04T00:04:56.47Z"}' + string: '{"name":"63db05af-a5f2-4fc0-a7f2-08186d80dcab","status":"InProgress","startTime":"2020-04-06T22:03:34.19Z"}' headers: cache-control: - no-cache @@ -771,7 +771,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:05:26 GMT + - Mon, 06 Apr 2020 22:04:03 GMT expires: - '-1' pragma: @@ -797,7 +797,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb ltr-backup restore Connection: - keep-alive ParameterSetName: @@ -806,10 +806,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview response: body: - string: '{"name":"1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70","status":"InProgress","startTime":"2020-04-04T00:04:56.47Z"}' + string: '{"name":"63db05af-a5f2-4fc0-a7f2-08186d80dcab","status":"InProgress","startTime":"2020-04-06T22:03:34.19Z"}' headers: cache-control: - no-cache @@ -818,7 +818,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:05:41 GMT + - Mon, 06 Apr 2020 22:04:18 GMT expires: - '-1' pragma: @@ -844,7 +844,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb ltr-backup restore Connection: - keep-alive ParameterSetName: @@ -853,10 +853,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview response: body: - string: '{"name":"1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70","status":"InProgress","startTime":"2020-04-04T00:04:56.47Z"}' + string: '{"name":"63db05af-a5f2-4fc0-a7f2-08186d80dcab","status":"InProgress","startTime":"2020-04-06T22:03:34.19Z"}' headers: cache-control: - no-cache @@ -865,7 +865,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:05:56 GMT + - Mon, 06 Apr 2020 22:04:34 GMT expires: - '-1' pragma: @@ -891,7 +891,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb ltr-backup restore Connection: - keep-alive ParameterSetName: @@ -900,10 +900,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview response: body: - string: '{"name":"1168f5b2-fdf7-43d0-aaa4-8c5a27c0bc70","status":"Succeeded","startTime":"2020-04-04T00:04:56.47Z"}' + string: '{"name":"63db05af-a5f2-4fc0-a7f2-08186d80dcab","status":"Succeeded","startTime":"2020-04-06T22:03:34.19Z"}' headers: cache-control: - no-cache @@ -912,7 +912,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:06:11 GMT + - Mon, 06 Apr 2020 22:04:49 GMT expires: - '-1' pragma: @@ -938,7 +938,7 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - sql midb ltr restore + - sql midb ltr-backup restore Connection: - keep-alive ParameterSetName: @@ -947,19 +947,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/cli-restore-dest?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-04-04T00:04:56.847Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest4vtazvlqbo/providers/Microsoft.Sql/managedInstances/ayang-ltr/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' + string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-04-06T22:03:34.597Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' headers: cache-control: - no-cache content-length: - - '421' + - '424' content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:06:11 GMT + - Mon, 06 Apr 2020 22:04:49 GMT expires: - '-1' pragma: @@ -998,13 +998,13 @@ interactions: accept-language: - en-US method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups/028065c3-0306-4986-a51b-d08c756d6b7a%3B132300259830000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79%3B132306732710000000?api-version=2018-06-01-preview response: body: - string: '{"operation":"DeleteLTRBackup","startTime":"2020-04-04T00:06:13.237Z"}' + string: '{"operation":"DeleteLTRBackup","startTime":"2020-04-06T22:04:50.863Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/6eb9acc1-d891-4c54-8bfd-08fa1bbea8b5?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/42fb96a8-8c76-4175-b4b5-50e53b55c95e?api-version=2018-06-01-preview cache-control: - no-cache content-length: @@ -1012,11 +1012,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:06:13 GMT + - Mon, 06 Apr 2020 22:04:50 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/6eb9acc1-d891-4c54-8bfd-08fa1bbea8b5?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/42fb96a8-8c76-4175-b4b5-50e53b55c95e?api-version=2018-06-01-preview pragma: - no-cache server: @@ -1047,10 +1047,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/6eb9acc1-d891-4c54-8bfd-08fa1bbea8b5?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/42fb96a8-8c76-4175-b4b5-50e53b55c95e?api-version=2018-06-01-preview response: body: - string: '{"name":"6eb9acc1-d891-4c54-8bfd-08fa1bbea8b5","status":"Succeeded","startTime":"2020-04-04T00:06:13.237Z"}' + string: '{"name":"42fb96a8-8c76-4175-b4b5-50e53b55c95e","status":"Succeeded","startTime":"2020-04-06T22:04:50.863Z"}' headers: cache-control: - no-cache @@ -1059,7 +1059,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:06:28 GMT + - Mon, 06 Apr 2020 22:05:05 GMT expires: - '-1' pragma: @@ -1096,7 +1096,7 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr/longTermRetentionDatabases/ayang-ltr-db-2/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: string: '{"value":[]}' @@ -1108,7 +1108,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Sat, 04 Apr 2020 00:06:29 GMT + - Mon, 06 Apr 2020 22:05:07 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 0f6d7ec287c..dd837b59b03 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3200,10 +3200,10 @@ def test_sql_managed_db_long_term_retention( self): self.kwargs.update({ - 'rg': 'clitest4vtazvlqbo', + 'rg': 'clitestxj6awmetud', 'loc': 'westus', - 'managed_instance_name': 'ayang-ltr', - 'database_name': 'ayang-ltr-db-2', + 'managed_instance_name': 'ayang-ltr-mi', + 'database_name': 'test-1', 'weekly_retention': 'P1W', 'monthly_retention': 'P1M', 'yearly_retention': 'P2M', @@ -3278,7 +3278,7 @@ def test_sql_managed_db_long_term_retention( }) self.cmd( - 'sql midb ltr restore --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}') + 'sql midb ltr-backup restore --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}') # test delete long term retention backup self.cmd( From 94b0530ecf6f27e0816d7203eb81818f33ae6f16 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 6 Apr 2020 15:45:45 -0700 Subject: [PATCH 37/54] update ltr restore command in help --- src/azure-cli/azure/cli/command_modules/sql/_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index d9cb36d711c..e359a42c160 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -717,7 +717,7 @@ short-summary: Restore a long term retention backup to a new database. examples: - name: Restore a managed database using LTR backup. - text: az sql midb ltr restore --dest-name targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + text: az sql midb ltr-backup restore --dest-name targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ helps['sql server'] = """ From 97c0ade650934ae6abe8550fa10342cbadddc95d Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 6 Apr 2020 16:16:50 -0700 Subject: [PATCH 38/54] add wait to help --- src/azure-cli/azure/cli/command_modules/sql/_help.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index e359a42c160..0c323892c1b 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -720,6 +720,11 @@ text: az sql midb ltr-backup restore --dest-name targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ +helps['sql midb ltr-backup wait'] = """ +type: command +short-summary: Place the CLI in a waiting state until a condition of the managed database is met. +""" + helps['sql server'] = """ type: group short-summary: Manage SQL servers. From 4b32d6a59248f6b0be791a1e9003370ce43896e0 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 6 Apr 2020 17:02:05 -0700 Subject: [PATCH 39/54] rename restore function for MI --- src/azure-cli/azure/cli/command_modules/sql/commands.py | 2 +- src/azure-cli/azure/cli/command_modules/sql/custom.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 96b2886a65d..c8f8b07d8ef 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -604,7 +604,7 @@ def load_command_table(self, _): client_factory=get_sql_managed_databases_operations) as g: g.custom_command( 'restore', - 'restore_long_term_retention_backup', + 'restore_long_term_retention_backup_mi', supports_no_wait=True) g.wait_command('wait') diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 3c3a917c537..48b8a58d7bc 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2861,7 +2861,7 @@ def list_long_term_retention_mi_backups( return backups -def restore_long_term_retention_backup( +def restore_long_term_retention_backup_mi( cmd, client, long_term_retention_backup_resource_id, From 41aa6dd4ff6580487f0401d9ade366011504930e Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Mon, 6 Apr 2020 22:35:50 -0700 Subject: [PATCH 40/54] rename restore custom function (again) --- src/azure-cli/azure/cli/command_modules/sql/commands.py | 2 +- src/azure-cli/azure/cli/command_modules/sql/custom.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index c8f8b07d8ef..5d8ac78c777 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -604,7 +604,7 @@ def load_command_table(self, _): client_factory=get_sql_managed_databases_operations) as g: g.custom_command( 'restore', - 'restore_long_term_retention_backup_mi', + 'restore_long_term_retention_mi_backup', supports_no_wait=True) g.wait_command('wait') diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 48b8a58d7bc..3cf2d12b567 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2861,7 +2861,7 @@ def list_long_term_retention_mi_backups( return backups -def restore_long_term_retention_backup_mi( +def restore_long_term_retention_mi_backup( cmd, client, long_term_retention_backup_resource_id, From 0ac9bfbcd70c0eb277df4623bdd325dbe0c02b24 Mon Sep 17 00:00:00 2001 From: xaliciayang <59986952+xaliciayang@users.noreply.github.com> Date: Tue, 7 Apr 2020 00:40:54 -0700 Subject: [PATCH 41/54] clarified param requirements for ltr-backup restore --- src/azure-cli/azure/cli/command_modules/sql/_params.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 5e12031912b..d269e33097e 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1567,15 +1567,13 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('target_managed_instance_name', options_list=['--dest-mi'], - help='Name of the managed instance to restore managed database to. ' - 'This can be same managed instance, or another managed instance on same subscription. ' - 'When not specified it defaults to source managed instance. ') + required=True, + help='Name of the managed instance to restore managed database to.') c.argument('target_resource_group_name', options_list=['--dest-resource-group'], - help='Name of the resource group of the managed instance to restore managed database to. ' - 'When not specified it defaults to source resource group. ' - 'Required for LTR.') + required=True, + help='Name of the resource group of the managed instance to restore managed database to.') c.argument('long_term_retention_backup_resource_id', options_list=['--backup-id'], From 8490995e5d7642837f1899ad9636fad2eae54f15 Mon Sep 17 00:00:00 2001 From: xaliciayang <59986952+xaliciayang@users.noreply.github.com> Date: Wed, 8 Apr 2020 13:12:07 -0700 Subject: [PATCH 42/54] changed help descriptions for retention params --- src/azure-cli/azure/cli/command_modules/sql/_params.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index d269e33097e..98dbad9392d 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1513,23 +1513,23 @@ def _configure_security_policy_storage_params(arg_ctx): ]) c.argument('weekly_retention', - help='The Weekly Retention.' + help='Retention for the weekly backup. ' 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' 'There is a minimum of 7 days and a maximum of 10 years.') c.argument('monthly_retention', - help='The Monthly Retention.' + help='Retention for the monthly backup. ' 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' 'There is a minimum of 7 days and a maximum of 10 years.') c.argument('yearly_retention', - help='The Yearly Retention.' + help='Retention for the yearly backup. ' 'If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.' 'There is a minimum of 7 days and a maximum of 10 years.') c.argument('week_of_year', - help='The Week of Year, 1 to 52, to save for the Yearly Retention.') - + help='The Week of Year, 1 to 52, in which to take the yearly backup.') + with self.argument_context('sql midb ltr-backup') as c: c.argument('location_name', required=True, From 9493d8e8b671fe5e6bf0dc005788f92733273ed9 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 9 Apr 2020 17:23:27 -0700 Subject: [PATCH 43/54] remove whitespace --- src/azure-cli/azure/cli/command_modules/sql/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 98dbad9392d..f0a1a18b9f8 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1529,7 +1529,7 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('week_of_year', help='The Week of Year, 1 to 52, in which to take the yearly backup.') - + with self.argument_context('sql midb ltr-backup') as c: c.argument('location_name', required=True, From 204b6fb8e129ade6366effc9fdd46f39f0e57d02 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 9 Apr 2020 21:33:51 -0700 Subject: [PATCH 44/54] changed --name to represent backup name in ltr-backup commands --- .../azure/cli/command_modules/sql/_help.py | 8 +- .../azure/cli/command_modules/sql/_params.py | 17 +- ...st_sql_managed_db_long_term_retention.yaml | 227 +++++++----------- .../sql/tests/latest/test_sql_commands.py | 18 +- 4 files changed, 111 insertions(+), 159 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index 0c323892c1b..d8de228aa3e 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -685,7 +685,7 @@ short-summary: Get a long term retention backup for a managed database. examples: - name: Show long term retention backup for a managed database. - text: az sql midb ltr-backup show -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + text: az sql midb ltr-backup show -l southeastasia --mi myinstance -d mymanageddb -n "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ helps['sql midb ltr-backup list'] = """ @@ -693,7 +693,7 @@ short-summary: List the long term retention backups for a location, instance or database. examples: - name: List long term retention backups for a managed database. - text: az sql midb ltr-backup list -l southeastasia --mi myinstance -n mymanageddb + text: az sql midb ltr-backup list -l southeastasia --mi myinstance -d mymanageddb - name: List long term retention backups for a managed instance (list only the latest LTR backups, which belong to live databases). text: az sql midb ltr-backup list -l southeastasia --mi myinstance --database-state Live --only-latest-per-database True - name: List long term retention backups for a managed instance (with resource group argument). @@ -709,7 +709,7 @@ short-summary: Delete a long term retention backup. examples: - name: Delete long term retention backup for a managed database. - text: az sql midb ltr-backup delete -l southeastasia --mi myinstance -n mymanageddb --backup-name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + text: az sql midb ltr-backup delete -l southeastasia --mi myinstance -d mymanageddb --name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ helps['sql midb ltr-backup restore'] = """ @@ -717,7 +717,7 @@ short-summary: Restore a long term retention backup to a new database. examples: - name: Restore a managed database using LTR backup. - text: az sql midb ltr-backup restore --dest-name targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + text: az sql midb ltr-backup restore --dest-name targetmidb --dest-database myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ helps['sql midb ltr-backup wait'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index f0a1a18b9f8..f3315c33613 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1536,17 +1536,22 @@ def _configure_security_policy_storage_params(arg_ctx): arg_type=get_location_type(self.cli_ctx), help='The location of the desired backups.') + c.argument('database_name', + options_list=['--database', '-d'], + help='The name of the Azure SQL Managed Database. ' + 'If specified (along with instance name), retrieves all requested backups under this database.') + + c.argument('backup_name', + options_list=['--name', '-n'], + help='The name of the LTR backup. ' + 'Use \'az sql midb ltr-backup show\' or \'az sql midb ltr-backup list\' for backup name.') + with self.argument_context('sql midb ltr-backup list') as c: c.argument('managed_instance_name', options_list=['--managed-instance', '--mi'], help='Name of the Azure SQL managed instance. ' 'If specified, retrieves all requested backups under this managed instance.') - c.argument('database_name', - options_list=['--name', '-n'], - help='The name of the Azure SQL Managed Database. ' - 'If specified (along with instance name), retrieves all requested backups under this database.') - c.argument('database_state', required=False, options_list=['--database-state', '--state'], @@ -1561,7 +1566,7 @@ def _configure_security_policy_storage_params(arg_ctx): with self.argument_context('sql midb ltr-backup restore') as c: c.argument('target_managed_database_name', - options_list=['--dest-name'], + options_list=['--dest-database'], required=True, help='Name of the managed database that will be created as the restore destination.') diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml index 92b58f3b8a7..46a2ae7fc4c 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -23,13 +23,13 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-04-06T22:03:11.813Z"}' + string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-04-10T04:30:46.887Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/66025821-1bf1-47f2-9c07-eb00389fed0b?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/5f438f4a-b9e9-4258-9968-f21c2983aafe?api-version=2018-06-01-preview cache-control: - no-cache content-length: @@ -37,11 +37,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:11 GMT + - Fri, 10 Apr 2020 04:30:46 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/66025821-1bf1-47f2-9c07-eb00389fed0b?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/5f438f4a-b9e9-4258-9968-f21c2983aafe?api-version=2018-06-01-preview pragma: - no-cache server: @@ -72,10 +72,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/66025821-1bf1-47f2-9c07-eb00389fed0b?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/5f438f4a-b9e9-4258-9968-f21c2983aafe?api-version=2018-06-01-preview response: body: - string: '{"name":"66025821-1bf1-47f2-9c07-eb00389fed0b","status":"Succeeded","startTime":"2020-04-06T22:03:11.813Z"}' + string: '{"name":"5f438f4a-b9e9-4258-9968-f21c2983aafe","status":"Succeeded","startTime":"2020-04-10T04:30:46.887Z"}' headers: cache-control: - no-cache @@ -84,7 +84,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:26 GMT + - Fri, 10 Apr 2020 04:31:01 GMT expires: - '-1' pragma: @@ -119,10 +119,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-2/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache @@ -131,7 +131,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:26 GMT + - Fri, 10 Apr 2020 04:31:01 GMT expires: - '-1' pragma: @@ -168,10 +168,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-2/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache @@ -180,7 +180,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:27 GMT + - Fri, 10 Apr 2020 04:31:03 GMT expires: - '-1' pragma: @@ -220,16 +220,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2183' + - '1459' content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:29 GMT + - Fri, 10 Apr 2020 04:31:03 GMT expires: - '-1' pragma: @@ -269,16 +269,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2183' + - '1459' content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:29 GMT + - Fri, 10 Apr 2020 04:31:03 GMT expires: - '-1' pragma: @@ -318,16 +318,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2183' + - '1459' content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:30 GMT + - Fri, 10 Apr 2020 04:31:04 GMT expires: - '-1' pragma: @@ -367,16 +367,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2183' + - '1459' content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:30 GMT + - Fri, 10 Apr 2020 04:31:05 GMT expires: - '-1' pragma: @@ -406,17 +406,17 @@ interactions: Connection: - keep-alive ParameterSetName: - - -l --mi -n -g + - -l --mi -d -g User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -425,7 +425,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:31 GMT + - Fri, 10 Apr 2020 04:31:06 GMT expires: - '-1' pragma: @@ -455,17 +455,17 @@ interactions: Connection: - keep-alive ParameterSetName: - - -l --mi -n + - -l --mi -d User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -474,7 +474,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:31 GMT + - Fri, 10 Apr 2020 04:31:06 GMT expires: - '-1' pragma: @@ -504,17 +504,17 @@ interactions: Connection: - keep-alive ParameterSetName: - - -l --mi -n --latest + - -l --mi -d --latest User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -523,7 +523,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:31 GMT + - Fri, 10 Apr 2020 04:31:07 GMT expires: - '-1' pragma: @@ -553,17 +553,17 @@ interactions: Connection: - keep-alive ParameterSetName: - - -l --mi -n --backup-name + - -l --mi -d -n User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79%3B132306732710000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158%3B132306738730000000?api-version=2018-06-01-preview response: body: - string: '{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-06T19:01:11Z","backupExpirationTime":"2020-04-13T19:01:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","name":"adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' + string: '{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' headers: cache-control: - no-cache @@ -572,7 +572,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:32 GMT + - Fri, 10 Apr 2020 04:31:07 GMT expires: - '-1' pragma: @@ -602,7 +602,7 @@ interactions: Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-database --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 @@ -621,7 +621,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:33 GMT + - Fri, 10 Apr 2020 04:31:07 GMT expires: - '-1' pragma: @@ -641,7 +641,7 @@ interactions: message: OK - request: body: '{"location": "westus", "properties": {"createMode": "RestoreLongTermRetentionBackup", - "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79;132306732710000000"}}' + "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000"}}' headers: Accept: - application/json @@ -656,7 +656,7 @@ interactions: Content-Type: - application/json; charset=utf-8 ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-database --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 @@ -666,22 +666,22 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-04-06T22:03:34.19Z"}' + string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-04-10T04:31:08.933Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview cache-control: - no-cache content-length: - - '94' + - '95' content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:33 GMT + - Fri, 10 Apr 2020 04:31:08 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview pragma: - no-cache server: @@ -707,24 +707,24 @@ interactions: Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-database --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview response: body: - string: '{"name":"63db05af-a5f2-4fc0-a7f2-08186d80dcab","status":"InProgress","startTime":"2020-04-06T22:03:34.19Z"}' + string: '{"name":"5463bf59-fba2-4326-b042-6b8ddd23d6ca","status":"InProgress","startTime":"2020-04-10T04:31:08.933Z"}' headers: cache-control: - no-cache content-length: - - '107' + - '108' content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:03:48 GMT + - Fri, 10 Apr 2020 04:31:23 GMT expires: - '-1' pragma: @@ -754,24 +754,24 @@ interactions: Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-database --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview response: body: - string: '{"name":"63db05af-a5f2-4fc0-a7f2-08186d80dcab","status":"InProgress","startTime":"2020-04-06T22:03:34.19Z"}' + string: '{"name":"5463bf59-fba2-4326-b042-6b8ddd23d6ca","status":"InProgress","startTime":"2020-04-10T04:31:08.933Z"}' headers: cache-control: - no-cache content-length: - - '107' + - '108' content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:04:03 GMT + - Fri, 10 Apr 2020 04:31:38 GMT expires: - '-1' pragma: @@ -801,24 +801,24 @@ interactions: Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-database --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview response: body: - string: '{"name":"63db05af-a5f2-4fc0-a7f2-08186d80dcab","status":"InProgress","startTime":"2020-04-06T22:03:34.19Z"}' + string: '{"name":"5463bf59-fba2-4326-b042-6b8ddd23d6ca","status":"InProgress","startTime":"2020-04-10T04:31:08.933Z"}' headers: cache-control: - no-cache content-length: - - '107' + - '108' content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:04:18 GMT + - Fri, 10 Apr 2020 04:31:54 GMT expires: - '-1' pragma: @@ -848,24 +848,24 @@ interactions: Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-database --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview response: body: - string: '{"name":"63db05af-a5f2-4fc0-a7f2-08186d80dcab","status":"InProgress","startTime":"2020-04-06T22:03:34.19Z"}' + string: '{"name":"5463bf59-fba2-4326-b042-6b8ddd23d6ca","status":"InProgress","startTime":"2020-04-10T04:31:08.933Z"}' headers: cache-control: - no-cache content-length: - - '107' + - '108' content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:04:34 GMT + - Fri, 10 Apr 2020 04:32:09 GMT expires: - '-1' pragma: @@ -895,24 +895,24 @@ interactions: Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-database --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/63db05af-a5f2-4fc0-a7f2-08186d80dcab?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview response: body: - string: '{"name":"63db05af-a5f2-4fc0-a7f2-08186d80dcab","status":"Succeeded","startTime":"2020-04-06T22:03:34.19Z"}' + string: '{"name":"5463bf59-fba2-4326-b042-6b8ddd23d6ca","status":"Succeeded","startTime":"2020-04-10T04:31:08.933Z"}' headers: cache-control: - no-cache content-length: - - '106' + - '107' content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:04:49 GMT + - Fri, 10 Apr 2020 04:32:24 GMT expires: - '-1' pragma: @@ -942,7 +942,7 @@ interactions: Connection: - keep-alive ParameterSetName: - - --backup-id --dest-name --dest-mi --dest-resource-group + - --backup-id --dest-database --dest-mi --dest-resource-group User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 @@ -950,7 +950,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-04-06T22:03:34.597Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' + string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-04-10T04:31:09.263Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' headers: cache-control: - no-cache @@ -959,7 +959,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:04:49 GMT + - Fri, 10 Apr 2020 04:32:24 GMT expires: - '-1' pragma: @@ -991,20 +991,20 @@ interactions: Content-Length: - '0' ParameterSetName: - - -l --mi -n --backup-name + - -l --mi -d -n User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 accept-language: - en-US method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/adb6c93f-b429-4a71-8b32-4efc3a4f5a79%3B132306732710000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158%3B132306738730000000?api-version=2018-06-01-preview response: body: - string: '{"operation":"DeleteLTRBackup","startTime":"2020-04-06T22:04:50.863Z"}' + string: '{"operation":"DeleteLTRBackup","startTime":"2020-04-10T04:32:25.597Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/42fb96a8-8c76-4175-b4b5-50e53b55c95e?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/165b425d-72aa-45ba-ae88-92fc82920584?api-version=2018-06-01-preview cache-control: - no-cache content-length: @@ -1012,11 +1012,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:04:50 GMT + - Fri, 10 Apr 2020 04:32:24 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/42fb96a8-8c76-4175-b4b5-50e53b55c95e?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/165b425d-72aa-45ba-ae88-92fc82920584?api-version=2018-06-01-preview pragma: - no-cache server: @@ -1042,15 +1042,15 @@ interactions: Connection: - keep-alive ParameterSetName: - - -l --mi -n --backup-name + - -l --mi -d -n User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/42fb96a8-8c76-4175-b4b5-50e53b55c95e?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/165b425d-72aa-45ba-ae88-92fc82920584?api-version=2018-06-01-preview response: body: - string: '{"name":"42fb96a8-8c76-4175-b4b5-50e53b55c95e","status":"Succeeded","startTime":"2020-04-06T22:04:50.863Z"}' + string: '{"name":"165b425d-72aa-45ba-ae88-92fc82920584","status":"Succeeded","startTime":"2020-04-10T04:32:25.597Z"}' headers: cache-control: - no-cache @@ -1059,56 +1059,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Mon, 06 Apr 2020 22:05:05 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - sql midb ltr-backup list - Connection: - - keep-alive - ParameterSetName: - - -l --mi -n - User-Agent: - - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 - azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 - accept-language: - - en-US - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview - response: - body: - string: '{"value":[]}' - headers: - cache-control: - - no-cache - content-length: - - '12' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 06 Apr 2020 22:05:07 GMT + - Fri, 10 Apr 2020 04:32:40 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index dd837b59b03..484c04e5ac6 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3203,7 +3203,7 @@ def test_sql_managed_db_long_term_retention( 'rg': 'clitestxj6awmetud', 'loc': 'westus', 'managed_instance_name': 'ayang-ltr-mi', - 'database_name': 'test-1', + 'database_name': 'test-2', 'weekly_retention': 'P1W', 'monthly_retention': 'P1M', 'yearly_retention': 'P2M', @@ -3248,15 +3248,15 @@ def test_sql_managed_db_long_term_retention( # test list long term retention backups for database # with resource group self.cmd( - 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -n {database_name} -g {rg}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name} -g {rg}') # without resource group self.cmd( - 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -n {database_name}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name}') # setup for test show long term retention backup backup = self.cmd( - 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -n {database_name} --latest True').get_output_in_json() + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name} --latest True').get_output_in_json() self.kwargs.update({ 'backup_name': backup[0]['name'], @@ -3265,7 +3265,7 @@ def test_sql_managed_db_long_term_retention( # test show long term retention backup self.cmd( - 'sql midb ltr-backup show -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name {backup_name}', + 'sql midb ltr-backup show -l {loc} --mi {managed_instance_name} -d {database_name} -n {backup_name}', checks=[ self.check('resourceGroup', '{rg}'), self.check('managedInstanceName', '{managed_instance_name}'), @@ -3278,15 +3278,11 @@ def test_sql_managed_db_long_term_retention( }) self.cmd( - 'sql midb ltr-backup restore --backup-id \'{backup_id}\' --dest-name {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}') + 'sql midb ltr-backup restore --backup-id \'{backup_id}\' --dest-database {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}') # test delete long term retention backup self.cmd( - 'sql midb ltr-backup delete -l {loc} --mi {managed_instance_name} -n {database_name} --backup-name \'{backup_name}\'') - # assert no backpus - self.cmd( - 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -n {database_name}') - + 'sql midb ltr-backup delete -l {loc} --mi {managed_instance_name} -d {database_name} -n \'{backup_name}\'') class SqlManagedInstanceRestoreDeletedDbScenarioTest(ScenarioTest): From 745242084988e8255fe30639d2ac315e54485706 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 9 Apr 2020 22:56:10 -0700 Subject: [PATCH 45/54] added lines for style --- .../cli/command_modules/sql/tests/latest/test_sql_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 484c04e5ac6..3667eee41fd 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3284,8 +3284,8 @@ def test_sql_managed_db_long_term_retention( self.cmd( 'sql midb ltr-backup delete -l {loc} --mi {managed_instance_name} -d {database_name} -n \'{backup_name}\'') -class SqlManagedInstanceRestoreDeletedDbScenarioTest(ScenarioTest): +class SqlManagedInstanceRestoreDeletedDbScenarioTest(ScenarioTest): @ResourceGroupPreparer(random_name_length=17, name_prefix='clitest') def test_sql_managed_deleted_db_restore(self, resource_group, resource_group_location): From f9d22b35ff87640f58c843bd11328bb4ce99ee20 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 9 Apr 2020 23:02:49 -0700 Subject: [PATCH 46/54] fix help --- src/azure-cli/azure/cli/command_modules/sql/_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index d8de228aa3e..b9636016772 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -717,7 +717,7 @@ short-summary: Restore a long term retention backup to a new database. examples: - name: Restore a managed database using LTR backup. - text: az sql midb ltr-backup restore --dest-name targetmidb --dest-database myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + text: az sql midb ltr-backup restore --dest-database targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ helps['sql midb ltr-backup wait'] = """ From bc782bdf7d6b8271823f08f2dda220b0b56a57a0 Mon Sep 17 00:00:00 2001 From: xaliciayang <59986952+xaliciayang@users.noreply.github.com> Date: Fri, 10 Apr 2020 00:33:38 -0700 Subject: [PATCH 47/54] update week_of_year help --- src/azure-cli/azure/cli/command_modules/sql/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index f3315c33613..10cb24680ca 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1528,7 +1528,7 @@ def _configure_security_policy_storage_params(arg_ctx): 'There is a minimum of 7 days and a maximum of 10 years.') c.argument('week_of_year', - help='The Week of Year, 1 to 52, in which to take the yearly backup.') + help='The Week of Year, 1 to 52, in which to take the yearly LTR backup.') with self.argument_context('sql midb ltr-backup') as c: c.argument('location_name', From 0be376f8784ab38278d9cf5a71dd0e48006dfe56 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Tue, 14 Apr 2020 16:41:40 -0700 Subject: [PATCH 48/54] add \ to help; add confirmation for delete; add checks in tests; re-record --- .../azure/cli/command_modules/sql/_help.py | 5 +- .../azure/cli/command_modules/sql/commands.py | 3 +- ...st_sql_managed_db_long_term_retention.yaml | 156 +++++++++--------- .../sql/tests/latest/test_sql_commands.py | 34 +++- 4 files changed, 109 insertions(+), 89 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index b9636016772..0d2ef70fefc 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -717,7 +717,10 @@ short-summary: Restore a long term retention backup to a new database. examples: - name: Restore a managed database using LTR backup. - text: az sql midb ltr-backup restore --dest-database targetmidb --dest-mi myinstance --dest-resource-group mygroup --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + text: | + az sql midb ltr-backup restore \\ + --dest-database targetmidb --dest-mi myinstance --dest-resource-group mygroup \\ + --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" """ helps['sql midb ltr-backup wait'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 5d8ac78c777..a8c86c4ba32 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -597,7 +597,8 @@ def load_command_table(self, _): g.custom_command( 'list', 'list_long_term_retention_mi_backups') - g.command('delete', 'delete') + g.command('delete', 'delete', + confirmation=True) with self.command_group('sql midb ltr-backup', managed_databases_operations, diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml index 46a2ae7fc4c..64951e8a17b 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -23,13 +23,13 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-04-10T04:30:46.887Z"}' + string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-04-14T23:37:22.313Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/5f438f4a-b9e9-4258-9968-f21c2983aafe?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/cc407b33-239d-42a4-9e29-91632f26a508?api-version=2018-06-01-preview cache-control: - no-cache content-length: @@ -37,11 +37,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:30:46 GMT + - Tue, 14 Apr 2020 23:37:22 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/5f438f4a-b9e9-4258-9968-f21c2983aafe?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/cc407b33-239d-42a4-9e29-91632f26a508?api-version=2018-06-01-preview pragma: - no-cache server: @@ -72,10 +72,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/5f438f4a-b9e9-4258-9968-f21c2983aafe?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/cc407b33-239d-42a4-9e29-91632f26a508?api-version=2018-06-01-preview response: body: - string: '{"name":"5f438f4a-b9e9-4258-9968-f21c2983aafe","status":"Succeeded","startTime":"2020-04-10T04:30:46.887Z"}' + string: '{"name":"cc407b33-239d-42a4-9e29-91632f26a508","status":"Succeeded","startTime":"2020-04-14T23:37:22.313Z"}' headers: cache-control: - no-cache @@ -84,7 +84,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:01 GMT + - Tue, 14 Apr 2020 23:37:36 GMT expires: - '-1' pragma: @@ -119,10 +119,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-2/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache @@ -131,7 +131,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:01 GMT + - Tue, 14 Apr 2020 23:37:37 GMT expires: - '-1' pragma: @@ -168,10 +168,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-2/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-2/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache @@ -180,7 +180,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:03 GMT + - Tue, 14 Apr 2020 23:37:38 GMT expires: - '-1' pragma: @@ -220,16 +220,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '1459' + - '2907' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:03 GMT + - Tue, 14 Apr 2020 23:37:38 GMT expires: - '-1' pragma: @@ -269,16 +269,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '1459' + - '2907' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:03 GMT + - Tue, 14 Apr 2020 23:37:39 GMT expires: - '-1' pragma: @@ -318,16 +318,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '1459' + - '2907' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:04 GMT + - Tue, 14 Apr 2020 23:37:39 GMT expires: - '-1' pragma: @@ -367,16 +367,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-3","backupTime":"2020-04-06T19:11:11Z","backupExpirationTime":"2020-04-13T19:11:11Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-3/longTermRetentionManagedInstanceBackups/d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","name":"d52bf1ad-627b-48e9-9eb4-584d402d3fa9;132306738710000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '1459' + - '2907' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:05 GMT + - Tue, 14 Apr 2020 23:37:40 GMT expires: - '-1' pragma: @@ -413,10 +413,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -425,7 +425,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:06 GMT + - Tue, 14 Apr 2020 23:37:41 GMT expires: - '-1' pragma: @@ -462,10 +462,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -474,7 +474,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:06 GMT + - Tue, 14 Apr 2020 23:37:41 GMT expires: - '-1' pragma: @@ -511,10 +511,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -523,7 +523,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:07 GMT + - Tue, 14 Apr 2020 23:37:41 GMT expires: - '-1' pragma: @@ -560,10 +560,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158%3B132306738730000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253%3B132309599250000000?api-version=2018-06-01-preview response: body: - string: '{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-2","backupTime":"2020-04-06T19:11:13Z","backupExpirationTime":"2020-04-13T19:11:13Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","name":"5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' + string: '{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' headers: cache-control: - no-cache @@ -572,7 +572,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:07 GMT + - Tue, 14 Apr 2020 23:37:42 GMT expires: - '-1' pragma: @@ -621,7 +621,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:07 GMT + - Tue, 14 Apr 2020 23:37:42 GMT expires: - '-1' pragma: @@ -641,7 +641,7 @@ interactions: message: OK - request: body: '{"location": "westus", "properties": {"createMode": "RestoreLongTermRetentionBackup", - "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158;132306738730000000"}}' + "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000"}}' headers: Accept: - application/json @@ -666,22 +666,22 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-04-10T04:31:08.933Z"}' + string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-04-14T23:37:43.9Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview cache-control: - no-cache content-length: - - '95' + - '93' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:08 GMT + - Tue, 14 Apr 2020 23:37:43 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview pragma: - no-cache server: @@ -712,19 +712,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview response: body: - string: '{"name":"5463bf59-fba2-4326-b042-6b8ddd23d6ca","status":"InProgress","startTime":"2020-04-10T04:31:08.933Z"}' + string: '{"name":"10f32a39-61d1-4da3-83c3-a9ceaca3acdd","status":"InProgress","startTime":"2020-04-14T23:37:43.9Z"}' headers: cache-control: - no-cache content-length: - - '108' + - '106' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:23 GMT + - Tue, 14 Apr 2020 23:37:59 GMT expires: - '-1' pragma: @@ -759,19 +759,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview response: body: - string: '{"name":"5463bf59-fba2-4326-b042-6b8ddd23d6ca","status":"InProgress","startTime":"2020-04-10T04:31:08.933Z"}' + string: '{"name":"10f32a39-61d1-4da3-83c3-a9ceaca3acdd","status":"InProgress","startTime":"2020-04-14T23:37:43.9Z"}' headers: cache-control: - no-cache content-length: - - '108' + - '106' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:38 GMT + - Tue, 14 Apr 2020 23:38:14 GMT expires: - '-1' pragma: @@ -806,19 +806,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview response: body: - string: '{"name":"5463bf59-fba2-4326-b042-6b8ddd23d6ca","status":"InProgress","startTime":"2020-04-10T04:31:08.933Z"}' + string: '{"name":"10f32a39-61d1-4da3-83c3-a9ceaca3acdd","status":"InProgress","startTime":"2020-04-14T23:37:43.9Z"}' headers: cache-control: - no-cache content-length: - - '108' + - '106' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:31:54 GMT + - Tue, 14 Apr 2020 23:38:29 GMT expires: - '-1' pragma: @@ -853,19 +853,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview response: body: - string: '{"name":"5463bf59-fba2-4326-b042-6b8ddd23d6ca","status":"InProgress","startTime":"2020-04-10T04:31:08.933Z"}' + string: '{"name":"10f32a39-61d1-4da3-83c3-a9ceaca3acdd","status":"InProgress","startTime":"2020-04-14T23:37:43.9Z"}' headers: cache-control: - no-cache content-length: - - '108' + - '106' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:32:09 GMT + - Tue, 14 Apr 2020 23:38:44 GMT expires: - '-1' pragma: @@ -900,19 +900,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/5463bf59-fba2-4326-b042-6b8ddd23d6ca?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview response: body: - string: '{"name":"5463bf59-fba2-4326-b042-6b8ddd23d6ca","status":"Succeeded","startTime":"2020-04-10T04:31:08.933Z"}' + string: '{"name":"10f32a39-61d1-4da3-83c3-a9ceaca3acdd","status":"Succeeded","startTime":"2020-04-14T23:37:43.9Z"}' headers: cache-control: - no-cache content-length: - - '107' + - '105' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:32:24 GMT + - Tue, 14 Apr 2020 23:38:58 GMT expires: - '-1' pragma: @@ -950,16 +950,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-04-10T04:31:09.263Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' + string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-04-14T23:37:44.26Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' headers: cache-control: - no-cache content-length: - - '424' + - '423' content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:32:24 GMT + - Tue, 14 Apr 2020 23:38:59 GMT expires: - '-1' pragma: @@ -991,20 +991,20 @@ interactions: Content-Length: - '0' ParameterSetName: - - -l --mi -d -n + - -l --mi -d -n --yes User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 accept-language: - en-US method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-2/longTermRetentionManagedInstanceBackups/5ccc88c6-576d-4db3-848f-84d11ba7a158%3B132306738730000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253%3B132309599250000000?api-version=2018-06-01-preview response: body: - string: '{"operation":"DeleteLTRBackup","startTime":"2020-04-10T04:32:25.597Z"}' + string: '{"operation":"DeleteLTRBackup","startTime":"2020-04-14T23:39:00.597Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/165b425d-72aa-45ba-ae88-92fc82920584?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/1c92f5eb-4cd2-4daa-b9a2-e54cf74f9aaf?api-version=2018-06-01-preview cache-control: - no-cache content-length: @@ -1012,11 +1012,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:32:24 GMT + - Tue, 14 Apr 2020 23:39:00 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/165b425d-72aa-45ba-ae88-92fc82920584?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/1c92f5eb-4cd2-4daa-b9a2-e54cf74f9aaf?api-version=2018-06-01-preview pragma: - no-cache server: @@ -1042,15 +1042,15 @@ interactions: Connection: - keep-alive ParameterSetName: - - -l --mi -d -n + - -l --mi -d -n --yes User-Agent: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/165b425d-72aa-45ba-ae88-92fc82920584?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/1c92f5eb-4cd2-4daa-b9a2-e54cf74f9aaf?api-version=2018-06-01-preview response: body: - string: '{"name":"165b425d-72aa-45ba-ae88-92fc82920584","status":"Succeeded","startTime":"2020-04-10T04:32:25.597Z"}' + string: '{"name":"1c92f5eb-4cd2-4daa-b9a2-e54cf74f9aaf","status":"Succeeded","startTime":"2020-04-14T23:39:00.597Z"}' headers: cache-control: - no-cache @@ -1059,7 +1059,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 10 Apr 2020 04:32:40 GMT + - Tue, 14 Apr 2020 23:39:15 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 3667eee41fd..0a5205e5555 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3203,7 +3203,7 @@ def test_sql_managed_db_long_term_retention( 'rg': 'clitestxj6awmetud', 'loc': 'westus', 'managed_instance_name': 'ayang-ltr-mi', - 'database_name': 'test-2', + 'database_name': 'test-1', 'weekly_retention': 'P1W', 'monthly_retention': 'P1M', 'yearly_retention': 'P2M', @@ -3231,28 +3231,41 @@ def test_sql_managed_db_long_term_retention( # test list long term retention backups for location # with resource group self.cmd( - 'sql midb ltr-backup list -l {loc} -g {rg}') + 'sql midb ltr-backup list -l {loc} -g {rg}', + checks=[ + self.greater_than('length(@)', 0)]) + # without resource group self.cmd( - 'sql midb ltr-backup list -l {loc}') + 'sql midb ltr-backup list -l {loc}', + checks=[ + self.greater_than('length(@)', 0)]) # test list long term retention backups for instance # with resource group self.cmd( - 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -g {rg}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -g {rg}', + checks=[ + self.greater_than('length(@)', 0)]) # without resource group self.cmd( - 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name}', + checks=[ + self.greater_than('length(@)', 0)]) # test list long term retention backups for database # with resource group self.cmd( - 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name} -g {rg}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name} -g {rg}', + checks=[ + self.greater_than('length(@)', 0)]) # without resource group self.cmd( - 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name}') + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name}', + checks=[ + self.greater_than('length(@)', 0)]) # setup for test show long term retention backup backup = self.cmd( @@ -3278,11 +3291,14 @@ def test_sql_managed_db_long_term_retention( }) self.cmd( - 'sql midb ltr-backup restore --backup-id \'{backup_id}\' --dest-database {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}') + 'sql midb ltr-backup restore --backup-id \'{backup_id}\' --dest-database {dest_database_name} --dest-mi {managed_instance_name} --dest-resource-group {rg}', + checks=[ + self.check('name', '{dest_database_name}')]) # test delete long term retention backup self.cmd( - 'sql midb ltr-backup delete -l {loc} --mi {managed_instance_name} -d {database_name} -n \'{backup_name}\'') + 'sql midb ltr-backup delete -l {loc} --mi {managed_instance_name} -d {database_name} -n \'{backup_name}\' --yes', + checks=[NoneCheck()]) class SqlManagedInstanceRestoreDeletedDbScenarioTest(ScenarioTest): From 96c6b3aac5841fd44ec4b874f852b220fe78682c Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 16 Apr 2020 00:16:14 -0700 Subject: [PATCH 49/54] enable ltr-backup show to accept backup-id --- .../azure/cli/command_modules/sql/_help.py | 6 ++- .../azure/cli/command_modules/sql/_params.py | 20 ++++++-- .../azure/cli/command_modules/sql/commands.py | 2 +- .../azure/cli/command_modules/sql/custom.py | 50 +++++++++++++++++++ 4 files changed, 70 insertions(+), 8 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index 0d2ef70fefc..95d3e56a96b 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -686,6 +686,8 @@ examples: - name: Show long term retention backup for a managed database. text: az sql midb ltr-backup show -l southeastasia --mi myinstance -d mymanageddb -n "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + name: Show long term retention backup for a managed database. + text: az sql midb ltr-backup show --backup-id '/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/mymanageddb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000' """ helps['sql midb ltr-backup list'] = """ @@ -695,11 +697,11 @@ - name: List long term retention backups for a managed database. text: az sql midb ltr-backup list -l southeastasia --mi myinstance -d mymanageddb - name: List long term retention backups for a managed instance (list only the latest LTR backups, which belong to live databases). - text: az sql midb ltr-backup list -l southeastasia --mi myinstance --database-state Live --only-latest-per-database True + text: az sql midb ltr-backup list -l southeastasia --mi myinstance --database-state Live --only-latest-per-database - name: List long term retention backups for a managed instance (with resource group argument). text: az sql midb ltr-backup list -l southeastasia -g mygroup --mi myinstance - name: List long term retention backups for a location (list only the latest LTR backups, which belong to live databases). - text: az sql midb ltr-backup list -l southeastasia --database-state Live --only-latest-per-database True + text: az sql midb ltr-backup list -l southeastasia --database-state Live --only-latest-per-database - name: List long term retention backups for a location (with resource group argument). text: az sql midb ltr-backup list -l southeastasia -g mygroup """ diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 10cb24680ca..4b2775e57fb 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1532,25 +1532,34 @@ def _configure_security_policy_storage_params(arg_ctx): with self.argument_context('sql midb ltr-backup') as c: c.argument('location_name', - required=True, arg_type=get_location_type(self.cli_ctx), - help='The location of the desired backups.') + help='The location of the desired backups.', + id_part=None) c.argument('database_name', options_list=['--database', '-d'], help='The name of the Azure SQL Managed Database. ' - 'If specified (along with instance name), retrieves all requested backups under this database.') + 'If specified (along with instance name), retrieves all requested backups under this database.', + id_part=None) c.argument('backup_name', options_list=['--name', '-n'], help='The name of the LTR backup. ' - 'Use \'az sql midb ltr-backup show\' or \'az sql midb ltr-backup list\' for backup name.') + 'Use \'az sql midb ltr-backup show\' or \'az sql midb ltr-backup list\' for backup name.', + id_part=None) + + c.argument('backup_id', + options_list=['--backup-id', '--id'], + help='The resource id of the backups. ' + 'Use \'az sql midb ltr-backup show\' or \'az sql midb ltr-backup list\' for backup id.', + id_part=None) with self.argument_context('sql midb ltr-backup list') as c: c.argument('managed_instance_name', options_list=['--managed-instance', '--mi'], help='Name of the Azure SQL managed instance. ' - 'If specified, retrieves all requested backups under this managed instance.') + 'If specified, retrieves all requested backups under this managed instance.', + id_part=None) c.argument('database_state', required=False, @@ -1560,6 +1569,7 @@ def _configure_security_policy_storage_params(arg_ctx): 'If no state provied, defaults to \'All\'.') c.argument('only_latest_per_database', + action='store_true', options_list=['--only-latest-per-database', '--latest'], required=False, help='If true, will only return the latest backup for each database') diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index a8c86c4ba32..40a8fd5105d 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -593,7 +593,7 @@ def load_command_table(self, _): with self.command_group('sql midb ltr-backup', managed_database_long_term_retention_backups_operations, client_factory=get_sql_managed_database_long_term_retention_backups_operations) as g: - g.show_command('show', 'get') + g.custom_command('show', 'get_long_term_retention_mi_backup') g.custom_command( 'list', 'list_long_term_retention_mi_backups') diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 3cf2d12b567..91c791c266b 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2735,6 +2735,56 @@ def update_long_term_retention_mi( return policy +def get_long_term_retention_mi_backup( + client, + location_name=None, + managed_instance_name=None, + database_name=None, + backup_name=None, + backup_id=None): + ''' + Gets the requested long term retention backup. + ''' + + if backup_id: + backup_id = backup_id.replace('\'', '') + backup_id = backup_id.replace('"', '') + + if backup_id[0] == '/': + # remove leading / + backup_id = backup_id[1:] + print(backup_id) + + resources_list = backup_id.split('/') + print(resources_list) + resources_dict = {resources_list[i]: resources_list[i + 1] for i in range(0, len(resources_list), 2)} + + if not ('locations'.casefold() in resources_dict and + 'longTermRetentionManagedInstances'.casefold() not in resources_dict and + 'longTermRetentionDatabases'.casefold() not in resources_dict and + 'longTermRetentionManagedInstanceBackups'.casefold() not in resources_dict): + + raise CLIError('Please provide a valid resource URI. See --help for example.') + + location_name = resources_dict['locations'] + managed_instance_name = resources_dict['longTermRetentionManagedInstances'] + database_name = resources_dict['longTermRetentionDatabases'] + backup_name = resources_dict['longTermRetentionManagedInstanceBackups'] + + else: + if not (location_name and + managed_instance_name and + database_name and + backup_name): + raise CLIError('Please provide valid resource to show. See --help for examples.') + + return client.get( + location_name=location_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + backup_name=backup_name) + + def _list_by_database_long_term_retention_mi_backups( client, location_name, From 35badd478d4e96a89ea14724371ad355d81a59fb Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 16 Apr 2020 00:56:57 -0700 Subject: [PATCH 50/54] enable delete with backup_id --- azure-cli1.pyproj | 1570 +++++++++++++++++ azure-cli1.sln | 23 + .../azure/cli/command_modules/sql/_help.py | 2 + .../azure/cli/command_modules/sql/_params.py | 22 +- .../azure/cli/command_modules/sql/commands.py | 3 +- .../azure/cli/command_modules/sql/custom.py | 80 +- 6 files changed, 1665 insertions(+), 35 deletions(-) create mode 100644 azure-cli1.pyproj create mode 100644 azure-cli1.sln diff --git a/azure-cli1.pyproj b/azure-cli1.pyproj new file mode 100644 index 00000000000..a7979cf83d7 --- /dev/null +++ b/azure-cli1.pyproj @@ -0,0 +1,1570 @@ + + + + Debug + 2.0 + {9aaf97af-77fd-4090-a1ad-b888a9fc653e} + + + + . + . + {888888a0-9f3d-457c-b088-3a5042f75d52} + Standard Python launcher + MSBuild|env|$(MSBuildProjectFullPath) + + + + + 10.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + env + env (Python 3.8 (64-bit)) + Scripts\python.exe + Scripts\pythonw.exe + 0.0 + X64 + PYTHONPATH + + + + \ No newline at end of file diff --git a/azure-cli1.sln b/azure-cli1.sln new file mode 100644 index 00000000000..5c0f6964aae --- /dev/null +++ b/azure-cli1.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.1062 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "azure-cli1", "azure-cli1.pyproj", "{9AAF97AF-77FD-4090-A1AD-B888A9FC653E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9AAF97AF-77FD-4090-A1AD-B888A9FC653E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9AAF97AF-77FD-4090-A1AD-B888A9FC653E}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {717866F5-9972-4B25-8301-3E351A2F772D} + EndGlobalSection +EndGlobal diff --git a/src/azure-cli/azure/cli/command_modules/sql/_help.py b/src/azure-cli/azure/cli/command_modules/sql/_help.py index 95d3e56a96b..43a5fb69c71 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_help.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_help.py @@ -712,6 +712,8 @@ examples: - name: Delete long term retention backup for a managed database. text: az sql midb ltr-backup delete -l southeastasia --mi myinstance -d mymanageddb --name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" + - name: Delete long term retention backup for a managed database. + text: az sql midb ltr-backup delete --backup-id '/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/mymanageddb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000' """ helps['sql midb ltr-backup restore'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/sql/_params.py b/src/azure-cli/azure/cli/command_modules/sql/_params.py index 4b2775e57fb..d3c6b22ba25 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/_params.py +++ b/src/azure-cli/azure/cli/command_modules/sql/_params.py @@ -1533,13 +1533,15 @@ def _configure_security_policy_storage_params(arg_ctx): with self.argument_context('sql midb ltr-backup') as c: c.argument('location_name', arg_type=get_location_type(self.cli_ctx), - help='The location of the desired backups.', + help='The location of the desired backup(s).', id_part=None) c.argument('database_name', options_list=['--database', '-d'], - help='The name of the Azure SQL Managed Database. ' - 'If specified (along with instance name), retrieves all requested backups under this database.', + id_part=None) + + c.argument('managed_instance_name', + options_list=['--managed-instance', '--mi'], id_part=None) c.argument('backup_name', @@ -1551,15 +1553,19 @@ def _configure_security_policy_storage_params(arg_ctx): c.argument('backup_id', options_list=['--backup-id', '--id'], help='The resource id of the backups. ' - 'Use \'az sql midb ltr-backup show\' or \'az sql midb ltr-backup list\' for backup id.', - id_part=None) + 'Use \'az sql midb ltr-backup show\' or \'az sql midb ltr-backup list\' for backup id. ' + 'If provided, other arguments are not required. ') with self.argument_context('sql midb ltr-backup list') as c: + c.argument('database_name', + options_list=['--database', '-d'], + help='The name of the Azure SQL Managed Database. ' + 'If specified (along with instance name), retrieves all requested backups under this database.') + c.argument('managed_instance_name', options_list=['--managed-instance', '--mi'], help='Name of the Azure SQL managed instance. ' - 'If specified, retrieves all requested backups under this managed instance.', - id_part=None) + 'If specified, retrieves all requested backups under this managed instance.') c.argument('database_state', required=False, @@ -1591,7 +1597,7 @@ def _configure_security_policy_storage_params(arg_ctx): help='Name of the resource group of the managed instance to restore managed database to.') c.argument('long_term_retention_backup_resource_id', - options_list=['--backup-id'], + options_list=['--backup-id', '--id'], required=True, help='The resource id of the long term retention backup to be restored. ' 'Use \'az sql midb ltr-backup show\' or \'az sql midb ltr-backup list\' for backup id.') diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index 40a8fd5105d..da5752fa4b2 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -597,8 +597,7 @@ def load_command_table(self, _): g.custom_command( 'list', 'list_long_term_retention_mi_backups') - g.command('delete', 'delete', - confirmation=True) + g.custom_command('delete', 'delete_long_term_retention_mi_backup', confirmation=True) with self.command_group('sql midb ltr-backup', managed_databases_operations, diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 91c791c266b..959231ea24c 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2735,6 +2735,34 @@ def update_long_term_retention_mi( return policy +def _get_backup_id_resource_values(backup_id): + ''' + Extract resource values from the backup id + ''' + + backup_id = backup_id.replace('\'', '') + backup_id = backup_id.replace('"', '') + + if backup_id[0] == '/': + # remove leading / + backup_id = backup_id[1:] + print(backup_id) + + resources_list = backup_id.split('/') + print(resources_list) + resources_dict = {resources_list[i]: resources_list[i + 1] for i in range(0, len(resources_list), 2)} + + if not ('locations'.casefold() in resources_dict and + 'longTermRetentionManagedInstances'.casefold() not in resources_dict and + 'longTermRetentionDatabases'.casefold() not in resources_dict and + 'longTermRetentionManagedInstanceBackups'.casefold() not in resources_dict): + + # backup ID should contain all these + raise CLIError('Please provide a valid resource URI. See --help for example.') + + return resources_dict + + def get_long_term_retention_mi_backup( client, location_name=None, @@ -2747,37 +2775,13 @@ def get_long_term_retention_mi_backup( ''' if backup_id: - backup_id = backup_id.replace('\'', '') - backup_id = backup_id.replace('"', '') - - if backup_id[0] == '/': - # remove leading / - backup_id = backup_id[1:] - print(backup_id) - - resources_list = backup_id.split('/') - print(resources_list) - resources_dict = {resources_list[i]: resources_list[i + 1] for i in range(0, len(resources_list), 2)} - - if not ('locations'.casefold() in resources_dict and - 'longTermRetentionManagedInstances'.casefold() not in resources_dict and - 'longTermRetentionDatabases'.casefold() not in resources_dict and - 'longTermRetentionManagedInstanceBackups'.casefold() not in resources_dict): - - raise CLIError('Please provide a valid resource URI. See --help for example.') + resources_dict = _get_backup_id_resource_values(backup_id) location_name = resources_dict['locations'] managed_instance_name = resources_dict['longTermRetentionManagedInstances'] database_name = resources_dict['longTermRetentionDatabases'] backup_name = resources_dict['longTermRetentionManagedInstanceBackups'] - else: - if not (location_name and - managed_instance_name and - database_name and - backup_name): - raise CLIError('Please provide valid resource to show. See --help for examples.') - return client.get( location_name=location_name, managed_instance_name=managed_instance_name, @@ -2911,6 +2915,32 @@ def list_long_term_retention_mi_backups( return backups +def delete_long_term_retention_mi_backup( + client, + location_name=None, + managed_instance_name=None, + database_name=None, + backup_name=None, + backup_id=None): + ''' + Deletes the requested long term retention backup. + ''' + + if backup_id: + resources_dict = _get_backup_id_resource_values(backup_id) + + location_name = resources_dict['locations'] + managed_instance_name = resources_dict['longTermRetentionManagedInstances'] + database_name = resources_dict['longTermRetentionDatabases'] + backup_name = resources_dict['longTermRetentionManagedInstanceBackups'] + + return client.delete( + location_name=location_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + backup_name=backup_name) + + def restore_long_term_retention_mi_backup( cmd, client, From fb054157b1ec1710104b97b4a33a6545e66c2291 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 16 Apr 2020 00:58:59 -0700 Subject: [PATCH 51/54] adjust usage of --latest in test --- .../cli/command_modules/sql/tests/latest/test_sql_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index 0a5205e5555..a0abab53153 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3269,7 +3269,7 @@ def test_sql_managed_db_long_term_retention( # setup for test show long term retention backup backup = self.cmd( - 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name} --latest True').get_output_in_json() + 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name} --latest').get_output_in_json() self.kwargs.update({ 'backup_name': backup[0]['name'], From 7898a1d0336ea8efbf7fc8ceb802802065b341b6 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 16 Apr 2020 01:34:15 -0700 Subject: [PATCH 52/54] remove py files --- azure-cli1.pyproj | 1570 --------------------------------------------- azure-cli1.sln | 23 - 2 files changed, 1593 deletions(-) delete mode 100644 azure-cli1.pyproj delete mode 100644 azure-cli1.sln diff --git a/azure-cli1.pyproj b/azure-cli1.pyproj deleted file mode 100644 index a7979cf83d7..00000000000 --- a/azure-cli1.pyproj +++ /dev/null @@ -1,1570 +0,0 @@ - - - - Debug - 2.0 - {9aaf97af-77fd-4090-a1ad-b888a9fc653e} - - - - . - . - {888888a0-9f3d-457c-b088-3a5042f75d52} - Standard Python launcher - MSBuild|env|$(MSBuildProjectFullPath) - - - - - 10.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - env - env (Python 3.8 (64-bit)) - Scripts\python.exe - Scripts\pythonw.exe - 0.0 - X64 - PYTHONPATH - - - - \ No newline at end of file diff --git a/azure-cli1.sln b/azure-cli1.sln deleted file mode 100644 index 5c0f6964aae..00000000000 --- a/azure-cli1.sln +++ /dev/null @@ -1,23 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.1062 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "azure-cli1", "azure-cli1.pyproj", "{9AAF97AF-77FD-4090-A1AD-B888A9FC653E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9AAF97AF-77FD-4090-A1AD-B888A9FC653E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9AAF97AF-77FD-4090-A1AD-B888A9FC653E}.Release|Any CPU.ActiveCfg = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {717866F5-9972-4B25-8301-3E351A2F772D} - EndGlobalSection -EndGlobal From 98ea63ffc79193c2158ea63fbc5573c55224cd2e Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 16 Apr 2020 12:05:02 -0700 Subject: [PATCH 53/54] added hard length checks to tests; added show test using backup id; added is_preview=True to new commands; added ability to use int arguments to configure retention settings in days --- .../azure/cli/command_modules/sql/commands.py | 18 ++++++++------- .../azure/cli/command_modules/sql/custom.py | 22 +++++++++++++++++-- .../sql/tests/latest/test_sql_commands.py | 20 ++++++++++++----- 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/commands.py b/src/azure-cli/azure/cli/command_modules/sql/commands.py index da5752fa4b2..8cdfcdcd0e4 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/commands.py @@ -572,8 +572,9 @@ def load_command_table(self, _): g.custom_command( 'set', 'update_short_term_retention_mi', - supports_no_wait=True) - g.custom_command('show', 'get_short_term_retention_mi') + supports_no_wait=True, + is_preview=True) + g.custom_command('show', 'get_short_term_retention_mi', is_preview=True) managed_database_long_term_retention_policies_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#ManagedInstanceLongTermRetentionPoliciesOperations.{}', @@ -583,8 +584,8 @@ def load_command_table(self, _): managed_database_long_term_retention_policies_operations, client_factory=get_sql_managed_database_long_term_retention_policies_operations) as g: - g.custom_command('set', 'update_long_term_retention_mi') - g.show_command('show', 'get') + g.custom_command('set', 'update_long_term_retention_mi', is_preview=True) + g.show_command('show', 'get', is_preview=True) managed_database_long_term_retention_backups_operations = CliCommandType( operations_tmpl='azure.mgmt.sql.operations#LongTermRetentionManagedInstanceBackupsOperations.{}', @@ -593,11 +594,11 @@ def load_command_table(self, _): with self.command_group('sql midb ltr-backup', managed_database_long_term_retention_backups_operations, client_factory=get_sql_managed_database_long_term_retention_backups_operations) as g: - g.custom_command('show', 'get_long_term_retention_mi_backup') + g.custom_command('show', 'get_long_term_retention_mi_backup', is_preview=True) g.custom_command( 'list', - 'list_long_term_retention_mi_backups') - g.custom_command('delete', 'delete_long_term_retention_mi_backup', confirmation=True) + 'list_long_term_retention_mi_backups', is_preview=True) + g.custom_command('delete', 'delete_long_term_retention_mi_backup', confirmation=True, is_preview=True) with self.command_group('sql midb ltr-backup', managed_databases_operations, @@ -605,7 +606,8 @@ def load_command_table(self, _): g.custom_command( 'restore', 'restore_long_term_retention_mi_backup', - supports_no_wait=True) + supports_no_wait=True, + is_preview=True) g.wait_command('wait') ############################################### diff --git a/src/azure-cli/azure/cli/command_modules/sql/custom.py b/src/azure-cli/azure/cli/command_modules/sql/custom.py index 959231ea24c..6e6d092b580 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/custom.py +++ b/src/azure-cli/azure/cli/command_modules/sql/custom.py @@ -2699,6 +2699,14 @@ def get_short_term_retention_mi( return policy +def _is_int(retention): + try: + int(retention) + return True + except ValueError: + return False + + def update_long_term_retention_mi( client, database_name, @@ -2712,12 +2720,24 @@ def update_long_term_retention_mi( ''' Updates long term retention for managed database ''' + if not (weekly_retention or monthly_retention or yearly_retention): raise CLIError('Please specify retention setting(s). See \'--help\' for more details.') if yearly_retention and not week_of_year: raise CLIError('Please specify week of year for yearly retention.') + # if an int is provided for retention, convert to ISO 8601 using days + if (weekly_retention and _is_int(weekly_retention)): + weekly_retention = 'P%sD' % weekly_retention + print(weekly_retention) + + if (monthly_retention and _is_int(monthly_retention)): + monthly_retention = 'P%sD' % monthly_retention + + if (yearly_retention and _is_int(yearly_retention)): + yearly_retention = 'P%sD' % yearly_retention + kwargs['weekly_retention'] = weekly_retention kwargs['monthly_retention'] = monthly_retention @@ -2746,10 +2766,8 @@ def _get_backup_id_resource_values(backup_id): if backup_id[0] == '/': # remove leading / backup_id = backup_id[1:] - print(backup_id) resources_list = backup_id.split('/') - print(resources_list) resources_dict = {resources_list[i]: resources_list[i + 1] for i in range(0, len(resources_list), 2)} if not ('locations'.casefold() in resources_dict and diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index a0abab53153..adf929564bb 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3233,39 +3233,39 @@ def test_sql_managed_db_long_term_retention( self.cmd( 'sql midb ltr-backup list -l {loc} -g {rg}', checks=[ - self.greater_than('length(@)', 0)]) + self.check('length(@)', 3)]) # without resource group self.cmd( 'sql midb ltr-backup list -l {loc}', checks=[ - self.greater_than('length(@)', 0)]) + self.check('length(@)', 3)]) # test list long term retention backups for instance # with resource group self.cmd( 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -g {rg}', checks=[ - self.greater_than('length(@)', 0)]) + self.check('length(@)', 3)]) # without resource group self.cmd( 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name}', checks=[ - self.greater_than('length(@)', 0)]) + self.check('length(@)', 3)]) # test list long term retention backups for database # with resource group self.cmd( 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name} -g {rg}', checks=[ - self.greater_than('length(@)', 0)]) + self.check('length(@)', 1)]) # without resource group self.cmd( 'sql midb ltr-backup list -l {loc} --mi {managed_instance_name} -d {database_name}', checks=[ - self.greater_than('length(@)', 0)]) + self.check('length(@)', 1)]) # setup for test show long term retention backup backup = self.cmd( @@ -3285,6 +3285,14 @@ def test_sql_managed_db_long_term_retention( self.check('databaseName', '{database_name}'), self.check('name', '{backup_name}')]) + self.cmd( + 'sql midb ltr-backup show --id {backup_id}', + checks=[ + self.check('resourceGroup', '{rg}'), + self.check('managedInstanceName', '{managed_instance_name}'), + self.check('databaseName', '{database_name}'), + self.check('name', '{backup_name}')]) + # test restore managed database from LTR backup self.kwargs.update({ 'dest_database_name': 'cli-restore-dest' From 81450d14ca0194c3c98fbc929ad4c2d5561712a7 Mon Sep 17 00:00:00 2001 From: xaliciayang Date: Thu, 16 Apr 2020 12:40:55 -0700 Subject: [PATCH 54/54] test re-record --- ...st_sql_managed_db_long_term_retention.yaml | 207 +++++++++++------- .../sql/tests/latest/test_sql_commands.py | 2 +- 2 files changed, 129 insertions(+), 80 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml index 64951e8a17b..8d856abfff1 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/recordings/test_sql_managed_db_long_term_retention.yaml @@ -23,25 +23,25 @@ interactions: accept-language: - en-US method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-4/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-04-14T23:37:22.313Z"}' + string: '{"operation":"UpsertDatabaseBackupArchivalPolicyV2","startTime":"2020-04-16T19:37:34.39Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/cc407b33-239d-42a4-9e29-91632f26a508?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/13677f68-cfe1-4f98-a653-04b2e197636f?api-version=2018-06-01-preview cache-control: - no-cache content-length: - - '91' + - '90' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:22 GMT + - Thu, 16 Apr 2020 19:37:34 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/cc407b33-239d-42a4-9e29-91632f26a508?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyOperationResults/13677f68-cfe1-4f98-a653-04b2e197636f?api-version=2018-06-01-preview pragma: - no-cache server: @@ -51,7 +51,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 202 message: Accepted @@ -72,19 +72,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/cc407b33-239d-42a4-9e29-91632f26a508?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/managedInstanceLongTermRetentionPolicyAzureAsyncOperation/13677f68-cfe1-4f98-a653-04b2e197636f?api-version=2018-06-01-preview response: body: - string: '{"name":"cc407b33-239d-42a4-9e29-91632f26a508","status":"Succeeded","startTime":"2020-04-14T23:37:22.313Z"}' + string: '{"name":"13677f68-cfe1-4f98-a653-04b2e197636f","status":"Succeeded","startTime":"2020-04-16T19:37:34.39Z"}' headers: cache-control: - no-cache content-length: - - '107' + - '106' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:36 GMT + - Thu, 16 Apr 2020 19:37:49 GMT expires: - '-1' pragma: @@ -119,10 +119,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-4/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-4/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache @@ -131,7 +131,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:37 GMT + - Thu, 16 Apr 2020 19:37:49 GMT expires: - '-1' pragma: @@ -168,10 +168,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-4/backupLongTermRetentionPolicies/default?api-version=2018-06-01-preview response: body: - string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-1/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' + string: '{"properties":{"weeklyRetention":"P1W","monthlyRetention":"P1M","yearlyRetention":"P2M","weekOfYear":12},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/test-4/backupLongTermRetentionPolicies/default","name":"default","type":"Microsoft.Sql/managedInstances/databases/backupLongTermRetentionPolicy"}' headers: cache-control: - no-cache @@ -180,7 +180,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:38 GMT + - Thu, 16 Apr 2020 19:37:51 GMT expires: - '-1' pragma: @@ -220,16 +220,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2907' + - '2183' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:38 GMT + - Thu, 16 Apr 2020 19:37:50 GMT expires: - '-1' pragma: @@ -269,16 +269,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2907' + - '2183' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:39 GMT + - Thu, 16 Apr 2020 19:37:51 GMT expires: - '-1' pragma: @@ -318,16 +318,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2907' + - '2183' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:39 GMT + - Thu, 16 Apr 2020 19:37:51 GMT expires: - '-1' pragma: @@ -367,16 +367,16 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-6","backupTime":"2020-04-14T22:11:46Z","backupExpirationTime":"2020-04-21T22:11:46Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-6/longTermRetentionManagedInstanceBackups/63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","name":"63937397-37b8-4efe-82f0-51f39955f9b4;132313759060000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"},{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-5","backupTime":"2020-04-14T22:09:42Z","backupExpirationTime":"2020-04-21T22:09:42Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-5/longTermRetentionManagedInstanceBackups/538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","name":"538e3c19-ffeb-4fa0-ad1e-efa36c393ce2;132313757820000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache content-length: - - '2907' + - '2183' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:40 GMT + - Thu, 16 Apr 2020 19:37:53 GMT expires: - '-1' pragma: @@ -413,10 +413,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -425,7 +425,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:41 GMT + - Thu, 16 Apr 2020 19:37:53 GMT expires: - '-1' pragma: @@ -462,10 +462,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups?api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -474,7 +474,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:41 GMT + - Thu, 16 Apr 2020 19:37:53 GMT expires: - '-1' pragma: @@ -511,10 +511,10 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups?onlyLatestPerDatabase=true&api-version=2018-06-01-preview response: body: - string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' + string: '{"value":[{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}]}' headers: cache-control: - no-cache @@ -523,7 +523,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:41 GMT + - Thu, 16 Apr 2020 19:37:54 GMT expires: - '-1' pragma: @@ -560,10 +560,59 @@ interactions: accept-language: - en-US method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253%3B132309599250000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034%3B132313757810000000?api-version=2018-06-01-preview + response: + body: + string: '{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' + headers: + cache-control: + - no-cache + content-length: + - '723' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 16 Apr 2020 19:37:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - sql midb ltr-backup show + Connection: + - keep-alive + ParameterSetName: + - --id + User-Agent: + - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 + azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 + accept-language: + - en-US + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034%3B132313757810000000?api-version=2018-06-01-preview response: body: - string: '{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-1","backupTime":"2020-04-10T02:38:45Z","backupExpirationTime":"2020-04-24T02:38:45Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","name":"611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' + string: '{"properties":{"managedInstanceName":"ayang-ltr-mi","managedInstanceCreateTime":"2020-04-06T09:13:39.977Z","databaseName":"test-4","backupTime":"2020-04-14T22:09:41Z","backupExpirationTime":"2020-04-21T22:09:41Z"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","name":"ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000","type":"Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups"}' headers: cache-control: - no-cache @@ -572,7 +621,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:42 GMT + - Thu, 16 Apr 2020 19:37:54 GMT expires: - '-1' pragma: @@ -621,7 +670,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:42 GMT + - Thu, 16 Apr 2020 19:37:55 GMT expires: - '-1' pragma: @@ -641,7 +690,7 @@ interactions: message: OK - request: body: '{"location": "westus", "properties": {"createMode": "RestoreLongTermRetentionBackup", - "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253;132309599250000000"}}' + "longTermRetentionBackupResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034;132313757810000000"}}' headers: Accept: - application/json @@ -666,22 +715,22 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-04-14T23:37:43.9Z"}' + string: '{"operation":"CreateManagedRestoreFromLtrBackupRequest","startTime":"2020-04-16T19:37:56.74Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/a9366cae-ca7e-4cda-9091-0da781642889?api-version=2019-06-01-preview cache-control: - no-cache content-length: - - '93' + - '94' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:43 GMT + - Thu, 16 Apr 2020 19:37:56 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseOperationResults/a9366cae-ca7e-4cda-9091-0da781642889?api-version=2019-06-01-preview pragma: - no-cache server: @@ -691,7 +740,7 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' status: code: 202 message: Accepted @@ -712,19 +761,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/a9366cae-ca7e-4cda-9091-0da781642889?api-version=2019-06-01-preview response: body: - string: '{"name":"10f32a39-61d1-4da3-83c3-a9ceaca3acdd","status":"InProgress","startTime":"2020-04-14T23:37:43.9Z"}' + string: '{"name":"a9366cae-ca7e-4cda-9091-0da781642889","status":"InProgress","startTime":"2020-04-16T19:37:56.74Z"}' headers: cache-control: - no-cache content-length: - - '106' + - '107' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:37:59 GMT + - Thu, 16 Apr 2020 19:38:11 GMT expires: - '-1' pragma: @@ -759,19 +808,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/a9366cae-ca7e-4cda-9091-0da781642889?api-version=2019-06-01-preview response: body: - string: '{"name":"10f32a39-61d1-4da3-83c3-a9ceaca3acdd","status":"InProgress","startTime":"2020-04-14T23:37:43.9Z"}' + string: '{"name":"a9366cae-ca7e-4cda-9091-0da781642889","status":"InProgress","startTime":"2020-04-16T19:37:56.74Z"}' headers: cache-control: - no-cache content-length: - - '106' + - '107' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:38:14 GMT + - Thu, 16 Apr 2020 19:38:26 GMT expires: - '-1' pragma: @@ -806,19 +855,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/a9366cae-ca7e-4cda-9091-0da781642889?api-version=2019-06-01-preview response: body: - string: '{"name":"10f32a39-61d1-4da3-83c3-a9ceaca3acdd","status":"InProgress","startTime":"2020-04-14T23:37:43.9Z"}' + string: '{"name":"a9366cae-ca7e-4cda-9091-0da781642889","status":"InProgress","startTime":"2020-04-16T19:37:56.74Z"}' headers: cache-control: - no-cache content-length: - - '106' + - '107' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:38:29 GMT + - Thu, 16 Apr 2020 19:38:41 GMT expires: - '-1' pragma: @@ -853,19 +902,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/a9366cae-ca7e-4cda-9091-0da781642889?api-version=2019-06-01-preview response: body: - string: '{"name":"10f32a39-61d1-4da3-83c3-a9ceaca3acdd","status":"InProgress","startTime":"2020-04-14T23:37:43.9Z"}' + string: '{"name":"a9366cae-ca7e-4cda-9091-0da781642889","status":"InProgress","startTime":"2020-04-16T19:37:56.74Z"}' headers: cache-control: - no-cache content-length: - - '106' + - '107' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:38:44 GMT + - Thu, 16 Apr 2020 19:38:56 GMT expires: - '-1' pragma: @@ -900,19 +949,19 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/10f32a39-61d1-4da3-83c3-a9ceaca3acdd?api-version=2019-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/managedDatabaseAzureAsyncOperation/a9366cae-ca7e-4cda-9091-0da781642889?api-version=2019-06-01-preview response: body: - string: '{"name":"10f32a39-61d1-4da3-83c3-a9ceaca3acdd","status":"Succeeded","startTime":"2020-04-14T23:37:43.9Z"}' + string: '{"name":"a9366cae-ca7e-4cda-9091-0da781642889","status":"Succeeded","startTime":"2020-04-16T19:37:56.74Z"}' headers: cache-control: - no-cache content-length: - - '105' + - '106' content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:38:58 GMT + - Thu, 16 Apr 2020 19:39:12 GMT expires: - '-1' pragma: @@ -950,7 +999,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest?api-version=2019-06-01-preview response: body: - string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-04-14T23:37:44.26Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' + string: '{"properties":{"collation":"SQL_Latin1_General_CP1_CI_AS","status":"Online","creationDate":"2020-04-16T19:37:57.02Z","defaultSecondaryLocation":"eastus"},"location":"westus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitestxj6awmetud/providers/Microsoft.Sql/managedInstances/ayang-ltr-mi/databases/cli-restore-dest","name":"cli-restore-dest","type":"Microsoft.Sql/managedInstances/databases"}' headers: cache-control: - no-cache @@ -959,7 +1008,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:38:59 GMT + - Thu, 16 Apr 2020 19:39:12 GMT expires: - '-1' pragma: @@ -998,13 +1047,13 @@ interactions: accept-language: - en-US method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-1/longTermRetentionManagedInstanceBackups/611f8f2e-87c0-44ba-b4a0-c8c599e44253%3B132309599250000000?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstances/ayang-ltr-mi/longTermRetentionDatabases/test-4/longTermRetentionManagedInstanceBackups/ab281953-f91d-40cc-8a1b-d8b227573034%3B132313757810000000?api-version=2018-06-01-preview response: body: - string: '{"operation":"DeleteLTRBackup","startTime":"2020-04-14T23:39:00.597Z"}' + string: '{"operation":"DeleteLTRBackup","startTime":"2020-04-16T19:39:13.447Z"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/1c92f5eb-4cd2-4daa-b9a2-e54cf74f9aaf?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/674078e7-894c-42de-be63-6ade59743bb1?api-version=2018-06-01-preview cache-control: - no-cache content-length: @@ -1012,11 +1061,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:39:00 GMT + - Thu, 16 Apr 2020 19:39:13 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/1c92f5eb-4cd2-4daa-b9a2-e54cf74f9aaf?api-version=2018-06-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupOperationResults/674078e7-894c-42de-be63-6ade59743bb1?api-version=2018-06-01-preview pragma: - no-cache server: @@ -1047,10 +1096,10 @@ interactions: - python/3.8.2 (Windows-10-10.0.14393-SP0) msrest/0.6.11 msrest_azure/0.6.3 azure-mgmt-sql/0.17.0 Azure-SDK-For-Python AZURECLI/2.2.0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/1c92f5eb-4cd2-4daa-b9a2-e54cf74f9aaf?api-version=2018-06-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Sql/locations/westus/longTermRetentionManagedInstanceBackupAzureAsyncOperation/674078e7-894c-42de-be63-6ade59743bb1?api-version=2018-06-01-preview response: body: - string: '{"name":"1c92f5eb-4cd2-4daa-b9a2-e54cf74f9aaf","status":"Succeeded","startTime":"2020-04-14T23:39:00.597Z"}' + string: '{"name":"674078e7-894c-42de-be63-6ade59743bb1","status":"Succeeded","startTime":"2020-04-16T19:39:13.447Z"}' headers: cache-control: - no-cache @@ -1059,7 +1108,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Tue, 14 Apr 2020 23:39:15 GMT + - Thu, 16 Apr 2020 19:39:28 GMT expires: - '-1' pragma: diff --git a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py index adf929564bb..de0c3da59f4 100644 --- a/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py +++ b/src/azure-cli/azure/cli/command_modules/sql/tests/latest/test_sql_commands.py @@ -3203,7 +3203,7 @@ def test_sql_managed_db_long_term_retention( 'rg': 'clitestxj6awmetud', 'loc': 'westus', 'managed_instance_name': 'ayang-ltr-mi', - 'database_name': 'test-1', + 'database_name': 'test-4', 'weekly_retention': 'P1W', 'monthly_retention': 'P1M', 'yearly_retention': 'P2M',