Skip to content

Commit 3b4fab9

Browse files
authored
{RDBMS} Update Python SDK for PostgreSQL flexible servers to version API to 2025-08-01 (#32517)
1 parent 63606b2 commit 3b4fab9

File tree

48 files changed

+52762
-47237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+52762
-47237
lines changed

src/azure-cli/azure/cli/command_modules/rdbms/_client_factory.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -275,27 +275,27 @@ def cf_postgres_flexible_replica(cli_ctx, _):
275275

276276

277277
def cf_postgres_flexible_location_capabilities(cli_ctx, _):
278-
return get_postgresql_flexible_management_client(cli_ctx).location_based_capabilities
278+
return get_postgresql_flexible_management_client(cli_ctx).capabilities_by_location
279279

280280

281281
def cf_postgres_flexible_server_capabilities(cli_ctx, _):
282-
return get_postgresql_flexible_management_client(cli_ctx).server_capabilities
282+
return get_postgresql_flexible_management_client(cli_ctx).capabilities_by_server
283283

284284

285285
def cf_postgres_flexible_backups(cli_ctx, _):
286-
return get_postgresql_flexible_management_client(cli_ctx).backups
286+
return get_postgresql_flexible_management_client(cli_ctx).backups_automatic_and_on_demand
287287

288288

289289
def cf_postgres_flexible_ltr_backups(cli_ctx, _):
290-
return get_postgresql_flexible_management_client(cli_ctx).ltr_backup_operations
290+
return get_postgresql_flexible_management_client(cli_ctx).backups_long_term_retention
291291

292292

293293
def cf_postgres_flexible_operations(cli_ctx, _):
294-
return get_postgresql_flexible_management_client(cli_ctx).flexible_server
294+
return get_postgresql_flexible_management_client(cli_ctx).operations
295295

296296

297297
def cf_postgres_flexible_admin(cli_ctx, _):
298-
return get_postgresql_flexible_management_client(cli_ctx).administrators
298+
return get_postgresql_flexible_management_client(cli_ctx).administrators_microsoft_entra
299299

300300

301301
def cf_postgres_flexible_migrations(cli_ctx, _):
@@ -306,34 +306,30 @@ def cf_postgres_flexible_server_threat_protection_settings(cli_ctx, _):
306306
return get_postgresql_flexible_management_client(cli_ctx).server_threat_protection_settings
307307

308308

309+
def cf_postgres_flexible_advanced_threat_protection_settings(cli_ctx, _):
310+
return get_postgresql_flexible_management_client(cli_ctx).advanced_threat_protection_settings
311+
312+
309313
def cf_postgres_flexible_server_log_files(cli_ctx, _):
310-
return get_postgresql_flexible_management_client(cli_ctx).log_files
314+
return get_postgresql_flexible_management_client(cli_ctx).captured_logs
311315

312316

313317
def cf_postgres_check_resource_availability(cli_ctx, _):
314-
return get_postgresql_flexible_management_client(cli_ctx).check_name_availability
318+
return get_postgresql_flexible_management_client(cli_ctx).name_availability
315319

316320

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

320324

321-
def cf_postgres_check_resource_availability_with_location(cli_ctx, _):
322-
return get_postgresql_flexible_management_client(cli_ctx).check_name_availability_with_location
323-
324-
325325
def cf_postgres_flexible_private_dns_zone_suffix_operations(cli_ctx, _):
326-
return get_postgresql_flexible_management_client(cli_ctx).get_private_dns_zone_suffix
326+
return get_postgresql_flexible_management_client(cli_ctx).private_dns_zone_suffix
327327

328328

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

332332

333-
def cf_postgres_flexible_private_endpoint_connection(cli_ctx, _):
334-
return get_postgresql_flexible_management_client(cli_ctx).private_endpoint_connection
335-
336-
337333
def cf_postgres_flexible_private_link_resources(cli_ctx, _):
338334
return get_postgresql_flexible_management_client(cli_ctx).private_link_resources
339335

src/azure-cli/azure/cli/command_modules/rdbms/_flexible_server_location_capabilities_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
def get_postgres_location_capability_info(cmd, location, is_offer_restriction_check_required=False):
1414
list_location_capability_client = cf_postgres_flexible_location_capabilities(cmd.cli_ctx, '_')
15-
list_location_capability_result = list_location_capability_client.execute(location)
15+
list_location_capability_result = list_location_capability_client.list(location)
1616
return _postgres_parse_list_capability(list_location_capability_result, is_offer_restriction_check_required)
1717

1818

src/azure-cli/azure/cli/command_modules/rdbms/_flexible_server_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
logger = get_logger(__name__)
3232

33-
DEFAULT_LOCATION_PG = 'eastus' # For testing: 'eastus2euap'
33+
DEFAULT_LOCATION_PG = 'canadacentral'
3434
DEFAULT_LOCATION_MySQL = 'westus2'
3535
AZURE_CREDENTIALS = 'AZURE_CREDENTIALS'
3636
AZURE_POSTGRESQL_CONNECTION_STRING = 'AZURE_POSTGRESQL_CONNECTION_STRING'

src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_commands.py

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414
cf_postgres_flexible_location_capabilities,
1515
cf_postgres_flexible_backups,
1616
cf_postgres_flexible_ltr_backups,
17-
cf_postgres_flexible_operations,
1817
cf_postgres_flexible_replica,
1918
cf_postgres_flexible_admin,
2019
cf_postgres_flexible_migrations,
21-
cf_postgres_flexible_private_endpoint_connection,
2220
cf_postgres_flexible_private_endpoint_connections,
2321
cf_postgres_flexible_private_link_resources,
2422
cf_postgres_flexible_virtual_endpoints,
2523
cf_postgres_flexible_server_threat_protection_settings,
24+
cf_postgres_flexible_advanced_threat_protection_settings,
2625
cf_postgres_flexible_server_log_files)
2726

2827
from ._transformers import (
@@ -61,32 +60,27 @@ def load_flexibleserver_command_table(self, _):
6160
)
6261

6362
postgres_flexible_location_capabilities_sdk = CliCommandType(
64-
operations_tmpl='azure.mgmt.rdbms.postgresqlflexibleservers.operations#LocationBasedCapabilitiesOperations.{}',
63+
operations_tmpl='azure.mgmt.rdbms.postgresqlflexibleservers.operations#CapabilitiesByLocationOperations.{}',
6564
client_factory=cf_postgres_flexible_location_capabilities
6665
)
6766

6867
postgres_flexible_backups_sdk = CliCommandType(
69-
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#BackupsOperations.{}',
68+
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#BackupsAutomaticAndOnDemandOperations.{}',
7069
client_factory=cf_postgres_flexible_backups
7170
)
7271

7372
postgres_flexible_ltr_backup_sdk = CliCommandType(
74-
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#LtrBackupOperationsOperations.{}',
73+
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#BackupsLongTermRetentionOperations.{}',
7574
client_factory=cf_postgres_flexible_ltr_backups
7675
)
7776

78-
postgres_flexible_operations_sdk = CliCommandType(
79-
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#FlexibleServerOperations.{}',
80-
client_factory=cf_postgres_flexible_operations
81-
)
82-
8377
postgres_flexible_replica_sdk = CliCommandType(
8478
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#ReplicasOperations.{}',
8579
client_factory=cf_postgres_flexible_replica
8680
)
8781

8882
postgres_flexible_admin_sdk = CliCommandType(
89-
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#AdministratorsOperations.{}',
83+
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#AdministratorsMicrosoftEntraOperations.{}',
9084
client_factory=cf_postgres_flexible_admin
9185
)
9286

@@ -105,14 +99,14 @@ def load_flexibleserver_command_table(self, _):
10599
client_factory=cf_postgres_flexible_server_threat_protection_settings
106100
)
107101

108-
postgres_flexible_server_log_files_sdk = CliCommandType(
109-
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#LogFilesOperations.{}',
110-
client_factory=cf_postgres_flexible_server_log_files
102+
postgres_flexible_advanced_threat_protection_settings_sdk = CliCommandType(
103+
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#AdvancedThreatProtectionSettingsOperations.{}',
104+
client_factory=cf_postgres_flexible_advanced_threat_protection_settings
111105
)
112106

113-
postgres_flexible_server_private_endpoint_connection_sdk = CliCommandType(
114-
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#PrivateEndpointConnectionOperations.{}',
115-
client_factory=cf_postgres_flexible_private_endpoint_connection
107+
postgres_flexible_server_log_files_sdk = CliCommandType(
108+
operations_tmpl='azure.mgmt.postgresqlflexibleservers.operations#CapturedLogsOperations.{}',
109+
client_factory=cf_postgres_flexible_server_log_files
116110
)
117111

118112
postgres_flexible_server_private_endpoint_connections_sdk = CliCommandType(
@@ -223,9 +217,6 @@ def load_flexibleserver_command_table(self, _):
223217
client_factory=cf_postgres_flexible_ltr_backups) as g:
224218
g.command('list', 'list_by_server', transform=transform_backups_list)
225219
g.show_command('show', 'get', transform=transform_backup)
226-
227-
with self.command_group('postgres flexible-server long-term-retention', postgres_flexible_operations_sdk,
228-
client_factory=cf_postgres_flexible_operations) as g:
229220
g.custom_command('pre-check', 'ltr_precheck_func', custom_command_type=flexible_servers_custom_postgres)
230221
g.custom_command('start', 'ltr_start_func', custom_command_type=flexible_servers_custom_postgres)
231222

@@ -258,10 +249,14 @@ def load_flexibleserver_command_table(self, _):
258249
g.custom_show_command('show', 'flexible_server_microsoft_entra_admin_show')
259250
g.custom_wait_command('wait', 'flexible_server_microsoft_entra_admin_show')
260251

252+
with self.command_group('postgres flexible-server advanced-threat-protection-setting', postgres_flexible_advanced_threat_protection_settings_sdk,
253+
custom_command_type=flexible_servers_custom_postgres,
254+
client_factory=cf_postgres_flexible_advanced_threat_protection_settings) as g:
255+
g.custom_show_command('show', 'flexible_server_threat_protection_get', custom_command_type=flexible_servers_custom_postgres)
256+
261257
with self.command_group('postgres flexible-server advanced-threat-protection-setting', postgres_flexible_server_threat_protection_settings_sdk,
262258
custom_command_type=flexible_servers_custom_postgres,
263259
client_factory=cf_postgres_flexible_server_threat_protection_settings) as g:
264-
g.custom_show_command('show', 'flexible_server_threat_protection_get', custom_command_type=flexible_servers_custom_postgres)
265260
g.custom_command('update', 'flexible_server_threat_protection_update', custom_command_type=flexible_servers_custom_postgres)
266261

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

273-
with self.command_group('postgres flexible-server private-endpoint-connection', postgres_flexible_server_private_endpoint_connections_sdk) as g:
268+
with self.command_group('postgres flexible-server private-endpoint-connection', postgres_flexible_server_private_endpoint_connections_sdk,
269+
custom_command_type=flexible_servers_custom_postgres,
270+
client_factory=cf_postgres_flexible_private_endpoint_connections) as g:
274271
g.command('list', 'list_by_server')
275272
g.show_command('show', 'get', validator=validate_private_endpoint_connection_id)
276-
277-
with self.command_group('postgres flexible-server private-endpoint-connection', postgres_flexible_server_private_endpoint_connection_sdk,
278-
custom_command_type=flexible_servers_custom_postgres,
279-
client_factory=cf_postgres_flexible_private_endpoint_connection) as g:
280273
g.command('delete', 'begin_delete', validator=validate_private_endpoint_connection_id)
281274
g.custom_command('approve', 'flexible_server_approve_private_endpoint_connection', custom_command_type=flexible_servers_custom_postgres,
282275
validator=validate_private_endpoint_connection_id)

src/azure-cli/azure/cli/command_modules/rdbms/flexible_server_custom_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def server_list_custom_func(client, resource_group_name=None, show_cluster=None)
5050
if not check_resource_group(resource_group_name):
5151
resource_group_name = None
5252

53-
servers = client.list()
53+
servers = client.list_by_subscription()
5454

5555
if resource_group_name:
5656
servers = client.list_by_resource_group(resource_group_name)

0 commit comments

Comments
 (0)