Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions src/azure-cli/azure/cli/command_modules/rdbms/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,27 +275,27 @@ def cf_postgres_flexible_replica(cli_ctx, _):


def cf_postgres_flexible_location_capabilities(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).location_based_capabilities
return get_postgresql_flexible_management_client(cli_ctx).capabilities_by_location


def cf_postgres_flexible_server_capabilities(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).server_capabilities
return get_postgresql_flexible_management_client(cli_ctx).capabilities_by_server


def cf_postgres_flexible_backups(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).backups
return get_postgresql_flexible_management_client(cli_ctx).backups_automatic_and_on_demand


def cf_postgres_flexible_ltr_backups(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).ltr_backup_operations
return get_postgresql_flexible_management_client(cli_ctx).backups_long_term_retention


def cf_postgres_flexible_operations(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).flexible_server
return get_postgresql_flexible_management_client(cli_ctx).operations


def cf_postgres_flexible_admin(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).administrators
return get_postgresql_flexible_management_client(cli_ctx).administrators_microsoft_entra


def cf_postgres_flexible_migrations(cli_ctx, _):
Expand All @@ -306,34 +306,30 @@ def cf_postgres_flexible_server_threat_protection_settings(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).server_threat_protection_settings


def cf_postgres_flexible_advanced_threat_protection_settings(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).advanced_threat_protection_settings


def cf_postgres_flexible_server_log_files(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).log_files
return get_postgresql_flexible_management_client(cli_ctx).captured_logs


def cf_postgres_check_resource_availability(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).check_name_availability
return get_postgresql_flexible_management_client(cli_ctx).name_availability


def cf_postgres_flexible_db(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).databases


def cf_postgres_check_resource_availability_with_location(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).check_name_availability_with_location


def cf_postgres_flexible_private_dns_zone_suffix_operations(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).get_private_dns_zone_suffix
return get_postgresql_flexible_management_client(cli_ctx).private_dns_zone_suffix


def cf_postgres_flexible_private_endpoint_connections(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).private_endpoint_connections


def cf_postgres_flexible_private_endpoint_connection(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).private_endpoint_connection


def cf_postgres_flexible_private_link_resources(cli_ctx, _):
return get_postgresql_flexible_management_client(cli_ctx).private_link_resources

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def get_postgres_location_capability_info(cmd, location, is_offer_restriction_check_required=False):
list_location_capability_client = cf_postgres_flexible_location_capabilities(cmd.cli_ctx, '_')
list_location_capability_result = list_location_capability_client.execute(location)
list_location_capability_result = list_location_capability_client.list(location)
return _postgres_parse_list_capability(list_location_capability_result, is_offer_restriction_check_required)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

logger = get_logger(__name__)

DEFAULT_LOCATION_PG = 'eastus' # For testing: 'eastus2euap'
DEFAULT_LOCATION_PG = 'canadacentral'
DEFAULT_LOCATION_MySQL = 'westus2'
AZURE_CREDENTIALS = 'AZURE_CREDENTIALS'
AZURE_POSTGRESQL_CONNECTION_STRING = 'AZURE_POSTGRESQL_CONNECTION_STRING'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
cf_postgres_flexible_location_capabilities,
cf_postgres_flexible_backups,
cf_postgres_flexible_ltr_backups,
cf_postgres_flexible_operations,
cf_postgres_flexible_replica,
cf_postgres_flexible_admin,
cf_postgres_flexible_migrations,
cf_postgres_flexible_private_endpoint_connection,
cf_postgres_flexible_private_endpoint_connections,
cf_postgres_flexible_private_link_resources,
cf_postgres_flexible_virtual_endpoints,
cf_postgres_flexible_server_threat_protection_settings,
cf_postgres_flexible_advanced_threat_protection_settings,
cf_postgres_flexible_server_log_files)

from ._transformers import (
Expand Down Expand Up @@ -61,32 +60,27 @@ def load_flexibleserver_command_table(self, _):
)

postgres_flexible_location_capabilities_sdk = CliCommandType(
operations_tmpl='azure.mgmt.rdbms.postgresqlflexibleservers.operations#LocationBasedCapabilitiesOperations.{}',
operations_tmpl='azure.mgmt.rdbms.postgresqlflexibleservers.operations#CapabilitiesByLocationOperations.{}',
client_factory=cf_postgres_flexible_location_capabilities
)

postgres_flexible_backups_sdk = CliCommandType(
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#BackupsOperations.{}',
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#BackupsAutomaticAndOnDemandOperations.{}',
client_factory=cf_postgres_flexible_backups
)

postgres_flexible_ltr_backup_sdk = CliCommandType(
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#LtrBackupOperationsOperations.{}',
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#BackupsLongTermRetentionOperations.{}',
client_factory=cf_postgres_flexible_ltr_backups
)

postgres_flexible_operations_sdk = CliCommandType(
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#FlexibleServerOperations.{}',
client_factory=cf_postgres_flexible_operations
)

postgres_flexible_replica_sdk = CliCommandType(
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#ReplicasOperations.{}',
client_factory=cf_postgres_flexible_replica
)

postgres_flexible_admin_sdk = CliCommandType(
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#AdministratorsOperations.{}',
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#AdministratorsMicrosoftEntraOperations.{}',
client_factory=cf_postgres_flexible_admin
)

Expand All @@ -105,14 +99,14 @@ def load_flexibleserver_command_table(self, _):
client_factory=cf_postgres_flexible_server_threat_protection_settings
)

postgres_flexible_server_log_files_sdk = CliCommandType(
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#LogFilesOperations.{}',
client_factory=cf_postgres_flexible_server_log_files
postgres_flexible_advanced_threat_protection_settings_sdk = CliCommandType(
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#AdvancedThreatProtectionSettingsOperations.{}',
client_factory=cf_postgres_flexible_advanced_threat_protection_settings
)

postgres_flexible_server_private_endpoint_connection_sdk = CliCommandType(
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#PrivateEndpointConnectionOperations.{}',
client_factory=cf_postgres_flexible_private_endpoint_connection
postgres_flexible_server_log_files_sdk = CliCommandType(
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#CapturedLogsOperations.{}',
client_factory=cf_postgres_flexible_server_log_files
)

postgres_flexible_server_private_endpoint_connections_sdk = CliCommandType(
Expand Down Expand Up @@ -223,9 +217,6 @@ def load_flexibleserver_command_table(self, _):
client_factory=cf_postgres_flexible_ltr_backups) as g:
g.command('list', 'list_by_server', transform=transform_backups_list)
g.show_command('show', 'get', transform=transform_backup)

with self.command_group('postgres flexible-server long-term-retention', postgres_flexible_operations_sdk,
client_factory=cf_postgres_flexible_operations) as g:
g.custom_command('pre-check', 'ltr_precheck_func', custom_command_type=flexible_servers_custom_postgres)
g.custom_command('start', 'ltr_start_func', custom_command_type=flexible_servers_custom_postgres)

Expand Down Expand Up @@ -258,10 +249,14 @@ def load_flexibleserver_command_table(self, _):
g.custom_show_command('show', 'flexible_server_microsoft_entra_admin_show')
g.custom_wait_command('wait', 'flexible_server_microsoft_entra_admin_show')

with self.command_group('postgres flexible-server advanced-threat-protection-setting', postgres_flexible_advanced_threat_protection_settings_sdk,
custom_command_type=flexible_servers_custom_postgres,
client_factory=cf_postgres_flexible_advanced_threat_protection_settings) as g:
g.custom_show_command('show', 'flexible_server_threat_protection_get', custom_command_type=flexible_servers_custom_postgres)

with self.command_group('postgres flexible-server advanced-threat-protection-setting', postgres_flexible_server_threat_protection_settings_sdk,
custom_command_type=flexible_servers_custom_postgres,
client_factory=cf_postgres_flexible_server_threat_protection_settings) as g:
g.custom_show_command('show', 'flexible_server_threat_protection_get', custom_command_type=flexible_servers_custom_postgres)
g.custom_command('update', 'flexible_server_threat_protection_update', custom_command_type=flexible_servers_custom_postgres)

with self.command_group('postgres flexible-server server-logs', postgres_flexible_server_log_files_sdk,
Expand All @@ -270,13 +265,11 @@ def load_flexibleserver_command_table(self, _):
g.custom_command('list', 'flexible_server_list_log_files_with_filter', custom_command_type=flexible_servers_custom_postgres)
g.custom_command('download', 'flexible_server_download_log_files', custom_command_type=flexible_servers_custom_postgres)

with self.command_group('postgres flexible-server private-endpoint-connection', postgres_flexible_server_private_endpoint_connections_sdk) as g:
with self.command_group('postgres flexible-server private-endpoint-connection', postgres_flexible_server_private_endpoint_connections_sdk,
custom_command_type=flexible_servers_custom_postgres,
client_factory=cf_postgres_flexible_private_endpoint_connections) as g:
g.command('list', 'list_by_server')
g.show_command('show', 'get', validator=validate_private_endpoint_connection_id)

with self.command_group('postgres flexible-server private-endpoint-connection', postgres_flexible_server_private_endpoint_connection_sdk,
custom_command_type=flexible_servers_custom_postgres,
client_factory=cf_postgres_flexible_private_endpoint_connection) as g:
g.command('delete', 'begin_delete', validator=validate_private_endpoint_connection_id)
g.custom_command('approve', 'flexible_server_approve_private_endpoint_connection', custom_command_type=flexible_servers_custom_postgres,
validator=validate_private_endpoint_connection_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def server_list_custom_func(client, resource_group_name=None, show_cluster=None)
if not check_resource_group(resource_group_name):
resource_group_name = None

servers = client.list()
servers = client.list_by_subscription()

if resource_group_name:
servers = client.list_by_resource_group(resource_group_name)
Expand Down
Loading
Loading