Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ def _resolve_api_version(client, provider_namespace, resource_type, parent_path)
if t.resource_type.lower() == resource_type_str.lower()]
if not rt:
raise InvalidArgumentValueError('Resource type {} not found.'.format(resource_type_str))
if len(rt) == 1 and rt[0].default_api_version not in (None, ''):
return rt[0].default_api_version
if len(rt) == 1 and rt[0].api_versions:
npv = [v for v in rt[0].api_versions if 'preview' not in v.lower()]
return npv[0] if npv else rt[0].api_versions[0]
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def _get_resource_group(self, **kwargs):

class FlexibleServerMgmtScenarioTest(ScenarioTest):

postgres_location = 'eastus'
postgres_backup_location = 'westus'
postgres_location = 'centralindia'
postgres_backup_location = 'southindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -1019,7 +1019,7 @@ def main_tests(geo_redundant_backup):

class FlexibleServerProxyResourceMgmtScenarioTest(ScenarioTest):

postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -1123,7 +1123,7 @@ def _test_database_mgmt(self, database_engine, resource_group, server):

class FlexibleServerValidatorScenarioTest(ScenarioTest):

postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -1262,7 +1262,7 @@ def _test_mgmt_update_validator(self, database_engine, resource_group):

class FlexibleServerReplicationMgmtScenarioTest(ScenarioTest): # pylint: disable=too-few-public-methods

postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -1487,7 +1487,7 @@ def _test_flexible_server_replica_mgmt(self, database_engine, resource_group, vn

class FlexibleServerVnetMgmtScenarioTest(ScenarioTest):

postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -1880,20 +1880,20 @@ def _test_flexible_server_vnet_mgmt_validator(self, resource_group):
resource_group, location, vnet_name, vnet_prefix))

self.cmd('postgres flexible-server create -g {} -l {} --vnet {} --yes'.format(
resource_group, 'westus', vnet_name), # location of vnet and server are different
resource_group, 'southindia', vnet_name), # location of vnet and server are different
expect_failure=True)

# delegated to different service
subnet = self.cmd('network vnet subnet create -g {} -n {} --vnet-name {} --address-prefixes {} --delegations {} --default-outbound false'.format(
resource_group, subnet_name, vnet_name, subnet_prefix, "Microsoft.DBforMySQL/flexibleServers")).get_output_in_json()

self.cmd('postgres flexible-server create -g {} -l {} --subnet {} --yes'.format(
resource_group, 'eastus', subnet["id"]), # Delegated to different service
resource_group, 'centralindia', subnet["id"]), # Delegated to different service
expect_failure=True)


class FlexibleServerPrivateDnsZoneScenarioTest(ScenarioTest):
postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location, parameter_name='server_resource_group')
Expand Down Expand Up @@ -2085,7 +2085,7 @@ def _test_flexible_server_new_private_dns_zone(self, database_engine, server_res


class FlexibleServerPublicAccessMgmtScenarioTest(ScenarioTest):
postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -2157,7 +2157,7 @@ def _test_flexible_server_public_access_mgmt(self, database_engine, resource_gro


class FlexibleServerUpgradeMgmtScenarioTest(ScenarioTest):
postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -2262,7 +2262,7 @@ def _test_backups_mgmt(self, database_engine, resource_group, server):


class FlexibleServerIdentityMicrosoftEntraAdminMgmtScenarioTest(ScenarioTest):
postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -2434,7 +2434,7 @@ def _test_identity_microsoft_entra_admin_mgmt(self, database_engine, resource_gr


class FlexibleServerAdvancedThreatProtectionSettingMgmtScenarioTest(ScenarioTest):
postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -2483,7 +2483,7 @@ def _test_advanced_threat_protection_setting_mgmt(self, database_engine, resourc


class FlexibleServerLogsMgmtScenarioTest(ScenarioTest):
postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -2542,7 +2542,7 @@ def _test_server_logs_mgmt(self, database_engine, resource_group):

class FlexibleServerPrivateEndpointsMgmtScenarioTest(ScenarioTest):

postgres_location = 'eastus'
postgres_location = 'centralindia'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down
Loading