From 9ed0d7b09cd6afe248c939df81b33bcf126f4891 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Tue, 11 Nov 2025 05:48:19 +0000 Subject: [PATCH] code and test --- .../CHANGELOG.md | 234 + .../MANIFEST.in | 9 +- .../{_meta.json => _metadata.json} | 6 +- .../apiview-properties.json | 310 + .../azure/__init__.py | 2 +- .../azure/mgmt/__init__.py | 2 +- .../_configuration.py | 21 +- .../_postgre_sql_management_client.py | 168 +- .../_utils/serialization.py | 26 +- .../postgresqlflexibleservers/_utils/utils.py | 25 - .../postgresqlflexibleservers/_version.py | 2 +- .../aio/_configuration.py | 21 +- .../aio/_postgre_sql_management_client.py | 170 +- .../aio/operations/__init__.py | 55 +- ...inistrators_microsoft_entra_operations.py} | 163 +- ..._threat_protection_settings_operations.py} | 165 +- ...ups_automatic_and_on_demand_operations.py} | 100 +- ...backups_long_term_retention_operations.py} | 268 +- ...> _capabilities_by_location_operations.py} | 31 +- ... => _capabilities_by_server_operations.py} | 31 +- ...ations.py => _captured_logs_operations.py} | 28 +- .../_check_name_availability_operations.py | 161 - ...e_availability_with_location_operations.py | 177 - .../operations/_configurations_operations.py | 204 +- .../aio/operations/_databases_operations.py | 117 +- .../operations/_firewall_rules_operations.py | 106 +- .../aio/operations/_migrations_operations.py | 447 +- .../_name_availability_operations.py | 285 + .../aio/operations/_operations.py | 18 +- ...ostgre_sql_management_client_operations.py | 186 - ...=> _private_dns_zone_suffix_operations.py} | 22 +- ..._private_endpoint_connection_operations.py | 389 -- ...private_endpoint_connections_operations.py | 366 +- .../_private_link_resources_operations.py | 21 +- .../operations/_quota_usages_operations.py | 16 +- .../aio/operations/_replicas_operations.py | 18 +- ...r_threat_protection_settings_operations.py | 247 +- .../aio/operations/_servers_operations.py | 265 +- .../_tuning_configuration_operations.py | 840 --- .../operations/_tuning_index_operations.py | 157 - .../operations/_tuning_options_operations.py | 160 +- .../_virtual_endpoints_operations.py | 210 +- ...virtual_network_subnet_usage_operations.py | 48 +- .../models/__init__.py | 302 +- .../models/_models_py3.py | 5793 +++++++++-------- .../_postgre_sql_management_client_enums.py | 613 +- .../operations/__init__.py | 55 +- ...inistrators_microsoft_entra_operations.py} | 171 +- ..._threat_protection_settings_operations.py} | 183 +- ...ups_automatic_and_on_demand_operations.py} | 122 +- ...backups_long_term_retention_operations.py} | 341 +- ...> _capabilities_by_location_operations.py} | 36 +- ... => _capabilities_by_server_operations.py} | 34 +- ...ations.py => _captured_logs_operations.py} | 32 +- .../_check_name_availability_operations.py | 192 - ...e_availability_with_location_operations.py | 211 - .../operations/_configurations_operations.py | 219 +- .../operations/_databases_operations.py | 129 +- .../operations/_firewall_rules_operations.py | 137 +- .../operations/_migrations_operations.py | 584 +- .../_name_availability_operations.py | 348 + .../operations/_operations.py | 22 +- ...ostgre_sql_management_client_operations.py | 232 - ...=> _private_dns_zone_suffix_operations.py} | 26 +- ..._private_endpoint_connection_operations.py | 484 -- ...private_endpoint_connections_operations.py | 457 +- .../_private_link_resources_operations.py | 27 +- .../operations/_quota_usages_operations.py | 20 +- .../operations/_replicas_operations.py | 22 +- ...r_threat_protection_settings_operations.py | 318 +- .../operations/_servers_operations.py | 279 +- .../_tuning_configuration_operations.py | 1081 --- .../operations/_tuning_index_operations.py | 203 - .../operations/_tuning_options_operations.py | 206 +- .../_virtual_endpoints_operations.py | 222 +- ...virtual_network_subnet_usage_operations.py | 52 +- ... => administrators_microsoft_entra_add.py} | 13 +- ... administrators_microsoft_entra_delete.py} | 10 +- ... => administrators_microsoft_entra_get.py} | 10 +- ...strators_microsoft_entra_list_by_server.py | 44 + ...t_protection_settings_create_or_update.py} | 13 +- ...advanced_threat_protection_settings_get.py | 44 + ...reat_protection_settings_list_by_server.py | 44 + ...backups_automatic_and_on_demand_create.py} | 13 +- ...backups_automatic_and_on_demand_delete.py} | 12 +- .../backups_automatic_and_on_demand_get.py | 44 + ..._automatic_and_on_demand_list_by_server.py | 44 + ...ong_term_retention_check_prerequisites.py} | 11 +- ....py => backups_long_term_retention_get.py} | 12 +- ...kups_long_term_retention_list_by_server.py | 44 + .../backups_long_term_retention_start.py | 44 + ...on.py => capabilities_by_location_list.py} | 6 +- ...rver.py => capabilities_by_server_list.py} | 10 +- ...ver.py => captured_logs_list_by_server.py} | 10 +- .../check_migration_name_availability.py | 45 - ...iguration_get.py => configurations_get.py} | 8 +- ...er.py => configurations_list_by_server.py} | 8 +- ...ion_update.py => configurations_update.py} | 11 +- .../configurations_update_using_put.py | 44 + ...database_create.py => databases_create.py} | 13 +- ...database_delete.py => databases_delete.py} | 10 +- .../{database_get.py => databases_get.py} | 10 +- .../databases_list_by_server.py | 6 +- ....py => firewall_rules_create_or_update.py} | 13 +- ...ule_delete.py => firewall_rules_delete.py} | 10 +- ...wall_rule_get.py => firewall_rules_get.py} | 10 +- ...er.py => firewall_rules_list_by_server.py} | 8 +- .../log_files_list_by_server.py | 44 - .../long_term_retention_backup.py | 44 - .../long_term_retention_operation_get.py | 44 - ...term_retention_operation_list_by_server.py | 44 - .../long_term_retention_pre_backup.py | 44 - .../generated_samples/migrations_cancel.py | 12 +- .../migrations_check_name_availability.py | 44 + .../generated_samples/migrations_create.py | 20 +- ...ate_other_source_types_validate_migrate.py | 20 +- .../migrations_create_validate_only.py | 20 +- ...create_with_fully_qualified_domain_name.py | 19 +- .../migrations_create_with_other_users.py | 22 +- ...ns_create_with_private_endpoint_servers.py | 22 +- .../migrations_create_with_roles.py | 20 +- .../generated_samples/migrations_delete.py | 44 - .../generated_samples/migrations_get.py | 9 +- ...ith_successful_validation_and_migration.py | 9 +- ...essful_validation_but_migration_failure.py | 9 +- ...gration_with_successful_validation_only.py | 9 +- ..._get_migration_with_validation_failures.py | 9 +- .../migrations_list_by_target_server.py | 7 +- .../generated_samples/migrations_update.py | 9 +- ...py => name_availability_check_globally.py} | 8 +- .../name_availability_check_with_location.py | 43 + .../{operation_list.py => operations_list.py} | 4 +- ...ffix.py => private_dns_zone_suffix_get.py} | 6 +- ...=> private_endpoint_connections_delete.py} | 10 +- ...py => private_endpoint_connections_get.py} | 8 +- ...y => private_endpoint_connections_list.py} | 8 +- ...=> private_endpoint_connections_update.py} | 11 +- .../private_link_resources_get.py | 8 +- .../private_link_resources_list.py | 6 +- ...ote_replica_as_forced_standalone_server.py | 44 - .../promote_replica_as_forced_switchover.py | 44 - ...te_replica_as_planned_standalone_server.py | 44 - .../promote_replica_as_planned_switchover.py | 44 - .../quota_usages_for_flexible_servers.py | 4 +- .../replicas_list_by_server.py | 6 +- .../generated_samples/server_capabilities.py | 44 - .../server_threat_protection_settings_get.py | 44 - ...reat_protection_settings_list_by_server.py | 44 - ...er_create.py => servers_cluster_create.py} | 19 +- ...eo_restore_with_data_encryption_enabled.py | 64 + ...th_data_encryption_enabled_auto_update.py} | 27 +- ..._with_zone_redundant_high_availability.py} | 24 +- ...etwork_with_same_zone_high_availability.py | 61 + ...> servers_create_point_in_time_restore.py} | 17 +- ...e_replica.py => servers_create_replica.py} | 23 +- ...ed.py => servers_create_revive_dropped.py} | 17 +- ...ers_create_with_data_encryption_enabled.py | 73 + ...th_data_encryption_enabled_auto_update.py} | 29 +- ...tual_network_without_high_availability.py} | 26 +- .../{server_delete.py => servers_delete.py} | 8 +- .../{server_get.py => servers_get.py} | 8 +- ... => servers_get_with_private_endpoints.py} | 8 +- ..._with_vnet.py => servers_get_with_vnet.py} | 8 +- ...p.py => servers_list_by_resource_group.py} | 6 +- ...ist.py => servers_list_by_subscription.py} | 6 +- ...ote_replica_as_forced_standalone_server.py | 43 + ...rs_promote_replica_as_forced_switchover.py | 43 + ...te_replica_as_planned_standalone_server.py | 43 + ...s_promote_replica_as_planned_switchover.py | 43 + .../{server_restart.py => servers_restart.py} | 8 +- ...er.py => servers_restart_with_failover.py} | 8 +- .../{server_start.py => servers_start.py} | 8 +- .../{server_stop.py => servers_stop.py} | 8 +- .../{server_update.py => servers_update.py} | 13 +- ..._update_with_custom_maintenance_window.py} | 11 +- ...ers_update_with_data_encryption_enabled.py | 64 + ...th_data_encryption_enabled_auto_update.py} | 25 +- ...vers_update_with_major_version_upgrade.py} | 13 +- ...rs_update_with_microsoft_entra_enabled.py} | 13 +- .../tuning_configuration_disable.py | 43 - .../tuning_configuration_enable.py | 43 - ...ning_configuration_list_session_details.py | 46 - .../tuning_configuration_list_sessions.py | 45 - .../tuning_configuration_start_session.py | 44 - .../tuning_configuration_stop_session.py | 43 - ...tuning_option.py => tuning_options_get.py} | 8 +- ...ns.py => tuning_options_list_by_server.py} | 8 +- ...ing_options_list_index_recommendations.py} | 10 +- ...ommendations_filtered_for_create_index.py} | 10 +- ...ning_options_list_table_recommendations.py | 45 + ...ommendations_filtered_for_analyze_table.py | 45 + .../virtual_endpoint_create.py | 13 +- .../virtual_endpoint_delete.py | 8 +- .../virtual_endpoint_update.py | 13 +- .../virtual_endpoints_get.py | 8 +- .../virtual_endpoints_list_by_server.py | 6 +- ...y => virtual_network_subnet_usage_list.py} | 10 +- .../pyproject.toml | 82 + .../sdk_packaging.toml | 12 - .../setup.py | 82 - 200 files changed, 10714 insertions(+), 11705 deletions(-) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/{_meta.json => _metadata.json} (50%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/apiview-properties.json delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_utils/utils.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/{_administrators_operations.py => _administrators_microsoft_entra_operations.py} (78%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/{_ltr_backup_operations_operations.py => _advanced_threat_protection_settings_operations.py} (76%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/{_backups_operations.py => _backups_automatic_and_on_demand_operations.py} (84%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/{_flexible_server_operations.py => _backups_long_term_retention_operations.py} (61%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/{_location_based_capabilities_operations.py => _capabilities_by_location_operations.py} (83%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/{_server_capabilities_operations.py => _capabilities_by_server_operations.py} (85%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/{_log_files_operations.py => _captured_logs_operations.py} (86%) delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_check_name_availability_operations.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_check_name_availability_with_location_operations.py create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_name_availability_operations.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_postgre_sql_management_client_operations.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/{_get_private_dns_zone_suffix_operations.py => _private_dns_zone_suffix_operations.py} (86%) delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_endpoint_connection_operations.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_configuration_operations.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_index_operations.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/{_administrators_operations.py => _administrators_microsoft_entra_operations.py} (82%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/{_ltr_backup_operations_operations.py => _advanced_threat_protection_settings_operations.py} (79%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/{_backups_operations.py => _backups_automatic_and_on_demand_operations.py} (85%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/{_flexible_server_operations.py => _backups_long_term_retention_operations.py} (59%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/{_location_based_capabilities_operations.py => _capabilities_by_location_operations.py} (84%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/{_server_capabilities_operations.py => _capabilities_by_server_operations.py} (87%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/{_log_files_operations.py => _captured_logs_operations.py} (88%) delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_check_name_availability_operations.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_check_name_availability_with_location_operations.py create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_name_availability_operations.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_postgre_sql_management_client_operations.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/{_get_private_dns_zone_suffix_operations.py => _private_dns_zone_suffix_operations.py} (88%) delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_endpoint_connection_operations.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_configuration_operations.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_index_operations.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{administrator_add.py => administrators_microsoft_entra_add.py} (82%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{administrator_delete.py => administrators_microsoft_entra_delete.py} (83%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{administrator_get.py => administrators_microsoft_entra_get.py} (83%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_list_by_server.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_threat_protection_settings_create_or_update.py => advanced_threat_protection_settings_create_or_update.py} (76%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_get.py create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_list_by_server.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{backup_create.py => backups_automatic_and_on_demand_create.py} (80%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{backup_delete.py => backups_automatic_and_on_demand_delete.py} (80%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_get.py create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_list_by_server.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{check_name_availability_location_based.py => backups_long_term_retention_check_prerequisites.py} (78%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{backup_get.py => backups_long_term_retention_get.py} (81%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_list_by_server.py create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_start.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{capabilities_by_location.py => capabilities_by_location_list.py} (88%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{administrators_list_by_server.py => capabilities_by_server_list.py} (84%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{backup_list_by_server.py => captured_logs_list_by_server.py} (84%) delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/check_migration_name_availability.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{configuration_get.py => configurations_get.py} (88%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{configuration_list_by_server.py => configurations_list_by_server.py} (87%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{configuration_update.py => configurations_update.py} (85%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_update_using_put.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{database_create.py => databases_create.py} (84%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{database_delete.py => databases_delete.py} (86%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{database_get.py => databases_get.py} (86%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{firewall_rule_create.py => firewall_rules_create_or_update.py} (82%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{firewall_rule_delete.py => firewall_rules_delete.py} (85%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{firewall_rule_get.py => firewall_rules_get.py} (85%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{firewall_rule_list_by_server.py => firewall_rules_list_by_server.py} (87%) delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/log_files_list_by_server.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_backup.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_operation_get.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_operation_list_by_server.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_pre_backup.py create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_check_name_availability.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_delete.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{check_name_availability.py => name_availability_check_globally.py} (83%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/name_availability_check_with_location.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{operation_list.py => operations_list.py} (93%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{get_private_dns_zone_suffix.py => private_dns_zone_suffix_get.py} (88%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{private_endpoint_connection_delete.py => private_endpoint_connections_delete.py} (84%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{private_endpoint_connection_get.py => private_endpoint_connections_get.py} (87%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{private_endpoint_connection_list.py => private_endpoint_connections_list.py} (87%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{private_endpoint_connection_update.py => private_endpoint_connections_update.py} (85%) delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_forced_standalone_server.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_forced_switchover.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_planned_standalone_server.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_planned_switchover.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_capabilities.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_get.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_list_by_server.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{cluster_create.py => servers_cluster_create.py} (80%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_geo_restore_with_data_encryption_enabled.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_create_geo_restore_with_data_encryption_enabled.py => servers_create_geo_restore_with_data_encryption_enabled_auto_update.py} (61%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_create.py => servers_create_in_microsoft_owned_virtual_network_with_zone_redundant_high_availability.py} (68%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_in_your_own_virtual_network_with_same_zone_high_availability.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_create_point_in_time_restore.py => servers_create_point_in_time_restore.py} (75%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_create_replica.py => servers_create_replica.py} (69%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_create_revive_dropped.py => servers_create_revive_dropped.py} (76%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_with_data_encryption_enabled.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_create_with_data_encryption_enabled.py => servers_create_with_data_encryption_enabled_auto_update.py} (67%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_create_with_microsoft_entra_enabled.py => servers_create_with_microsoft_entra_enabled_in_your_own_virtual_network_without_high_availability.py} (69%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_delete.py => servers_delete.py} (88%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_get.py => servers_get.py} (88%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_get_with_private_endpoints.py => servers_get_with_private_endpoints.py} (86%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_get_with_vnet.py => servers_get_with_vnet.py} (87%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_list_by_resource_group.py => servers_list_by_resource_group.py} (89%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_list.py => servers_list_by_subscription.py} (88%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_forced_standalone_server.py create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_forced_switchover.py create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_planned_standalone_server.py create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_planned_switchover.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_restart.py => servers_restart.py} (88%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_restart_with_failover.py => servers_restart_with_failover.py} (86%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_start.py => servers_start.py} (88%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_stop.py => servers_stop.py} (88%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_update.py => servers_update.py} (85%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_update_with_customer_maintenance_window.py => servers_update_with_custom_maintenance_window.py} (84%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_data_encryption_enabled.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_update_with_data_encryption_enabled.py => servers_update_with_data_encryption_enabled_auto_update.py} (64%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_update_with_major_version_upgrade.py => servers_update_with_major_version_upgrade.py} (82%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{server_update_with_microsoft_entra_enabled.py => servers_update_with_microsoft_entra_enabled.py} (84%) delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_disable.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_enable.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_list_session_details.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_list_sessions.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_start_session.py delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_stop_session.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{tuning_get_tuning_option.py => tuning_options_get.py} (88%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{tuning_list_tuning_options.py => tuning_options_list_by_server.py} (87%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{tuning_index_get_filtered_recommendations.py => tuning_options_list_index_recommendations.py} (83%) rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{tuning_index_get_recommendations.py => tuning_options_list_index_recommendations_filtered_for_create_index.py} (81%) create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_table_recommendations.py create mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_table_recommendations_filtered_for_analyze_table.py rename sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/{virtual_network_subnet_usage.py => virtual_network_subnet_usage_list.py} (80%) delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/sdk_packaging.toml delete mode 100644 sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/setup.py diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/CHANGELOG.md b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/CHANGELOG.md index a144c8a89720..4013903c760f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/CHANGELOG.md +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/CHANGELOG.md @@ -1,5 +1,239 @@ # Release History +## 2.0.0 (2025-11-17) + +### Features Added + + - Model `PostgreSQLManagementClient` added parameter `cloud_setting` in method `__init__` + - Client `PostgreSQLManagementClient` added operation group `administrators_microsoft_entra` + - Client `PostgreSQLManagementClient` added operation group `advanced_threat_protection_settings` + - Client `PostgreSQLManagementClient` added operation group `backups_automatic_and_on_demand` + - Client `PostgreSQLManagementClient` added operation group `capabilities_by_location` + - Client `PostgreSQLManagementClient` added operation group `capabilities_by_server` + - Client `PostgreSQLManagementClient` added operation group `captured_logs` + - Client `PostgreSQLManagementClient` added operation group `backups_long_term_retention` + - Client `PostgreSQLManagementClient` added operation group `name_availability` + - Client `PostgreSQLManagementClient` added operation group `private_dns_zone_suffix` + - Client `PostgreSQLManagementClient` added operation group `quota_usages` + - Client `PostgreSQLManagementClient` added operation group `tuning_options` + - Enum `ConfigurationDataType` added member `SET` + - Enum `ConfigurationDataType` added member `STRING` + - Model `Server` added property `cluster` + - Model `ServerSkuCapability` added property `supported_features` + - Model `ServerSkuCapability` added property `security_profile` + - Enum `ServerState` added member `INACCESSIBLE` + - Enum `ServerState` added member `PROVISIONING` + - Enum `ServerState` added member `RESTARTING` + - Model `ServerVersionCapability` added property `supported_features` + - Enum `SourceType` added member `APSARA_DB_RDS` + - Enum `SourceType` added member `CRUNCHY_POSTGRE_SQL` + - Enum `SourceType` added member `DIGITAL_OCEAN_DROPLETS` + - Enum `SourceType` added member `DIGITAL_OCEAN_POSTGRE_SQL` + - Enum `SourceType` added member `EDB_ORACLE_SERVER` + - Enum `SourceType` added member `EDB_POSTGRE_SQL` + - Enum `SourceType` added member `HEROKU_POSTGRE_SQL` + - Enum `SourceType` added member `HUAWEI_COMPUTE` + - Enum `SourceType` added member `HUAWEI_RDS` + - Enum `SourceType` added member `POSTGRE_SQL_COSMOS_DB` + - Enum `SourceType` added member `POSTGRE_SQL_FLEXIBLE_SERVER` + - Enum `SourceType` added member `SUPABASE_POSTGRE_SQL` + - Enum `StorageType` added member `ULTRA_SSD_LRS` + - Added model `AdminCredentialsForPatch` + - Added model `AdministratorMicrosoftEntra` + - Added model `AdministratorMicrosoftEntraAdd` + - Added model `AdministratorMicrosoftEntraList` + - Added model `AdvancedThreatProtectionSettingsList` + - Added model `AdvancedThreatProtectionSettingsModel` + - Added model `AuthConfigForPatch` + - Added enum `AzureManagedDiskPerformanceTier` + - Added model `BackupAutomaticAndOnDemand` + - Added model `BackupAutomaticAndOnDemandList` + - Added model `BackupForPatch` + - Added enum `BackupType` + - Added model `BackupsLongTermRetentionOperation` + - Added model `BackupsLongTermRetentionRequest` + - Added model `BackupsLongTermRetentionResponse` + - Added enum `Cancel` + - Added model `Capability` + - Added model `CapabilityList` + - Added model `CapturedLog` + - Added model `CapturedLogList` + - Added model `Cluster` + - Added model `ConfigurationList` + - Added enum `CreateModeForPatch` + - Added enum `DataEncryptionType` + - Added model `DatabaseList` + - Added model `DatabaseMigrationState` + - Added enum `EncryptionKeyStatus` + - Added enum `FastProvisioningSupport` + - Added enum `FeatureStatus` + - Added model `FirewallRuleList` + - Added enum `GeographicallyRedundantBackup` + - Added enum `GeographicallyRedundantBackupSupport` + - Added model `HighAvailabilityForPatch` + - Added enum `HighAvailabilityState` + - Added model `ImpactRecord` + - Added enum `LocationRestricted` + - Added enum `LogicalReplicationOnSourceServer` + - Added model `MaintenanceWindowForPatch` + - Added enum `MicrosoftEntraAuth` + - Added enum `MigrateRolesAndPermissions` + - Added model `Migration` + - Added enum `MigrationDatabaseState` + - Added model `MigrationList` + - Added model `MigrationNameAvailability` + - Added model `MigrationSecretParametersForPatch` + - Added enum `MigrationSubstate` + - Added model `MigrationSubstateDetails` + - Added model `NameAvailabilityModel` + - Added model `NameProperty` + - Added model `ObjectRecommendation` + - Added model `ObjectRecommendationDetails` + - Added model `ObjectRecommendationList` + - Added model `ObjectRecommendationPropertiesAnalyzedWorkload` + - Added model `ObjectRecommendationPropertiesImplementationDetails` + - Added enum `OnlineStorageResizeSupport` + - Added model `OperationList` + - Added enum `OverwriteDatabasesOnTargetServer` + - Added enum `PasswordBasedAuth` + - Added enum `PostgresMajorVersion` + - Added model `PrivateEndpointConnectionList` + - Added model `PrivateLinkResourceList` + - Added model `QuotaUsage` + - Added model `QuotaUsageList` + - Added enum `ReadReplicaPromoteOption` + - Added enum `RecommendationTypeEnum` + - Added enum `RecommendationTypeParameterEnum` + - Added model `ServerEditionCapability` + - Added model `ServerForPatch` + - Added model `ServerList` + - Added model `SkuForPatch` + - Added enum `StartDataMigration` + - Added enum `StorageAutoGrowthSupport` + - Added model `SupportedFeature` + - Added enum `TriggerCutover` + - Added enum `TuningOptionParameterEnum` + - Added model `TuningOptions` + - Added model `TuningOptionsList` + - Added model `VirtualEndpoint` + - Added model `VirtualEndpointsList` + - Added model `VirtualNetworkSubnetUsageModel` + - Added enum `ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport` + - Added enum `ZoneRedundantHighAvailabilitySupport` + - Model `MigrationsOperations` added method `cancel` + - Model `MigrationsOperations` added method `check_name_availability` + - Model `PrivateEndpointConnectionsOperations` added method `begin_delete` + - Model `PrivateEndpointConnectionsOperations` added method `begin_update` + - Model `ServersOperations` added method `begin_create_or_update` + - Model `ServersOperations` added method `list_by_subscription` + - Model `VirtualNetworkSubnetUsageOperations` added method `list` + - Added model `AdministratorsMicrosoftEntraOperations` + - Added model `AdvancedThreatProtectionSettingsOperations` + - Added model `BackupsAutomaticAndOnDemandOperations` + - Added model `BackupsLongTermRetentionOperations` + - Added model `CapabilitiesByLocationOperations` + - Added model `CapabilitiesByServerOperations` + - Added model `CapturedLogsOperations` + - Added model `NameAvailabilityOperations` + - Added model `PrivateDnsZoneSuffixOperations` + - Added model `QuotaUsagesOperations` + - Added model `TuningOptionsOperations` + +### Breaking Changes + + - Deleted or renamed client operation group `PostgreSQLManagementClient.administrators` + - Deleted or renamed client operation group `PostgreSQLManagementClient.backups` + - Deleted or renamed client operation group `PostgreSQLManagementClient.location_based_capabilities` + - Deleted or renamed client operation group `PostgreSQLManagementClient.server_capabilities` + - Deleted or renamed client operation group `PostgreSQLManagementClient.check_name_availability` + - Deleted or renamed client operation group `PostgreSQLManagementClient.check_name_availability_with_location` + - Deleted or renamed client operation group `PostgreSQLManagementClient.flexible_server` + - Deleted or renamed client operation group `PostgreSQLManagementClient.ltr_backup_operations` + - Deleted or renamed client operation group `PostgreSQLManagementClient.get_private_dns_zone_suffix` + - Deleted or renamed client operation group `PostgreSQLManagementClient.private_endpoint_connection` + - Deleted or renamed client operation group `PostgreSQLManagementClient.log_files` + - Deleted or renamed client method `PostgreSQLManagementClient.check_migration_name_availability` + - Method `Operations.list` changed from `asynchronous` to `synchronous` + - Method `AuthConfig.__init__` parameter `password_auth` changed default value from `str` to `none` + - Method `Backup.__init__` parameter `geo_redundant_backup` changed default value from `str` to `none` + - Method `HighAvailability.__init__` parameter `mode` changed default value from `str` to `none` + - Deleted or renamed enum value `HighAvailabilityMode.DISABLED` + - Deleted or renamed model `ActiveDirectoryAdministrator` + - Deleted or renamed model `ActiveDirectoryAdministratorAdd` + - Deleted or renamed model `ActiveDirectoryAuthEnum` + - Deleted or renamed model `ArmServerKeyType` + - Deleted or renamed model `AzureManagedDiskPerformanceTiers` + - Deleted or renamed model `CancelEnum` + - Deleted or renamed model `CreateModeForUpdate` + - Deleted or renamed model `DbMigrationStatus` + - Deleted or renamed model `FastProvisioningSupportedEnum` + - Deleted or renamed model `FlexibleServerCapability` + - Deleted or renamed model `FlexibleServerEditionCapability` + - Deleted or renamed model `GeoBackupSupportedEnum` + - Deleted or renamed model `GeoRedundantBackupEnum` + - Deleted or renamed model `HaMode` + - Deleted or renamed model `KeyStatusEnum` + - Deleted or renamed model `LogFile` + - Deleted or renamed model `LogicalReplicationOnSourceDbEnum` + - Deleted or renamed model `LtrBackupRequest` + - Deleted or renamed model `LtrBackupResponse` + - Deleted or renamed model `LtrServerBackupOperation` + - Deleted or renamed model `MigrateRolesEnum` + - Deleted or renamed model `MigrationDbState` + - Deleted or renamed model `MigrationNameAvailabilityResource` + - Deleted or renamed model `MigrationResource` + - Deleted or renamed model `MigrationSubState` + - Deleted or renamed model `MigrationSubStateDetails` + - Deleted or renamed model `NameAvailability` + - Deleted or renamed model `OnlineResizeSupportedEnum` + - Deleted or renamed model `Origin` + - Deleted or renamed model `OverwriteDbsInTargetEnum` + - Deleted or renamed model `PasswordAuthEnum` + - Deleted or renamed model `ReplicationPromoteOption` + - Deleted or renamed model `RestrictedEnum` + - Deleted or renamed model `ServerBackup` + - Deleted or renamed model `ServerForUpdate` + - Deleted or renamed model `ServerHAState` + - Deleted or renamed model `ServerThreatProtectionSettingsModel` + - Deleted or renamed model `ServerVersion` + - Deleted or renamed model `StartDataMigrationEnum` + - Deleted or renamed model `StorageAutoGrowthSupportedEnum` + - Deleted or renamed model `TriggerCutoverEnum` + - Deleted or renamed model `VirtualEndpointResource` + - Deleted or renamed model `VirtualNetworkSubnetUsageResult` + - Deleted or renamed model `ZoneRedundantHaAndGeoBackupSupportedEnum` + - Deleted or renamed model `ZoneRedundantHaSupportedEnum` + - Method `MigrationsOperations.create` inserted a `positional_or_keyword` parameter `server_name` + - Method `MigrationsOperations.create` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `MigrationsOperations.create` deleted or renamed its parameter `target_db_server_name` of kind `positional_or_keyword` + - Method `MigrationsOperations.get` inserted a `positional_or_keyword` parameter `server_name` + - Method `MigrationsOperations.get` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `MigrationsOperations.get` deleted or renamed its parameter `target_db_server_name` of kind `positional_or_keyword` + - Method `MigrationsOperations.list_by_target_server` inserted a `positional_or_keyword` parameter `server_name` + - Method `MigrationsOperations.list_by_target_server` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `MigrationsOperations.list_by_target_server` deleted or renamed its parameter `target_db_server_name` of kind `positional_or_keyword` + - Method `MigrationsOperations.update` inserted a `positional_or_keyword` parameter `server_name` + - Method `MigrationsOperations.update` deleted or renamed its parameter `subscription_id` of kind `positional_or_keyword` + - Method `MigrationsOperations.update` deleted or renamed its parameter `target_db_server_name` of kind `positional_or_keyword` + - Deleted or renamed method `MigrationsOperations.delete` + - Deleted or renamed method `ServerThreatProtectionSettingsOperations.get` + - Deleted or renamed method `ServerThreatProtectionSettingsOperations.list_by_server` + - Deleted or renamed method `ServersOperations.begin_create` + - Deleted or renamed method `ServersOperations.list` + - Deleted or renamed method `VirtualNetworkSubnetUsageOperations.execute` + - Deleted or renamed model `AdministratorsOperations` + - Deleted or renamed model `BackupsOperations` + - Deleted or renamed model `CheckNameAvailabilityOperations` + - Deleted or renamed model `CheckNameAvailabilityWithLocationOperations` + - Deleted or renamed model `FlexibleServerOperations` + - Deleted or renamed model `GetPrivateDnsZoneSuffixOperations` + - Deleted or renamed model `LocationBasedCapabilitiesOperations` + - Deleted or renamed model `LogFilesOperations` + - Deleted or renamed model `LtrBackupOperationsOperations` + - Deleted or renamed model `PostgreSQLManagementClientOperationsMixin` + - Deleted or renamed model `PrivateEndpointConnectionOperations` + - Deleted or renamed model `ServerCapabilitiesOperations` + ## 1.2.0b1 (2025-05-19) ### Features Added diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/MANIFEST.in b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/MANIFEST.in index d9e94429b8fc..1fc20daa26af 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/MANIFEST.in +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/MANIFEST.in @@ -1,8 +1,7 @@ -include _meta.json -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/postgresqlflexibleservers/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/_meta.json b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/_metadata.json similarity index 50% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/_meta.json rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/_metadata.json index 435f7f75ba58..c0ccabc94aa2 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/_meta.json +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/_metadata.json @@ -1,11 +1,11 @@ { - "commit": "761d8b58e465b26eddb8ad70dda3cde7b4228bdf", + "commit": "cb0947b1897ac18478c88d0322cb679cefd1948d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.34.1", + "@autorest/python@6.42.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/postgresql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-flexibleserver-2025-01-01-preview --use=@autorest/python@6.34.1 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/postgresql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.42.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/postgresql/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/apiview-properties.json b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/apiview-properties.json new file mode 100644 index 000000000000..058449d953f9 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/apiview-properties.json @@ -0,0 +1,310 @@ +{ + "CrossLanguagePackageId": null, + "CrossLanguageDefinitionId": { + "azure.mgmt.postgresqlflexibleservers.models.AdminCredentials": null, + "azure.mgmt.postgresqlflexibleservers.models.AdminCredentialsForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.Resource": null, + "azure.mgmt.postgresqlflexibleservers.models.ProxyResource": null, + "azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntra": null, + "azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntraAdd": null, + "azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntraList": null, + "azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsList": null, + "azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsModel": null, + "azure.mgmt.postgresqlflexibleservers.models.AuthConfig": null, + "azure.mgmt.postgresqlflexibleservers.models.AuthConfigForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.Backup": null, + "azure.mgmt.postgresqlflexibleservers.models.BackupAutomaticAndOnDemand": null, + "azure.mgmt.postgresqlflexibleservers.models.BackupAutomaticAndOnDemandList": null, + "azure.mgmt.postgresqlflexibleservers.models.BackupForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.BackupRequestBase": null, + "azure.mgmt.postgresqlflexibleservers.models.BackupSettings": null, + "azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionOperation": null, + "azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionRequest": null, + "azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionResponse": null, + "azure.mgmt.postgresqlflexibleservers.models.BackupStoreDetails": null, + "azure.mgmt.postgresqlflexibleservers.models.CapabilityBase": null, + "azure.mgmt.postgresqlflexibleservers.models.Capability": null, + "azure.mgmt.postgresqlflexibleservers.models.CapabilityList": null, + "azure.mgmt.postgresqlflexibleservers.models.CapturedLog": null, + "azure.mgmt.postgresqlflexibleservers.models.CapturedLogList": null, + "azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest": null, + "azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityResponse": null, + "azure.mgmt.postgresqlflexibleservers.models.Cluster": null, + "azure.mgmt.postgresqlflexibleservers.models.Configuration": null, + "azure.mgmt.postgresqlflexibleservers.models.ConfigurationForUpdate": null, + "azure.mgmt.postgresqlflexibleservers.models.ConfigurationList": null, + "azure.mgmt.postgresqlflexibleservers.models.Database": null, + "azure.mgmt.postgresqlflexibleservers.models.DatabaseList": null, + "azure.mgmt.postgresqlflexibleservers.models.DatabaseMigrationState": null, + "azure.mgmt.postgresqlflexibleservers.models.DataEncryption": null, + "azure.mgmt.postgresqlflexibleservers.models.DbLevelValidationStatus": null, + "azure.mgmt.postgresqlflexibleservers.models.DbServerMetadata": null, + "azure.mgmt.postgresqlflexibleservers.models.DelegatedSubnetUsage": null, + "azure.mgmt.postgresqlflexibleservers.models.ErrorAdditionalInfo": null, + "azure.mgmt.postgresqlflexibleservers.models.ErrorDetail": null, + "azure.mgmt.postgresqlflexibleservers.models.ErrorResponse": null, + "azure.mgmt.postgresqlflexibleservers.models.FastProvisioningEditionCapability": null, + "azure.mgmt.postgresqlflexibleservers.models.FirewallRule": null, + "azure.mgmt.postgresqlflexibleservers.models.FirewallRuleList": null, + "azure.mgmt.postgresqlflexibleservers.models.HighAvailability": null, + "azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.ImpactRecord": null, + "azure.mgmt.postgresqlflexibleservers.models.LtrPreBackupRequest": null, + "azure.mgmt.postgresqlflexibleservers.models.LtrPreBackupResponse": null, + "azure.mgmt.postgresqlflexibleservers.models.LtrServerBackupOperationList": null, + "azure.mgmt.postgresqlflexibleservers.models.MaintenanceWindow": null, + "azure.mgmt.postgresqlflexibleservers.models.MaintenanceWindowForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.TrackedResource": null, + "azure.mgmt.postgresqlflexibleservers.models.Migration": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationList": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationResourceForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationSecretParameters": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationSecretParametersForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationStatus": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationSubstateDetails": null, + "azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel": null, + "azure.mgmt.postgresqlflexibleservers.models.NameProperty": null, + "azure.mgmt.postgresqlflexibleservers.models.Network": null, + "azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendation": null, + "azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendationDetails": null, + "azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendationList": null, + "azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendationPropertiesAnalyzedWorkload": null, + "azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendationPropertiesImplementationDetails": null, + "azure.mgmt.postgresqlflexibleservers.models.Operation": null, + "azure.mgmt.postgresqlflexibleservers.models.OperationDisplay": null, + "azure.mgmt.postgresqlflexibleservers.models.OperationList": null, + "azure.mgmt.postgresqlflexibleservers.models.PrivateEndpoint": null, + "azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection": null, + "azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnectionList": null, + "azure.mgmt.postgresqlflexibleservers.models.PrivateLinkResource": null, + "azure.mgmt.postgresqlflexibleservers.models.PrivateLinkResourceList": null, + "azure.mgmt.postgresqlflexibleservers.models.PrivateLinkServiceConnectionState": null, + "azure.mgmt.postgresqlflexibleservers.models.QuotaUsage": null, + "azure.mgmt.postgresqlflexibleservers.models.QuotaUsageList": null, + "azure.mgmt.postgresqlflexibleservers.models.Replica": null, + "azure.mgmt.postgresqlflexibleservers.models.RestartParameter": null, + "azure.mgmt.postgresqlflexibleservers.models.Server": null, + "azure.mgmt.postgresqlflexibleservers.models.ServerEditionCapability": null, + "azure.mgmt.postgresqlflexibleservers.models.ServerForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.ServerList": null, + "azure.mgmt.postgresqlflexibleservers.models.ServerSku": null, + "azure.mgmt.postgresqlflexibleservers.models.ServerSkuCapability": null, + "azure.mgmt.postgresqlflexibleservers.models.ServerVersionCapability": null, + "azure.mgmt.postgresqlflexibleservers.models.Sku": null, + "azure.mgmt.postgresqlflexibleservers.models.SkuForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.Storage": null, + "azure.mgmt.postgresqlflexibleservers.models.StorageEditionCapability": null, + "azure.mgmt.postgresqlflexibleservers.models.StorageMbCapability": null, + "azure.mgmt.postgresqlflexibleservers.models.StorageTierCapability": null, + "azure.mgmt.postgresqlflexibleservers.models.SupportedFeature": null, + "azure.mgmt.postgresqlflexibleservers.models.SystemData": null, + "azure.mgmt.postgresqlflexibleservers.models.TuningOptions": null, + "azure.mgmt.postgresqlflexibleservers.models.TuningOptionsList": null, + "azure.mgmt.postgresqlflexibleservers.models.UserAssignedIdentity": null, + "azure.mgmt.postgresqlflexibleservers.models.UserIdentity": null, + "azure.mgmt.postgresqlflexibleservers.models.ValidationDetails": null, + "azure.mgmt.postgresqlflexibleservers.models.ValidationMessage": null, + "azure.mgmt.postgresqlflexibleservers.models.ValidationSummaryItem": null, + "azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResourceForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint": null, + "azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointsList": null, + "azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageModel": null, + "azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageParameter": null, + "azure.mgmt.postgresqlflexibleservers.models.CreatedByType": null, + "azure.mgmt.postgresqlflexibleservers.models.PrincipalType": null, + "azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionState": null, + "azure.mgmt.postgresqlflexibleservers.models.BackupType": null, + "azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus": null, + "azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityMode": null, + "azure.mgmt.postgresqlflexibleservers.models.FeatureStatus": null, + "azure.mgmt.postgresqlflexibleservers.models.FastProvisioningSupport": null, + "azure.mgmt.postgresqlflexibleservers.models.GeographicallyRedundantBackupSupport": null, + "azure.mgmt.postgresqlflexibleservers.models.ZoneRedundantHighAvailabilitySupport": null, + "azure.mgmt.postgresqlflexibleservers.models.ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport": null, + "azure.mgmt.postgresqlflexibleservers.models.StorageAutoGrowthSupport": null, + "azure.mgmt.postgresqlflexibleservers.models.OnlineStorageResizeSupport": null, + "azure.mgmt.postgresqlflexibleservers.models.LocationRestricted": null, + "azure.mgmt.postgresqlflexibleservers.models.ConfigurationDataType": null, + "azure.mgmt.postgresqlflexibleservers.models.ExecutionStatus": null, + "azure.mgmt.postgresqlflexibleservers.models.ValidationState": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationState": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationSubstate": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationDatabaseState": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationMode": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationOption": null, + "azure.mgmt.postgresqlflexibleservers.models.SourceType": null, + "azure.mgmt.postgresqlflexibleservers.models.SslMode": null, + "azure.mgmt.postgresqlflexibleservers.models.SkuTier": null, + "azure.mgmt.postgresqlflexibleservers.models.LogicalReplicationOnSourceServer": null, + "azure.mgmt.postgresqlflexibleservers.models.OverwriteDatabasesOnTargetServer": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrateRolesAndPermissions": null, + "azure.mgmt.postgresqlflexibleservers.models.StartDataMigration": null, + "azure.mgmt.postgresqlflexibleservers.models.TriggerCutover": null, + "azure.mgmt.postgresqlflexibleservers.models.Cancel": null, + "azure.mgmt.postgresqlflexibleservers.models.OperationOrigin": null, + "azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointServiceConnectionStatus": null, + "azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnectionProvisioningState": null, + "azure.mgmt.postgresqlflexibleservers.models.IdentityType": null, + "azure.mgmt.postgresqlflexibleservers.models.PostgresMajorVersion": null, + "azure.mgmt.postgresqlflexibleservers.models.ServerState": null, + "azure.mgmt.postgresqlflexibleservers.models.StorageAutoGrow": null, + "azure.mgmt.postgresqlflexibleservers.models.AzureManagedDiskPerformanceTier": null, + "azure.mgmt.postgresqlflexibleservers.models.StorageType": null, + "azure.mgmt.postgresqlflexibleservers.models.MicrosoftEntraAuth": null, + "azure.mgmt.postgresqlflexibleservers.models.PasswordBasedAuth": null, + "azure.mgmt.postgresqlflexibleservers.models.DataEncryptionType": null, + "azure.mgmt.postgresqlflexibleservers.models.EncryptionKeyStatus": null, + "azure.mgmt.postgresqlflexibleservers.models.GeographicallyRedundantBackup": null, + "azure.mgmt.postgresqlflexibleservers.models.ServerPublicNetworkAccessState": null, + "azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityState": null, + "azure.mgmt.postgresqlflexibleservers.models.ReplicationRole": null, + "azure.mgmt.postgresqlflexibleservers.models.ReplicationState": null, + "azure.mgmt.postgresqlflexibleservers.models.ReadReplicaPromoteMode": null, + "azure.mgmt.postgresqlflexibleservers.models.ReadReplicaPromoteOption": null, + "azure.mgmt.postgresqlflexibleservers.models.CreateMode": null, + "azure.mgmt.postgresqlflexibleservers.models.RecommendationTypeEnum": null, + "azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointType": null, + "azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationListFilter": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityReason": null, + "azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityReason": null, + "azure.mgmt.postgresqlflexibleservers.models.CreateModeForPatch": null, + "azure.mgmt.postgresqlflexibleservers.models.FailoverMode": null, + "azure.mgmt.postgresqlflexibleservers.models.TuningOptionParameterEnum": null, + "azure.mgmt.postgresqlflexibleservers.models.RecommendationTypeParameterEnum": null, + "azure.mgmt.postgresqlflexibleservers.models.MigrationDetailsLevel": null, + "azure.mgmt.postgresqlflexibleservers.operations.AdministratorsMicrosoftEntraOperations.begin_create_or_update": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.AdministratorsMicrosoftEntraOperations.begin_create_or_update": null, + "azure.mgmt.postgresqlflexibleservers.operations.AdministratorsMicrosoftEntraOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.AdministratorsMicrosoftEntraOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.operations.AdministratorsMicrosoftEntraOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.AdministratorsMicrosoftEntraOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.AdministratorsMicrosoftEntraOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.AdministratorsMicrosoftEntraOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.AdvancedThreatProtectionSettingsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.AdvancedThreatProtectionSettingsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.AdvancedThreatProtectionSettingsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.AdvancedThreatProtectionSettingsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.ServerThreatProtectionSettingsOperations.begin_create_or_update": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ServerThreatProtectionSettingsOperations.begin_create_or_update": null, + "azure.mgmt.postgresqlflexibleservers.operations.BackupsAutomaticAndOnDemandOperations.begin_create": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsAutomaticAndOnDemandOperations.begin_create": null, + "azure.mgmt.postgresqlflexibleservers.operations.BackupsAutomaticAndOnDemandOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsAutomaticAndOnDemandOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.operations.BackupsAutomaticAndOnDemandOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsAutomaticAndOnDemandOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.BackupsAutomaticAndOnDemandOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsAutomaticAndOnDemandOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.CapabilitiesByLocationOperations.list": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.CapabilitiesByLocationOperations.list": null, + "azure.mgmt.postgresqlflexibleservers.operations.CapabilitiesByServerOperations.list": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.CapabilitiesByServerOperations.list": null, + "azure.mgmt.postgresqlflexibleservers.operations.CapturedLogsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.CapturedLogsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.ConfigurationsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ConfigurationsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.ConfigurationsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ConfigurationsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.ConfigurationsOperations.begin_update": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ConfigurationsOperations.begin_update": null, + "azure.mgmt.postgresqlflexibleservers.operations.ConfigurationsOperations.begin_put": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ConfigurationsOperations.begin_put": null, + "azure.mgmt.postgresqlflexibleservers.operations.DatabasesOperations.begin_create": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.DatabasesOperations.begin_create": null, + "azure.mgmt.postgresqlflexibleservers.operations.DatabasesOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.DatabasesOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.operations.DatabasesOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.DatabasesOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.DatabasesOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.DatabasesOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.FirewallRulesOperations.begin_create_or_update": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.FirewallRulesOperations.begin_create_or_update": null, + "azure.mgmt.postgresqlflexibleservers.operations.FirewallRulesOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.FirewallRulesOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.operations.FirewallRulesOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.FirewallRulesOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.FirewallRulesOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.FirewallRulesOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.BackupsLongTermRetentionOperations.check_prerequisites": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsLongTermRetentionOperations.check_prerequisites": null, + "azure.mgmt.postgresqlflexibleservers.operations.BackupsLongTermRetentionOperations.begin_start": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsLongTermRetentionOperations.begin_start": null, + "azure.mgmt.postgresqlflexibleservers.operations.BackupsLongTermRetentionOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsLongTermRetentionOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.BackupsLongTermRetentionOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsLongTermRetentionOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.MigrationsOperations.create": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.MigrationsOperations.create": null, + "azure.mgmt.postgresqlflexibleservers.operations.MigrationsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.MigrationsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.MigrationsOperations.update": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.MigrationsOperations.update": null, + "azure.mgmt.postgresqlflexibleservers.operations.MigrationsOperations.cancel": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.MigrationsOperations.cancel": null, + "azure.mgmt.postgresqlflexibleservers.operations.MigrationsOperations.list_by_target_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.MigrationsOperations.list_by_target_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.MigrationsOperations.check_name_availability": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.MigrationsOperations.check_name_availability": null, + "azure.mgmt.postgresqlflexibleservers.operations.NameAvailabilityOperations.check_globally": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.NameAvailabilityOperations.check_globally": null, + "azure.mgmt.postgresqlflexibleservers.operations.NameAvailabilityOperations.check_with_location": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.NameAvailabilityOperations.check_with_location": null, + "azure.mgmt.postgresqlflexibleservers.operations.Operations.list": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.Operations.list": null, + "azure.mgmt.postgresqlflexibleservers.operations.PrivateDnsZoneSuffixOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateDnsZoneSuffixOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.PrivateEndpointConnectionsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateEndpointConnectionsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.PrivateEndpointConnectionsOperations.begin_update": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateEndpointConnectionsOperations.begin_update": null, + "azure.mgmt.postgresqlflexibleservers.operations.PrivateEndpointConnectionsOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.operations.PrivateEndpointConnectionsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateEndpointConnectionsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.PrivateLinkResourcesOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateLinkResourcesOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.PrivateLinkResourcesOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateLinkResourcesOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.QuotaUsagesOperations.list": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.QuotaUsagesOperations.list": null, + "azure.mgmt.postgresqlflexibleservers.operations.ReplicasOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ReplicasOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.ServersOperations.begin_create_or_update": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations.begin_create_or_update": null, + "azure.mgmt.postgresqlflexibleservers.operations.ServersOperations.begin_update": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations.begin_update": null, + "azure.mgmt.postgresqlflexibleservers.operations.ServersOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.operations.ServersOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.ServersOperations.list_by_resource_group": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations.list_by_resource_group": null, + "azure.mgmt.postgresqlflexibleservers.operations.ServersOperations.list_by_subscription": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations.list_by_subscription": null, + "azure.mgmt.postgresqlflexibleservers.operations.ServersOperations.begin_restart": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations.begin_restart": null, + "azure.mgmt.postgresqlflexibleservers.operations.ServersOperations.begin_start": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations.begin_start": null, + "azure.mgmt.postgresqlflexibleservers.operations.ServersOperations.begin_stop": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations.begin_stop": null, + "azure.mgmt.postgresqlflexibleservers.operations.TuningOptionsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.TuningOptionsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.TuningOptionsOperations.list_recommendations": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.TuningOptionsOperations.list_recommendations": null, + "azure.mgmt.postgresqlflexibleservers.operations.TuningOptionsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.TuningOptionsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.VirtualEndpointsOperations.begin_create": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.VirtualEndpointsOperations.begin_create": null, + "azure.mgmt.postgresqlflexibleservers.operations.VirtualEndpointsOperations.begin_update": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.VirtualEndpointsOperations.begin_update": null, + "azure.mgmt.postgresqlflexibleservers.operations.VirtualEndpointsOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.VirtualEndpointsOperations.begin_delete": null, + "azure.mgmt.postgresqlflexibleservers.operations.VirtualEndpointsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.VirtualEndpointsOperations.get": null, + "azure.mgmt.postgresqlflexibleservers.operations.VirtualEndpointsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.VirtualEndpointsOperations.list_by_server": null, + "azure.mgmt.postgresqlflexibleservers.operations.VirtualNetworkSubnetUsageOperations.list": null, + "azure.mgmt.postgresqlflexibleservers.aio.operations.VirtualNetworkSubnetUsageOperations.list": null + } +} \ No newline at end of file diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/__init__.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/__init__.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/__init__.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/__init__.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_configuration.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_configuration.py index f15a8c707bff..4ddcd144107f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_configuration.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,6 +14,7 @@ from ._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential @@ -27,13 +28,22 @@ class PostgreSQLManagementClientConfiguration: # pylint: disable=too-many-insta :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2025-01-01-preview". Note that overriding - this default value may result in unsupported behavior. + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2025-08-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-01-01-preview") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -42,6 +52,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-postgresqlflexibleservers/{}".format(VERSION)) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_postgre_sql_management_client.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_postgre_sql_management_client.py index 7265516754f5..2895722d9d63 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_postgre_sql_management_client.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_postgre_sql_management_client.py @@ -21,65 +21,63 @@ from ._configuration import PostgreSQLManagementClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( - AdministratorsOperations, - BackupsOperations, - CheckNameAvailabilityOperations, - CheckNameAvailabilityWithLocationOperations, + AdministratorsMicrosoftEntraOperations, + AdvancedThreatProtectionSettingsOperations, + BackupsAutomaticAndOnDemandOperations, + BackupsLongTermRetentionOperations, + CapabilitiesByLocationOperations, + CapabilitiesByServerOperations, + CapturedLogsOperations, ConfigurationsOperations, DatabasesOperations, FirewallRulesOperations, - FlexibleServerOperations, - GetPrivateDnsZoneSuffixOperations, - LocationBasedCapabilitiesOperations, - LogFilesOperations, - LtrBackupOperationsOperations, MigrationsOperations, + NameAvailabilityOperations, Operations, - PostgreSQLManagementClientOperationsMixin, - PrivateEndpointConnectionOperations, + PrivateDnsZoneSuffixOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotaUsagesOperations, ReplicasOperations, - ServerCapabilitiesOperations, ServerThreatProtectionSettingsOperations, ServersOperations, - TuningConfigurationOperations, - TuningIndexOperations, TuningOptionsOperations, VirtualEndpointsOperations, VirtualNetworkSubnetUsageOperations, ) if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class PostgreSQLManagementClient( - PostgreSQLManagementClientOperationsMixin -): # pylint: disable=too-many-instance-attributes - """The Microsoft Azure management API provides create, read, update, and delete functionality for - Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security - alert policies, log files and configurations with new business model. +class PostgreSQLManagementClient: # pylint: disable=too-many-instance-attributes + """The Azure Database for PostgreSQL management API provides create, read, update, and delete + functionality for Azure PostgreSQL resources including servers, databases, firewall rules, + network configuration, security alert policies, log files and configurations with new business + model. - :ivar administrators: AdministratorsOperations operations - :vartype administrators: - azure.mgmt.postgresqlflexibleservers.operations.AdministratorsOperations - :ivar backups: BackupsOperations operations - :vartype backups: azure.mgmt.postgresqlflexibleservers.operations.BackupsOperations - :ivar location_based_capabilities: LocationBasedCapabilitiesOperations operations - :vartype location_based_capabilities: - azure.mgmt.postgresqlflexibleservers.operations.LocationBasedCapabilitiesOperations - :ivar server_capabilities: ServerCapabilitiesOperations operations - :vartype server_capabilities: - azure.mgmt.postgresqlflexibleservers.operations.ServerCapabilitiesOperations - :ivar check_name_availability: CheckNameAvailabilityOperations operations - :vartype check_name_availability: - azure.mgmt.postgresqlflexibleservers.operations.CheckNameAvailabilityOperations - :ivar check_name_availability_with_location: CheckNameAvailabilityWithLocationOperations + :ivar administrators_microsoft_entra: AdministratorsMicrosoftEntraOperations operations + :vartype administrators_microsoft_entra: + azure.mgmt.postgresqlflexibleservers.operations.AdministratorsMicrosoftEntraOperations + :ivar advanced_threat_protection_settings: AdvancedThreatProtectionSettingsOperations operations - :vartype check_name_availability_with_location: - azure.mgmt.postgresqlflexibleservers.operations.CheckNameAvailabilityWithLocationOperations + :vartype advanced_threat_protection_settings: + azure.mgmt.postgresqlflexibleservers.operations.AdvancedThreatProtectionSettingsOperations + :ivar server_threat_protection_settings: ServerThreatProtectionSettingsOperations operations + :vartype server_threat_protection_settings: + azure.mgmt.postgresqlflexibleservers.operations.ServerThreatProtectionSettingsOperations + :ivar backups_automatic_and_on_demand: BackupsAutomaticAndOnDemandOperations operations + :vartype backups_automatic_and_on_demand: + azure.mgmt.postgresqlflexibleservers.operations.BackupsAutomaticAndOnDemandOperations + :ivar capabilities_by_location: CapabilitiesByLocationOperations operations + :vartype capabilities_by_location: + azure.mgmt.postgresqlflexibleservers.operations.CapabilitiesByLocationOperations + :ivar capabilities_by_server: CapabilitiesByServerOperations operations + :vartype capabilities_by_server: + azure.mgmt.postgresqlflexibleservers.operations.CapabilitiesByServerOperations + :ivar captured_logs: CapturedLogsOperations operations + :vartype captured_logs: azure.mgmt.postgresqlflexibleservers.operations.CapturedLogsOperations :ivar configurations: ConfigurationsOperations operations :vartype configurations: azure.mgmt.postgresqlflexibleservers.operations.ConfigurationsOperations @@ -88,27 +86,22 @@ class PostgreSQLManagementClient( :ivar firewall_rules: FirewallRulesOperations operations :vartype firewall_rules: azure.mgmt.postgresqlflexibleservers.operations.FirewallRulesOperations - :ivar servers: ServersOperations operations - :vartype servers: azure.mgmt.postgresqlflexibleservers.operations.ServersOperations - :ivar flexible_server: FlexibleServerOperations operations - :vartype flexible_server: - azure.mgmt.postgresqlflexibleservers.operations.FlexibleServerOperations - :ivar ltr_backup_operations: LtrBackupOperationsOperations operations - :vartype ltr_backup_operations: - azure.mgmt.postgresqlflexibleservers.operations.LtrBackupOperationsOperations + :ivar backups_long_term_retention: BackupsLongTermRetentionOperations operations + :vartype backups_long_term_retention: + azure.mgmt.postgresqlflexibleservers.operations.BackupsLongTermRetentionOperations :ivar migrations: MigrationsOperations operations :vartype migrations: azure.mgmt.postgresqlflexibleservers.operations.MigrationsOperations + :ivar name_availability: NameAvailabilityOperations operations + :vartype name_availability: + azure.mgmt.postgresqlflexibleservers.operations.NameAvailabilityOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.postgresqlflexibleservers.operations.Operations - :ivar get_private_dns_zone_suffix: GetPrivateDnsZoneSuffixOperations operations - :vartype get_private_dns_zone_suffix: - azure.mgmt.postgresqlflexibleservers.operations.GetPrivateDnsZoneSuffixOperations + :ivar private_dns_zone_suffix: PrivateDnsZoneSuffixOperations operations + :vartype private_dns_zone_suffix: + azure.mgmt.postgresqlflexibleservers.operations.PrivateDnsZoneSuffixOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.postgresqlflexibleservers.operations.PrivateEndpointConnectionsOperations - :ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations - :vartype private_endpoint_connection: - azure.mgmt.postgresqlflexibleservers.operations.PrivateEndpointConnectionOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.postgresqlflexibleservers.operations.PrivateLinkResourcesOperations @@ -116,19 +109,11 @@ class PostgreSQLManagementClient( :vartype quota_usages: azure.mgmt.postgresqlflexibleservers.operations.QuotaUsagesOperations :ivar replicas: ReplicasOperations operations :vartype replicas: azure.mgmt.postgresqlflexibleservers.operations.ReplicasOperations - :ivar log_files: LogFilesOperations operations - :vartype log_files: azure.mgmt.postgresqlflexibleservers.operations.LogFilesOperations - :ivar server_threat_protection_settings: ServerThreatProtectionSettingsOperations operations - :vartype server_threat_protection_settings: - azure.mgmt.postgresqlflexibleservers.operations.ServerThreatProtectionSettingsOperations + :ivar servers: ServersOperations operations + :vartype servers: azure.mgmt.postgresqlflexibleservers.operations.ServersOperations :ivar tuning_options: TuningOptionsOperations operations :vartype tuning_options: azure.mgmt.postgresqlflexibleservers.operations.TuningOptionsOperations - :ivar tuning_index: TuningIndexOperations operations - :vartype tuning_index: azure.mgmt.postgresqlflexibleservers.operations.TuningIndexOperations - :ivar tuning_configuration: TuningConfigurationOperations operations - :vartype tuning_configuration: - azure.mgmt.postgresqlflexibleservers.operations.TuningConfigurationOperations :ivar virtual_endpoints: VirtualEndpointsOperations operations :vartype virtual_endpoints: azure.mgmt.postgresqlflexibleservers.operations.VirtualEndpointsOperations @@ -141,23 +126,36 @@ class PostgreSQLManagementClient( :type subscription_id: str :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2025-01-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2025-08-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + self, + credential: "TokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = PostgreSQLManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) _policies = kwargs.pop("policies", None) @@ -184,37 +182,40 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.administrators = AdministratorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backups = BackupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.location_based_capabilities = LocationBasedCapabilitiesOperations( + self.administrators_microsoft_entra = AdministratorsMicrosoftEntraOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.advanced_threat_protection_settings = AdvancedThreatProtectionSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.server_threat_protection_settings = ServerThreatProtectionSettingsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.server_capabilities = ServerCapabilitiesOperations( + self.backups_automatic_and_on_demand = BackupsAutomaticAndOnDemandOperations( self._client, self._config, self._serialize, self._deserialize ) - self.check_name_availability = CheckNameAvailabilityOperations( + self.capabilities_by_location = CapabilitiesByLocationOperations( self._client, self._config, self._serialize, self._deserialize ) - self.check_name_availability_with_location = CheckNameAvailabilityWithLocationOperations( + self.capabilities_by_server = CapabilitiesByServerOperations( self._client, self._config, self._serialize, self._deserialize ) + self.captured_logs = CapturedLogsOperations(self._client, self._config, self._serialize, self._deserialize) self.configurations = ConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize) self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.flexible_server = FlexibleServerOperations(self._client, self._config, self._serialize, self._deserialize) - self.ltr_backup_operations = LtrBackupOperationsOperations( + self.backups_long_term_retention = BackupsLongTermRetentionOperations( self._client, self._config, self._serialize, self._deserialize ) self.migrations = MigrationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.get_private_dns_zone_suffix = GetPrivateDnsZoneSuffixOperations( + self.name_availability = NameAvailabilityOperations( self._client, self._config, self._serialize, self._deserialize ) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.private_dns_zone_suffix = PrivateDnsZoneSuffixOperations( self._client, self._config, self._serialize, self._deserialize ) - self.private_endpoint_connection = PrivateEndpointConnectionOperations( + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( @@ -222,15 +223,8 @@ def __init__( ) self.quota_usages = QuotaUsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) - self.log_files = LogFilesOperations(self._client, self._config, self._serialize, self._deserialize) - self.server_threat_protection_settings = ServerThreatProtectionSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) self.tuning_options = TuningOptionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.tuning_index = TuningIndexOperations(self._client, self._config, self._serialize, self._deserialize) - self.tuning_configuration = TuningConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.virtual_endpoints = VirtualEndpointsOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_utils/serialization.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_utils/serialization.py index f5187701d7be..ff543ed937ff 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_utils/serialization.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_utils/serialization.py @@ -21,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -31,7 +30,6 @@ Mapping, Callable, MutableMapping, - List, ) try: @@ -229,12 +227,12 @@ class Model: serialization and deserialization. """ - _subtype_map: Dict[str, Dict[str, Any]] = {} - _attribute_map: Dict[str, Dict[str, Any]] = {} - _validation: Dict[str, Dict[str, Any]] = {} + _subtype_map: dict[str, dict[str, Any]] = {} + _attribute_map: dict[str, dict[str, Any]] = {} + _validation: dict[str, dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Optional[Dict[str, Any]] = {} + self.additional_properties: Optional[dict[str, Any]] = {} for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -311,7 +309,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -380,7 +378,7 @@ def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: def from_dict( cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, ) -> Self: """Parse a dict using given key extractor return a model. @@ -414,7 +412,7 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod @@ -528,7 +526,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -579,7 +577,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -789,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -1184,7 +1182,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1386,7 +1384,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_utils/utils.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_utils/utils.py deleted file mode 100644 index 39b612f39a9b..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_utils/utils.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_version.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_version.py index 58920e6942de..48944bf3938a 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_version.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0b1" +VERSION = "2.0.0" diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/_configuration.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/_configuration.py index 97998eceac4c..096a7285ac43 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/_configuration.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,6 +14,7 @@ from .._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential @@ -27,13 +28,22 @@ class PostgreSQLManagementClientConfiguration: # pylint: disable=too-many-insta :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2025-01-01-preview". Note that overriding - this default value may result in unsupported behavior. + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2025-08-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-01-01-preview") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-08-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -42,6 +52,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-postgresqlflexibleservers/{}".format(VERSION)) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/_postgre_sql_management_client.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/_postgre_sql_management_client.py index e8ce5351b741..8ad880fe7ccb 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/_postgre_sql_management_client.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/_postgre_sql_management_client.py @@ -21,65 +21,64 @@ from .._utils.serialization import Deserializer, Serializer from ._configuration import PostgreSQLManagementClientConfiguration from .operations import ( - AdministratorsOperations, - BackupsOperations, - CheckNameAvailabilityOperations, - CheckNameAvailabilityWithLocationOperations, + AdministratorsMicrosoftEntraOperations, + AdvancedThreatProtectionSettingsOperations, + BackupsAutomaticAndOnDemandOperations, + BackupsLongTermRetentionOperations, + CapabilitiesByLocationOperations, + CapabilitiesByServerOperations, + CapturedLogsOperations, ConfigurationsOperations, DatabasesOperations, FirewallRulesOperations, - FlexibleServerOperations, - GetPrivateDnsZoneSuffixOperations, - LocationBasedCapabilitiesOperations, - LogFilesOperations, - LtrBackupOperationsOperations, MigrationsOperations, + NameAvailabilityOperations, Operations, - PostgreSQLManagementClientOperationsMixin, - PrivateEndpointConnectionOperations, + PrivateDnsZoneSuffixOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotaUsagesOperations, ReplicasOperations, - ServerCapabilitiesOperations, ServerThreatProtectionSettingsOperations, ServersOperations, - TuningConfigurationOperations, - TuningIndexOperations, TuningOptionsOperations, VirtualEndpointsOperations, VirtualNetworkSubnetUsageOperations, ) if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class PostgreSQLManagementClient( - PostgreSQLManagementClientOperationsMixin -): # pylint: disable=too-many-instance-attributes - """The Microsoft Azure management API provides create, read, update, and delete functionality for - Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security - alert policies, log files and configurations with new business model. +class PostgreSQLManagementClient: # pylint: disable=too-many-instance-attributes + """The Azure Database for PostgreSQL management API provides create, read, update, and delete + functionality for Azure PostgreSQL resources including servers, databases, firewall rules, + network configuration, security alert policies, log files and configurations with new business + model. - :ivar administrators: AdministratorsOperations operations - :vartype administrators: - azure.mgmt.postgresqlflexibleservers.aio.operations.AdministratorsOperations - :ivar backups: BackupsOperations operations - :vartype backups: azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsOperations - :ivar location_based_capabilities: LocationBasedCapabilitiesOperations operations - :vartype location_based_capabilities: - azure.mgmt.postgresqlflexibleservers.aio.operations.LocationBasedCapabilitiesOperations - :ivar server_capabilities: ServerCapabilitiesOperations operations - :vartype server_capabilities: - azure.mgmt.postgresqlflexibleservers.aio.operations.ServerCapabilitiesOperations - :ivar check_name_availability: CheckNameAvailabilityOperations operations - :vartype check_name_availability: - azure.mgmt.postgresqlflexibleservers.aio.operations.CheckNameAvailabilityOperations - :ivar check_name_availability_with_location: CheckNameAvailabilityWithLocationOperations + :ivar administrators_microsoft_entra: AdministratorsMicrosoftEntraOperations operations + :vartype administrators_microsoft_entra: + azure.mgmt.postgresqlflexibleservers.aio.operations.AdministratorsMicrosoftEntraOperations + :ivar advanced_threat_protection_settings: AdvancedThreatProtectionSettingsOperations operations - :vartype check_name_availability_with_location: - azure.mgmt.postgresqlflexibleservers.aio.operations.CheckNameAvailabilityWithLocationOperations + :vartype advanced_threat_protection_settings: + azure.mgmt.postgresqlflexibleservers.aio.operations.AdvancedThreatProtectionSettingsOperations + :ivar server_threat_protection_settings: ServerThreatProtectionSettingsOperations operations + :vartype server_threat_protection_settings: + azure.mgmt.postgresqlflexibleservers.aio.operations.ServerThreatProtectionSettingsOperations + :ivar backups_automatic_and_on_demand: BackupsAutomaticAndOnDemandOperations operations + :vartype backups_automatic_and_on_demand: + azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsAutomaticAndOnDemandOperations + :ivar capabilities_by_location: CapabilitiesByLocationOperations operations + :vartype capabilities_by_location: + azure.mgmt.postgresqlflexibleservers.aio.operations.CapabilitiesByLocationOperations + :ivar capabilities_by_server: CapabilitiesByServerOperations operations + :vartype capabilities_by_server: + azure.mgmt.postgresqlflexibleservers.aio.operations.CapabilitiesByServerOperations + :ivar captured_logs: CapturedLogsOperations operations + :vartype captured_logs: + azure.mgmt.postgresqlflexibleservers.aio.operations.CapturedLogsOperations :ivar configurations: ConfigurationsOperations operations :vartype configurations: azure.mgmt.postgresqlflexibleservers.aio.operations.ConfigurationsOperations @@ -88,27 +87,22 @@ class PostgreSQLManagementClient( :ivar firewall_rules: FirewallRulesOperations operations :vartype firewall_rules: azure.mgmt.postgresqlflexibleservers.aio.operations.FirewallRulesOperations - :ivar servers: ServersOperations operations - :vartype servers: azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations - :ivar flexible_server: FlexibleServerOperations operations - :vartype flexible_server: - azure.mgmt.postgresqlflexibleservers.aio.operations.FlexibleServerOperations - :ivar ltr_backup_operations: LtrBackupOperationsOperations operations - :vartype ltr_backup_operations: - azure.mgmt.postgresqlflexibleservers.aio.operations.LtrBackupOperationsOperations + :ivar backups_long_term_retention: BackupsLongTermRetentionOperations operations + :vartype backups_long_term_retention: + azure.mgmt.postgresqlflexibleservers.aio.operations.BackupsLongTermRetentionOperations :ivar migrations: MigrationsOperations operations :vartype migrations: azure.mgmt.postgresqlflexibleservers.aio.operations.MigrationsOperations + :ivar name_availability: NameAvailabilityOperations operations + :vartype name_availability: + azure.mgmt.postgresqlflexibleservers.aio.operations.NameAvailabilityOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.postgresqlflexibleservers.aio.operations.Operations - :ivar get_private_dns_zone_suffix: GetPrivateDnsZoneSuffixOperations operations - :vartype get_private_dns_zone_suffix: - azure.mgmt.postgresqlflexibleservers.aio.operations.GetPrivateDnsZoneSuffixOperations + :ivar private_dns_zone_suffix: PrivateDnsZoneSuffixOperations operations + :vartype private_dns_zone_suffix: + azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateDnsZoneSuffixOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateEndpointConnectionsOperations - :ivar private_endpoint_connection: PrivateEndpointConnectionOperations operations - :vartype private_endpoint_connection: - azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateEndpointConnectionOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.postgresqlflexibleservers.aio.operations.PrivateLinkResourcesOperations @@ -117,20 +111,11 @@ class PostgreSQLManagementClient( azure.mgmt.postgresqlflexibleservers.aio.operations.QuotaUsagesOperations :ivar replicas: ReplicasOperations operations :vartype replicas: azure.mgmt.postgresqlflexibleservers.aio.operations.ReplicasOperations - :ivar log_files: LogFilesOperations operations - :vartype log_files: azure.mgmt.postgresqlflexibleservers.aio.operations.LogFilesOperations - :ivar server_threat_protection_settings: ServerThreatProtectionSettingsOperations operations - :vartype server_threat_protection_settings: - azure.mgmt.postgresqlflexibleservers.aio.operations.ServerThreatProtectionSettingsOperations + :ivar servers: ServersOperations operations + :vartype servers: azure.mgmt.postgresqlflexibleservers.aio.operations.ServersOperations :ivar tuning_options: TuningOptionsOperations operations :vartype tuning_options: azure.mgmt.postgresqlflexibleservers.aio.operations.TuningOptionsOperations - :ivar tuning_index: TuningIndexOperations operations - :vartype tuning_index: - azure.mgmt.postgresqlflexibleservers.aio.operations.TuningIndexOperations - :ivar tuning_configuration: TuningConfigurationOperations operations - :vartype tuning_configuration: - azure.mgmt.postgresqlflexibleservers.aio.operations.TuningConfigurationOperations :ivar virtual_endpoints: VirtualEndpointsOperations operations :vartype virtual_endpoints: azure.mgmt.postgresqlflexibleservers.aio.operations.VirtualEndpointsOperations @@ -143,23 +128,36 @@ class PostgreSQLManagementClient( :type subscription_id: str :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2025-01-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2025-08-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = PostgreSQLManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) _policies = kwargs.pop("policies", None) @@ -188,37 +186,40 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.administrators = AdministratorsOperations(self._client, self._config, self._serialize, self._deserialize) - self.backups = BackupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.location_based_capabilities = LocationBasedCapabilitiesOperations( + self.administrators_microsoft_entra = AdministratorsMicrosoftEntraOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.advanced_threat_protection_settings = AdvancedThreatProtectionSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.server_threat_protection_settings = ServerThreatProtectionSettingsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.server_capabilities = ServerCapabilitiesOperations( + self.backups_automatic_and_on_demand = BackupsAutomaticAndOnDemandOperations( self._client, self._config, self._serialize, self._deserialize ) - self.check_name_availability = CheckNameAvailabilityOperations( + self.capabilities_by_location = CapabilitiesByLocationOperations( self._client, self._config, self._serialize, self._deserialize ) - self.check_name_availability_with_location = CheckNameAvailabilityWithLocationOperations( + self.capabilities_by_server = CapabilitiesByServerOperations( self._client, self._config, self._serialize, self._deserialize ) + self.captured_logs = CapturedLogsOperations(self._client, self._config, self._serialize, self._deserialize) self.configurations = ConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize) self.firewall_rules = FirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) - self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.flexible_server = FlexibleServerOperations(self._client, self._config, self._serialize, self._deserialize) - self.ltr_backup_operations = LtrBackupOperationsOperations( + self.backups_long_term_retention = BackupsLongTermRetentionOperations( self._client, self._config, self._serialize, self._deserialize ) self.migrations = MigrationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.get_private_dns_zone_suffix = GetPrivateDnsZoneSuffixOperations( + self.name_availability = NameAvailabilityOperations( self._client, self._config, self._serialize, self._deserialize ) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.private_dns_zone_suffix = PrivateDnsZoneSuffixOperations( self._client, self._config, self._serialize, self._deserialize ) - self.private_endpoint_connection = PrivateEndpointConnectionOperations( + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.private_link_resources = PrivateLinkResourcesOperations( @@ -226,15 +227,8 @@ def __init__( ) self.quota_usages = QuotaUsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.replicas = ReplicasOperations(self._client, self._config, self._serialize, self._deserialize) - self.log_files = LogFilesOperations(self._client, self._config, self._serialize, self._deserialize) - self.server_threat_protection_settings = ServerThreatProtectionSettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) self.tuning_options = TuningOptionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.tuning_index = TuningIndexOperations(self._client, self._config, self._serialize, self._deserialize) - self.tuning_configuration = TuningConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.virtual_endpoints = VirtualEndpointsOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/__init__.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/__init__.py index 3ffb79f125ba..e3f2cc110001 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/__init__.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/__init__.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -13,32 +12,27 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._administrators_operations import AdministratorsOperations # type: ignore -from ._backups_operations import BackupsOperations # type: ignore -from ._location_based_capabilities_operations import LocationBasedCapabilitiesOperations # type: ignore -from ._server_capabilities_operations import ServerCapabilitiesOperations # type: ignore -from ._check_name_availability_operations import CheckNameAvailabilityOperations # type: ignore -from ._check_name_availability_with_location_operations import CheckNameAvailabilityWithLocationOperations # type: ignore +from ._administrators_microsoft_entra_operations import AdministratorsMicrosoftEntraOperations # type: ignore +from ._advanced_threat_protection_settings_operations import AdvancedThreatProtectionSettingsOperations # type: ignore +from ._server_threat_protection_settings_operations import ServerThreatProtectionSettingsOperations # type: ignore +from ._backups_automatic_and_on_demand_operations import BackupsAutomaticAndOnDemandOperations # type: ignore +from ._capabilities_by_location_operations import CapabilitiesByLocationOperations # type: ignore +from ._capabilities_by_server_operations import CapabilitiesByServerOperations # type: ignore +from ._captured_logs_operations import CapturedLogsOperations # type: ignore from ._configurations_operations import ConfigurationsOperations # type: ignore from ._databases_operations import DatabasesOperations # type: ignore from ._firewall_rules_operations import FirewallRulesOperations # type: ignore -from ._servers_operations import ServersOperations # type: ignore -from ._flexible_server_operations import FlexibleServerOperations # type: ignore -from ._ltr_backup_operations_operations import LtrBackupOperationsOperations # type: ignore +from ._backups_long_term_retention_operations import BackupsLongTermRetentionOperations # type: ignore from ._migrations_operations import MigrationsOperations # type: ignore -from ._postgre_sql_management_client_operations import PostgreSQLManagementClientOperationsMixin # type: ignore +from ._name_availability_operations import NameAvailabilityOperations # type: ignore from ._operations import Operations # type: ignore -from ._get_private_dns_zone_suffix_operations import GetPrivateDnsZoneSuffixOperations # type: ignore +from ._private_dns_zone_suffix_operations import PrivateDnsZoneSuffixOperations # type: ignore from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations # type: ignore from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore from ._quota_usages_operations import QuotaUsagesOperations # type: ignore from ._replicas_operations import ReplicasOperations # type: ignore -from ._log_files_operations import LogFilesOperations # type: ignore -from ._server_threat_protection_settings_operations import ServerThreatProtectionSettingsOperations # type: ignore +from ._servers_operations import ServersOperations # type: ignore from ._tuning_options_operations import TuningOptionsOperations # type: ignore -from ._tuning_index_operations import TuningIndexOperations # type: ignore -from ._tuning_configuration_operations import TuningConfigurationOperations # type: ignore from ._virtual_endpoints_operations import VirtualEndpointsOperations # type: ignore from ._virtual_network_subnet_usage_operations import VirtualNetworkSubnetUsageOperations # type: ignore @@ -47,32 +41,27 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AdministratorsOperations", - "BackupsOperations", - "LocationBasedCapabilitiesOperations", - "ServerCapabilitiesOperations", - "CheckNameAvailabilityOperations", - "CheckNameAvailabilityWithLocationOperations", + "AdministratorsMicrosoftEntraOperations", + "AdvancedThreatProtectionSettingsOperations", + "ServerThreatProtectionSettingsOperations", + "BackupsAutomaticAndOnDemandOperations", + "CapabilitiesByLocationOperations", + "CapabilitiesByServerOperations", + "CapturedLogsOperations", "ConfigurationsOperations", "DatabasesOperations", "FirewallRulesOperations", - "ServersOperations", - "FlexibleServerOperations", - "LtrBackupOperationsOperations", + "BackupsLongTermRetentionOperations", "MigrationsOperations", - "PostgreSQLManagementClientOperationsMixin", + "NameAvailabilityOperations", "Operations", - "GetPrivateDnsZoneSuffixOperations", + "PrivateDnsZoneSuffixOperations", "PrivateEndpointConnectionsOperations", - "PrivateEndpointConnectionOperations", "PrivateLinkResourcesOperations", "QuotaUsagesOperations", "ReplicasOperations", - "LogFilesOperations", - "ServerThreatProtectionSettingsOperations", + "ServersOperations", "TuningOptionsOperations", - "TuningIndexOperations", - "TuningConfigurationOperations", "VirtualEndpointsOperations", "VirtualNetworkSubnetUsageOperations", ] diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_administrators_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_administrators_microsoft_entra_operations.py similarity index 78% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_administrators_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_administrators_microsoft_entra_operations.py index 7f52682d783f..f363963772b5 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_administrators_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_administrators_microsoft_entra_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -34,8 +34,8 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._administrators_operations import ( - build_create_request, +from ...operations._administrators_microsoft_entra_operations import ( + build_create_or_update_request, build_delete_request, build_get_request, build_list_by_server_request, @@ -43,17 +43,18 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class AdministratorsOperations: +class AdministratorsMicrosoftEntraOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`administrators` attribute. + :attr:`administrators_microsoft_entra` attribute. """ models = _models @@ -67,12 +68,12 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def _create_initial( + async def _create_or_update_initial( self, resource_group_name: str, server_name: str, object_id: str, - parameters: Union[_models.ActiveDirectoryAdministratorAdd, IO[bytes]], + parameters: Union[_models.AdministratorMicrosoftEntraAdd, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -96,9 +97,9 @@ async def _create_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "ActiveDirectoryAdministratorAdd") + _json = self._serialize.body(parameters, "AdministratorMicrosoftEntraAdd") - _request = build_create_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, object_id=object_id, @@ -120,18 +121,23 @@ async def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -141,40 +147,38 @@ async def _create_initial( return deserialized # type: ignore @overload - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, server_name: str, object_id: str, - parameters: _models.ActiveDirectoryAdministratorAdd, + parameters: _models.AdministratorMicrosoftEntraAdd, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ActiveDirectoryAdministrator]: - """Creates a new server. + ) -> AsyncLROPoller[None]: + """Creates a new server administrator associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param object_id: Guid of the objectId for the administrator. Required. + :param object_id: Object identifier of the Microsoft Entra principal. Required. :type object_id: str - :param parameters: The required parameters for adding an Microsoft Entra Administrator for a - server. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministratorAdd + :param parameters: Required parameters for adding a server administrator associated to a + Microsoft Entra principal. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntraAdd :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ActiveDirectoryAdministrator or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -183,55 +187,52 @@ async def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ActiveDirectoryAdministrator]: - """Creates a new server. + ) -> AsyncLROPoller[None]: + """Creates a new server administrator associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param object_id: Guid of the objectId for the administrator. Required. + :param object_id: Object identifier of the Microsoft Entra principal. Required. :type object_id: str - :param parameters: The required parameters for adding an Microsoft Entra Administrator for a - server. Required. + :param parameters: Required parameters for adding a server administrator associated to a + Microsoft Entra principal. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ActiveDirectoryAdministrator or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, server_name: str, object_id: str, - parameters: Union[_models.ActiveDirectoryAdministratorAdd, IO[bytes]], + parameters: Union[_models.AdministratorMicrosoftEntraAdd, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.ActiveDirectoryAdministrator]: - """Creates a new server. + ) -> AsyncLROPoller[None]: + """Creates a new server administrator associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param object_id: Guid of the objectId for the administrator. Required. + :param object_id: Object identifier of the Microsoft Entra principal. Required. :type object_id: str - :param parameters: The required parameters for adding an Microsoft Entra Administrator for a - server. Is either a ActiveDirectoryAdministratorAdd type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministratorAdd + :param parameters: Required parameters for adding a server administrator associated to a + Microsoft Entra principal. Is either a AdministratorMicrosoftEntraAdd type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntraAdd or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ActiveDirectoryAdministrator or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -239,12 +240,12 @@ async def begin_create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ActiveDirectoryAdministrator] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, object_id=object_id, @@ -259,11 +260,9 @@ async def begin_create( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -275,15 +274,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ActiveDirectoryAdministrator].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ActiveDirectoryAdministrator]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _delete_initial( self, resource_group_name: str, server_name: str, object_id: str, **kwargs: Any @@ -321,18 +318,24 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -345,14 +348,14 @@ async def _delete_initial( async def begin_delete( self, resource_group_name: str, server_name: str, object_id: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes an Microsoft Entra Administrator associated with the server. + """Deletes an existing server administrator associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param object_id: Guid of the objectId for the administrator. Required. + :param object_id: Object identifier of the Microsoft Entra principal. Required. :type object_id: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] @@ -404,18 +407,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace_async async def get( self, resource_group_name: str, server_name: str, object_id: str, **kwargs: Any - ) -> _models.ActiveDirectoryAdministrator: - """Gets information about a server. + ) -> _models.AdministratorMicrosoftEntra: + """Gets information about a server administrator associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param object_id: Guid of the objectId for the administrator. Required. + :param object_id: Object identifier of the Microsoft Entra principal. Required. :type object_id: str - :return: ActiveDirectoryAdministrator or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator + :return: AdministratorMicrosoftEntra or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntra :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -430,7 +433,7 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ActiveDirectoryAdministrator] = kwargs.pop("cls", None) + cls: ClsType[_models.AdministratorMicrosoftEntra] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -452,10 +455,13 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response.http_response) + deserialized = self._deserialize("AdministratorMicrosoftEntra", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -465,25 +471,25 @@ async def get( @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ActiveDirectoryAdministrator"]: - """List all the AAD administrators for a given server. + ) -> AsyncItemPaged["_models.AdministratorMicrosoftEntra"]: + """List all server administrators associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either ActiveDirectoryAdministrator or the result of + :return: An iterator like instance of either AdministratorMicrosoftEntra or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntra] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AdministratorListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.AdministratorMicrosoftEntraList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -524,7 +530,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("AdministratorListResult", pipeline_response) + deserialized = self._deserialize("AdministratorMicrosoftEntraList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -541,7 +547,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_ltr_backup_operations_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_advanced_threat_protection_settings_operations.py similarity index 76% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_ltr_backup_operations_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_advanced_threat_protection_settings_operations.py index a120ea47a7e2..8e7654d38c45 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_ltr_backup_operations_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_advanced_threat_protection_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar, Union import urllib.parse from azure.core import AsyncPipelineClient @@ -28,21 +29,25 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._ltr_backup_operations_operations import build_get_request, build_list_by_server_request +from ...operations._advanced_threat_protection_settings_operations import ( + build_get_request, + build_list_by_server_request, +) from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class LtrBackupOperationsOperations: +class AdvancedThreatProtectionSettingsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`ltr_backup_operations` attribute. + :attr:`advanced_threat_protection_settings` attribute. """ models = _models @@ -56,89 +61,28 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get( - self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any - ) -> _models.LtrServerBackupOperation: - """Gets the result of the give long term retention backup operation for the flexible server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param backup_name: The name of the backup. Required. - :type backup_name: str - :return: LtrServerBackupOperation or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.LtrServerBackupOperation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LtrServerBackupOperation] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - server_name=server_name, - backup_name=backup_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LtrServerBackupOperation", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.LtrServerBackupOperation"]: - """Gets the result of the give long term retention backup operations for the flexible server. + ) -> AsyncItemPaged["_models.AdvancedThreatProtectionSettingsModel"]: + """Lists state of advanced threat protection settings for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either LtrServerBackupOperation or the result of - cls(response) + :return: An iterator like instance of either AdvancedThreatProtectionSettingsModel or the + result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.LtrServerBackupOperation] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsModel] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LtrServerBackupOperationList] = kwargs.pop("cls", None) + cls: ClsType[_models.AdvancedThreatProtectionSettingsList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -179,7 +123,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("LtrServerBackupOperationList", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtectionSettingsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -196,9 +140,82 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + **kwargs: Any + ) -> _models.AdvancedThreatProtectionSettingsModel: + """Gets state of advanced threat protection settings for a server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param threat_protection_name: Name of the advanced threat protection settings. "Default" + Required. + :type threat_protection_name: str or + ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName + :return: AdvancedThreatProtectionSettingsModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AdvancedThreatProtectionSettingsModel] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + threat_protection_name=threat_protection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AdvancedThreatProtectionSettingsModel", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_backups_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_backups_automatic_and_on_demand_operations.py similarity index 84% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_backups_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_backups_automatic_and_on_demand_operations.py index da088187c46d..67b5428068c1 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_backups_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_backups_automatic_and_on_demand_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast +from typing import Any, AsyncIterator, Callable, Optional, TypeVar, Union, cast import urllib.parse from azure.core import AsyncPipelineClient @@ -32,7 +33,7 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._backups_operations import ( +from ...operations._backups_automatic_and_on_demand_operations import ( build_create_request, build_delete_request, build_get_request, @@ -41,17 +42,18 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class BackupsOperations: +class BackupsAutomaticAndOnDemandOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`backups` attribute. + :attr:`backups_automatic_and_on_demand` attribute. """ models = _models @@ -101,18 +103,23 @@ async def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -124,27 +131,25 @@ async def _create_initial( @distributed_trace_async async def begin_create( self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ServerBackup]: - """Create a specific backup for PostgreSQL flexible server. + ) -> AsyncLROPoller[None]: + """Creates an on demand backup of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param backup_name: The name of the backup. Required. + :param backup_name: Name of the backup. Required. :type backup_name: str - :return: An instance of AsyncLROPoller that returns either ServerBackup or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.ServerBackup] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerBackup] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -162,11 +167,9 @@ async def begin_create( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerBackup", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -178,15 +181,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ServerBackup].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ServerBackup]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _delete_initial( self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any @@ -230,12 +231,18 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -248,14 +255,14 @@ async def _delete_initial( async def begin_delete( self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes a specific backup. + """Deletes a specific backup, given its name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param backup_name: The name of the backup. Required. + :param backup_name: Name of the backup. Required. :type backup_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] @@ -307,18 +314,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace_async async def get( self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any - ) -> _models.ServerBackup: - """Get specific backup for a given server. + ) -> _models.BackupAutomaticAndOnDemand: + """Gets information of an on demand backup, given its name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param backup_name: The name of the backup. Required. + :param backup_name: Name of the backup. Required. :type backup_name: str - :return: ServerBackup or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.ServerBackup + :return: BackupAutomaticAndOnDemand or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.BackupAutomaticAndOnDemand :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -333,7 +340,7 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerBackup] = kwargs.pop("cls", None) + cls: ClsType[_models.BackupAutomaticAndOnDemand] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -355,10 +362,13 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerBackup", pipeline_response.http_response) + deserialized = self._deserialize("BackupAutomaticAndOnDemand", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -368,24 +378,25 @@ async def get( @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServerBackup"]: - """List all the backups for a given server. + ) -> AsyncItemPaged["_models.BackupAutomaticAndOnDemand"]: + """Lists all available backups of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either ServerBackup or the result of cls(response) + :return: An iterator like instance of either BackupAutomaticAndOnDemand or the result of + cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.ServerBackup] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.BackupAutomaticAndOnDemand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerBackupListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.BackupAutomaticAndOnDemandList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -426,7 +437,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServerBackupListResult", pipeline_response) + deserialized = self._deserialize("BackupAutomaticAndOnDemandList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -443,7 +454,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_flexible_server_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_backups_long_term_retention_operations.py similarity index 61% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_flexible_server_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_backups_long_term_retention_operations.py index 5b0b5c49dae7..71e86a4ef808 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_flexible_server_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_backups_long_term_retention_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,9 +8,11 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -23,6 +26,7 @@ from azure.core.pipeline import PipelineResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,24 +34,27 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._flexible_server_operations import ( - build_start_ltr_backup_request, - build_trigger_ltr_pre_backup_request, +from ...operations._backups_long_term_retention_operations import ( + build_check_prerequisites_request, + build_get_request, + build_list_by_server_request, + build_start_request, ) from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class FlexibleServerOperations: +class BackupsLongTermRetentionOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`flexible_server` attribute. + :attr:`backups_long_term_retention` attribute. """ models = _models @@ -62,7 +69,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - async def trigger_ltr_pre_backup( + async def check_prerequisites( self, resource_group_name: str, server_name: str, @@ -71,8 +78,7 @@ async def trigger_ltr_pre_backup( content_type: str = "application/json", **kwargs: Any ) -> _models.LtrPreBackupResponse: - """PreBackup operation performs all the checks that are needed for the subsequent long term - retention backup operation to succeed. + """Performs all checks required for a long term retention backup operation to succeed. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -90,7 +96,7 @@ async def trigger_ltr_pre_backup( """ @overload - async def trigger_ltr_pre_backup( + async def check_prerequisites( self, resource_group_name: str, server_name: str, @@ -99,8 +105,7 @@ async def trigger_ltr_pre_backup( content_type: str = "application/json", **kwargs: Any ) -> _models.LtrPreBackupResponse: - """PreBackup operation performs all the checks that are needed for the subsequent long term - retention backup operation to succeed. + """Performs all checks required for a long term retention backup operation to succeed. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -118,15 +123,14 @@ async def trigger_ltr_pre_backup( """ @distributed_trace_async - async def trigger_ltr_pre_backup( + async def check_prerequisites( self, resource_group_name: str, server_name: str, parameters: Union[_models.LtrPreBackupRequest, IO[bytes]], **kwargs: Any ) -> _models.LtrPreBackupResponse: - """PreBackup operation performs all the checks that are needed for the subsequent long term - retention backup operation to succeed. + """Performs all checks required for a long term retention backup operation to succeed. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -163,7 +167,7 @@ async def trigger_ltr_pre_backup( else: _json = self._serialize.body(parameters, "LtrPreBackupRequest") - _request = build_trigger_ltr_pre_backup_request( + _request = build_check_prerequisites_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -185,7 +189,10 @@ async def trigger_ltr_pre_backup( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -198,11 +205,11 @@ async def trigger_ltr_pre_backup( return deserialized # type: ignore - async def _start_ltr_backup_initial( + async def _start_initial( self, resource_group_name: str, server_name: str, - parameters: Union[_models.LtrBackupRequest, IO[bytes]], + parameters: Union[_models.BackupsLongTermRetentionRequest, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -226,9 +233,9 @@ async def _start_ltr_backup_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "LtrBackupRequest") + _json = self._serialize.body(parameters, "BackupsLongTermRetentionRequest") - _request = build_start_ltr_backup_request( + _request = build_start_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -255,7 +262,10 @@ async def _start_ltr_backup_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -278,16 +288,16 @@ async def _start_ltr_backup_initial( return deserialized # type: ignore @overload - async def begin_start_ltr_backup( + async def begin_start( self, resource_group_name: str, server_name: str, - parameters: _models.LtrBackupRequest, + parameters: _models.BackupsLongTermRetentionRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.LtrBackupResponse]: - """Start the Long Term Retention Backup operation. + ) -> AsyncLROPoller[_models.BackupsLongTermRetentionResponse]: + """Initiates a long term retention backup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -295,19 +305,19 @@ async def begin_start_ltr_backup( :param server_name: The name of the server. Required. :type server_name: str :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.LtrBackupRequest + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LtrBackupResponse or the result of - cls(response) + :return: An instance of AsyncLROPoller that returns either BackupsLongTermRetentionResponse or + the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.LtrBackupResponse] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_start_ltr_backup( + async def begin_start( self, resource_group_name: str, server_name: str, @@ -315,8 +325,8 @@ async def begin_start_ltr_backup( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.LtrBackupResponse]: - """Start the Long Term Retention Backup operation. + ) -> AsyncLROPoller[_models.BackupsLongTermRetentionResponse]: + """Initiates a long term retention backup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -328,35 +338,36 @@ async def begin_start_ltr_backup( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either LtrBackupResponse or the result of - cls(response) + :return: An instance of AsyncLROPoller that returns either BackupsLongTermRetentionResponse or + the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.LtrBackupResponse] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_start_ltr_backup( + async def begin_start( self, resource_group_name: str, server_name: str, - parameters: Union[_models.LtrBackupRequest, IO[bytes]], + parameters: Union[_models.BackupsLongTermRetentionRequest, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.LtrBackupResponse]: - """Start the Long Term Retention Backup operation. + ) -> AsyncLROPoller[_models.BackupsLongTermRetentionResponse]: + """Initiates a long term retention backup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: Request body for operation. Is either a LtrBackupRequest type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.LtrBackupRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either LtrBackupResponse or the result of - cls(response) + :param parameters: Request body for operation. Is either a BackupsLongTermRetentionRequest type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionRequest + or IO[bytes] + :return: An instance of AsyncLROPoller that returns either BackupsLongTermRetentionResponse or + the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.LtrBackupResponse] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -364,12 +375,12 @@ async def begin_start_ltr_backup( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LtrBackupResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.BackupsLongTermRetentionResponse] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._start_ltr_backup_initial( + raw_result = await self._start_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -388,7 +399,7 @@ def get_long_running_output(pipeline_response): response = pipeline_response.http_response response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) - deserialized = self._deserialize("LtrBackupResponse", pipeline_response.http_response) + deserialized = self._deserialize("BackupsLongTermRetentionResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -402,12 +413,165 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.LtrBackupResponse].from_continuation_token( + return AsyncLROPoller[_models.BackupsLongTermRetentionResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.LtrBackupResponse]( + return AsyncLROPoller[_models.BackupsLongTermRetentionResponse]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + + @distributed_trace_async + async def get( + self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any + ) -> _models.BackupsLongTermRetentionOperation: + """Gets the results of a long retention backup operation for a server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param backup_name: The name of the backup. Required. + :type backup_name: str + :return: BackupsLongTermRetentionOperation or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BackupsLongTermRetentionOperation] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + backup_name=backup_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BackupsLongTermRetentionOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.BackupsLongTermRetentionOperation"]: + """Lists the results of the long term retention backup operations for a server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :return: An iterator like instance of either BackupsLongTermRetentionOperation or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LtrServerBackupOperationList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_server_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LtrServerBackupOperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_location_based_capabilities_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_capabilities_by_location_operations.py similarity index 83% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_location_based_capabilities_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_capabilities_by_location_operations.py index dc3f79e876e4..a4e5ee04a742 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_location_based_capabilities_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_capabilities_by_location_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import AsyncPipelineClient @@ -27,21 +27,22 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._location_based_capabilities_operations import build_execute_request +from ...operations._capabilities_by_location_operations import build_list_request from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class LocationBasedCapabilitiesOperations: +class CapabilitiesByLocationOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`location_based_capabilities` attribute. + :attr:`capabilities_by_location` attribute. """ models = _models @@ -56,22 +57,21 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def execute(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.FlexibleServerCapability"]: - """Get capabilities at specified location in a given subscription. + def list(self, location_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Capability"]: + """Lists the capabilities available in a given location for a specific subscription. :param location_name: The name of the location. Required. :type location_name: str - :return: An iterator like instance of either FlexibleServerCapability or the result of - cls(response) + :return: An iterator like instance of either Capability or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.FlexibleServerCapability] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.Capability] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapabilityList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -84,7 +84,7 @@ def execute(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.F def prepare_request(next_link=None): if not next_link: - _request = build_execute_request( + _request = build_list_request( location_name=location_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -111,7 +111,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("CapabilitiesListResult", pipeline_response) + deserialized = self._deserialize("CapabilityList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -128,7 +128,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_server_capabilities_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_capabilities_by_server_operations.py similarity index 85% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_server_capabilities_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_capabilities_by_server_operations.py index 9482cd3b638d..755b6958b13b 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_server_capabilities_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_capabilities_by_server_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import AsyncPipelineClient @@ -27,21 +27,22 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._server_capabilities_operations import build_list_request +from ...operations._capabilities_by_server_operations import build_list_request from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class ServerCapabilitiesOperations: +class CapabilitiesByServerOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`server_capabilities` attribute. + :attr:`capabilities_by_server` attribute. """ models = _models @@ -56,27 +57,24 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FlexibleServerCapability"]: - """Get capabilities for a flexible server. + def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Capability"]: + """Lists the capabilities available for a given server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either FlexibleServerCapability or the result of - cls(response) + :return: An iterator like instance of either Capability or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.FlexibleServerCapability] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.Capability] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapabilityList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -117,7 +115,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("CapabilitiesListResult", pipeline_response) + deserialized = self._deserialize("CapabilityList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -134,7 +132,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_log_files_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_captured_logs_operations.py similarity index 86% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_log_files_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_captured_logs_operations.py index 2b92776a3c3c..804ca63c71a0 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_log_files_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_captured_logs_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import AsyncPipelineClient @@ -27,21 +27,22 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._log_files_operations import build_list_by_server_request +from ...operations._captured_logs_operations import build_list_by_server_request from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class LogFilesOperations: +class CapturedLogsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`log_files` attribute. + :attr:`captured_logs` attribute. """ models = _models @@ -58,24 +59,24 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.LogFile"]: - """List all the server log files in a given server. + ) -> AsyncItemPaged["_models.CapturedLog"]: + """Lists all captured logs for download in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either LogFile or the result of cls(response) + :return: An iterator like instance of either CapturedLog or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.LogFile] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.CapturedLog] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapturedLogList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -116,7 +117,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("LogFileListResult", pipeline_response) + deserialized = self._deserialize("CapturedLogList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -133,7 +134,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_check_name_availability_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_check_name_availability_operations.py deleted file mode 100644 index bdcb3e2f3bff..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_check_name_availability_operations.py +++ /dev/null @@ -1,161 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._check_name_availability_operations import build_execute_request -from .._configuration import PostgreSQLManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CheckNameAvailabilityOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`check_name_availability` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PostgreSQLManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def execute( - self, - name_availability_request: _models.CheckNameAvailabilityRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param name_availability_request: The required parameters for checking if resource name is - available. Required. - :type name_availability_request: - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def execute( - self, name_availability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param name_availability_request: The required parameters for checking if resource name is - available. Required. - :type name_availability_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def execute( - self, name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param name_availability_request: The required parameters for checking if resource name is - available. Is either a CheckNameAvailabilityRequest type or a IO[bytes] type. Required. - :type name_availability_request: - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(name_availability_request, (IOBase, bytes)): - _content = name_availability_request - else: - _json = self._serialize.body(name_availability_request, "CheckNameAvailabilityRequest") - - _request = build_execute_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_check_name_availability_with_location_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_check_name_availability_with_location_operations.py deleted file mode 100644 index c5398231efcf..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_check_name_availability_with_location_operations.py +++ /dev/null @@ -1,177 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._check_name_availability_with_location_operations import build_execute_request -from .._configuration import PostgreSQLManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CheckNameAvailabilityWithLocationOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`check_name_availability_with_location` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PostgreSQLManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def execute( - self, - location_name: str, - name_availability_request: _models.CheckNameAvailabilityRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param location_name: The name of the location. Required. - :type location_name: str - :param name_availability_request: The required parameters for checking if resource name is - available. Required. - :type name_availability_request: - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def execute( - self, - location_name: str, - name_availability_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param location_name: The name of the location. Required. - :type location_name: str - :param name_availability_request: The required parameters for checking if resource name is - available. Required. - :type name_availability_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def execute( - self, - location_name: str, - name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param location_name: The name of the location. Required. - :type location_name: str - :param name_availability_request: The required parameters for checking if resource name is - available. Is either a CheckNameAvailabilityRequest type or a IO[bytes] type. Required. - :type name_availability_request: - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(name_availability_request, (IOBase, bytes)): - _content = name_availability_request - else: - _json = self._serialize.body(name_availability_request, "CheckNameAvailabilityRequest") - - _request = build_execute_request( - location_name=location_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_configurations_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_configurations_operations.py index a9759d3f523f..da66b784fe52 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_configurations_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_configurations_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -42,7 +42,8 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ConfigurationsOperations: @@ -69,8 +70,8 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Configuration"]: - """List all the configurations in a given server. + ) -> AsyncItemPaged["_models.Configuration"]: + """Lists all configurations (also known as server parameters) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -86,7 +87,7 @@ def list_by_server( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ConfigurationList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -127,7 +128,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = self._deserialize("ConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -144,7 +145,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -155,14 +159,15 @@ async def get_next(next_link=None): async def get( self, resource_group_name: str, server_name: str, configuration_name: str, **kwargs: Any ) -> _models.Configuration: - """Gets information about a configuration of server. + """Gets information about a specific configuration (also known as server parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str :return: Configuration or the result of cls(response) :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Configuration @@ -202,7 +207,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Configuration", pipeline_response.http_response) @@ -265,18 +273,23 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -295,25 +308,26 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> AsyncLROPoller[None]: + """Updates the value assigned to a specific modifiable configuration (also known as server + parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Required. + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationForUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -327,25 +341,26 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> AsyncLROPoller[None]: + """Updates the value assigned to a specific modifiable configuration (also known as server + parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Required. + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -357,24 +372,25 @@ async def begin_update( configuration_name: str, parameters: Union[_models.ConfigurationForUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> AsyncLROPoller[None]: + """Updates the value assigned to a specific modifiable configuration (also known as server + parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Is either a - ConfigurationForUpdate type or a IO[bytes] type. Required. + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Is either a ConfigurationForUpdate type or a + IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationForUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -382,7 +398,7 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -402,11 +418,9 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -418,22 +432,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Configuration].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Configuration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _put_initial( self, resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO[bytes]], + parameters: Union[_models.ConfigurationForUpdate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -457,7 +469,7 @@ async def _put_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "Configuration") + _json = self._serialize.body(parameters, "ConfigurationForUpdate") _request = build_put_request( resource_group_name=resource_group_name, @@ -481,18 +493,23 @@ async def _put_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -507,29 +524,30 @@ async def begin_put( resource_group_name: str, server_name: str, configuration_name: str, - parameters: _models.Configuration, + parameters: _models.ConfigurationForUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> AsyncLROPoller[None]: + """Updates, using Put verb, the value assigned to a specific modifiable configuration (also known + as server parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Configuration + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationForUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -543,25 +561,26 @@ async def begin_put( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> AsyncLROPoller[None]: + """Updates, using Put verb, the value assigned to a specific modifiable configuration (also known + as server parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Required. + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -571,25 +590,27 @@ async def begin_put( resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO[bytes]], + parameters: Union[_models.ConfigurationForUpdate, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> AsyncLROPoller[None]: + """Updates, using Put verb, the value assigned to a specific modifiable configuration (also known + as server parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Is either a - Configuration type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Configuration or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Is either a ConfigurationForUpdate type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationForUpdate or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -597,7 +618,7 @@ async def begin_put( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -617,27 +638,24 @@ async def begin_put( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Configuration].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Configuration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_databases_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_databases_operations.py index b28cf5a1d7b4..d9903d2eb7ad 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_databases_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_databases_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -42,7 +42,8 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class DatabasesOperations: @@ -119,18 +120,23 @@ async def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -149,25 +155,24 @@ async def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Database]: - """Creates a new database or updates an existing database. + ) -> AsyncLROPoller[None]: + """Creates a new database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param database_name: The name of the database. Required. + :param database_name: Name of the database (case-sensitive). Exact database names can be + retrieved by getting the list of all existing databases in a server. Required. :type database_name: str - :param parameters: The required parameters for creating or updating a database. Required. + :param parameters: Parameters required to create a new database. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Database :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Database or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Database] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -181,25 +186,24 @@ async def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Database]: - """Creates a new database or updates an existing database. + ) -> AsyncLROPoller[None]: + """Creates a new database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param database_name: The name of the database. Required. + :param database_name: Name of the database (case-sensitive). Exact database names can be + retrieved by getting the list of all existing databases in a server. Required. :type database_name: str - :param parameters: The required parameters for creating or updating a database. Required. + :param parameters: Parameters required to create a new database. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Database or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Database] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -211,23 +215,22 @@ async def begin_create( database_name: str, parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Database]: - """Creates a new database or updates an existing database. + ) -> AsyncLROPoller[None]: + """Creates a new database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param database_name: The name of the database. Required. + :param database_name: Name of the database (case-sensitive). Exact database names can be + retrieved by getting the list of all existing databases in a server. Required. :type database_name: str - :param parameters: The required parameters for creating or updating a database. Is either a - Database type or a IO[bytes] type. Required. + :param parameters: Parameters required to create a new database. Is either a Database type or a + IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Database or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Database or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Database] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -235,7 +238,7 @@ async def begin_create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Database] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -255,11 +258,9 @@ async def begin_create( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -271,15 +272,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Database].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Database]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any @@ -317,18 +316,24 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -341,14 +346,15 @@ async def _delete_initial( async def begin_delete( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes a database. + """Deletes an existing database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param database_name: The name of the database. Required. + :param database_name: Name of the database (case-sensitive). Exact database names can be + retrieved by getting the list of all existing databases in a server. Required. :type database_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] @@ -401,14 +407,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def get( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any ) -> _models.Database: - """Gets information about a database. + """Gets information about an existing database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param database_name: The name of the database. Required. + :param database_name: Name of the database (case-sensitive). Exact database names can be + retrieved by getting the list of all existing databases in a server. Required. :type database_name: str :return: Database or the result of cls(response) :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Database @@ -448,7 +455,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Database", pipeline_response.http_response) @@ -461,8 +471,8 @@ async def get( @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Database"]: - """List all the databases in a given server. + ) -> AsyncItemPaged["_models.Database"]: + """Lists all databases in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -478,7 +488,7 @@ def list_by_server( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.DatabaseList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -519,7 +529,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DatabaseListResult", pipeline_response) + deserialized = self._deserialize("DatabaseList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -536,7 +546,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_firewall_rules_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_firewall_rules_operations.py index dcda768a92a2..a29e47d5ce2f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_firewall_rules_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_firewall_rules_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -42,7 +42,8 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class FirewallRulesOperations: @@ -119,18 +120,23 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -149,7 +155,7 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.FirewallRule]: + ) -> AsyncLROPoller[None]: """Creates a new firewall rule or updates an existing firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -157,17 +163,15 @@ async def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param firewall_rule_name: The name of the server firewall rule. Required. + :param firewall_rule_name: Name of the firewall rule. Required. :type firewall_rule_name: str - :param parameters: The required parameters for creating or updating a firewall rule. Required. + :param parameters: Parameters required for creating or updating a firewall rule. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.FirewallRule :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FirewallRule or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.FirewallRule] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -181,7 +185,7 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.FirewallRule]: + ) -> AsyncLROPoller[None]: """Creates a new firewall rule or updates an existing firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -189,17 +193,15 @@ async def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param firewall_rule_name: The name of the server firewall rule. Required. + :param firewall_rule_name: Name of the firewall rule. Required. :type firewall_rule_name: str - :param parameters: The required parameters for creating or updating a firewall rule. Required. + :param parameters: Parameters required for creating or updating a firewall rule. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FirewallRule or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.FirewallRule] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -211,7 +213,7 @@ async def begin_create_or_update( firewall_rule_name: str, parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.FirewallRule]: + ) -> AsyncLROPoller[None]: """Creates a new firewall rule or updates an existing firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -219,15 +221,13 @@ async def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param firewall_rule_name: The name of the server firewall rule. Required. + :param firewall_rule_name: Name of the firewall rule. Required. :type firewall_rule_name: str - :param parameters: The required parameters for creating or updating a firewall rule. Is either - a FirewallRule type or a IO[bytes] type. Required. + :param parameters: Parameters required for creating or updating a firewall rule. Is either a + FirewallRule type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.FirewallRule or IO[bytes] - :return: An instance of AsyncLROPoller that returns either FirewallRule or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.FirewallRule] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -235,7 +235,7 @@ async def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -255,11 +255,9 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -271,15 +269,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.FirewallRule].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.FirewallRule]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any @@ -317,18 +313,24 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -341,14 +343,14 @@ async def _delete_initial( async def begin_delete( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes a PostgreSQL server firewall rule. + """Deletes an existing firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param firewall_rule_name: The name of the server firewall rule. Required. + :param firewall_rule_name: Name of the firewall rule. Required. :type firewall_rule_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] @@ -401,14 +403,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def get( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any ) -> _models.FirewallRule: - """List all the firewall rules in a given server. + """Gets information about a firewall rule in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param firewall_rule_name: The name of the server firewall rule. Required. + :param firewall_rule_name: Name of the firewall rule. Required. :type firewall_rule_name: str :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.postgresqlflexibleservers.models.FirewallRule @@ -448,7 +450,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) @@ -461,8 +466,8 @@ async def get( @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FirewallRule"]: - """List all the firewall rules in a given PostgreSQL server. + ) -> AsyncItemPaged["_models.FirewallRule"]: + """Lists information about all firewall rules in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -478,7 +483,7 @@ def list_by_server( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.FirewallRuleList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -519,7 +524,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) + deserialized = self._deserialize("FirewallRuleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -536,7 +541,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_migrations_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_migrations_operations.py index 88174ce24429..e28231e7539b 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_migrations_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_migrations_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -30,8 +30,9 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer from ...operations._migrations_operations import ( + build_cancel_request, + build_check_name_availability_request, build_create_request, - build_delete_request, build_get_request, build_list_by_target_server_request, build_update_request, @@ -39,7 +40,8 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class MigrationsOperations: @@ -66,92 +68,86 @@ def __init__(self, *args, **kwargs) -> None: @overload async def create( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, - parameters: _models.MigrationResource, + parameters: _models.Migration, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Creates a new migration. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for creating a migration. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :param parameters: Parameters required for creating a migration. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Migration :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def create( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Creates a new migration. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for creating a migration. Required. + :param parameters: Parameters required for creating a migration. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def create( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, - parameters: Union[_models.MigrationResource, IO[bytes]], + parameters: Union[_models.Migration, IO[bytes]], **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Creates a new migration. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for creating a migration. Is either a - MigrationResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource or IO[bytes] - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :param parameters: Parameters required for creating a migration. Is either a Migration type or + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Migration or IO[bytes] + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -167,7 +163,7 @@ async def create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MigrationResource] = kwargs.pop("cls", None) + cls: ClsType[_models.Migration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -175,13 +171,13 @@ async def create( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "MigrationResource") + _json = self._serialize.body(parameters, "Migration") _request = build_create_request( - subscription_id=subscription_id, resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, + server_name=server_name, migration_name=migration_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -200,10 +196,13 @@ async def create( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) + deserialized = self._deserialize("Migration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -212,25 +211,19 @@ async def create( @distributed_trace_async async def get( - self, - subscription_id: str, - resource_group_name: str, - target_db_server_name: str, - migration_name: str, - **kwargs: Any - ) -> _models.MigrationResource: - """Gets details of a migration. + self, resource_group_name: str, server_name: str, migration_name: str, **kwargs: Any + ) -> _models.Migration: + """Gets information about a migration. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -245,13 +238,13 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MigrationResource] = kwargs.pop("cls", None) + cls: ClsType[_models.Migration] = kwargs.pop("cls", None) _request = build_get_request( - subscription_id=subscription_id, resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, + server_name=server_name, migration_name=migration_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, @@ -267,10 +260,13 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) + deserialized = self._deserialize("Migration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -280,99 +276,93 @@ async def get( @overload async def update( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, parameters: _models.MigrationResourceForPatch, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for updating a migration. Required. + :param parameters: Parameters required to update an existing migration. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResourceForPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def update( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for updating a migration. Required. + :param parameters: Parameters required to update an existing migration. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def update( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, parameters: Union[_models.MigrationResourceForPatch, IO[bytes]], **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for updating a migration. Is either a + :param parameters: Parameters required to update an existing migration. Is either a MigrationResourceForPatch type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResourceForPatch or IO[bytes] - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -388,7 +378,7 @@ async def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MigrationResource] = kwargs.pop("cls", None) + cls: ClsType[_models.Migration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -399,10 +389,10 @@ async def update( _json = self._serialize.body(parameters, "MigrationResourceForPatch") _request = build_update_request( - subscription_id=subscription_id, resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, + server_name=server_name, migration_name=migration_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -421,10 +411,13 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) + deserialized = self._deserialize("Migration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -432,26 +425,20 @@ async def update( return deserialized # type: ignore @distributed_trace_async - async def delete( - self, - subscription_id: str, - resource_group_name: str, - target_db_server_name: str, - migration_name: str, - **kwargs: Any - ) -> None: - """Deletes a migration. + async def cancel( + self, resource_group_name: str, server_name: str, migration_name: str, **kwargs: Any + ) -> Optional[_models.Migration]: + """Cancels an active migration. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :return: None or the result of cls(response) - :rtype: None + :return: Migration or None or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration or None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -466,13 +453,13 @@ async def delete( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.Migration]] = kwargs.pop("cls", None) - _request = build_delete_request( - subscription_id=subscription_id, + _request = build_cancel_request( resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, + server_name=server_name, migration_name=migration_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, @@ -488,43 +475,51 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("Migration", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def list_by_target_server( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_list_filter: Optional[Union[str, _models.MigrationListFilter]] = None, **kwargs: Any - ) -> AsyncIterable["_models.MigrationResource"]: - """List all the migrations on a given target server. + ) -> AsyncItemPaged["_models.Migration"]: + """Lists all migrations of a target flexible server. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_list_filter: Migration list filter. Retrieves either active migrations or all - migrations. Known values are: "Active" and "All". Default value is None. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_list_filter: Migration list filter. Indicates if the request should retrieve + only active migrations or all migrations. Defaults to Active. Known values are: "Active" and + "All". Default value is None. :type migration_list_filter: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationListFilter - :return: An iterator like instance of either MigrationResource or the result of cls(response) + :return: An iterator like instance of either Migration or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.MigrationResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.Migration] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MigrationResourceListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.MigrationList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -538,9 +533,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_list_by_target_server_request( - subscription_id=subscription_id, resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, + server_name=server_name, + subscription_id=self._config.subscription_id, migration_list_filter=migration_list_filter, api_version=api_version, headers=_headers, @@ -566,7 +561,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("MigrationResourceListResult", pipeline_response) + deserialized = self._deserialize("MigrationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -583,9 +578,155 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + + @overload + async def check_name_availability( + self, + resource_group_name: str, + server_name: str, + parameters: _models.MigrationNameAvailability, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MigrationNameAvailability: + """Check the validity and availability of the given name, to assign it to a new migration. + + Checks if a proposed migration name is valid and available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param parameters: Parameters required to check if a migration name is valid and available. + Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MigrationNameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + resource_group_name: str, + server_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MigrationNameAvailability: + """Check the validity and availability of the given name, to assign it to a new migration. + + Checks if a proposed migration name is valid and available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param parameters: Parameters required to check if a migration name is valid and available. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MigrationNameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + server_name: str, + parameters: Union[_models.MigrationNameAvailability, IO[bytes]], + **kwargs: Any + ) -> _models.MigrationNameAvailability: + """Check the validity and availability of the given name, to assign it to a new migration. + + Checks if a proposed migration name is valid and available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param parameters: Parameters required to check if a migration name is valid and available. Is + either a MigrationNameAvailability type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability or + IO[bytes] + :return: MigrationNameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationNameAvailability] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationNameAvailability") + + _request = build_check_name_availability_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MigrationNameAvailability", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_name_availability_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_name_availability_operations.py new file mode 100644 index 000000000000..c9a106edb2e6 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_name_availability_operations.py @@ -0,0 +1,285 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._name_availability_operations import build_check_globally_request, build_check_with_location_request +from .._configuration import PostgreSQLManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class NameAvailabilityOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s + :attr:`name_availability` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PostgreSQLManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def check_globally( + self, parameters: _models.CheckNameAvailabilityRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Checks the validity and availability of the given name, to assign it to a new server or to use + it as the base name of a new pair of virtual endpoints. + + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_globally( + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Checks the validity and availability of the given name, to assign it to a new server or to use + it as the base name of a new pair of virtual endpoints. + + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_globally( + self, parameters: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Checks the validity and availability of the given name, to assign it to a new server or to use + it as the base name of a new pair of virtual endpoints. + + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. Is + either a CheckNameAvailabilityRequest type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest or + IO[bytes] + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailabilityRequest") + + _request = build_check_globally_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NameAvailabilityModel", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def check_with_location( + self, + location_name: str, + parameters: _models.CheckNameAvailabilityRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Check the availability of name for resource. + + :param location_name: The name of the location. Required. + :type location_name: str + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_with_location( + self, location_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Check the availability of name for resource. + + :param location_name: The name of the location. Required. + :type location_name: str + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_with_location( + self, location_name: str, parameters: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Check the availability of name for resource. + + :param location_name: The name of the location. Required. + :type location_name: str + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. Is + either a CheckNameAvailabilityRequest type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest or + IO[bytes] + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailabilityRequest") + + _request = build_check_with_location_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NameAvailabilityModel", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_operations.py index c8eb0cc0db70..bc6c66ad71c0 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import AsyncPipelineClient @@ -31,7 +31,8 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class Operations: @@ -56,8 +57,8 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """Lists all of the available REST API operations. + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: + """Lists all available REST API operations. :return: An iterator like instance of either Operation or the result of cls(response) :rtype: @@ -68,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -106,7 +107,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -123,7 +124,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_postgre_sql_management_client_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_postgre_sql_management_client_operations.py deleted file mode 100644 index bcbe27dc03a6..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_postgre_sql_management_client_operations.py +++ /dev/null @@ -1,186 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.utils import ClientMixinABC -from ...operations._postgre_sql_management_client_operations import build_check_migration_name_availability_request -from .._configuration import PostgreSQLManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PostgreSQLManagementClientOperationsMixin( # pylint: disable=name-too-long - ClientMixinABC[AsyncPipelineClient, PostgreSQLManagementClientConfiguration] -): - - @overload - async def check_migration_name_availability( - self, - subscription_id: str, - resource_group_name: str, - target_db_server_name: str, - parameters: _models.MigrationNameAvailabilityResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MigrationNameAvailabilityResource: - """Check migration name validity and availability. - - This method checks whether a proposed migration name is valid and available. - - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. - :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param parameters: The required parameters for checking if a migration name is available. - Required. - :type parameters: - ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MigrationNameAvailabilityResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_migration_name_availability( - self, - subscription_id: str, - resource_group_name: str, - target_db_server_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MigrationNameAvailabilityResource: - """Check migration name validity and availability. - - This method checks whether a proposed migration name is valid and available. - - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. - :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param parameters: The required parameters for checking if a migration name is available. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MigrationNameAvailabilityResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_migration_name_availability( - self, - subscription_id: str, - resource_group_name: str, - target_db_server_name: str, - parameters: Union[_models.MigrationNameAvailabilityResource, IO[bytes]], - **kwargs: Any - ) -> _models.MigrationNameAvailabilityResource: - """Check migration name validity and availability. - - This method checks whether a proposed migration name is valid and available. - - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. - :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param parameters: The required parameters for checking if a migration name is available. Is - either a MigrationNameAvailabilityResource type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityResource or IO[bytes] - :return: MigrationNameAvailabilityResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MigrationNameAvailabilityResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "MigrationNameAvailabilityResource") - - _request = build_check_migration_name_availability_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MigrationNameAvailabilityResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_dns_zone_suffix_operations.py similarity index 86% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_dns_zone_suffix_operations.py index 6dd1e8a064b2..a606efdc16e7 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_get_private_dns_zone_suffix_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_dns_zone_suffix_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -25,21 +25,22 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._get_private_dns_zone_suffix_operations import build_execute_request +from ...operations._private_dns_zone_suffix_operations import build_get_request from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class GetPrivateDnsZoneSuffixOperations: +class PrivateDnsZoneSuffixOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`get_private_dns_zone_suffix` attribute. + :attr:`private_dns_zone_suffix` attribute. """ models = _models @@ -54,8 +55,8 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def execute(self, **kwargs: Any) -> str: - """Get private DNS zone suffix in the cloud. + async def get(self, **kwargs: Any) -> str: + """Gets the private DNS zone suffix. :return: str or the result of cls(response) :rtype: str @@ -75,7 +76,7 @@ async def execute(self, **kwargs: Any) -> str: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[str] = kwargs.pop("cls", None) - _request = build_execute_request( + _request = build_get_request( api_version=api_version, headers=_headers, params=_params, @@ -91,7 +92,10 @@ async def execute(self, **kwargs: Any) -> str: if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("str", pipeline_response.http_response) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_endpoint_connection_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_endpoint_connection_operations.py deleted file mode 100644 index bc45a4b2aa2e..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_endpoint_connection_operations.py +++ /dev/null @@ -1,389 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._private_endpoint_connection_operations import build_delete_request, build_update_request -from .._configuration import PostgreSQLManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateEndpointConnectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`private_endpoint_connection` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PostgreSQLManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _update_initial( - self, - resource_group_name: str, - server_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PrivateEndpointConnection") - - _request = build_update_request( - resource_group_name=resource_group_name, - server_name=server_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - server_name: str, - private_endpoint_connection_name: str, - parameters: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: The required parameters for updating private endpoint connection. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - server_name: str, - private_endpoint_connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: The required parameters for updating private endpoint connection. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - server_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: The required parameters for updating private endpoint connection. Is either - a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - server_name=server_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - server_name=server_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - server_name=server_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_endpoint_connections_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_endpoint_connections_operations.py index f2d7bafd277a..7c798005ae97 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from io import IOBase +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -17,22 +18,32 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._private_endpoint_connections_operations import build_get_request, build_list_by_server_request +from ...operations._private_endpoint_connections_operations import ( + build_delete_request, + build_get_request, + build_list_by_server_request, + build_update_request, +) from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class PrivateEndpointConnectionsOperations: @@ -107,7 +118,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) @@ -117,11 +131,342 @@ async def get( return deserialized # type: ignore + async def _update_initial( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") + + _request = build_update_request( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approves or rejects a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters required to update a private endpoint connection. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approves or rejects a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters required to update a private endpoint connection. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Approves or rejects a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters required to update a private endpoint connection. Is either a + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnection"]: - """Gets all private endpoint connections on a server. + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """Lists all private endpoint connections on a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -138,7 +483,7 @@ def list_by_server( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnectionList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -179,7 +524,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -196,7 +541,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_link_resources_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_link_resources_operations.py index 45172db746a8..68f09b54ab05 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_link_resources_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_private_link_resources_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import AsyncPipelineClient @@ -32,7 +32,8 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class PrivateLinkResourcesOperations: @@ -59,7 +60,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateLinkResource"]: + ) -> AsyncItemPaged["_models.PrivateLinkResource"]: """Gets the private link resources for PostgreSQL server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -76,7 +77,7 @@ def list_by_server( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateLinkResourceList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -117,7 +118,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -134,7 +135,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -192,7 +196,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_quota_usages_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_quota_usages_operations.py index 547dce393139..eb225e680f39 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_quota_usages_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_quota_usages_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import AsyncPipelineClient @@ -31,7 +31,8 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class QuotaUsagesOperations: @@ -56,7 +57,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.QuotaUsage"]: + def list(self, location_name: str, **kwargs: Any) -> AsyncItemPaged["_models.QuotaUsage"]: """Get quota usages at specified location in a given subscription. :param location_name: The name of the location. Required. @@ -70,7 +71,7 @@ def list(self, location_name: str, **kwargs: Any) -> AsyncIterable["_models.Quot _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.QuotaUsageList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -110,7 +111,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("QuotaUsagesListResult", pipeline_response) + deserialized = self._deserialize("QuotaUsageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -127,7 +128,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_replicas_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_replicas_operations.py index b206726fb0d6..9e12f3cb7a2c 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_replicas_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_replicas_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import AsyncPipelineClient @@ -31,7 +31,8 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ReplicasOperations: @@ -58,8 +59,8 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.Server"]: - """List all the replicas for a given server. + ) -> AsyncItemPaged["_models.Server"]: + """Lists all read replicas of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -75,7 +76,7 @@ def list_by_server( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ServerList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -116,7 +117,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServerListResult", pipeline_response) + deserialized = self._deserialize("ServerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -133,7 +134,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_server_threat_protection_settings_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_server_threat_protection_settings_operations.py index 28f5cafd7525..c99e7c32168f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_server_threat_protection_settings_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_server_threat_protection_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,11 +7,9 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,7 +23,6 @@ from azure.core.pipeline import PipelineResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -34,15 +30,12 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._server_threat_protection_settings_operations import ( - build_create_or_update_request, - build_get_request, - build_list_by_server_request, -) +from ...operations._server_threat_protection_settings_operations import build_create_or_update_request from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ServerThreatProtectionSettingsOperations: @@ -66,164 +59,12 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_server( - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServerThreatProtectionSettingsModel"]: - """Get a list of server's Threat Protection state. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :return: An iterator like instance of either ServerThreatProtectionSettingsModel or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerThreatProtectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_server_request( - resource_group_name=resource_group_name, - server_name=server_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ServerThreatProtectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - server_name: str, - threat_protection_name: Union[str, _models.ThreatProtectionName], - **kwargs: Any - ) -> _models.ServerThreatProtectionSettingsModel: - """Get a server's Advanced Threat Protection settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param threat_protection_name: The name of the Threat Protection state. "Default" Required. - :type threat_protection_name: str or - ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName - :return: ServerThreatProtectionSettingsModel or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerThreatProtectionSettingsModel] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - server_name=server_name, - threat_protection_name=threat_protection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - async def _create_or_update_initial( self, resource_group_name: str, server_name: str, threat_protection_name: Union[str, _models.ThreatProtectionName], - parameters: Union[_models.ServerThreatProtectionSettingsModel, IO[bytes]], + parameters: Union[_models.AdvancedThreatProtectionSettingsModel, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -247,7 +88,7 @@ async def _create_or_update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "ServerThreatProtectionSettingsModel") + _json = self._serialize.body(parameters, "AdvancedThreatProtectionSettingsModel") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -271,18 +112,23 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -297,11 +143,11 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, threat_protection_name: Union[str, _models.ThreatProtectionName], - parameters: _models.ServerThreatProtectionSettingsModel, + parameters: _models.AdvancedThreatProtectionSettingsModel, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ServerThreatProtectionSettingsModel]: + ) -> AsyncLROPoller[None]: """Creates or updates a server's Advanced Threat Protection settings. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -309,19 +155,18 @@ async def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :param threat_protection_name: Name of the advanced threat protection settings. "Default" + Required. :type threat_protection_name: str or ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName - :param parameters: The Advanced Threat Protection state for the flexible server. Required. + :param parameters: The Advanced Threat Protection state for the server. Required. :type parameters: - ~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel + ~azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsModel :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServerThreatProtectionSettingsModel - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -335,7 +180,7 @@ async def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ServerThreatProtectionSettingsModel]: + ) -> AsyncLROPoller[None]: """Creates or updates a server's Advanced Threat Protection settings. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -343,18 +188,17 @@ async def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :param threat_protection_name: Name of the advanced threat protection settings. "Default" + Required. :type threat_protection_name: str or ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName - :param parameters: The Advanced Threat Protection state for the flexible server. Required. + :param parameters: The Advanced Threat Protection state for the server. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ServerThreatProtectionSettingsModel - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -364,9 +208,9 @@ async def begin_create_or_update( resource_group_name: str, server_name: str, threat_protection_name: Union[str, _models.ThreatProtectionName], - parameters: Union[_models.ServerThreatProtectionSettingsModel, IO[bytes]], + parameters: Union[_models.AdvancedThreatProtectionSettingsModel, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.ServerThreatProtectionSettingsModel]: + ) -> AsyncLROPoller[None]: """Creates or updates a server's Advanced Threat Protection settings. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -374,17 +218,16 @@ async def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :param threat_protection_name: Name of the advanced threat protection settings. "Default" + Required. :type threat_protection_name: str or ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName - :param parameters: The Advanced Threat Protection state for the flexible server. Is either a - ServerThreatProtectionSettingsModel type or a IO[bytes] type. Required. + :param parameters: The Advanced Threat Protection state for the server. Is either a + AdvancedThreatProtectionSettingsModel type or a IO[bytes] type. Required. :type parameters: - ~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServerThreatProtectionSettingsModel - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel] + ~azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsModel or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -392,7 +235,7 @@ async def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerThreatProtectionSettingsModel] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -412,11 +255,9 @@ async def begin_create_or_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -428,12 +269,10 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ServerThreatProtectionSettingsModel].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ServerThreatProtectionSettingsModel]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_servers_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_servers_operations.py index 92976d040584..66cf19c27b11 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_servers_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_servers_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -35,11 +35,11 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer from ...operations._servers_operations import ( - build_create_request, + build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, - build_list_request, + build_list_by_subscription_request, build_restart_request, build_start_request, build_stop_request, @@ -48,7 +48,8 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ServersOperations: @@ -72,7 +73,7 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def _create_initial( + async def _create_or_update_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.Server, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -98,7 +99,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "Server") - _request = build_create_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -119,18 +120,23 @@ async def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -140,7 +146,7 @@ async def _create_initial( return deserialized # type: ignore @overload - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -148,7 +154,7 @@ async def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Server]: + ) -> AsyncLROPoller[None]: """Creates a new server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -156,19 +162,19 @@ async def begin_create( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for creating or updating a server. Required. + :param parameters: Parameters required to create a new server or to update an existing server. + Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Server :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Server or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -176,7 +182,7 @@ async def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Server]: + ) -> AsyncLROPoller[None]: """Creates a new server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -184,21 +190,21 @@ async def begin_create( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for creating or updating a server. Required. + :param parameters: Parameters required to create a new server or to update an existing server. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Server or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create( + async def begin_create_or_update( self, resource_group_name: str, server_name: str, parameters: Union[_models.Server, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Server]: + ) -> AsyncLROPoller[None]: """Creates a new server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -206,12 +212,11 @@ async def begin_create( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for creating or updating a server. Is either a - Server type or a IO[bytes] type. Required. + :param parameters: Parameters required to create a new server or to update an existing server. + Is either a Server type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Server or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Server or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -219,12 +224,12 @@ async def begin_create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Server] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -238,11 +243,9 @@ async def begin_create( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -254,21 +257,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Server].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Server]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _update_initial( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerForUpdate, IO[bytes]], + parameters: Union[_models.ServerForPatch, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -292,7 +293,7 @@ async def _update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "ServerForUpdate") + _json = self._serialize.body(parameters, "ServerForPatch") _request = build_update_request( resource_group_name=resource_group_name, @@ -315,18 +316,23 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -340,27 +346,26 @@ async def begin_update( self, resource_group_name: str, server_name: str, - parameters: _models.ServerForUpdate, + parameters: _models.ServerForPatch, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Server]: - """Updates an existing server. The request body can contain one to many of the properties present - in the normal server definition. + ) -> AsyncLROPoller[None]: + """Updates an existing server. The request body can contain one or multiple of the properties + present in the normal server definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for updating a server. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ServerForUpdate + :param parameters: Parameters required to update a server. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ServerForPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Server or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -373,23 +378,22 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.Server]: - """Updates an existing server. The request body can contain one to many of the properties present - in the normal server definition. + ) -> AsyncLROPoller[None]: + """Updates an existing server. The request body can contain one or multiple of the properties + present in the normal server definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for updating a server. Required. + :param parameters: Parameters required to update a server. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Server or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -398,23 +402,22 @@ async def begin_update( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerForUpdate, IO[bytes]], + parameters: Union[_models.ServerForPatch, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Server]: - """Updates an existing server. The request body can contain one to many of the properties present - in the normal server definition. + ) -> AsyncLROPoller[None]: + """Updates an existing server. The request body can contain one or multiple of the properties + present in the normal server definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for updating a server. Is either a ServerForUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ServerForUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Server or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :param parameters: Parameters required to update a server. Is either a ServerForPatch type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ServerForPatch or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -422,7 +425,7 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Server] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -441,11 +444,9 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -457,15 +458,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.Server].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.Server]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -500,18 +499,24 @@ async def _delete_initial(self, resource_group_name: str, server_name: str, **kw response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -522,7 +527,7 @@ async def _delete_initial(self, resource_group_name: str, server_name: str, **kw @distributed_trace_async async def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a server. + """Deletes or drops an existing server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -577,7 +582,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace_async async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _models.Server: - """Gets information about a server. + """Gets information about an existing server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -621,7 +626,10 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Server", pipeline_response.http_response) @@ -632,8 +640,8 @@ async def get(self, resource_group_name: str, server_name: str, **kwargs: Any) - return deserialized # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Server"]: - """List all the servers in a given resource group. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Server"]: + """Lists all servers in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -647,7 +655,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ServerList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -687,7 +695,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServerListResult", pipeline_response) + deserialized = self._deserialize("ServerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -704,7 +712,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -712,8 +723,8 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: - """List all the servers in a given subscription. + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.Server"]: + """Lists all servers in a subscription. :return: An iterator like instance of either Server or the result of cls(response) :rtype: @@ -724,7 +735,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ServerList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -737,7 +748,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Server"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -763,7 +774,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServerListResult", pipeline_response) + deserialized = self._deserialize("ServerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -780,7 +791,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -807,9 +821,10 @@ async def _restart_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if parameters else None _json = None _content = None if isinstance(parameters, (IOBase, bytes)): @@ -841,18 +856,23 @@ async def _restart_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -871,14 +891,14 @@ async def begin_restart( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Restarts a server. + """Restarts PostgreSQL database engine in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The parameters for restarting a server. Default value is None. + :param parameters: Parameters to restart a server. Default value is None. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.RestartParameter :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -898,14 +918,14 @@ async def begin_restart( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: - """Restarts a server. + """Restarts PostgreSQL database engine in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The parameters for restarting a server. Default value is None. + :param parameters: Parameters to restart a server. Default value is None. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -923,15 +943,15 @@ async def begin_restart( parameters: Optional[Union[_models.RestartParameter, IO[bytes]]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: - """Restarts a server. + """Restarts PostgreSQL database engine in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The parameters for restarting a server. Is either a RestartParameter type or - a IO[bytes] type. Default value is None. + :param parameters: Parameters to restart a server. Is either a RestartParameter type or a + IO[bytes] type. Default value is None. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.RestartParameter or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] @@ -942,6 +962,7 @@ async def begin_restart( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1015,18 +1036,23 @@ async def _start_initial(self, resource_group_name: str, server_name: str, **kwa response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -1037,7 +1063,7 @@ async def _start_initial(self, resource_group_name: str, server_name: str, **kwa @distributed_trace_async async def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Starts a server. + """Starts a stopped server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1123,18 +1149,23 @@ async def _stop_initial(self, resource_group_name: str, server_name: str, **kwar response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_configuration_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_configuration_operations.py deleted file mode 100644 index 36ded0f71801..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_configuration_operations.py +++ /dev/null @@ -1,840 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._tuning_configuration_operations import ( - build_disable_request, - build_enable_request, - build_list_session_details_request, - build_list_sessions_request, - build_start_session_request, - build_stop_session_request, -) -from .._configuration import PostgreSQLManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class TuningConfigurationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`tuning_configuration` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PostgreSQLManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _enable_initial( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_enable( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enables the config tuning. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enable_initial( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _disable_initial( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_disable( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disables the config tuning. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._disable_initial( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_session_initial( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - config_tuning_request: Union[_models.ConfigTuningRequestParameter, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_tuning_request, (IOBase, bytes)): - _content = config_tuning_request - else: - _json = self._serialize.body(config_tuning_request, "ConfigTuningRequestParameter") - - _request = build_start_session_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_start_session( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - config_tuning_request: _models.ConfigTuningRequestParameter, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts up the config tuning session. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :param config_tuning_request: The parameters for tuning request. Required. - :type config_tuning_request: - ~azure.mgmt.postgresqlflexibleservers.models.ConfigTuningRequestParameter - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_start_session( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - config_tuning_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts up the config tuning session. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :param config_tuning_request: The parameters for tuning request. Required. - :type config_tuning_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_start_session( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - config_tuning_request: Union[_models.ConfigTuningRequestParameter, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Starts up the config tuning session. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :param config_tuning_request: The parameters for tuning request. Is either a - ConfigTuningRequestParameter type or a IO[bytes] type. Required. - :type config_tuning_request: - ~azure.mgmt.postgresqlflexibleservers.models.ConfigTuningRequestParameter or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_session_initial( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - config_tuning_request=config_tuning_request, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _stop_session_initial( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_session_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_stop_session( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Stops the config tuning session. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_session_initial( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_sessions( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> AsyncIterable["_models.SessionResource"]: - """Gets up the config tuning session status. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :return: An iterator like instance of either SessionResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.SessionResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SessionsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_sessions_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SessionsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_session_details( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - session_id: str, - **kwargs: Any - ) -> AsyncIterable["_models.SessionDetailsResource"]: - """Gets the session details of a config tuning session. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :param session_id: Guid of the objectId for the session. Required. - :type session_id: str - :return: An iterator like instance of either SessionDetailsResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.SessionDetailsResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SessionDetailsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_session_details_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - session_id=session_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("SessionDetailsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_index_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_index_operations.py deleted file mode 100644 index b5947e05c664..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_index_operations.py +++ /dev/null @@ -1,157 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._tuning_index_operations import build_list_recommendations_request -from .._configuration import PostgreSQLManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class TuningIndexOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.postgresqlflexibleservers.aio.PostgreSQLManagementClient`'s - :attr:`tuning_index` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PostgreSQLManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_recommendations( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - recommendation_type: Optional[Union[str, _models.RecommendationType]] = None, - **kwargs: Any - ) -> AsyncIterable["_models.IndexRecommendationResource"]: - """Retrieve the list of available tuning index recommendations. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :param recommendation_type: Recommendations list filter. Retrieves recommendations based on - type. Known values are: "CreateIndex" and "DropIndex". Default value is None. - :type recommendation_type: str or - ~azure.mgmt.postgresqlflexibleservers.models.RecommendationType - :return: An iterator like instance of either IndexRecommendationResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.IndexRecommendationResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.IndexRecommendationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_recommendations_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - recommendation_type=recommendation_type, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("IndexRecommendationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_options_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_options_operations.py index 111c8d80a0ca..519ecd34c582 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_options_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_tuning_options_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Optional, TypeVar, Union import urllib.parse from azure.core import AsyncPipelineClient @@ -28,11 +28,16 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._tuning_options_operations import build_get_request, build_list_by_server_request +from ...operations._tuning_options_operations import ( + build_get_request, + build_list_by_server_request, + build_list_recommendations_request, +) from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class TuningOptionsOperations: @@ -61,21 +66,22 @@ async def get( self, resource_group_name: str, server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], + tuning_option: Union[str, _models.TuningOptionParameterEnum], **kwargs: Any - ) -> _models.TuningOptionsResource: - """Retrieve the tuning option on a server. + ) -> _models.TuningOptions: + """Gets the tuning options of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :return: TuningOptionsResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionsResource + :param tuning_option: The name of the tuning option. Known values are: "index" and "table". + Required. + :type tuning_option: str or + ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionParameterEnum + :return: TuningOptions or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.TuningOptions :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -90,7 +96,7 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.TuningOptionsResource] = kwargs.pop("cls", None) + cls: ClsType[_models.TuningOptions] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -112,38 +118,145 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TuningOptionsResource", pipeline_response.http_response) + deserialized = self._deserialize("TuningOptions", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @distributed_trace + def list_recommendations( + self, + resource_group_name: str, + server_name: str, + tuning_option: Union[str, _models.TuningOptionParameterEnum], + recommendation_type: Optional[Union[str, _models.RecommendationTypeParameterEnum]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.ObjectRecommendation"]: + """Lists available object recommendations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param tuning_option: The name of the tuning option. Known values are: "index" and "table". + Required. + :type tuning_option: str or + ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionParameterEnum + :param recommendation_type: Recommendations list filter. Retrieves recommendations based on + type. Known values are: "CreateIndex", "DropIndex", "ReIndex", and "AnalyzeTable". Default + value is None. + :type recommendation_type: str or + ~azure.mgmt.postgresqlflexibleservers.models.RecommendationTypeParameterEnum + :return: An iterator like instance of either ObjectRecommendation or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ObjectRecommendationList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_recommendations_request( + resource_group_name=resource_group_name, + server_name=server_name, + tuning_option=tuning_option, + subscription_id=self._config.subscription_id, + recommendation_type=recommendation_type, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ObjectRecommendationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.TuningOptionsResource"]: - """Retrieve the list of available tuning options. + ) -> AsyncItemPaged["_models.TuningOptions"]: + """Lists the tuning options of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either TuningOptionsResource or the result of - cls(response) + :return: An iterator like instance of either TuningOptions or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.TuningOptionsResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.TuningOptions] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.TuningOptionsListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.TuningOptionsList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -184,7 +297,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("TuningOptionsListResult", pipeline_response) + deserialized = self._deserialize("TuningOptionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -201,7 +314,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_virtual_endpoints_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_virtual_endpoints_operations.py index 942c43def0b2..67b60e42fd98 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_virtual_endpoints_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_virtual_endpoints_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -43,7 +43,8 @@ from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class VirtualEndpointsOperations: @@ -72,7 +73,7 @@ async def _create_initial( resource_group_name: str, server_name: str, virtual_endpoint_name: str, - parameters: Union[_models.VirtualEndpointResource, IO[bytes]], + parameters: Union[_models.VirtualEndpoint, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -96,7 +97,7 @@ async def _create_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "VirtualEndpointResource") + _json = self._serialize.body(parameters, "VirtualEndpoint") _request = build_create_request( resource_group_name=resource_group_name, @@ -120,18 +121,23 @@ async def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -146,30 +152,28 @@ async def begin_create( resource_group_name: str, server_name: str, virtual_endpoint_name: str, - parameters: _models.VirtualEndpointResource, + parameters: _models.VirtualEndpoint, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualEndpointResource]: - """Creates a new virtual endpoint for PostgreSQL flexible server. + ) -> AsyncLROPoller[None]: + """Creates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for creating or updating virtual endpoints. + :param parameters: Parameters required to create or update a pair of virtual endpoints. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -183,26 +187,24 @@ async def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualEndpointResource]: - """Creates a new virtual endpoint for PostgreSQL flexible server. + ) -> AsyncLROPoller[None]: + """Creates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for creating or updating virtual endpoints. + :param parameters: Parameters required to create or update a pair of virtual endpoints. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -212,26 +214,23 @@ async def begin_create( resource_group_name: str, server_name: str, virtual_endpoint_name: str, - parameters: Union[_models.VirtualEndpointResource, IO[bytes]], + parameters: Union[_models.VirtualEndpoint, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualEndpointResource]: - """Creates a new virtual endpoint for PostgreSQL flexible server. + ) -> AsyncLROPoller[None]: + """Creates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for creating or updating virtual endpoints. Is - either a VirtualEndpointResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :param parameters: Parameters required to create or update a pair of virtual endpoints. Is + either a VirtualEndpoint type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -239,7 +238,7 @@ async def begin_create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualEndpointResource] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -259,11 +258,9 @@ async def begin_create( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -275,15 +272,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualEndpointResource].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualEndpointResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _update_initial( self, @@ -338,18 +333,23 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -368,26 +368,23 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualEndpointResource]: - """Updates an existing virtual endpoint. The request body can contain one to many of the - properties present in the normal virtual endpoint definition. + ) -> AsyncLROPoller[None]: + """Updates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for updating a server. Required. + :param parameters: Parameters required to update a pair of virtual endpoints. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResourceForPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -401,26 +398,23 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualEndpointResource]: - """Updates an existing virtual endpoint. The request body can contain one to many of the - properties present in the normal virtual endpoint definition. + ) -> AsyncLROPoller[None]: + """Updates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for updating a server. Required. + :param parameters: Parameters required to update a pair of virtual endpoints. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -432,25 +426,22 @@ async def begin_update( virtual_endpoint_name: str, parameters: Union[_models.VirtualEndpointResourceForPatch, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualEndpointResource]: - """Updates an existing virtual endpoint. The request body can contain one to many of the - properties present in the normal virtual endpoint definition. + ) -> AsyncLROPoller[None]: + """Updates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for updating a server. Is either a + :param parameters: Parameters required to update a pair of virtual endpoints. Is either a VirtualEndpointResourceForPatch type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResourceForPatch or IO[bytes] - :return: An instance of AsyncLROPoller that returns either VirtualEndpointResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -458,7 +449,7 @@ async def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualEndpointResource] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -478,11 +469,9 @@ async def begin_update( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -494,15 +483,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.VirtualEndpointResource].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.VirtualEndpointResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _delete_initial( self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any @@ -546,12 +533,18 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -564,14 +557,14 @@ async def _delete_initial( async def begin_delete( self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes a virtual endpoint. + """Deletes a pair of virtual endpoints. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] @@ -623,18 +616,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace_async async def get( self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any - ) -> _models.VirtualEndpointResource: - """Gets information about a virtual endpoint. + ) -> _models.VirtualEndpoint: + """Gets information about a pair of virtual endpoints. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :return: VirtualEndpointResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource + :return: VirtualEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -649,7 +642,7 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VirtualEndpointResource] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualEndpoint] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -671,10 +664,13 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) + deserialized = self._deserialize("VirtualEndpoint", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -684,25 +680,24 @@ async def get( @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> AsyncIterable["_models.VirtualEndpointResource"]: - """List all the servers in a given resource group. + ) -> AsyncItemPaged["_models.VirtualEndpoint"]: + """Lists pair of virtual endpoints associated to a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either VirtualEndpointResource or the result of - cls(response) + :return: An iterator like instance of either VirtualEndpoint or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VirtualEndpointsListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualEndpointsList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -743,7 +738,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualEndpointsListResult", pipeline_response) + deserialized = self._deserialize("VirtualEndpointsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -760,7 +755,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py index ef8c7066fb33..67952052b850 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/aio/operations/_virtual_network_subnet_usage_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -26,11 +26,12 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._virtual_network_subnet_usage_operations import build_execute_request +from ...operations._virtual_network_subnet_usage_operations import build_list_request from .._configuration import PostgreSQLManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class VirtualNetworkSubnetUsageOperations: @@ -55,15 +56,15 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - async def execute( + async def list( self, location_name: str, parameters: _models.VirtualNetworkSubnetUsageParameter, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.VirtualNetworkSubnetUsageResult: - """Get virtual network subnet usage for a given vNet resource id. + ) -> _models.VirtualNetworkSubnetUsageModel: + """Lists the virtual network subnet usage for a given virtual network. :param location_name: The name of the location. Required. :type location_name: str @@ -73,16 +74,16 @@ async def execute( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: VirtualNetworkSubnetUsageResult or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageResult + :return: VirtualNetworkSubnetUsageModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageModel :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def execute( + async def list( self, location_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.VirtualNetworkSubnetUsageResult: - """Get virtual network subnet usage for a given vNet resource id. + ) -> _models.VirtualNetworkSubnetUsageModel: + """Lists the virtual network subnet usage for a given virtual network. :param location_name: The name of the location. Required. :type location_name: str @@ -91,19 +92,19 @@ async def execute( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: VirtualNetworkSubnetUsageResult or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageResult + :return: VirtualNetworkSubnetUsageModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageModel :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def execute( + async def list( self, location_name: str, parameters: Union[_models.VirtualNetworkSubnetUsageParameter, IO[bytes]], **kwargs: Any - ) -> _models.VirtualNetworkSubnetUsageResult: - """Get virtual network subnet usage for a given vNet resource id. + ) -> _models.VirtualNetworkSubnetUsageModel: + """Lists the virtual network subnet usage for a given virtual network. :param location_name: The name of the location. Required. :type location_name: str @@ -111,8 +112,8 @@ async def execute( VirtualNetworkSubnetUsageParameter type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageParameter or IO[bytes] - :return: VirtualNetworkSubnetUsageResult or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageResult + :return: VirtualNetworkSubnetUsageModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageModel :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -128,7 +129,7 @@ async def execute( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualNetworkSubnetUsageResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualNetworkSubnetUsageModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -138,7 +139,7 @@ async def execute( else: _json = self._serialize.body(parameters, "VirtualNetworkSubnetUsageParameter") - _request = build_execute_request( + _request = build_list_request( location_name=location_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -159,10 +160,13 @@ async def execute( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkSubnetUsageResult", pipeline_response.http_response) + deserialized = self._deserialize("VirtualNetworkSubnetUsageModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/__init__.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/__init__.py index 12fcb95f3494..be8bdb6bb2ff 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/__init__.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/__init__.py @@ -14,29 +14,41 @@ from ._models_py3 import ( # type: ignore - ActiveDirectoryAdministrator, - ActiveDirectoryAdministratorAdd, AdminCredentials, - AdministratorListResult, + AdminCredentialsForPatch, + AdministratorMicrosoftEntra, + AdministratorMicrosoftEntraAdd, + AdministratorMicrosoftEntraList, + AdvancedThreatProtectionSettingsList, + AdvancedThreatProtectionSettingsModel, AuthConfig, + AuthConfigForPatch, Backup, + BackupAutomaticAndOnDemand, + BackupAutomaticAndOnDemandList, + BackupForPatch, BackupRequestBase, BackupSettings, BackupStoreDetails, - CapabilitiesListResult, + BackupsLongTermRetentionOperation, + BackupsLongTermRetentionRequest, + BackupsLongTermRetentionResponse, + Capability, CapabilityBase, + CapabilityList, + CapturedLog, + CapturedLogList, CheckNameAvailabilityRequest, CheckNameAvailabilityResponse, Cluster, - ConfigTuningRequestParameter, Configuration, ConfigurationForUpdate, - ConfigurationListResult, + ConfigurationList, DataEncryption, Database, - DatabaseListResult, + DatabaseList, + DatabaseMigrationState, DbLevelValidationStatus, - DbMigrationStatus, DbServerMetadata, DelegatedSubnetUsage, ErrorAdditionalInfo, @@ -44,65 +56,55 @@ ErrorResponse, FastProvisioningEditionCapability, FirewallRule, - FirewallRuleListResult, - FlexibleServerCapability, - FlexibleServerEditionCapability, + FirewallRuleList, HighAvailability, + HighAvailabilityForPatch, ImpactRecord, - IndexRecommendationDetails, - IndexRecommendationListResult, - IndexRecommendationResource, - IndexRecommendationResourcePropertiesAnalyzedWorkload, - IndexRecommendationResourcePropertiesImplementationDetails, - LogFile, - LogFileListResult, - LtrBackupRequest, - LtrBackupResponse, LtrPreBackupRequest, LtrPreBackupResponse, - LtrServerBackupOperation, LtrServerBackupOperationList, MaintenanceWindow, - MigrationNameAvailabilityResource, - MigrationResource, + MaintenanceWindowForPatch, + Migration, + MigrationList, + MigrationNameAvailability, MigrationResourceForPatch, - MigrationResourceListResult, MigrationSecretParameters, + MigrationSecretParametersForPatch, MigrationStatus, - MigrationSubStateDetails, - NameAvailability, + MigrationSubstateDetails, + NameAvailabilityModel, NameProperty, Network, + ObjectRecommendation, + ObjectRecommendationDetails, + ObjectRecommendationList, + ObjectRecommendationPropertiesAnalyzedWorkload, + ObjectRecommendationPropertiesImplementationDetails, Operation, OperationDisplay, - OperationListResult, + OperationList, PrivateEndpoint, PrivateEndpointConnection, - PrivateEndpointConnectionListResult, + PrivateEndpointConnectionList, PrivateLinkResource, - PrivateLinkResourceListResult, + PrivateLinkResourceList, PrivateLinkServiceConnectionState, ProxyResource, QuotaUsage, - QuotaUsagesListResult, + QuotaUsageList, Replica, Resource, RestartParameter, Server, - ServerBackup, - ServerBackupListResult, - ServerForUpdate, - ServerListResult, + ServerEditionCapability, + ServerForPatch, + ServerList, ServerSku, ServerSkuCapability, - ServerThreatProtectionListResult, - ServerThreatProtectionSettingsModel, ServerVersionCapability, - SessionDetailsListResult, - SessionDetailsResource, - SessionResource, - SessionsListResult, Sku, + SkuForPatch, Storage, StorageEditionCapability, StorageMbCapability, @@ -110,114 +112,125 @@ SupportedFeature, SystemData, TrackedResource, - TuningOptionsListResult, - TuningOptionsResource, + TuningOptions, + TuningOptionsList, UserAssignedIdentity, UserIdentity, ValidationDetails, ValidationMessage, ValidationSummaryItem, - VirtualEndpointResource, + VirtualEndpoint, VirtualEndpointResourceForPatch, - VirtualEndpointsListResult, + VirtualEndpointsList, + VirtualNetworkSubnetUsageModel, VirtualNetworkSubnetUsageParameter, - VirtualNetworkSubnetUsageResult, ) from ._postgre_sql_management_client_enums import ( # type: ignore - ActiveDirectoryAuthEnum, - ArmServerKeyType, - AzureManagedDiskPerformanceTiers, - CancelEnum, + AzureManagedDiskPerformanceTier, + BackupType, + Cancel, CapabilityStatus, CheckNameAvailabilityReason, ConfigurationDataType, CreateMode, - CreateModeForUpdate, + CreateModeForPatch, CreatedByType, + DataEncryptionType, + EncryptionKeyStatus, ExecutionStatus, FailoverMode, - FastProvisioningSupportedEnum, - GeoBackupSupportedEnum, - GeoRedundantBackupEnum, - HaMode, + FastProvisioningSupport, + FeatureStatus, + GeographicallyRedundantBackup, + GeographicallyRedundantBackupSupport, HighAvailabilityMode, + HighAvailabilityState, IdentityType, - KeyStatusEnum, - LogicalReplicationOnSourceDbEnum, - MigrateRolesEnum, - MigrationDbState, + LocationRestricted, + LogicalReplicationOnSourceServer, + MicrosoftEntraAuth, + MigrateRolesAndPermissions, + MigrationDatabaseState, MigrationDetailsLevel, MigrationListFilter, MigrationMode, MigrationNameAvailabilityReason, MigrationOption, MigrationState, - MigrationSubState, - OnlineResizeSupportedEnum, + MigrationSubstate, + OnlineStorageResizeSupport, OperationOrigin, - Origin, - OverwriteDbsInTargetEnum, - PasswordAuthEnum, + OverwriteDatabasesOnTargetServer, + PasswordBasedAuth, + PostgresMajorVersion, PrincipalType, PrivateEndpointConnectionProvisioningState, PrivateEndpointServiceConnectionStatus, ReadReplicaPromoteMode, - RecommendationType, + ReadReplicaPromoteOption, RecommendationTypeEnum, - ReplicationPromoteOption, + RecommendationTypeParameterEnum, ReplicationRole, ReplicationState, - RestrictedEnum, - ServerHAState, ServerPublicNetworkAccessState, ServerState, - ServerVersion, SkuTier, SourceType, SslMode, - StartDataMigrationEnum, + StartDataMigration, StorageAutoGrow, - StorageAutoGrowthSupportedEnum, + StorageAutoGrowthSupport, StorageType, - SupportedFeatureStatusEnum, ThreatProtectionName, ThreatProtectionState, - TriggerCutoverEnum, - TuningOptionEnum, + TriggerCutover, + TuningOptionParameterEnum, ValidationState, VirtualEndpointType, - ZoneRedundantHaAndGeoBackupSupportedEnum, - ZoneRedundantHaSupportedEnum, + ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport, + ZoneRedundantHighAvailabilitySupport, ) from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ActiveDirectoryAdministrator", - "ActiveDirectoryAdministratorAdd", "AdminCredentials", - "AdministratorListResult", + "AdminCredentialsForPatch", + "AdministratorMicrosoftEntra", + "AdministratorMicrosoftEntraAdd", + "AdministratorMicrosoftEntraList", + "AdvancedThreatProtectionSettingsList", + "AdvancedThreatProtectionSettingsModel", "AuthConfig", + "AuthConfigForPatch", "Backup", + "BackupAutomaticAndOnDemand", + "BackupAutomaticAndOnDemandList", + "BackupForPatch", "BackupRequestBase", "BackupSettings", "BackupStoreDetails", - "CapabilitiesListResult", + "BackupsLongTermRetentionOperation", + "BackupsLongTermRetentionRequest", + "BackupsLongTermRetentionResponse", + "Capability", "CapabilityBase", + "CapabilityList", + "CapturedLog", + "CapturedLogList", "CheckNameAvailabilityRequest", "CheckNameAvailabilityResponse", "Cluster", - "ConfigTuningRequestParameter", "Configuration", "ConfigurationForUpdate", - "ConfigurationListResult", + "ConfigurationList", "DataEncryption", "Database", - "DatabaseListResult", + "DatabaseList", + "DatabaseMigrationState", "DbLevelValidationStatus", - "DbMigrationStatus", "DbServerMetadata", "DelegatedSubnetUsage", "ErrorAdditionalInfo", @@ -225,65 +238,55 @@ "ErrorResponse", "FastProvisioningEditionCapability", "FirewallRule", - "FirewallRuleListResult", - "FlexibleServerCapability", - "FlexibleServerEditionCapability", + "FirewallRuleList", "HighAvailability", + "HighAvailabilityForPatch", "ImpactRecord", - "IndexRecommendationDetails", - "IndexRecommendationListResult", - "IndexRecommendationResource", - "IndexRecommendationResourcePropertiesAnalyzedWorkload", - "IndexRecommendationResourcePropertiesImplementationDetails", - "LogFile", - "LogFileListResult", - "LtrBackupRequest", - "LtrBackupResponse", "LtrPreBackupRequest", "LtrPreBackupResponse", - "LtrServerBackupOperation", "LtrServerBackupOperationList", "MaintenanceWindow", - "MigrationNameAvailabilityResource", - "MigrationResource", + "MaintenanceWindowForPatch", + "Migration", + "MigrationList", + "MigrationNameAvailability", "MigrationResourceForPatch", - "MigrationResourceListResult", "MigrationSecretParameters", + "MigrationSecretParametersForPatch", "MigrationStatus", - "MigrationSubStateDetails", - "NameAvailability", + "MigrationSubstateDetails", + "NameAvailabilityModel", "NameProperty", "Network", + "ObjectRecommendation", + "ObjectRecommendationDetails", + "ObjectRecommendationList", + "ObjectRecommendationPropertiesAnalyzedWorkload", + "ObjectRecommendationPropertiesImplementationDetails", "Operation", "OperationDisplay", - "OperationListResult", + "OperationList", "PrivateEndpoint", "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", + "PrivateEndpointConnectionList", "PrivateLinkResource", - "PrivateLinkResourceListResult", + "PrivateLinkResourceList", "PrivateLinkServiceConnectionState", "ProxyResource", "QuotaUsage", - "QuotaUsagesListResult", + "QuotaUsageList", "Replica", "Resource", "RestartParameter", "Server", - "ServerBackup", - "ServerBackupListResult", - "ServerForUpdate", - "ServerListResult", + "ServerEditionCapability", + "ServerForPatch", + "ServerList", "ServerSku", "ServerSkuCapability", - "ServerThreatProtectionListResult", - "ServerThreatProtectionSettingsModel", "ServerVersionCapability", - "SessionDetailsListResult", - "SessionDetailsResource", - "SessionResource", - "SessionsListResult", "Sku", + "SkuForPatch", "Storage", "StorageEditionCapability", "StorageMbCapability", @@ -291,82 +294,81 @@ "SupportedFeature", "SystemData", "TrackedResource", - "TuningOptionsListResult", - "TuningOptionsResource", + "TuningOptions", + "TuningOptionsList", "UserAssignedIdentity", "UserIdentity", "ValidationDetails", "ValidationMessage", "ValidationSummaryItem", - "VirtualEndpointResource", + "VirtualEndpoint", "VirtualEndpointResourceForPatch", - "VirtualEndpointsListResult", + "VirtualEndpointsList", + "VirtualNetworkSubnetUsageModel", "VirtualNetworkSubnetUsageParameter", - "VirtualNetworkSubnetUsageResult", - "ActiveDirectoryAuthEnum", - "ArmServerKeyType", - "AzureManagedDiskPerformanceTiers", - "CancelEnum", + "AzureManagedDiskPerformanceTier", + "BackupType", + "Cancel", "CapabilityStatus", "CheckNameAvailabilityReason", "ConfigurationDataType", "CreateMode", - "CreateModeForUpdate", + "CreateModeForPatch", "CreatedByType", + "DataEncryptionType", + "EncryptionKeyStatus", "ExecutionStatus", "FailoverMode", - "FastProvisioningSupportedEnum", - "GeoBackupSupportedEnum", - "GeoRedundantBackupEnum", - "HaMode", + "FastProvisioningSupport", + "FeatureStatus", + "GeographicallyRedundantBackup", + "GeographicallyRedundantBackupSupport", "HighAvailabilityMode", + "HighAvailabilityState", "IdentityType", - "KeyStatusEnum", - "LogicalReplicationOnSourceDbEnum", - "MigrateRolesEnum", - "MigrationDbState", + "LocationRestricted", + "LogicalReplicationOnSourceServer", + "MicrosoftEntraAuth", + "MigrateRolesAndPermissions", + "MigrationDatabaseState", "MigrationDetailsLevel", "MigrationListFilter", "MigrationMode", "MigrationNameAvailabilityReason", "MigrationOption", "MigrationState", - "MigrationSubState", - "OnlineResizeSupportedEnum", + "MigrationSubstate", + "OnlineStorageResizeSupport", "OperationOrigin", - "Origin", - "OverwriteDbsInTargetEnum", - "PasswordAuthEnum", + "OverwriteDatabasesOnTargetServer", + "PasswordBasedAuth", + "PostgresMajorVersion", "PrincipalType", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", "ReadReplicaPromoteMode", - "RecommendationType", + "ReadReplicaPromoteOption", "RecommendationTypeEnum", - "ReplicationPromoteOption", + "RecommendationTypeParameterEnum", "ReplicationRole", "ReplicationState", - "RestrictedEnum", - "ServerHAState", "ServerPublicNetworkAccessState", "ServerState", - "ServerVersion", "SkuTier", "SourceType", "SslMode", - "StartDataMigrationEnum", + "StartDataMigration", "StorageAutoGrow", - "StorageAutoGrowthSupportedEnum", + "StorageAutoGrowthSupport", "StorageType", - "SupportedFeatureStatusEnum", "ThreatProtectionName", "ThreatProtectionState", - "TriggerCutoverEnum", - "TuningOptionEnum", + "TriggerCutover", + "TuningOptionParameterEnum", "ValidationState", "VirtualEndpointType", - "ZoneRedundantHaAndGeoBackupSupportedEnum", - "ZoneRedundantHaSupportedEnum", + "ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport", + "ZoneRedundantHighAvailabilitySupport", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/_models_py3.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/_models_py3.py index 6cca63fe5a04..ac19d04e63cd 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/_models_py3.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/_models_py3.py @@ -7,13 +7,80 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Optional, TYPE_CHECKING, Union from .._utils import serialization as _serialization if TYPE_CHECKING: from .. import models as _models +JSON = MutableMapping[str, Any] + + +class AdminCredentials(_serialization.Model): + """Credentials of administrator users for source and target servers. + + All required parameters must be populated in order to send to server. + + :ivar source_server_password: Password for the user of the source server. Required. + :vartype source_server_password: str + :ivar target_server_password: Password for the user of the target server. Required. + :vartype target_server_password: str + """ + + _validation = { + "source_server_password": {"required": True}, + "target_server_password": {"required": True}, + } + + _attribute_map = { + "source_server_password": {"key": "sourceServerPassword", "type": "str"}, + "target_server_password": {"key": "targetServerPassword", "type": "str"}, + } + + def __init__(self, *, source_server_password: str, target_server_password: str, **kwargs: Any) -> None: + """ + :keyword source_server_password: Password for the user of the source server. Required. + :paramtype source_server_password: str + :keyword target_server_password: Password for the user of the target server. Required. + :paramtype target_server_password: str + """ + super().__init__(**kwargs) + self.source_server_password = source_server_password + self.target_server_password = target_server_password + + +class AdminCredentialsForPatch(_serialization.Model): + """Credentials of administrator users for source and target servers. + + :ivar source_server_password: Password for the user of the source server. + :vartype source_server_password: str + :ivar target_server_password: Password for the user of the target server. + :vartype target_server_password: str + """ + + _attribute_map = { + "source_server_password": {"key": "sourceServerPassword", "type": "str"}, + "target_server_password": {"key": "targetServerPassword", "type": "str"}, + } + + def __init__( + self, + *, + source_server_password: Optional[str] = None, + target_server_password: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword source_server_password: Password for the user of the source server. + :paramtype source_server_password: str + :keyword target_server_password: Password for the user of the target server. + :paramtype target_server_password: str + """ + super().__init__(**kwargs) + self.source_server_password = source_server_password + self.target_server_password = target_server_password class Resource(_serialization.Model): @@ -77,8 +144,8 @@ class ProxyResource(Resource): """ -class ActiveDirectoryAdministrator(ProxyResource): - """Represents an Microsoft Entra Administrator. +class AdministratorMicrosoftEntra(ProxyResource): + """Server administrator associated to a Microsoft Entra principal. Variables are only populated by the server, and will be ignored when sending a request. @@ -93,14 +160,14 @@ class ActiveDirectoryAdministrator(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - :ivar principal_type: The principal type used to represent the type of Microsoft Entra - Administrator. Known values are: "Unknown", "User", "Group", and "ServicePrincipal". + :ivar principal_type: Type of Microsoft Entra principal to which the server administrator is + associated. Known values are: "Unknown", "User", "Group", and "ServicePrincipal". :vartype principal_type: str or ~azure.mgmt.postgresqlflexibleservers.models.PrincipalType - :ivar principal_name: Microsoft Entra Administrator principal name. + :ivar principal_name: Name of the Microsoft Entra principal. :vartype principal_name: str - :ivar object_id: The objectId of the Microsoft Entra Administrator. + :ivar object_id: Object identifier of the Microsoft Entra principal. :vartype object_id: str - :ivar tenant_id: The tenantId of the Microsoft Entra Administrator. + :ivar tenant_id: Identifier of the tenant in which the Microsoft Entra principal exists. :vartype tenant_id: str """ @@ -132,14 +199,14 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword principal_type: The principal type used to represent the type of Microsoft Entra - Administrator. Known values are: "Unknown", "User", "Group", and "ServicePrincipal". + :keyword principal_type: Type of Microsoft Entra principal to which the server administrator is + associated. Known values are: "Unknown", "User", "Group", and "ServicePrincipal". :paramtype principal_type: str or ~azure.mgmt.postgresqlflexibleservers.models.PrincipalType - :keyword principal_name: Microsoft Entra Administrator principal name. + :keyword principal_name: Name of the Microsoft Entra principal. :paramtype principal_name: str - :keyword object_id: The objectId of the Microsoft Entra Administrator. + :keyword object_id: Object identifier of the Microsoft Entra principal. :paramtype object_id: str - :keyword tenant_id: The tenantId of the Microsoft Entra Administrator. + :keyword tenant_id: Identifier of the tenant in which the Microsoft Entra principal exists. :paramtype tenant_id: str """ super().__init__(**kwargs) @@ -149,15 +216,15 @@ def __init__( self.tenant_id = tenant_id -class ActiveDirectoryAdministratorAdd(_serialization.Model): - """Represents an Microsoft Entra Administrator. +class AdministratorMicrosoftEntraAdd(_serialization.Model): + """Server administrator associated to a Microsoft Entra principal. - :ivar principal_type: The principal type used to represent the type of Microsoft Entra - Administrator. Known values are: "Unknown", "User", "Group", and "ServicePrincipal". + :ivar principal_type: Type of Microsoft Entra principal to which the server administrator is + associated. Known values are: "Unknown", "User", "Group", and "ServicePrincipal". :vartype principal_type: str or ~azure.mgmt.postgresqlflexibleservers.models.PrincipalType - :ivar principal_name: Microsoft Entra Administrator principal name. + :ivar principal_name: Name of the Microsoft Entra principal. :vartype principal_name: str - :ivar tenant_id: The tenantId of the Microsoft Entra Administrator. + :ivar tenant_id: Identifier of the tenant in which the Microsoft Entra principal exists. :vartype tenant_id: str """ @@ -176,12 +243,12 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword principal_type: The principal type used to represent the type of Microsoft Entra - Administrator. Known values are: "Unknown", "User", "Group", and "ServicePrincipal". + :keyword principal_type: Type of Microsoft Entra principal to which the server administrator is + associated. Known values are: "Unknown", "User", "Group", and "ServicePrincipal". :paramtype principal_type: str or ~azure.mgmt.postgresqlflexibleservers.models.PrincipalType - :keyword principal_name: Microsoft Entra Administrator principal name. + :keyword principal_name: Name of the Microsoft Entra principal. :paramtype principal_name: str - :keyword tenant_id: The tenantId of the Microsoft Entra Administrator. + :keyword tenant_id: Identifier of the tenant in which the Microsoft Entra principal exists. :paramtype tenant_id: str """ super().__init__(**kwargs) @@ -190,83 +257,179 @@ def __init__( self.tenant_id = tenant_id -class AdminCredentials(_serialization.Model): - """Server admin credentials. +class AdministratorMicrosoftEntraList(_serialization.Model): + """List of server administrators associated to Microsoft Entra principals. - All required parameters must be populated in order to send to server. + :ivar value: List of server administrators associated to Microsoft Entra principals. + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntra] + :ivar next_link: Link used to get the next page of results. + :vartype next_link: str + """ - :ivar source_server_password: Password for source server. Required. - :vartype source_server_password: str - :ivar target_server_password: Password for target server. Required. - :vartype target_server_password: str + _attribute_map = { + "value": {"key": "value", "type": "[AdministratorMicrosoftEntra]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[list["_models.AdministratorMicrosoftEntra"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of server administrators associated to Microsoft Entra principals. + :paramtype value: + list[~azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntra] + :keyword next_link: Link used to get the next page of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AdvancedThreatProtectionSettingsList(_serialization.Model): + """List of advanced threat protection settings for a server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of results. + :vartype value: + list[~azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsModel] + :ivar next_link: Link used to get the next page of results. + :vartype next_link: str """ _validation = { - "source_server_password": {"required": True}, - "target_server_password": {"required": True}, + "value": {"readonly": True}, } _attribute_map = { - "source_server_password": {"key": "sourceServerPassword", "type": "str"}, - "target_server_password": {"key": "targetServerPassword", "type": "str"}, + "value": {"key": "value", "type": "[AdvancedThreatProtectionSettingsModel]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, source_server_password: str, target_server_password: str, **kwargs: Any) -> None: + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword source_server_password: Password for source server. Required. - :paramtype source_server_password: str - :keyword target_server_password: Password for target server. Required. - :paramtype target_server_password: str + :keyword next_link: Link used to get the next page of results. + :paramtype next_link: str """ super().__init__(**kwargs) - self.source_server_password = source_server_password - self.target_server_password = target_server_password + self.value: Optional[list["_models.AdvancedThreatProtectionSettingsModel"]] = None + self.next_link = next_link -class AdministratorListResult(_serialization.Model): - """A list of Microsoft Entra Administrators. +class AdvancedThreatProtectionSettingsModel(ProxyResource): + """Advanced threat protection settings of the server. - :ivar value: The list of Microsoft Entra Administrators. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator] - :ivar next_link: The link used to get the next page of Microsoft Entra administrators. - :vartype next_link: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData + :ivar state: Specifies the state of the advanced threat protection, whether it is enabled, + disabled, or a state has not been applied yet on the server. Known values are: "Enabled" and + "Disabled". + :vartype state: str or ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionState + :ivar creation_time: Specifies the creation time (UTC) of the policy. + :vartype creation_time: ~datetime.datetime """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "creation_time": {"readonly": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[ActiveDirectoryAdministrator]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "state": {"key": "properties.state", "type": "str"}, + "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, + } + + def __init__(self, *, state: Optional[Union[str, "_models.ThreatProtectionState"]] = None, **kwargs: Any) -> None: + """ + :keyword state: Specifies the state of the advanced threat protection, whether it is enabled, + disabled, or a state has not been applied yet on the server. Known values are: "Enabled" and + "Disabled". + :paramtype state: str or ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionState + """ + super().__init__(**kwargs) + self.state = state + self.creation_time: Optional[datetime.datetime] = None + + +class AuthConfig(_serialization.Model): + """Authentication configuration properties of a server. + + :ivar active_directory_auth: Indicates if the server supports Microsoft Entra authentication. + Known values are: "Enabled" and "Disabled". + :vartype active_directory_auth: str or + ~azure.mgmt.postgresqlflexibleservers.models.MicrosoftEntraAuth + :ivar password_auth: Indicates if the server supports password based authentication. Known + values are: "Enabled" and "Disabled". + :vartype password_auth: str or ~azure.mgmt.postgresqlflexibleservers.models.PasswordBasedAuth + :ivar tenant_id: Identifier of the tenant of the delegated resource. + :vartype tenant_id: str + """ + + _attribute_map = { + "active_directory_auth": {"key": "activeDirectoryAuth", "type": "str"}, + "password_auth": {"key": "passwordAuth", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, } def __init__( self, *, - value: Optional[List["_models.ActiveDirectoryAdministrator"]] = None, - next_link: Optional[str] = None, + active_directory_auth: Optional[Union[str, "_models.MicrosoftEntraAuth"]] = None, + password_auth: Optional[Union[str, "_models.PasswordBasedAuth"]] = None, + tenant_id: str = "", **kwargs: Any ) -> None: """ - :keyword value: The list of Microsoft Entra Administrators. - :paramtype value: - list[~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator] - :keyword next_link: The link used to get the next page of Microsoft Entra administrators. - :paramtype next_link: str + :keyword active_directory_auth: Indicates if the server supports Microsoft Entra + authentication. Known values are: "Enabled" and "Disabled". + :paramtype active_directory_auth: str or + ~azure.mgmt.postgresqlflexibleservers.models.MicrosoftEntraAuth + :keyword password_auth: Indicates if the server supports password based authentication. Known + values are: "Enabled" and "Disabled". + :paramtype password_auth: str or ~azure.mgmt.postgresqlflexibleservers.models.PasswordBasedAuth + :keyword tenant_id: Identifier of the tenant of the delegated resource. + :paramtype tenant_id: str """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.active_directory_auth = active_directory_auth + self.password_auth = password_auth + self.tenant_id = tenant_id -class AuthConfig(_serialization.Model): +class AuthConfigForPatch(_serialization.Model): """Authentication configuration properties of a server. - :ivar active_directory_auth: If Enabled, Microsoft Entra authentication is enabled. Known - values are: "Enabled" and "Disabled". + :ivar active_directory_auth: Indicates if the server supports Microsoft Entra authentication. + Known values are: "Enabled" and "Disabled". :vartype active_directory_auth: str or - ~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAuthEnum - :ivar password_auth: If Enabled, Password authentication is enabled. Known values are: - "Enabled" and "Disabled". - :vartype password_auth: str or ~azure.mgmt.postgresqlflexibleservers.models.PasswordAuthEnum - :ivar tenant_id: Tenant id of the server. + ~azure.mgmt.postgresqlflexibleservers.models.MicrosoftEntraAuth + :ivar password_auth: Indicates if the server supports password based authentication. Known + values are: "Enabled" and "Disabled". + :vartype password_auth: str or ~azure.mgmt.postgresqlflexibleservers.models.PasswordBasedAuth + :ivar tenant_id: Identifier of the tenant of the delegated resource. :vartype tenant_id: str """ @@ -279,20 +442,20 @@ class AuthConfig(_serialization.Model): def __init__( self, *, - active_directory_auth: Optional[Union[str, "_models.ActiveDirectoryAuthEnum"]] = None, - password_auth: Union[str, "_models.PasswordAuthEnum"] = "Enabled", - tenant_id: str = "", + active_directory_auth: Optional[Union[str, "_models.MicrosoftEntraAuth"]] = None, + password_auth: Optional[Union[str, "_models.PasswordBasedAuth"]] = None, + tenant_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword active_directory_auth: If Enabled, Microsoft Entra authentication is enabled. Known - values are: "Enabled" and "Disabled". + :keyword active_directory_auth: Indicates if the server supports Microsoft Entra + authentication. Known values are: "Enabled" and "Disabled". :paramtype active_directory_auth: str or - ~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAuthEnum - :keyword password_auth: If Enabled, Password authentication is enabled. Known values are: - "Enabled" and "Disabled". - :paramtype password_auth: str or ~azure.mgmt.postgresqlflexibleservers.models.PasswordAuthEnum - :keyword tenant_id: Tenant id of the server. + ~azure.mgmt.postgresqlflexibleservers.models.MicrosoftEntraAuth + :keyword password_auth: Indicates if the server supports password based authentication. Known + values are: "Enabled" and "Disabled". + :paramtype password_auth: str or ~azure.mgmt.postgresqlflexibleservers.models.PasswordBasedAuth + :keyword tenant_id: Identifier of the tenant of the delegated resource. :paramtype tenant_id: str """ super().__init__(**kwargs) @@ -308,11 +471,11 @@ class Backup(_serialization.Model): :ivar backup_retention_days: Backup retention days for the server. :vartype backup_retention_days: int - :ivar geo_redundant_backup: A value indicating whether Geo-Redundant backup is enabled on the - server. Known values are: "Enabled" and "Disabled". + :ivar geo_redundant_backup: Indicates if the server is configured to create geographically + redundant backups. Known values are: "Enabled" and "Disabled". :vartype geo_redundant_backup: str or - ~azure.mgmt.postgresqlflexibleservers.models.GeoRedundantBackupEnum - :ivar earliest_restore_date: The earliest restore point time (ISO8601 format) for server. + ~azure.mgmt.postgresqlflexibleservers.models.GeographicallyRedundantBackup + :ivar earliest_restore_date: Earliest restore point time (ISO8601 format) for a server. :vartype earliest_restore_date: ~datetime.datetime """ @@ -330,16 +493,16 @@ def __init__( self, *, backup_retention_days: int = 7, - geo_redundant_backup: Union[str, "_models.GeoRedundantBackupEnum"] = "Disabled", + geo_redundant_backup: Optional[Union[str, "_models.GeographicallyRedundantBackup"]] = None, **kwargs: Any ) -> None: """ :keyword backup_retention_days: Backup retention days for the server. :paramtype backup_retention_days: int - :keyword geo_redundant_backup: A value indicating whether Geo-Redundant backup is enabled on - the server. Known values are: "Enabled" and "Disabled". + :keyword geo_redundant_backup: Indicates if the server is configured to create geographically + redundant backups. Known values are: "Enabled" and "Disabled". :paramtype geo_redundant_backup: str or - ~azure.mgmt.postgresqlflexibleservers.models.GeoRedundantBackupEnum + ~azure.mgmt.postgresqlflexibleservers.models.GeographicallyRedundantBackup """ super().__init__(**kwargs) self.backup_retention_days = backup_retention_days @@ -347,281 +510,201 @@ def __init__( self.earliest_restore_date: Optional[datetime.datetime] = None -class BackupRequestBase(_serialization.Model): - """BackupRequestBase is the base for all backup request. +class BackupAutomaticAndOnDemand(ProxyResource): + """Properties of a backup. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar backup_settings: Backup Settings. Required. - :vartype backup_settings: ~azure.mgmt.postgresqlflexibleservers.models.BackupSettings + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData + :ivar backup_type: Type of backup. Known values are: "Full" and "Customer On-Demand". + :vartype backup_type: str or ~azure.mgmt.postgresqlflexibleservers.models.BackupType + :ivar completed_time: Time(ISO8601 format) at which the backup was completed. + :vartype completed_time: ~datetime.datetime + :ivar source: Source of the backup. + :vartype source: str """ _validation = { - "backup_settings": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { - "backup_settings": {"key": "backupSettings", "type": "BackupSettings"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "backup_type": {"key": "properties.backupType", "type": "str"}, + "completed_time": {"key": "properties.completedTime", "type": "iso-8601"}, + "source": {"key": "properties.source", "type": "str"}, } - def __init__(self, *, backup_settings: "_models.BackupSettings", **kwargs: Any) -> None: + def __init__( + self, + *, + backup_type: Optional[Union[str, "_models.BackupType"]] = None, + completed_time: Optional[datetime.datetime] = None, + source: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword backup_settings: Backup Settings. Required. - :paramtype backup_settings: ~azure.mgmt.postgresqlflexibleservers.models.BackupSettings + :keyword backup_type: Type of backup. Known values are: "Full" and "Customer On-Demand". + :paramtype backup_type: str or ~azure.mgmt.postgresqlflexibleservers.models.BackupType + :keyword completed_time: Time(ISO8601 format) at which the backup was completed. + :paramtype completed_time: ~datetime.datetime + :keyword source: Source of the backup. + :paramtype source: str """ super().__init__(**kwargs) - self.backup_settings = backup_settings - + self.backup_type = backup_type + self.completed_time = completed_time + self.source = source -class BackupSettings(_serialization.Model): - """The settings for the long term backup. - All required parameters must be populated in order to send to server. +class BackupAutomaticAndOnDemandList(_serialization.Model): + """List of backups. - :ivar backup_name: Backup Name for the current backup. Required. - :vartype backup_name: str + :ivar value: List of available backups. + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.BackupAutomaticAndOnDemand] + :ivar next_link: Link used to get the next page of results. + :vartype next_link: str """ - _validation = { - "backup_name": {"required": True}, - } - _attribute_map = { - "backup_name": {"key": "backupName", "type": "str"}, + "value": {"key": "value", "type": "[BackupAutomaticAndOnDemand]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, backup_name: str, **kwargs: Any) -> None: + def __init__( + self, + *, + value: Optional[list["_models.BackupAutomaticAndOnDemand"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword backup_name: Backup Name for the current backup. Required. - :paramtype backup_name: str + :keyword value: List of available backups. + :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.BackupAutomaticAndOnDemand] + :keyword next_link: Link used to get the next page of results. + :paramtype next_link: str """ super().__init__(**kwargs) - self.backup_name = backup_name + self.value = value + self.next_link = next_link -class BackupStoreDetails(_serialization.Model): - """Details about the target where the backup content will be stored. +class BackupForPatch(_serialization.Model): + """Backup properties of a server. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar sas_uri_list: List of SAS uri of storage containers where backup data is to be - streamed/copied. Required. - :vartype sas_uri_list: list[str] - """ + :ivar backup_retention_days: Backup retention days for the server. + :vartype backup_retention_days: int + :ivar geo_redundant_backup: Indicates if the server is configured to create geographically + redundant backups. Known values are: "Enabled" and "Disabled". + :vartype geo_redundant_backup: str or + ~azure.mgmt.postgresqlflexibleservers.models.GeographicallyRedundantBackup + :ivar earliest_restore_date: Earliest restore point time (ISO8601 format) for a server. + :vartype earliest_restore_date: ~datetime.datetime + """ _validation = { - "sas_uri_list": {"required": True}, + "earliest_restore_date": {"readonly": True}, } _attribute_map = { - "sas_uri_list": {"key": "sasUriList", "type": "[str]"}, + "backup_retention_days": {"key": "backupRetentionDays", "type": "int"}, + "geo_redundant_backup": {"key": "geoRedundantBackup", "type": "str"}, + "earliest_restore_date": {"key": "earliestRestoreDate", "type": "iso-8601"}, } - def __init__(self, *, sas_uri_list: List[str], **kwargs: Any) -> None: + def __init__( + self, + *, + backup_retention_days: Optional[int] = None, + geo_redundant_backup: Optional[Union[str, "_models.GeographicallyRedundantBackup"]] = None, + **kwargs: Any + ) -> None: """ - :keyword sas_uri_list: List of SAS uri of storage containers where backup data is to be - streamed/copied. Required. - :paramtype sas_uri_list: list[str] + :keyword backup_retention_days: Backup retention days for the server. + :paramtype backup_retention_days: int + :keyword geo_redundant_backup: Indicates if the server is configured to create geographically + redundant backups. Known values are: "Enabled" and "Disabled". + :paramtype geo_redundant_backup: str or + ~azure.mgmt.postgresqlflexibleservers.models.GeographicallyRedundantBackup """ super().__init__(**kwargs) - self.sas_uri_list = sas_uri_list - - -class CapabilitiesListResult(_serialization.Model): - """Capability for the PostgreSQL server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: A list of supported capabilities. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.FlexibleServerCapability] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FlexibleServerCapability]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.FlexibleServerCapability"]] = None - self.next_link: Optional[str] = None + self.backup_retention_days = backup_retention_days + self.geo_redundant_backup = geo_redundant_backup + self.earliest_restore_date: Optional[datetime.datetime] = None -class CapabilityBase(_serialization.Model): - """Base object for representing capability. +class BackupRequestBase(_serialization.Model): + """BackupRequestBase is the base for all backup request. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to server. - :ivar status: The status of the capability. Known values are: "Visible", "Available", - "Default", and "Disabled". - :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus - :ivar reason: The reason for the capability not being available. - :vartype reason: str + :ivar backup_settings: Backup Settings. Required. + :vartype backup_settings: ~azure.mgmt.postgresqlflexibleservers.models.BackupSettings """ _validation = { - "status": {"readonly": True}, - "reason": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, + "backup_settings": {"required": True}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status: Optional[Union[str, "_models.CapabilityStatus"]] = None - self.reason: Optional[str] = None - - -class CheckNameAvailabilityRequest(_serialization.Model): - """The check availability request body. - - :ivar name: The name of the resource for which availability needs to be checked. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - """ - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "backup_settings": {"key": "backupSettings", "type": "BackupSettings"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, backup_settings: "_models.BackupSettings", **kwargs: Any) -> None: """ - :keyword name: The name of the resource for which availability needs to be checked. - :paramtype name: str - :keyword type: The resource type. - :paramtype type: str + :keyword backup_settings: Backup Settings. Required. + :paramtype backup_settings: ~azure.mgmt.postgresqlflexibleservers.models.BackupSettings """ super().__init__(**kwargs) - self.name = name - self.type = type - - -class CheckNameAvailabilityResponse(_serialization.Model): - """The check availability result. - - :ivar name_available: Indicates if the resource name is available. - :vartype name_available: bool - :ivar reason: The reason why the given name is not available. Known values are: "Invalid" and - "AlreadyExists". - :vartype reason: str or - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityReason - :ivar message: Detailed reason why the given name is available. - :vartype message: str - """ - - _attribute_map = { - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } + self.backup_settings = backup_settings - def __init__( - self, - *, - name_available: Optional[bool] = None, - reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = None, - message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name_available: Indicates if the resource name is available. - :paramtype name_available: bool - :keyword reason: The reason why the given name is not available. Known values are: "Invalid" - and "AlreadyExists". - :paramtype reason: str or - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityReason - :keyword message: Detailed reason why the given name is available. - :paramtype message: str - """ - super().__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message +class BackupSettings(_serialization.Model): + """The settings for the long term backup. -class Cluster(_serialization.Model): - """Cluster properties of a server. + All required parameters must be populated in order to send to server. - :ivar cluster_size: The node count for the cluster. - :vartype cluster_size: int + :ivar backup_name: Backup Name for the current backup. Required. + :vartype backup_name: str """ - _attribute_map = { - "cluster_size": {"key": "clusterSize", "type": "int"}, + _validation = { + "backup_name": {"required": True}, } - def __init__(self, *, cluster_size: int = 0, **kwargs: Any) -> None: - """ - :keyword cluster_size: The node count for the cluster. - :paramtype cluster_size: int - """ - super().__init__(**kwargs) - self.cluster_size = cluster_size - - -class ConfigTuningRequestParameter(_serialization.Model): - """Config tuning request parameters. - - :ivar server_name: The name of server. - :vartype server_name: str - :ivar allow_server_restarts: Indicates whether PG should be restarted during a tuning session. - :vartype allow_server_restarts: bool - :ivar target_improvement_metric: The target metric the tuning session is trying to improve. - :vartype target_improvement_metric: str - :ivar config_tuning_usage_mode: The mode with which the feature will be enabled. - :vartype config_tuning_usage_mode: bool - """ - _attribute_map = { - "server_name": {"key": "serverName", "type": "str"}, - "allow_server_restarts": {"key": "allowServerRestarts", "type": "bool"}, - "target_improvement_metric": {"key": "targetImprovementMetric", "type": "str"}, - "config_tuning_usage_mode": {"key": "configTuningUsageMode", "type": "bool"}, + "backup_name": {"key": "backupName", "type": "str"}, } - def __init__( - self, - *, - server_name: Optional[str] = None, - allow_server_restarts: Optional[bool] = None, - target_improvement_metric: Optional[str] = None, - config_tuning_usage_mode: Optional[bool] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, backup_name: str, **kwargs: Any) -> None: """ - :keyword server_name: The name of server. - :paramtype server_name: str - :keyword allow_server_restarts: Indicates whether PG should be restarted during a tuning - session. - :paramtype allow_server_restarts: bool - :keyword target_improvement_metric: The target metric the tuning session is trying to improve. - :paramtype target_improvement_metric: str - :keyword config_tuning_usage_mode: The mode with which the feature will be enabled. - :paramtype config_tuning_usage_mode: bool + :keyword backup_name: Backup Name for the current backup. Required. + :paramtype backup_name: str """ super().__init__(**kwargs) - self.server_name = server_name - self.allow_server_restarts = allow_server_restarts - self.target_improvement_metric = target_improvement_metric - self.config_tuning_usage_mode = config_tuning_usage_mode + self.backup_name = backup_name -class Configuration(ProxyResource): - """Represents a Configuration. +class BackupsLongTermRetentionOperation(ProxyResource): + """Response for the LTR backup Operation API call. Variables are only populated by the server, and will be ignored when sending a request. @@ -636,29 +719,28 @@ class Configuration(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - :ivar value: Value of the configuration. Required to update the configuration. - :vartype value: str - :ivar description: Description of the configuration. - :vartype description: str - :ivar default_value: Default value of the configuration. - :vartype default_value: str - :ivar data_type: Data type of the configuration. Known values are: "Boolean", "Numeric", - "Integer", and "Enumeration". - :vartype data_type: str or ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationDataType - :ivar allowed_values: Allowed values of the configuration. - :vartype allowed_values: str - :ivar source: Source of the configuration. Required to update the configuration. - :vartype source: str - :ivar is_dynamic_config: Configuration dynamic or static. - :vartype is_dynamic_config: bool - :ivar is_read_only: Configuration read-only or not. - :vartype is_read_only: bool - :ivar is_config_pending_restart: Configuration is pending restart or not. - :vartype is_config_pending_restart: bool - :ivar unit: Configuration unit. - :vartype unit: str - :ivar documentation_link: Configuration documentation link. - :vartype documentation_link: str + :ivar datasource_size_in_bytes: Size of datasource in bytes. + :vartype datasource_size_in_bytes: int + :ivar data_transferred_in_bytes: Data transferred in bytes. + :vartype data_transferred_in_bytes: int + :ivar backup_name: Name of Backup operation. + :vartype backup_name: str + :ivar backup_metadata: Metadata to be stored in RP. Store everything that will be required to + perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc. + :vartype backup_metadata: str + :ivar status: Service-set extensible enum indicating the status of operation. Known values are: + "Running", "Cancelled", "Failed", and "Succeeded". + :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.ExecutionStatus + :ivar start_time: Start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of the operation. + :vartype end_time: ~datetime.datetime + :ivar percent_complete: PercentageCompleted. + :vartype percent_complete: float + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str """ _validation = { @@ -666,15 +748,9 @@ class Configuration(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "description": {"readonly": True}, - "default_value": {"readonly": True}, - "data_type": {"readonly": True}, - "allowed_values": {"readonly": True}, - "is_dynamic_config": {"readonly": True}, - "is_read_only": {"readonly": True}, - "is_config_pending_restart": {"readonly": True}, - "unit": {"readonly": True}, - "documentation_link": {"readonly": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + "error_code": {"readonly": True}, + "error_message": {"readonly": True}, } _attribute_map = { @@ -682,147 +758,412 @@ class Configuration(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "value": {"key": "properties.value", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "default_value": {"key": "properties.defaultValue", "type": "str"}, - "data_type": {"key": "properties.dataType", "type": "str"}, - "allowed_values": {"key": "properties.allowedValues", "type": "str"}, - "source": {"key": "properties.source", "type": "str"}, - "is_dynamic_config": {"key": "properties.isDynamicConfig", "type": "bool"}, - "is_read_only": {"key": "properties.isReadOnly", "type": "bool"}, - "is_config_pending_restart": {"key": "properties.isConfigPendingRestart", "type": "bool"}, - "unit": {"key": "properties.unit", "type": "str"}, - "documentation_link": {"key": "properties.documentationLink", "type": "str"}, + "datasource_size_in_bytes": {"key": "properties.datasourceSizeInBytes", "type": "int"}, + "data_transferred_in_bytes": {"key": "properties.dataTransferredInBytes", "type": "int"}, + "backup_name": {"key": "properties.backupName", "type": "str"}, + "backup_metadata": {"key": "properties.backupMetadata", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "end_time": {"key": "properties.endTime", "type": "iso-8601"}, + "percent_complete": {"key": "properties.percentComplete", "type": "float"}, + "error_code": {"key": "properties.errorCode", "type": "str"}, + "error_message": {"key": "properties.errorMessage", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, source: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + datasource_size_in_bytes: Optional[int] = None, + data_transferred_in_bytes: Optional[int] = None, + backup_name: Optional[str] = None, + backup_metadata: Optional[str] = None, + status: Optional[Union[str, "_models.ExecutionStatus"]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + percent_complete: Optional[float] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Value of the configuration. Required to update the configuration. - :paramtype value: str - :keyword source: Source of the configuration. Required to update the configuration. - :paramtype source: str + :keyword datasource_size_in_bytes: Size of datasource in bytes. + :paramtype datasource_size_in_bytes: int + :keyword data_transferred_in_bytes: Data transferred in bytes. + :paramtype data_transferred_in_bytes: int + :keyword backup_name: Name of Backup operation. + :paramtype backup_name: str + :keyword backup_metadata: Metadata to be stored in RP. Store everything that will be required + to perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc. + :paramtype backup_metadata: str + :keyword status: Service-set extensible enum indicating the status of operation. Known values + are: "Running", "Cancelled", "Failed", and "Succeeded". + :paramtype status: str or ~azure.mgmt.postgresqlflexibleservers.models.ExecutionStatus + :keyword start_time: Start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: End time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword percent_complete: PercentageCompleted. + :paramtype percent_complete: float """ super().__init__(**kwargs) - self.value = value - self.description: Optional[str] = None - self.default_value: Optional[str] = None - self.data_type: Optional[Union[str, "_models.ConfigurationDataType"]] = None - self.allowed_values: Optional[str] = None - self.source = source - self.is_dynamic_config: Optional[bool] = None - self.is_read_only: Optional[bool] = None - self.is_config_pending_restart: Optional[bool] = None - self.unit: Optional[str] = None - self.documentation_link: Optional[str] = None + self.datasource_size_in_bytes = datasource_size_in_bytes + self.data_transferred_in_bytes = data_transferred_in_bytes + self.backup_name = backup_name + self.backup_metadata = backup_metadata + self.status = status + self.start_time = start_time + self.end_time = end_time + self.percent_complete = percent_complete + self.error_code: Optional[str] = None + self.error_message: Optional[str] = None -class ConfigurationForUpdate(_serialization.Model): - """Represents a Configuration. +class BackupsLongTermRetentionRequest(BackupRequestBase): + """The request that is made for a long term retention backup. + + All required parameters must be populated in order to send to server. + + :ivar backup_settings: Backup Settings. Required. + :vartype backup_settings: ~azure.mgmt.postgresqlflexibleservers.models.BackupSettings + :ivar target_details: Backup store detail for target server. Required. + :vartype target_details: ~azure.mgmt.postgresqlflexibleservers.models.BackupStoreDetails + """ + + _validation = { + "backup_settings": {"required": True}, + "target_details": {"required": True}, + } + + _attribute_map = { + "backup_settings": {"key": "backupSettings", "type": "BackupSettings"}, + "target_details": {"key": "targetDetails", "type": "BackupStoreDetails"}, + } + + def __init__( + self, *, backup_settings: "_models.BackupSettings", target_details: "_models.BackupStoreDetails", **kwargs: Any + ) -> None: + """ + :keyword backup_settings: Backup Settings. Required. + :paramtype backup_settings: ~azure.mgmt.postgresqlflexibleservers.models.BackupSettings + :keyword target_details: Backup store detail for target server. Required. + :paramtype target_details: ~azure.mgmt.postgresqlflexibleservers.models.BackupStoreDetails + """ + super().__init__(backup_settings=backup_settings, **kwargs) + self.target_details = target_details + + +class BackupsLongTermRetentionResponse(_serialization.Model): + """Response for the LTR backup API call. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Value of the configuration. Required to update the configuration. - :vartype value: str - :ivar description: Description of the configuration. - :vartype description: str - :ivar default_value: Default value of the configuration. - :vartype default_value: str - :ivar data_type: Data type of the configuration. Known values are: "Boolean", "Numeric", - "Integer", and "Enumeration". - :vartype data_type: str or ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationDataType - :ivar allowed_values: Allowed values of the configuration. - :vartype allowed_values: str - :ivar source: Source of the configuration. Required to update the configuration. - :vartype source: str - :ivar is_dynamic_config: Configuration dynamic or static. - :vartype is_dynamic_config: bool - :ivar is_read_only: Configuration read-only or not. - :vartype is_read_only: bool - :ivar is_config_pending_restart: Configuration is pending restart or not. - :vartype is_config_pending_restart: bool - :ivar unit: Configuration unit. - :vartype unit: str - :ivar documentation_link: Configuration documentation link. - :vartype documentation_link: str + :ivar datasource_size_in_bytes: Size of datasource in bytes. + :vartype datasource_size_in_bytes: int + :ivar data_transferred_in_bytes: Data transferred in bytes. + :vartype data_transferred_in_bytes: int + :ivar backup_name: Name of Backup operation. + :vartype backup_name: str + :ivar backup_metadata: Metadata to be stored in RP. Store everything that will be required to + perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc. + :vartype backup_metadata: str + :ivar status: Service-set extensible enum indicating the status of operation. Known values are: + "Running", "Cancelled", "Failed", and "Succeeded". + :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.ExecutionStatus + :ivar start_time: Start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of the operation. + :vartype end_time: ~datetime.datetime + :ivar percent_complete: PercentageCompleted. + :vartype percent_complete: float + :ivar error_code: The error code. + :vartype error_code: str + :ivar error_message: The error message. + :vartype error_message: str """ _validation = { - "description": {"readonly": True}, - "default_value": {"readonly": True}, - "data_type": {"readonly": True}, - "allowed_values": {"readonly": True}, - "is_dynamic_config": {"readonly": True}, - "is_read_only": {"readonly": True}, - "is_config_pending_restart": {"readonly": True}, - "unit": {"readonly": True}, - "documentation_link": {"readonly": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + "error_code": {"readonly": True}, + "error_message": {"readonly": True}, } _attribute_map = { - "value": {"key": "properties.value", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "default_value": {"key": "properties.defaultValue", "type": "str"}, - "data_type": {"key": "properties.dataType", "type": "str"}, - "allowed_values": {"key": "properties.allowedValues", "type": "str"}, - "source": {"key": "properties.source", "type": "str"}, - "is_dynamic_config": {"key": "properties.isDynamicConfig", "type": "bool"}, - "is_read_only": {"key": "properties.isReadOnly", "type": "bool"}, - "is_config_pending_restart": {"key": "properties.isConfigPendingRestart", "type": "bool"}, - "unit": {"key": "properties.unit", "type": "str"}, - "documentation_link": {"key": "properties.documentationLink", "type": "str"}, + "datasource_size_in_bytes": {"key": "properties.datasourceSizeInBytes", "type": "int"}, + "data_transferred_in_bytes": {"key": "properties.dataTransferredInBytes", "type": "int"}, + "backup_name": {"key": "properties.backupName", "type": "str"}, + "backup_metadata": {"key": "properties.backupMetadata", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "start_time": {"key": "properties.startTime", "type": "iso-8601"}, + "end_time": {"key": "properties.endTime", "type": "iso-8601"}, + "percent_complete": {"key": "properties.percentComplete", "type": "float"}, + "error_code": {"key": "properties.errorCode", "type": "str"}, + "error_message": {"key": "properties.errorMessage", "type": "str"}, } - def __init__(self, *, value: Optional[str] = None, source: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + datasource_size_in_bytes: Optional[int] = None, + data_transferred_in_bytes: Optional[int] = None, + backup_name: Optional[str] = None, + backup_metadata: Optional[str] = None, + status: Optional[Union[str, "_models.ExecutionStatus"]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + percent_complete: Optional[float] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Value of the configuration. Required to update the configuration. - :paramtype value: str - :keyword source: Source of the configuration. Required to update the configuration. - :paramtype source: str + :keyword datasource_size_in_bytes: Size of datasource in bytes. + :paramtype datasource_size_in_bytes: int + :keyword data_transferred_in_bytes: Data transferred in bytes. + :paramtype data_transferred_in_bytes: int + :keyword backup_name: Name of Backup operation. + :paramtype backup_name: str + :keyword backup_metadata: Metadata to be stored in RP. Store everything that will be required + to perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc. + :paramtype backup_metadata: str + :keyword status: Service-set extensible enum indicating the status of operation. Known values + are: "Running", "Cancelled", "Failed", and "Succeeded". + :paramtype status: str or ~azure.mgmt.postgresqlflexibleservers.models.ExecutionStatus + :keyword start_time: Start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: End time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword percent_complete: PercentageCompleted. + :paramtype percent_complete: float """ super().__init__(**kwargs) - self.value = value - self.description: Optional[str] = None - self.default_value: Optional[str] = None - self.data_type: Optional[Union[str, "_models.ConfigurationDataType"]] = None - self.allowed_values: Optional[str] = None - self.source = source - self.is_dynamic_config: Optional[bool] = None - self.is_read_only: Optional[bool] = None - self.is_config_pending_restart: Optional[bool] = None - self.unit: Optional[str] = None - self.documentation_link: Optional[str] = None + self.datasource_size_in_bytes = datasource_size_in_bytes + self.data_transferred_in_bytes = data_transferred_in_bytes + self.backup_name = backup_name + self.backup_metadata = backup_metadata + self.status = status + self.start_time = start_time + self.end_time = end_time + self.percent_complete = percent_complete + self.error_code: Optional[str] = None + self.error_message: Optional[str] = None + +class BackupStoreDetails(_serialization.Model): + """Details about the target where the backup content will be stored. -class ConfigurationListResult(_serialization.Model): - """A list of server configurations. + All required parameters must be populated in order to send to server. - :ivar value: The list of server configurations. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.Configuration] - :ivar next_link: The link used to get the next page of operations. + :ivar sas_uri_list: List of SAS uri of storage containers where backup data is to be + streamed/copied. Required. + :vartype sas_uri_list: list[str] + """ + + _validation = { + "sas_uri_list": {"required": True}, + } + + _attribute_map = { + "sas_uri_list": {"key": "sasUriList", "type": "[str]"}, + } + + def __init__(self, *, sas_uri_list: list[str], **kwargs: Any) -> None: + """ + :keyword sas_uri_list: List of SAS uri of storage containers where backup data is to be + streamed/copied. Required. + :paramtype sas_uri_list: list[str] + """ + super().__init__(**kwargs) + self.sas_uri_list = sas_uri_list + + +class CapabilityBase(_serialization.Model): + """Base object for representing capability. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the capability. Known values are: "Visible", "Available", + "Default", and "Disabled". + :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus + :ivar reason: The reason for the capability not being available. + :vartype reason: str + """ + + _validation = { + "status": {"readonly": True}, + "reason": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.status: Optional[Union[str, "_models.CapabilityStatus"]] = None + self.reason: Optional[str] = None + + +class Capability(CapabilityBase): + """Capability for the Azure Database for PostgreSQL flexible server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the capability. Known values are: "Visible", "Available", + "Default", and "Disabled". + :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus + :ivar reason: The reason for the capability not being available. + :vartype reason: str + :ivar name: Name of flexible servers capabilities. + :vartype name: str + :ivar supported_server_editions: List of supported compute tiers. + :vartype supported_server_editions: + list[~azure.mgmt.postgresqlflexibleservers.models.ServerEditionCapability] + :ivar supported_server_versions: List of supported major versions of PostgreSQL database + engine. + :vartype supported_server_versions: + list[~azure.mgmt.postgresqlflexibleservers.models.ServerVersionCapability] + :ivar supported_features: Features supported. + :vartype supported_features: + list[~azure.mgmt.postgresqlflexibleservers.models.SupportedFeature] + :ivar fast_provisioning_supported: Indicates if fast provisioning is supported. 'Enabled' means + fast provisioning is supported. 'Disabled' stands for fast provisioning is not supported. Will + be deprecated in the future. Look to Supported Features for 'FastProvisioning'. Known values + are: "Enabled" and "Disabled". + :vartype fast_provisioning_supported: str or + ~azure.mgmt.postgresqlflexibleservers.models.FastProvisioningSupport + :ivar supported_fast_provisioning_editions: List of compute tiers supporting fast provisioning. + :vartype supported_fast_provisioning_editions: + list[~azure.mgmt.postgresqlflexibleservers.models.FastProvisioningEditionCapability] + :ivar geo_backup_supported: Indicates if geographically redundant backups are supported in this + location. 'Enabled' means geographically redundant backups are supported. 'Disabled' stands for + geographically redundant backup is not supported. Will be deprecated in the future. Look to + Supported Features for 'GeoBackup'. Known values are: "Enabled" and "Disabled". + :vartype geo_backup_supported: str or + ~azure.mgmt.postgresqlflexibleservers.models.GeographicallyRedundantBackupSupport + :ivar zone_redundant_ha_supported: Indicates if high availability with zone redundancy is + supported in this location. 'Enabled' means high availability with zone redundancy is + supported. 'Disabled' stands for high availability with zone redundancy is not supported. Will + be deprecated in the future. Look to Supported Features for 'ZoneRedundantHa'. Known values + are: "Enabled" and "Disabled". + :vartype zone_redundant_ha_supported: str or + ~azure.mgmt.postgresqlflexibleservers.models.ZoneRedundantHighAvailabilitySupport + :ivar zone_redundant_ha_and_geo_backup_supported: Indicates if high availability with zone + redundancy is supported in conjunction with geographically redundant backups in this location. + 'Enabled' means high availability with zone redundancy is supported in conjunction with + geographically redundant backups is supported. 'Disabled' stands for high availability with + zone redundancy is supported in conjunction with geographically redundant backups is not + supported. Will be deprecated in the future. Look to Supported Features for + 'ZoneRedundantHaAndGeoBackup'. Known values are: "Enabled" and "Disabled". + :vartype zone_redundant_ha_and_geo_backup_supported: str or + ~azure.mgmt.postgresqlflexibleservers.models.ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport + :ivar storage_auto_growth_supported: Indicates if storage autogrow is supported in this + location. 'Enabled' means storage autogrow is supported. 'Disabled' stands for storage autogrow + is not supported. Will be deprecated in the future. Look to Supported Features for + 'StorageAutoGrowth'. Known values are: "Enabled" and "Disabled". + :vartype storage_auto_growth_supported: str or + ~azure.mgmt.postgresqlflexibleservers.models.StorageAutoGrowthSupport + :ivar online_resize_supported: Indicates if resizing the storage, without interrupting the + operation of the database engine, is supported in this location for the given subscription. + 'Enabled' means resizing the storage without interrupting the operation of the database engine + is supported. 'Disabled' means resizing the storage without interrupting the operation of the + database engine is not supported. Will be deprecated in the future. Look to Supported Features + for 'OnlineResize'. Known values are: "Enabled" and "Disabled". + :vartype online_resize_supported: str or + ~azure.mgmt.postgresqlflexibleservers.models.OnlineStorageResizeSupport + :ivar restricted: Indicates if this location is restricted. 'Enabled' means location is + restricted. 'Disabled' stands for location is not restricted. Will be deprecated in the future. + Look to Supported Features for 'Restricted'. Known values are: "Enabled" and "Disabled". + :vartype restricted: str or ~azure.mgmt.postgresqlflexibleservers.models.LocationRestricted + """ + + _validation = { + "status": {"readonly": True}, + "reason": {"readonly": True}, + "supported_server_editions": {"readonly": True}, + "supported_server_versions": {"readonly": True}, + "supported_features": {"readonly": True}, + "fast_provisioning_supported": {"readonly": True}, + "supported_fast_provisioning_editions": {"readonly": True}, + "geo_backup_supported": {"readonly": True}, + "zone_redundant_ha_supported": {"readonly": True}, + "zone_redundant_ha_and_geo_backup_supported": {"readonly": True}, + "storage_auto_growth_supported": {"readonly": True}, + "online_resize_supported": {"readonly": True}, + "restricted": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "supported_server_editions": {"key": "supportedServerEditions", "type": "[ServerEditionCapability]"}, + "supported_server_versions": {"key": "supportedServerVersions", "type": "[ServerVersionCapability]"}, + "supported_features": {"key": "supportedFeatures", "type": "[SupportedFeature]"}, + "fast_provisioning_supported": {"key": "fastProvisioningSupported", "type": "str"}, + "supported_fast_provisioning_editions": { + "key": "supportedFastProvisioningEditions", + "type": "[FastProvisioningEditionCapability]", + }, + "geo_backup_supported": {"key": "geoBackupSupported", "type": "str"}, + "zone_redundant_ha_supported": {"key": "zoneRedundantHaSupported", "type": "str"}, + "zone_redundant_ha_and_geo_backup_supported": {"key": "zoneRedundantHaAndGeoBackupSupported", "type": "str"}, + "storage_auto_growth_supported": {"key": "storageAutoGrowthSupported", "type": "str"}, + "online_resize_supported": {"key": "onlineResizeSupported", "type": "str"}, + "restricted": {"key": "restricted", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of flexible servers capabilities. + :paramtype name: str + """ + super().__init__(**kwargs) + self.name = name + self.supported_server_editions: Optional[list["_models.ServerEditionCapability"]] = None + self.supported_server_versions: Optional[list["_models.ServerVersionCapability"]] = None + self.supported_features: Optional[list["_models.SupportedFeature"]] = None + self.fast_provisioning_supported: Optional[Union[str, "_models.FastProvisioningSupport"]] = None + self.supported_fast_provisioning_editions: Optional[list["_models.FastProvisioningEditionCapability"]] = None + self.geo_backup_supported: Optional[Union[str, "_models.GeographicallyRedundantBackupSupport"]] = None + self.zone_redundant_ha_supported: Optional[Union[str, "_models.ZoneRedundantHighAvailabilitySupport"]] = None + self.zone_redundant_ha_and_geo_backup_supported: Optional[ + Union[str, "_models.ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport"] + ] = None + self.storage_auto_growth_supported: Optional[Union[str, "_models.StorageAutoGrowthSupport"]] = None + self.online_resize_supported: Optional[Union[str, "_models.OnlineStorageResizeSupport"]] = None + self.restricted: Optional[Union[str, "_models.LocationRestricted"]] = None + + +class CapabilityList(_serialization.Model): + """List of capabilities for the Azure Database for PostgreSQL flexible server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of supported capabilities. + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.Capability] + :ivar next_link: Link to retrieve next page of results. :vartype next_link: str """ + _validation = { + "value": {"readonly": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[Configuration]"}, + "value": {"key": "value", "type": "[Capability]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, *, value: Optional[List["_models.Configuration"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: The list of server configurations. - :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.Configuration] - :keyword next_link: The link used to get the next page of operations. + :keyword next_link: Link to retrieve next page of results. :paramtype next_link: str """ super().__init__(**kwargs) - self.value = value + self.value: Optional[list["_models.Capability"]] = None self.next_link = next_link -class Database(ProxyResource): - """Represents a Database. +class CapturedLog(ProxyResource): + """Log file. Variables are only populated by the server, and will be ignored when sending a request. @@ -837,10 +1178,16 @@ class Database(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - :ivar charset: The charset of the database. - :vartype charset: str - :ivar collation: The collation of the database. - :vartype collation: str + :ivar created_time: Creation timestamp of the log file. + :vartype created_time: ~datetime.datetime + :ivar last_modified_time: Last modified timestamp of the log file. + :vartype last_modified_time: ~datetime.datetime + :ivar size_in_kb: Size (in KB) of the log file. + :vartype size_in_kb: int + :ivar type_properties_type: Type of log file. Can be 'ServerLogs' or 'UpgradeLogs'. + :vartype type_properties_type: str + :ivar url: URL to download the log file from. + :vartype url: str """ _validation = { @@ -848,8 +1195,6 @@ class Database(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "charset": {"pattern": r"^[a-zA-Z]+\w*$"}, - "collation": {"pattern": r"^[a-zA-Z\-]+([. ]|\w)*$"}, } _attribute_map = { @@ -857,43 +1202,64 @@ class Database(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "charset": {"key": "properties.charset", "type": "str"}, - "collation": {"key": "properties.collation", "type": "str"}, + "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, + "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, + "size_in_kb": {"key": "properties.sizeInKb", "type": "int"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "url": {"key": "properties.url", "type": "str"}, } - def __init__(self, *, charset: Optional[str] = None, collation: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + created_time: Optional[datetime.datetime] = None, + last_modified_time: Optional[datetime.datetime] = None, + size_in_kb: Optional[int] = None, + type_properties_type: Optional[str] = None, + url: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword charset: The charset of the database. - :paramtype charset: str - :keyword collation: The collation of the database. - :paramtype collation: str + :keyword created_time: Creation timestamp of the log file. + :paramtype created_time: ~datetime.datetime + :keyword last_modified_time: Last modified timestamp of the log file. + :paramtype last_modified_time: ~datetime.datetime + :keyword size_in_kb: Size (in KB) of the log file. + :paramtype size_in_kb: int + :keyword type_properties_type: Type of log file. Can be 'ServerLogs' or 'UpgradeLogs'. + :paramtype type_properties_type: str + :keyword url: URL to download the log file from. + :paramtype url: str """ super().__init__(**kwargs) - self.charset = charset - self.collation = collation + self.created_time = created_time + self.last_modified_time = last_modified_time + self.size_in_kb = size_in_kb + self.type_properties_type = type_properties_type + self.url = url -class DatabaseListResult(_serialization.Model): - """A List of databases. +class CapturedLogList(_serialization.Model): + """List of log files. - :ivar value: The list of databases housed in a server. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.Database] - :ivar next_link: The link used to get the next page of databases. + :ivar value: List of log files in a server. + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.CapturedLog] + :ivar next_link: Link used to get the next page of results. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[Database]"}, + "value": {"key": "value", "type": "[CapturedLog]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.Database"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.CapturedLog"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The list of databases housed in a server. - :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.Database] - :keyword next_link: The link used to get the next page of databases. + :keyword value: List of log files in a server. + :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.CapturedLog] + :keyword next_link: Link used to get the next page of results. :paramtype next_link: str """ super().__init__(**kwargs) @@ -901,498 +1267,333 @@ def __init__( self.next_link = next_link -class DataEncryption(_serialization.Model): - """Data encryption properties of a server. +class CheckNameAvailabilityRequest(_serialization.Model): + """The check availability request body. - :ivar primary_key_uri: URI for the key in keyvault for data encryption of the primary server. - :vartype primary_key_uri: str - :ivar primary_user_assigned_identity_id: Resource Id for the User assigned identity to be used - for data encryption of the primary server. - :vartype primary_user_assigned_identity_id: str - :ivar geo_backup_key_uri: URI for the key in keyvault for data encryption for geo-backup of - server. - :vartype geo_backup_key_uri: str - :ivar geo_backup_user_assigned_identity_id: Resource Id for the User assigned identity to be - used for data encryption for geo-backup of server. - :vartype geo_backup_user_assigned_identity_id: str - :ivar type: Data encryption type to depict if it is System Managed vs Azure Key vault. Known - values are: "SystemManaged" and "AzureKeyVault". - :vartype type: str or ~azure.mgmt.postgresqlflexibleservers.models.ArmServerKeyType - :ivar primary_encryption_key_status: Primary encryption key status for Data encryption enabled - server. Known values are: "Valid" and "Invalid". - :vartype primary_encryption_key_status: str or - ~azure.mgmt.postgresqlflexibleservers.models.KeyStatusEnum - :ivar geo_backup_encryption_key_status: Geo-backup encryption key status for Data encryption - enabled server. Known values are: "Valid" and "Invalid". - :vartype geo_backup_encryption_key_status: str or - ~azure.mgmt.postgresqlflexibleservers.models.KeyStatusEnum + :ivar name: The name of the resource for which availability needs to be checked. + :vartype name: str + :ivar type: The resource type. + :vartype type: str """ _attribute_map = { - "primary_key_uri": {"key": "primaryKeyURI", "type": "str"}, - "primary_user_assigned_identity_id": {"key": "primaryUserAssignedIdentityId", "type": "str"}, - "geo_backup_key_uri": {"key": "geoBackupKeyURI", "type": "str"}, - "geo_backup_user_assigned_identity_id": {"key": "geoBackupUserAssignedIdentityId", "type": "str"}, + "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "primary_encryption_key_status": {"key": "primaryEncryptionKeyStatus", "type": "str"}, - "geo_backup_encryption_key_status": {"key": "geoBackupEncryptionKeyStatus", "type": "str"}, } - def __init__( - self, - *, - primary_key_uri: Optional[str] = None, - primary_user_assigned_identity_id: Optional[str] = None, - geo_backup_key_uri: Optional[str] = None, - geo_backup_user_assigned_identity_id: Optional[str] = None, - type: Optional[Union[str, "_models.ArmServerKeyType"]] = None, - primary_encryption_key_status: Optional[Union[str, "_models.KeyStatusEnum"]] = None, - geo_backup_encryption_key_status: Optional[Union[str, "_models.KeyStatusEnum"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword primary_key_uri: URI for the key in keyvault for data encryption of the primary - server. - :paramtype primary_key_uri: str - :keyword primary_user_assigned_identity_id: Resource Id for the User assigned identity to be - used for data encryption of the primary server. - :paramtype primary_user_assigned_identity_id: str - :keyword geo_backup_key_uri: URI for the key in keyvault for data encryption for geo-backup of - server. - :paramtype geo_backup_key_uri: str - :keyword geo_backup_user_assigned_identity_id: Resource Id for the User assigned identity to be - used for data encryption for geo-backup of server. - :paramtype geo_backup_user_assigned_identity_id: str - :keyword type: Data encryption type to depict if it is System Managed vs Azure Key vault. Known - values are: "SystemManaged" and "AzureKeyVault". - :paramtype type: str or ~azure.mgmt.postgresqlflexibleservers.models.ArmServerKeyType - :keyword primary_encryption_key_status: Primary encryption key status for Data encryption - enabled server. Known values are: "Valid" and "Invalid". - :paramtype primary_encryption_key_status: str or - ~azure.mgmt.postgresqlflexibleservers.models.KeyStatusEnum - :keyword geo_backup_encryption_key_status: Geo-backup encryption key status for Data encryption - enabled server. Known values are: "Valid" and "Invalid". - :paramtype geo_backup_encryption_key_status: str or - ~azure.mgmt.postgresqlflexibleservers.models.KeyStatusEnum + :keyword name: The name of the resource for which availability needs to be checked. + :paramtype name: str + :keyword type: The resource type. + :paramtype type: str """ super().__init__(**kwargs) - self.primary_key_uri = primary_key_uri - self.primary_user_assigned_identity_id = primary_user_assigned_identity_id - self.geo_backup_key_uri = geo_backup_key_uri - self.geo_backup_user_assigned_identity_id = geo_backup_user_assigned_identity_id + self.name = name self.type = type - self.primary_encryption_key_status = primary_encryption_key_status - self.geo_backup_encryption_key_status = geo_backup_encryption_key_status - - -class DbLevelValidationStatus(_serialization.Model): - """Validation status summary for an individual database. - - :ivar database_name: Name of the database. - :vartype database_name: str - :ivar started_on: Start date-time of a database level validation. - :vartype started_on: ~datetime.datetime - :ivar ended_on: End date-time of a database level validation. - :vartype ended_on: ~datetime.datetime - :ivar summary: Summary of database level validations. - :vartype summary: list[~azure.mgmt.postgresqlflexibleservers.models.ValidationSummaryItem] - """ - - _attribute_map = { - "database_name": {"key": "databaseName", "type": "str"}, - "started_on": {"key": "startedOn", "type": "iso-8601"}, - "ended_on": {"key": "endedOn", "type": "iso-8601"}, - "summary": {"key": "summary", "type": "[ValidationSummaryItem]"}, - } - - def __init__( - self, - *, - database_name: Optional[str] = None, - started_on: Optional[datetime.datetime] = None, - ended_on: Optional[datetime.datetime] = None, - summary: Optional[List["_models.ValidationSummaryItem"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword database_name: Name of the database. - :paramtype database_name: str - :keyword started_on: Start date-time of a database level validation. - :paramtype started_on: ~datetime.datetime - :keyword ended_on: End date-time of a database level validation. - :paramtype ended_on: ~datetime.datetime - :keyword summary: Summary of database level validations. - :paramtype summary: list[~azure.mgmt.postgresqlflexibleservers.models.ValidationSummaryItem] - """ - super().__init__(**kwargs) - self.database_name = database_name - self.started_on = started_on - self.ended_on = ended_on - self.summary = summary -class DbMigrationStatus(_serialization.Model): - """Migration status of an individual database. +class CheckNameAvailabilityResponse(_serialization.Model): + """The check availability result. - :ivar database_name: Name of the database. - :vartype database_name: str - :ivar migration_state: Migration db state of an individual database. Known values are: - "InProgress", "WaitingForCutoverTrigger", "Failed", "Canceled", "Succeeded", and "Canceling". - :vartype migration_state: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationDbState - :ivar migration_operation: Migration operation of an individual database. - :vartype migration_operation: str - :ivar started_on: Start date-time of a migration state. - :vartype started_on: ~datetime.datetime - :ivar ended_on: End date-time of a migration state. - :vartype ended_on: ~datetime.datetime - :ivar full_load_queued_tables: Number of tables queued for the migration of a DB. - :vartype full_load_queued_tables: int - :ivar full_load_errored_tables: Number of tables errored out during the migration of a DB. - :vartype full_load_errored_tables: int - :ivar full_load_loading_tables: Number of tables loading during the migration of a DB. - :vartype full_load_loading_tables: int - :ivar full_load_completed_tables: Number of tables loaded during the migration of a DB. - :vartype full_load_completed_tables: int - :ivar cdc_update_counter: CDC update counter. - :vartype cdc_update_counter: int - :ivar cdc_delete_counter: CDC delete counter. - :vartype cdc_delete_counter: int - :ivar cdc_insert_counter: CDC insert counter. - :vartype cdc_insert_counter: int - :ivar applied_changes: CDC applied changes counter. - :vartype applied_changes: int - :ivar incoming_changes: CDC incoming changes counter. - :vartype incoming_changes: int - :ivar latency: Lag in seconds between source and target during online phase. - :vartype latency: int - :ivar message: Error message, if any, for the migration state. + :ivar name_available: Indicates if the resource name is available. + :vartype name_available: bool + :ivar reason: The reason why the given name is not available. Known values are: "Invalid" and + "AlreadyExists". + :vartype reason: str or + ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityReason + :ivar message: Detailed reason why the given name is available. :vartype message: str """ _attribute_map = { - "database_name": {"key": "databaseName", "type": "str"}, - "migration_state": {"key": "migrationState", "type": "str"}, - "migration_operation": {"key": "migrationOperation", "type": "str"}, - "started_on": {"key": "startedOn", "type": "iso-8601"}, - "ended_on": {"key": "endedOn", "type": "iso-8601"}, - "full_load_queued_tables": {"key": "fullLoadQueuedTables", "type": "int"}, - "full_load_errored_tables": {"key": "fullLoadErroredTables", "type": "int"}, - "full_load_loading_tables": {"key": "fullLoadLoadingTables", "type": "int"}, - "full_load_completed_tables": {"key": "fullLoadCompletedTables", "type": "int"}, - "cdc_update_counter": {"key": "cdcUpdateCounter", "type": "int"}, - "cdc_delete_counter": {"key": "cdcDeleteCounter", "type": "int"}, - "cdc_insert_counter": {"key": "cdcInsertCounter", "type": "int"}, - "applied_changes": {"key": "appliedChanges", "type": "int"}, - "incoming_changes": {"key": "incomingChanges", "type": "int"}, - "latency": {"key": "latency", "type": "int"}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, "message": {"key": "message", "type": "str"}, } def __init__( self, *, - database_name: Optional[str] = None, - migration_state: Optional[Union[str, "_models.MigrationDbState"]] = None, - migration_operation: Optional[str] = None, - started_on: Optional[datetime.datetime] = None, - ended_on: Optional[datetime.datetime] = None, - full_load_queued_tables: Optional[int] = None, - full_load_errored_tables: Optional[int] = None, - full_load_loading_tables: Optional[int] = None, - full_load_completed_tables: Optional[int] = None, - cdc_update_counter: Optional[int] = None, - cdc_delete_counter: Optional[int] = None, - cdc_insert_counter: Optional[int] = None, - applied_changes: Optional[int] = None, - incoming_changes: Optional[int] = None, - latency: Optional[int] = None, - message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword database_name: Name of the database. - :paramtype database_name: str - :keyword migration_state: Migration db state of an individual database. Known values are: - "InProgress", "WaitingForCutoverTrigger", "Failed", "Canceled", "Succeeded", and "Canceling". - :paramtype migration_state: str or - ~azure.mgmt.postgresqlflexibleservers.models.MigrationDbState - :keyword migration_operation: Migration operation of an individual database. - :paramtype migration_operation: str - :keyword started_on: Start date-time of a migration state. - :paramtype started_on: ~datetime.datetime - :keyword ended_on: End date-time of a migration state. - :paramtype ended_on: ~datetime.datetime - :keyword full_load_queued_tables: Number of tables queued for the migration of a DB. - :paramtype full_load_queued_tables: int - :keyword full_load_errored_tables: Number of tables errored out during the migration of a DB. - :paramtype full_load_errored_tables: int - :keyword full_load_loading_tables: Number of tables loading during the migration of a DB. - :paramtype full_load_loading_tables: int - :keyword full_load_completed_tables: Number of tables loaded during the migration of a DB. - :paramtype full_load_completed_tables: int - :keyword cdc_update_counter: CDC update counter. - :paramtype cdc_update_counter: int - :keyword cdc_delete_counter: CDC delete counter. - :paramtype cdc_delete_counter: int - :keyword cdc_insert_counter: CDC insert counter. - :paramtype cdc_insert_counter: int - :keyword applied_changes: CDC applied changes counter. - :paramtype applied_changes: int - :keyword incoming_changes: CDC incoming changes counter. - :paramtype incoming_changes: int - :keyword latency: Lag in seconds between source and target during online phase. - :paramtype latency: int - :keyword message: Error message, if any, for the migration state. - :paramtype message: str - """ - super().__init__(**kwargs) - self.database_name = database_name - self.migration_state = migration_state - self.migration_operation = migration_operation - self.started_on = started_on - self.ended_on = ended_on - self.full_load_queued_tables = full_load_queued_tables - self.full_load_errored_tables = full_load_errored_tables - self.full_load_loading_tables = full_load_loading_tables - self.full_load_completed_tables = full_load_completed_tables - self.cdc_update_counter = cdc_update_counter - self.cdc_delete_counter = cdc_delete_counter - self.cdc_insert_counter = cdc_insert_counter - self.applied_changes = applied_changes - self.incoming_changes = incoming_changes - self.latency = latency - self.message = message - - -class DbServerMetadata(_serialization.Model): - """Database server metadata. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: Location of database server. - :vartype location: str - :ivar version: Version for database engine. - :vartype version: str - :ivar storage_mb: Storage size in MB for database server. - :vartype storage_mb: int - :ivar sku: SKU for the database server. This object is empty for PG single server. - :vartype sku: ~azure.mgmt.postgresqlflexibleservers.models.ServerSku - """ - - _validation = { - "location": {"readonly": True}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "version": {"key": "version", "type": "str"}, - "storage_mb": {"key": "storageMb", "type": "int"}, - "sku": {"key": "sku", "type": "ServerSku"}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - storage_mb: Optional[int] = None, - sku: Optional["_models.ServerSku"] = None, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = None, + message: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword version: Version for database engine. - :paramtype version: str - :keyword storage_mb: Storage size in MB for database server. - :paramtype storage_mb: int - :keyword sku: SKU for the database server. This object is empty for PG single server. - :paramtype sku: ~azure.mgmt.postgresqlflexibleservers.models.ServerSku + :keyword name_available: Indicates if the resource name is available. + :paramtype name_available: bool + :keyword reason: The reason why the given name is not available. Known values are: "Invalid" + and "AlreadyExists". + :paramtype reason: str or + ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityReason + :keyword message: Detailed reason why the given name is available. + :paramtype message: str """ super().__init__(**kwargs) - self.location: Optional[str] = None - self.version = version - self.storage_mb = storage_mb - self.sku = sku - + self.name_available = name_available + self.reason = reason + self.message = message -class DelegatedSubnetUsage(_serialization.Model): - """Delegated subnet usage data. - Variables are only populated by the server, and will be ignored when sending a request. +class Cluster(_serialization.Model): + """Cluster properties of a server. - :ivar subnet_name: Name of the delegated subnet for which IP addresses are in use. - :vartype subnet_name: str - :ivar usage: Number of IP addresses used by the delegated subnet. - :vartype usage: int + :ivar cluster_size: Number of nodes assigned to the elastic cluster. + :vartype cluster_size: int + :ivar default_database_name: Default database name for the elastic cluster. + :vartype default_database_name: str """ - _validation = { - "subnet_name": {"readonly": True}, - "usage": {"readonly": True}, - } - _attribute_map = { - "subnet_name": {"key": "subnetName", "type": "str"}, - "usage": {"key": "usage", "type": "int"}, + "cluster_size": {"key": "clusterSize", "type": "int"}, + "default_database_name": {"key": "defaultDatabaseName", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, cluster_size: int = 0, default_database_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword cluster_size: Number of nodes assigned to the elastic cluster. + :paramtype cluster_size: int + :keyword default_database_name: Default database name for the elastic cluster. + :paramtype default_database_name: str + """ super().__init__(**kwargs) - self.subnet_name: Optional[str] = None - self.usage: Optional[int] = None + self.cluster_size = cluster_size + self.default_database_name = default_database_name -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. +class Configuration(ProxyResource): + """Configuration (also known as server parameter). Variables are only populated by the server, and will be ignored when sending a request. - :ivar type: The additional info type. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar info: The additional info. - :vartype info: JSON + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData + :ivar value: Value of the configuration (also known as server parameter). Required to update + the value assigned to a specific modifiable configuration. + :vartype value: str + :ivar description: Description of the configuration (also known as server parameter). + :vartype description: str + :ivar default_value: Value assigned by default to the configuration (also known as server + parameter). + :vartype default_value: str + :ivar data_type: Data type of the configuration (also known as server parameter). Known values + are: "Boolean", "Numeric", "Integer", "Enumeration", "String", and "Set". + :vartype data_type: str or ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationDataType + :ivar allowed_values: Allowed values of the configuration (also known as server parameter). + :vartype allowed_values: str + :ivar source: Source of the value assigned to the configuration (also known as server + parameter). Required to update the value assigned to a specific modifiable configuration. + :vartype source: str + :ivar is_dynamic_config: Indicates if it's a dynamic (true) or static (false) configuration + (also known as server parameter). Static server parameters require a server restart after + changing the value assigned to them, for the change to take effect. Dynamic server parameters + do not require a server restart after changing the value assigned to them, for the change to + take effect. + :vartype is_dynamic_config: bool + :ivar is_read_only: Indicates if it's a read-only (true) or modifiable (false) configuration + (also known as server parameter). + :vartype is_read_only: bool + :ivar is_config_pending_restart: Indicates if the value assigned to the configuration (also + known as server parameter) is pending a server restart for it to take effect. + :vartype is_config_pending_restart: bool + :ivar unit: Units in which the configuration (also known as server parameter) value is + expressed. + :vartype unit: str + :ivar documentation_link: Link pointing to the documentation of the configuration (also known + as server parameter). + :vartype documentation_link: str """ _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, "type": {"readonly": True}, - "info": {"readonly": True}, + "system_data": {"readonly": True}, + "description": {"readonly": True}, + "default_value": {"readonly": True}, + "data_type": {"readonly": True}, + "allowed_values": {"readonly": True}, + "is_dynamic_config": {"readonly": True}, + "is_read_only": {"readonly": True}, + "is_config_pending_restart": {"readonly": True}, + "unit": {"readonly": True}, + "documentation_link": {"readonly": True}, } _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "value": {"key": "properties.value", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "default_value": {"key": "properties.defaultValue", "type": "str"}, + "data_type": {"key": "properties.dataType", "type": "str"}, + "allowed_values": {"key": "properties.allowedValues", "type": "str"}, + "source": {"key": "properties.source", "type": "str"}, + "is_dynamic_config": {"key": "properties.isDynamicConfig", "type": "bool"}, + "is_read_only": {"key": "properties.isReadOnly", "type": "bool"}, + "is_config_pending_restart": {"key": "properties.isConfigPendingRestart", "type": "bool"}, + "unit": {"key": "properties.unit", "type": "str"}, + "documentation_link": {"key": "properties.documentationLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, value: Optional[str] = None, source: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: Value of the configuration (also known as server parameter). Required to update + the value assigned to a specific modifiable configuration. + :paramtype value: str + :keyword source: Source of the value assigned to the configuration (also known as server + parameter). Required to update the value assigned to a specific modifiable configuration. + :paramtype source: str + """ super().__init__(**kwargs) - self.type: Optional[str] = None - self.info: Optional[JSON] = None + self.value = value + self.description: Optional[str] = None + self.default_value: Optional[str] = None + self.data_type: Optional[Union[str, "_models.ConfigurationDataType"]] = None + self.allowed_values: Optional[str] = None + self.source = source + self.is_dynamic_config: Optional[bool] = None + self.is_read_only: Optional[bool] = None + self.is_config_pending_restart: Optional[bool] = None + self.unit: Optional[str] = None + self.documentation_link: Optional[str] = None -class ErrorDetail(_serialization.Model): - """The error detail. +class ConfigurationForUpdate(_serialization.Model): + """Configuration (also known as server parameter). Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.postgresqlflexibleservers.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.postgresqlflexibleservers.models.ErrorAdditionalInfo] + :ivar value: Value of the configuration (also known as server parameter). Required to update + the value assigned to a specific modifiable configuration. + :vartype value: str + :ivar description: Description of the configuration (also known as server parameter). + :vartype description: str + :ivar default_value: Value assigned by default to the configuration (also known as server + parameter). + :vartype default_value: str + :ivar data_type: Data type of the configuration (also known as server parameter). Known values + are: "Boolean", "Numeric", "Integer", "Enumeration", "String", and "Set". + :vartype data_type: str or ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationDataType + :ivar allowed_values: Allowed values of the configuration (also known as server parameter). + :vartype allowed_values: str + :ivar source: Source of the value assigned to the configuration (also known as server + parameter). Required to update the value assigned to a specific modifiable configuration. + :vartype source: str + :ivar is_dynamic_config: Indicates if it's a dynamic (true) or static (false) configuration + (also known as server parameter). Static server parameters require a server restart after + changing the value assigned to them, for the change to take effect. Dynamic server parameters + do not require a server restart after changing the value assigned to them, for the change to + take effect. + :vartype is_dynamic_config: bool + :ivar is_read_only: Indicates if it's a read-only (true) or modifiable (false) configuration + (also known as server parameter). + :vartype is_read_only: bool + :ivar is_config_pending_restart: Indicates if the value assigned to the configuration (also + known as server parameter) is pending a server restart for it to take effect. + :vartype is_config_pending_restart: bool + :ivar unit: Units in which the configuration (also known as server parameter) value is + expressed. + :vartype unit: str + :ivar documentation_link: Link pointing to the documentation of the configuration (also known + as server parameter). + :vartype documentation_link: str """ _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + "description": {"readonly": True}, + "default_value": {"readonly": True}, + "data_type": {"readonly": True}, + "allowed_values": {"readonly": True}, + "is_dynamic_config": {"readonly": True}, + "is_read_only": {"readonly": True}, + "is_config_pending_restart": {"readonly": True}, + "unit": {"readonly": True}, + "documentation_link": {"readonly": True}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.target: Optional[str] = None - self.details: Optional[List["_models.ErrorDetail"]] = None - self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.postgresqlflexibleservers.models.ErrorDetail - """ - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, + "value": {"key": "properties.value", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "default_value": {"key": "properties.defaultValue", "type": "str"}, + "data_type": {"key": "properties.dataType", "type": "str"}, + "allowed_values": {"key": "properties.allowedValues", "type": "str"}, + "source": {"key": "properties.source", "type": "str"}, + "is_dynamic_config": {"key": "properties.isDynamicConfig", "type": "bool"}, + "is_read_only": {"key": "properties.isReadOnly", "type": "bool"}, + "is_config_pending_restart": {"key": "properties.isConfigPendingRestart", "type": "bool"}, + "unit": {"key": "properties.unit", "type": "str"}, + "documentation_link": {"key": "properties.documentationLink", "type": "str"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + def __init__(self, *, value: Optional[str] = None, source: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.postgresqlflexibleservers.models.ErrorDetail + :keyword value: Value of the configuration (also known as server parameter). Required to update + the value assigned to a specific modifiable configuration. + :paramtype value: str + :keyword source: Source of the value assigned to the configuration (also known as server + parameter). Required to update the value assigned to a specific modifiable configuration. + :paramtype source: str """ super().__init__(**kwargs) - self.error = error - + self.value = value + self.description: Optional[str] = None + self.default_value: Optional[str] = None + self.data_type: Optional[Union[str, "_models.ConfigurationDataType"]] = None + self.allowed_values: Optional[str] = None + self.source = source + self.is_dynamic_config: Optional[bool] = None + self.is_read_only: Optional[bool] = None + self.is_config_pending_restart: Optional[bool] = None + self.unit: Optional[str] = None + self.documentation_link: Optional[str] = None -class FastProvisioningEditionCapability(CapabilityBase): - """Represents capability of a fast provisioning edition. - Variables are only populated by the server, and will be ignored when sending a request. +class ConfigurationList(_serialization.Model): + """List of configurations (also known as server parameters). - :ivar status: The status of the capability. Known values are: "Visible", "Available", - "Default", and "Disabled". - :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus - :ivar reason: The reason for the capability not being available. - :vartype reason: str - :ivar supported_tier: Fast provisioning supported tier name. - :vartype supported_tier: str - :ivar supported_sku: Fast provisioning supported sku name. - :vartype supported_sku: str - :ivar supported_storage_gb: Fast provisioning supported storage in Gb. - :vartype supported_storage_gb: int - :ivar supported_server_versions: Fast provisioning supported version. - :vartype supported_server_versions: str - :ivar server_count: Count of servers in cache matching the spec. - :vartype server_count: int + :ivar value: List of configurations (also known as server parameters). + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :ivar next_link: Link used to get the next page of results. + :vartype next_link: str """ - _validation = { - "status": {"readonly": True}, - "reason": {"readonly": True}, - "supported_tier": {"readonly": True}, - "supported_sku": {"readonly": True}, - "supported_storage_gb": {"readonly": True}, - "supported_server_versions": {"readonly": True}, - "server_count": {"readonly": True}, - } - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "supported_tier": {"key": "supportedTier", "type": "str"}, - "supported_sku": {"key": "supportedSku", "type": "str"}, - "supported_storage_gb": {"key": "supportedStorageGb", "type": "int"}, - "supported_server_versions": {"key": "supportedServerVersions", "type": "str"}, - "server_count": {"key": "serverCount", "type": "int"}, + "value": {"key": "value", "type": "[Configuration]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, value: Optional[list["_models.Configuration"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of configurations (also known as server parameters). + :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :keyword next_link: Link used to get the next page of results. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.supported_tier: Optional[str] = None - self.supported_sku: Optional[str] = None - self.supported_storage_gb: Optional[int] = None - self.supported_server_versions: Optional[str] = None - self.server_count: Optional[int] = None + self.value = value + self.next_link = next_link -class FirewallRule(ProxyResource): - """Represents a server firewall rule. +class Database(ProxyResource): + """Represents a database. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str @@ -1404,12 +1605,10 @@ class FirewallRule(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - :ivar start_ip_address: The start IP address of the server firewall rule. Must be IPv4 format. - Required. - :vartype start_ip_address: str - :ivar end_ip_address: The end IP address of the server firewall rule. Must be IPv4 format. - Required. - :vartype end_ip_address: str + :ivar charset: Character set of the database. + :vartype charset: str + :ivar collation: Collation of the database. + :vartype collation: str """ _validation = { @@ -1417,14 +1616,8 @@ class FirewallRule(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "start_ip_address": { - "required": True, - "pattern": r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", - }, - "end_ip_address": { - "required": True, - "pattern": r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", - }, + "charset": {"pattern": r"^[a-zA-Z]+\w*$"}, + "collation": {"pattern": r"^[a-zA-Z\-]+([. ]|\w)*$"}, } _attribute_map = { @@ -1432,45 +1625,43 @@ class FirewallRule(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "start_ip_address": {"key": "properties.startIpAddress", "type": "str"}, - "end_ip_address": {"key": "properties.endIpAddress", "type": "str"}, + "charset": {"key": "properties.charset", "type": "str"}, + "collation": {"key": "properties.collation", "type": "str"}, } - def __init__(self, *, start_ip_address: str, end_ip_address: str, **kwargs: Any) -> None: + def __init__(self, *, charset: Optional[str] = None, collation: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword start_ip_address: The start IP address of the server firewall rule. Must be IPv4 - format. Required. - :paramtype start_ip_address: str - :keyword end_ip_address: The end IP address of the server firewall rule. Must be IPv4 format. - Required. - :paramtype end_ip_address: str + :keyword charset: Character set of the database. + :paramtype charset: str + :keyword collation: Collation of the database. + :paramtype collation: str """ super().__init__(**kwargs) - self.start_ip_address = start_ip_address - self.end_ip_address = end_ip_address + self.charset = charset + self.collation = collation -class FirewallRuleListResult(_serialization.Model): - """A list of firewall rules. +class DatabaseList(_serialization.Model): + """List of all databases in a server. - :ivar value: The list of firewall rules in a server. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.FirewallRule] - :ivar next_link: The link used to get the next page of operations. + :ivar value: List of all databases in a server. + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.Database] + :ivar next_link: Link used to get the next page of results. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[FirewallRule]"}, + "value": {"key": "value", "type": "[Database]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.FirewallRule"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Database"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The list of firewall rules in a server. - :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.FirewallRule] - :keyword next_link: The link used to get the next page of operations. + :keyword value: List of all databases in a server. + :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.Database] + :keyword next_link: Link used to get the next page of results. :paramtype next_link: str """ super().__init__(**kwargs) @@ -1478,574 +1669,518 @@ def __init__( self.next_link = next_link -class FlexibleServerCapability(CapabilityBase): - """Capability for the PostgreSQL server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the capability. Known values are: "Visible", "Available", - "Default", and "Disabled". - :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus - :ivar reason: The reason for the capability not being available. - :vartype reason: str - :ivar name: Name of flexible servers capability. - :vartype name: str - :ivar supported_server_editions: List of supported flexible server editions. - :vartype supported_server_editions: - list[~azure.mgmt.postgresqlflexibleservers.models.FlexibleServerEditionCapability] - :ivar supported_server_versions: The list of server versions supported for this capability. - :vartype supported_server_versions: - list[~azure.mgmt.postgresqlflexibleservers.models.ServerVersionCapability] - :ivar supported_features: The supported features. - :vartype supported_features: - list[~azure.mgmt.postgresqlflexibleservers.models.SupportedFeature] - :ivar fast_provisioning_supported: Gets a value indicating whether fast provisioning is - supported. "Enabled" means fast provisioning is supported. "Disabled" stands for fast - provisioning is not supported. Will be deprecated in future, please look to Supported Features - for "FastProvisioning". Known values are: "Enabled" and "Disabled". - :vartype fast_provisioning_supported: str or - ~azure.mgmt.postgresqlflexibleservers.models.FastProvisioningSupportedEnum - :ivar supported_fast_provisioning_editions: List of supported server editions for fast - provisioning. - :vartype supported_fast_provisioning_editions: - list[~azure.mgmt.postgresqlflexibleservers.models.FastProvisioningEditionCapability] - :ivar geo_backup_supported: Determines if geo-backup is supported in this region. "Enabled" - means geo-backup is supported. "Disabled" stands for geo-back is not supported. Will be - deprecated in future, please look to Supported Features for "GeoBackup". Known values are: - "Enabled" and "Disabled". - :vartype geo_backup_supported: str or - ~azure.mgmt.postgresqlflexibleservers.models.GeoBackupSupportedEnum - :ivar zone_redundant_ha_supported: A value indicating whether Zone Redundant HA is supported in - this region. "Enabled" means zone redundant HA is supported. "Disabled" stands for zone - redundant HA is not supported. Will be deprecated in future, please look to Supported Features - for "ZoneRedundantHa". Known values are: "Enabled" and "Disabled". - :vartype zone_redundant_ha_supported: str or - ~azure.mgmt.postgresqlflexibleservers.models.ZoneRedundantHaSupportedEnum - :ivar zone_redundant_ha_and_geo_backup_supported: A value indicating whether Zone Redundant HA - and Geo-backup is supported in this region. "Enabled" means zone redundant HA and geo-backup is - supported. "Disabled" stands for zone redundant HA and geo-backup is not supported. Will be - deprecated in future, please look to Supported Features for "ZoneRedundantHaAndGeoBackup". - Known values are: "Enabled" and "Disabled". - :vartype zone_redundant_ha_and_geo_backup_supported: str or - ~azure.mgmt.postgresqlflexibleservers.models.ZoneRedundantHaAndGeoBackupSupportedEnum - :ivar storage_auto_growth_supported: A value indicating whether storage auto-grow is supported - in this region. "Enabled" means storage auto-grow is supported. "Disabled" stands for storage - auto-grow is not supported. Will be deprecated in future, please look to Supported Features for - "StorageAutoGrowth". Known values are: "Enabled" and "Disabled". - :vartype storage_auto_growth_supported: str or - ~azure.mgmt.postgresqlflexibleservers.models.StorageAutoGrowthSupportedEnum - :ivar online_resize_supported: A value indicating whether online resize is supported in this - region for the given subscription. "Enabled" means storage online resize is supported. - "Disabled" means storage online resize is not supported. Will be deprecated in future, please - look to Supported Features for "OnlineResize". Known values are: "Enabled" and "Disabled". - :vartype online_resize_supported: str or - ~azure.mgmt.postgresqlflexibleservers.models.OnlineResizeSupportedEnum - :ivar restricted: A value indicating whether this region is restricted. "Enabled" means region - is restricted. "Disabled" stands for region is not restricted. Will be deprecated in future, - please look to Supported Features for "Restricted". Known values are: "Enabled" and "Disabled". - :vartype restricted: str or ~azure.mgmt.postgresqlflexibleservers.models.RestrictedEnum - """ - - _validation = { - "status": {"readonly": True}, - "reason": {"readonly": True}, - "supported_server_editions": {"readonly": True}, - "supported_server_versions": {"readonly": True}, - "supported_features": {"readonly": True}, - "fast_provisioning_supported": {"readonly": True}, - "supported_fast_provisioning_editions": {"readonly": True}, - "geo_backup_supported": {"readonly": True}, - "zone_redundant_ha_supported": {"readonly": True}, - "zone_redundant_ha_and_geo_backup_supported": {"readonly": True}, - "storage_auto_growth_supported": {"readonly": True}, - "online_resize_supported": {"readonly": True}, - "restricted": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "supported_server_editions": {"key": "supportedServerEditions", "type": "[FlexibleServerEditionCapability]"}, - "supported_server_versions": {"key": "supportedServerVersions", "type": "[ServerVersionCapability]"}, - "supported_features": {"key": "supportedFeatures", "type": "[SupportedFeature]"}, - "fast_provisioning_supported": {"key": "fastProvisioningSupported", "type": "str"}, - "supported_fast_provisioning_editions": { - "key": "supportedFastProvisioningEditions", - "type": "[FastProvisioningEditionCapability]", - }, - "geo_backup_supported": {"key": "geoBackupSupported", "type": "str"}, - "zone_redundant_ha_supported": {"key": "zoneRedundantHaSupported", "type": "str"}, - "zone_redundant_ha_and_geo_backup_supported": {"key": "zoneRedundantHaAndGeoBackupSupported", "type": "str"}, - "storage_auto_growth_supported": {"key": "storageAutoGrowthSupported", "type": "str"}, - "online_resize_supported": {"key": "onlineResizeSupported", "type": "str"}, - "restricted": {"key": "restricted", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: Name of flexible servers capability. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - self.supported_server_editions: Optional[List["_models.FlexibleServerEditionCapability"]] = None - self.supported_server_versions: Optional[List["_models.ServerVersionCapability"]] = None - self.supported_features: Optional[List["_models.SupportedFeature"]] = None - self.fast_provisioning_supported: Optional[Union[str, "_models.FastProvisioningSupportedEnum"]] = None - self.supported_fast_provisioning_editions: Optional[List["_models.FastProvisioningEditionCapability"]] = None - self.geo_backup_supported: Optional[Union[str, "_models.GeoBackupSupportedEnum"]] = None - self.zone_redundant_ha_supported: Optional[Union[str, "_models.ZoneRedundantHaSupportedEnum"]] = None - self.zone_redundant_ha_and_geo_backup_supported: Optional[ - Union[str, "_models.ZoneRedundantHaAndGeoBackupSupportedEnum"] - ] = None - self.storage_auto_growth_supported: Optional[Union[str, "_models.StorageAutoGrowthSupportedEnum"]] = None - self.online_resize_supported: Optional[Union[str, "_models.OnlineResizeSupportedEnum"]] = None - self.restricted: Optional[Union[str, "_models.RestrictedEnum"]] = None - - -class FlexibleServerEditionCapability(CapabilityBase): - """Flexible server edition capabilities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the capability. Known values are: "Visible", "Available", - "Default", and "Disabled". - :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus - :ivar reason: The reason for the capability not being available. - :vartype reason: str - :ivar name: Server edition name. - :vartype name: str - :ivar default_sku_name: Default sku name for the server edition. - :vartype default_sku_name: str - :ivar supported_storage_editions: The list of editions supported by this server edition. - :vartype supported_storage_editions: - list[~azure.mgmt.postgresqlflexibleservers.models.StorageEditionCapability] - :ivar supported_server_skus: List of supported server SKUs. - :vartype supported_server_skus: - list[~azure.mgmt.postgresqlflexibleservers.models.ServerSkuCapability] - """ - - _validation = { - "status": {"readonly": True}, - "reason": {"readonly": True}, - "name": {"readonly": True}, - "default_sku_name": {"readonly": True}, - "supported_storage_editions": {"readonly": True}, - "supported_server_skus": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "reason": {"key": "reason", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "default_sku_name": {"key": "defaultSkuName", "type": "str"}, - "supported_storage_editions": {"key": "supportedStorageEditions", "type": "[StorageEditionCapability]"}, - "supported_server_skus": {"key": "supportedServerSkus", "type": "[ServerSkuCapability]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.default_sku_name: Optional[str] = None - self.supported_storage_editions: Optional[List["_models.StorageEditionCapability"]] = None - self.supported_server_skus: Optional[List["_models.ServerSkuCapability"]] = None - - -class HighAvailability(_serialization.Model): - """High availability properties of a server. - - Variables are only populated by the server, and will be ignored when sending a request. +class DatabaseMigrationState(_serialization.Model): + """Migration state of a database. - :ivar mode: The HA mode for the server. Known values are: "Disabled", "ZoneRedundant", and - "SameZone". - :vartype mode: str or ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityMode - :ivar state: A state of a HA server that is visible to user. Known values are: "NotEnabled", - "CreatingStandby", "ReplicatingData", "FailingOver", "Healthy", and "RemovingStandby". - :vartype state: str or ~azure.mgmt.postgresqlflexibleservers.models.ServerHAState - :ivar standby_availability_zone: availability zone information of the standby. - :vartype standby_availability_zone: str + :ivar database_name: Name of database. + :vartype database_name: str + :ivar migration_state: Migration state of a database. Known values are: "InProgress", + "WaitingForCutoverTrigger", "Failed", "Canceled", "Succeeded", and "Canceling". + :vartype migration_state: str or + ~azure.mgmt.postgresqlflexibleservers.models.MigrationDatabaseState + :ivar migration_operation: Migration operation of a database. + :vartype migration_operation: str + :ivar started_on: Start time of a migration state. + :vartype started_on: ~datetime.datetime + :ivar ended_on: End time of a migration state. + :vartype ended_on: ~datetime.datetime + :ivar full_load_queued_tables: Number of tables queued for the migration of a database. + :vartype full_load_queued_tables: int + :ivar full_load_errored_tables: Number of tables encountering errors during the migration of a + database. + :vartype full_load_errored_tables: int + :ivar full_load_loading_tables: Number of tables loading during the migration of a database. + :vartype full_load_loading_tables: int + :ivar full_load_completed_tables: Number of tables loaded during the migration of a database. + :vartype full_load_completed_tables: int + :ivar cdc_update_counter: Change Data Capture update counter. + :vartype cdc_update_counter: int + :ivar cdc_delete_counter: Change Data Capture delete counter. + :vartype cdc_delete_counter: int + :ivar cdc_insert_counter: Change Data Capture insert counter. + :vartype cdc_insert_counter: int + :ivar applied_changes: Change Data Capture applied changes counter. + :vartype applied_changes: int + :ivar incoming_changes: Change Data Capture incoming changes counter. + :vartype incoming_changes: int + :ivar latency: Lag in seconds between source and target during online phase. + :vartype latency: int + :ivar message: Error message, if any, for the migration state. + :vartype message: str """ - _validation = { - "state": {"readonly": True}, - } - _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "state": {"key": "state", "type": "str"}, - "standby_availability_zone": {"key": "standbyAvailabilityZone", "type": "str"}, + "database_name": {"key": "databaseName", "type": "str"}, + "migration_state": {"key": "migrationState", "type": "str"}, + "migration_operation": {"key": "migrationOperation", "type": "str"}, + "started_on": {"key": "startedOn", "type": "iso-8601"}, + "ended_on": {"key": "endedOn", "type": "iso-8601"}, + "full_load_queued_tables": {"key": "fullLoadQueuedTables", "type": "int"}, + "full_load_errored_tables": {"key": "fullLoadErroredTables", "type": "int"}, + "full_load_loading_tables": {"key": "fullLoadLoadingTables", "type": "int"}, + "full_load_completed_tables": {"key": "fullLoadCompletedTables", "type": "int"}, + "cdc_update_counter": {"key": "cdcUpdateCounter", "type": "int"}, + "cdc_delete_counter": {"key": "cdcDeleteCounter", "type": "int"}, + "cdc_insert_counter": {"key": "cdcInsertCounter", "type": "int"}, + "applied_changes": {"key": "appliedChanges", "type": "int"}, + "incoming_changes": {"key": "incomingChanges", "type": "int"}, + "latency": {"key": "latency", "type": "int"}, + "message": {"key": "message", "type": "str"}, } def __init__( self, *, - mode: Union[str, "_models.HighAvailabilityMode"] = "Disabled", - standby_availability_zone: str = "", + database_name: Optional[str] = None, + migration_state: Optional[Union[str, "_models.MigrationDatabaseState"]] = None, + migration_operation: Optional[str] = None, + started_on: Optional[datetime.datetime] = None, + ended_on: Optional[datetime.datetime] = None, + full_load_queued_tables: Optional[int] = None, + full_load_errored_tables: Optional[int] = None, + full_load_loading_tables: Optional[int] = None, + full_load_completed_tables: Optional[int] = None, + cdc_update_counter: Optional[int] = None, + cdc_delete_counter: Optional[int] = None, + cdc_insert_counter: Optional[int] = None, + applied_changes: Optional[int] = None, + incoming_changes: Optional[int] = None, + latency: Optional[int] = None, + message: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword mode: The HA mode for the server. Known values are: "Disabled", "ZoneRedundant", and - "SameZone". - :paramtype mode: str or ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityMode - :keyword standby_availability_zone: availability zone information of the standby. - :paramtype standby_availability_zone: str + :keyword database_name: Name of database. + :paramtype database_name: str + :keyword migration_state: Migration state of a database. Known values are: "InProgress", + "WaitingForCutoverTrigger", "Failed", "Canceled", "Succeeded", and "Canceling". + :paramtype migration_state: str or + ~azure.mgmt.postgresqlflexibleservers.models.MigrationDatabaseState + :keyword migration_operation: Migration operation of a database. + :paramtype migration_operation: str + :keyword started_on: Start time of a migration state. + :paramtype started_on: ~datetime.datetime + :keyword ended_on: End time of a migration state. + :paramtype ended_on: ~datetime.datetime + :keyword full_load_queued_tables: Number of tables queued for the migration of a database. + :paramtype full_load_queued_tables: int + :keyword full_load_errored_tables: Number of tables encountering errors during the migration of + a database. + :paramtype full_load_errored_tables: int + :keyword full_load_loading_tables: Number of tables loading during the migration of a database. + :paramtype full_load_loading_tables: int + :keyword full_load_completed_tables: Number of tables loaded during the migration of a + database. + :paramtype full_load_completed_tables: int + :keyword cdc_update_counter: Change Data Capture update counter. + :paramtype cdc_update_counter: int + :keyword cdc_delete_counter: Change Data Capture delete counter. + :paramtype cdc_delete_counter: int + :keyword cdc_insert_counter: Change Data Capture insert counter. + :paramtype cdc_insert_counter: int + :keyword applied_changes: Change Data Capture applied changes counter. + :paramtype applied_changes: int + :keyword incoming_changes: Change Data Capture incoming changes counter. + :paramtype incoming_changes: int + :keyword latency: Lag in seconds between source and target during online phase. + :paramtype latency: int + :keyword message: Error message, if any, for the migration state. + :paramtype message: str """ super().__init__(**kwargs) - self.mode = mode - self.state: Optional[Union[str, "_models.ServerHAState"]] = None - self.standby_availability_zone = standby_availability_zone + self.database_name = database_name + self.migration_state = migration_state + self.migration_operation = migration_operation + self.started_on = started_on + self.ended_on = ended_on + self.full_load_queued_tables = full_load_queued_tables + self.full_load_errored_tables = full_load_errored_tables + self.full_load_loading_tables = full_load_loading_tables + self.full_load_completed_tables = full_load_completed_tables + self.cdc_update_counter = cdc_update_counter + self.cdc_delete_counter = cdc_delete_counter + self.cdc_insert_counter = cdc_insert_counter + self.applied_changes = applied_changes + self.incoming_changes = incoming_changes + self.latency = latency + self.message = message -class ImpactRecord(_serialization.Model): - """Stores property that features impact on some metric if this recommended action is applied. +class DataEncryption(_serialization.Model): + """Data encryption properties of a server. - :ivar dimension_name: Dimension name. - :vartype dimension_name: str - :ivar unit: Dimension unit. - :vartype unit: str - :ivar query_id: Optional property that can be used to store the QueryId if the metric is for a - specific query. - :vartype query_id: int - :ivar absolute_value: Absolute value. - :vartype absolute_value: float + :ivar primary_key_uri: URI of the key in Azure Key Vault used for data encryption of the + primary storage associated to a server. + :vartype primary_key_uri: str + :ivar primary_user_assigned_identity_id: Identifier of the user assigned managed identity used + to access the key in Azure Key Vault for data encryption of the primary storage associated to a + server. + :vartype primary_user_assigned_identity_id: str + :ivar geo_backup_key_uri: Identifier of the user assigned managed identity used to access the + key in Azure Key Vault for data encryption of the geographically redundant storage associated + to a server that is configured to support geographically redundant backups. + :vartype geo_backup_key_uri: str + :ivar geo_backup_user_assigned_identity_id: Identifier of the user assigned managed identity + used to access the key in Azure Key Vault for data encryption of the geographically redundant + storage associated to a server that is configured to support geographically redundant backups. + :vartype geo_backup_user_assigned_identity_id: str + :ivar type: Data encryption type used by a server. Known values are: "SystemManaged" and + "AzureKeyVault". + :vartype type: str or ~azure.mgmt.postgresqlflexibleservers.models.DataEncryptionType + :ivar primary_encryption_key_status: Status of key used by a server configured with data + encryption based on customer managed key, to encrypt the primary storage associated to the + server. Known values are: "Valid" and "Invalid". + :vartype primary_encryption_key_status: str or + ~azure.mgmt.postgresqlflexibleservers.models.EncryptionKeyStatus + :ivar geo_backup_encryption_key_status: Status of key used by a server configured with data + encryption based on customer managed key, to encrypt the geographically redundant storage + associated to the server when it is configured to support geographically redundant backups. + Known values are: "Valid" and "Invalid". + :vartype geo_backup_encryption_key_status: str or + ~azure.mgmt.postgresqlflexibleservers.models.EncryptionKeyStatus """ _attribute_map = { - "dimension_name": {"key": "dimensionName", "type": "str"}, - "unit": {"key": "unit", "type": "str"}, - "query_id": {"key": "queryId", "type": "int"}, - "absolute_value": {"key": "absoluteValue", "type": "float"}, + "primary_key_uri": {"key": "primaryKeyURI", "type": "str"}, + "primary_user_assigned_identity_id": {"key": "primaryUserAssignedIdentityId", "type": "str"}, + "geo_backup_key_uri": {"key": "geoBackupKeyURI", "type": "str"}, + "geo_backup_user_assigned_identity_id": {"key": "geoBackupUserAssignedIdentityId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "primary_encryption_key_status": {"key": "primaryEncryptionKeyStatus", "type": "str"}, + "geo_backup_encryption_key_status": {"key": "geoBackupEncryptionKeyStatus", "type": "str"}, } def __init__( self, *, - dimension_name: Optional[str] = None, - unit: Optional[str] = None, - query_id: Optional[int] = None, - absolute_value: Optional[float] = None, + primary_key_uri: Optional[str] = None, + primary_user_assigned_identity_id: Optional[str] = None, + geo_backup_key_uri: Optional[str] = None, + geo_backup_user_assigned_identity_id: Optional[str] = None, + type: Optional[Union[str, "_models.DataEncryptionType"]] = None, + primary_encryption_key_status: Optional[Union[str, "_models.EncryptionKeyStatus"]] = None, + geo_backup_encryption_key_status: Optional[Union[str, "_models.EncryptionKeyStatus"]] = None, **kwargs: Any ) -> None: """ - :keyword dimension_name: Dimension name. - :paramtype dimension_name: str - :keyword unit: Dimension unit. - :paramtype unit: str - :keyword query_id: Optional property that can be used to store the QueryId if the metric is for - a specific query. - :paramtype query_id: int - :keyword absolute_value: Absolute value. - :paramtype absolute_value: float + :keyword primary_key_uri: URI of the key in Azure Key Vault used for data encryption of the + primary storage associated to a server. + :paramtype primary_key_uri: str + :keyword primary_user_assigned_identity_id: Identifier of the user assigned managed identity + used to access the key in Azure Key Vault for data encryption of the primary storage associated + to a server. + :paramtype primary_user_assigned_identity_id: str + :keyword geo_backup_key_uri: Identifier of the user assigned managed identity used to access + the key in Azure Key Vault for data encryption of the geographically redundant storage + associated to a server that is configured to support geographically redundant backups. + :paramtype geo_backup_key_uri: str + :keyword geo_backup_user_assigned_identity_id: Identifier of the user assigned managed identity + used to access the key in Azure Key Vault for data encryption of the geographically redundant + storage associated to a server that is configured to support geographically redundant backups. + :paramtype geo_backup_user_assigned_identity_id: str + :keyword type: Data encryption type used by a server. Known values are: "SystemManaged" and + "AzureKeyVault". + :paramtype type: str or ~azure.mgmt.postgresqlflexibleservers.models.DataEncryptionType + :keyword primary_encryption_key_status: Status of key used by a server configured with data + encryption based on customer managed key, to encrypt the primary storage associated to the + server. Known values are: "Valid" and "Invalid". + :paramtype primary_encryption_key_status: str or + ~azure.mgmt.postgresqlflexibleservers.models.EncryptionKeyStatus + :keyword geo_backup_encryption_key_status: Status of key used by a server configured with data + encryption based on customer managed key, to encrypt the geographically redundant storage + associated to the server when it is configured to support geographically redundant backups. + Known values are: "Valid" and "Invalid". + :paramtype geo_backup_encryption_key_status: str or + ~azure.mgmt.postgresqlflexibleservers.models.EncryptionKeyStatus """ super().__init__(**kwargs) - self.dimension_name = dimension_name - self.unit = unit - self.query_id = query_id - self.absolute_value = absolute_value + self.primary_key_uri = primary_key_uri + self.primary_user_assigned_identity_id = primary_user_assigned_identity_id + self.geo_backup_key_uri = geo_backup_key_uri + self.geo_backup_user_assigned_identity_id = geo_backup_user_assigned_identity_id + self.type = type + self.primary_encryption_key_status = primary_encryption_key_status + self.geo_backup_encryption_key_status = geo_backup_encryption_key_status -class IndexRecommendationDetails(_serialization.Model): - """Recommendation details for the recommended action. +class DbLevelValidationStatus(_serialization.Model): + """Validation status summary for a database. - :ivar database_name: Database name. + :ivar database_name: Name of database. :vartype database_name: str - :ivar schema: Schema name. - :vartype schema: str - :ivar table: Table name. - :vartype table: str - :ivar index_type: Index type. - :vartype index_type: str - :ivar index_name: Index name. - :vartype index_name: str - :ivar index_columns: Index columns. - :vartype index_columns: list[str] - :ivar included_columns: Index included columns. - :vartype included_columns: list[str] + :ivar started_on: Start time of a database level validation. + :vartype started_on: ~datetime.datetime + :ivar ended_on: End time of a database level validation. + :vartype ended_on: ~datetime.datetime + :ivar summary: Summary of database level validations. + :vartype summary: list[~azure.mgmt.postgresqlflexibleservers.models.ValidationSummaryItem] """ _attribute_map = { "database_name": {"key": "databaseName", "type": "str"}, - "schema": {"key": "schema", "type": "str"}, - "table": {"key": "table", "type": "str"}, - "index_type": {"key": "indexType", "type": "str"}, - "index_name": {"key": "indexName", "type": "str"}, - "index_columns": {"key": "indexColumns", "type": "[str]"}, - "included_columns": {"key": "includedColumns", "type": "[str]"}, + "started_on": {"key": "startedOn", "type": "iso-8601"}, + "ended_on": {"key": "endedOn", "type": "iso-8601"}, + "summary": {"key": "summary", "type": "[ValidationSummaryItem]"}, } def __init__( self, *, database_name: Optional[str] = None, - schema: Optional[str] = None, - table: Optional[str] = None, - index_type: Optional[str] = None, - index_name: Optional[str] = None, - index_columns: Optional[List[str]] = None, - included_columns: Optional[List[str]] = None, + started_on: Optional[datetime.datetime] = None, + ended_on: Optional[datetime.datetime] = None, + summary: Optional[list["_models.ValidationSummaryItem"]] = None, **kwargs: Any ) -> None: """ - :keyword database_name: Database name. + :keyword database_name: Name of database. :paramtype database_name: str - :keyword schema: Schema name. - :paramtype schema: str - :keyword table: Table name. - :paramtype table: str - :keyword index_type: Index type. - :paramtype index_type: str - :keyword index_name: Index name. - :paramtype index_name: str - :keyword index_columns: Index columns. - :paramtype index_columns: list[str] - :keyword included_columns: Index included columns. - :paramtype included_columns: list[str] + :keyword started_on: Start time of a database level validation. + :paramtype started_on: ~datetime.datetime + :keyword ended_on: End time of a database level validation. + :paramtype ended_on: ~datetime.datetime + :keyword summary: Summary of database level validations. + :paramtype summary: list[~azure.mgmt.postgresqlflexibleservers.models.ValidationSummaryItem] """ super().__init__(**kwargs) self.database_name = database_name - self.schema = schema - self.table = table - self.index_type = index_type - self.index_name = index_name - self.index_columns = index_columns - self.included_columns = included_columns + self.started_on = started_on + self.ended_on = ended_on + self.summary = summary -class IndexRecommendationListResult(_serialization.Model): - """A list of available index recommendations. +class DbServerMetadata(_serialization.Model): + """Database server metadata. + + Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: A list of available index recommendations. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.IndexRecommendationResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str + :ivar location: Location of database server. + :vartype location: str + :ivar version: Major version of PostgreSQL database engine. + :vartype version: str + :ivar storage_mb: Storage size (in MB) for database server. + :vartype storage_mb: int + :ivar sku: Compute tier and size of the database server. This object is empty for an Azure + Database for PostgreSQL single server. + :vartype sku: ~azure.mgmt.postgresqlflexibleservers.models.ServerSku """ + _validation = { + "location": {"readonly": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[IndexRecommendationResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "storage_mb": {"key": "storageMb", "type": "int"}, + "sku": {"key": "sku", "type": "ServerSku"}, } def __init__( self, *, - value: Optional[List["_models.IndexRecommendationResource"]] = None, - next_link: Optional[str] = None, + version: Optional[str] = None, + storage_mb: Optional[int] = None, + sku: Optional["_models.ServerSku"] = None, **kwargs: Any ) -> None: """ - :keyword value: A list of available index recommendations. - :paramtype value: - list[~azure.mgmt.postgresqlflexibleservers.models.IndexRecommendationResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str + :keyword version: Major version of PostgreSQL database engine. + :paramtype version: str + :keyword storage_mb: Storage size (in MB) for database server. + :paramtype storage_mb: int + :keyword sku: Compute tier and size of the database server. This object is empty for an Azure + Database for PostgreSQL single server. + :paramtype sku: ~azure.mgmt.postgresqlflexibleservers.models.ServerSku """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.location: Optional[str] = None + self.version = version + self.storage_mb = storage_mb + self.sku = sku -class IndexRecommendationResource(ProxyResource): - """Index recommendation properties. +class DelegatedSubnetUsage(_serialization.Model): + """Delegated subnet usage data. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar subnet_name: Name of the delegated subnet for which IP addresses are in use. + :vartype subnet_name: str + :ivar usage: Number of IP addresses used by the delegated subnet. + :vartype usage: int + """ + + _validation = { + "subnet_name": {"readonly": True}, + "usage": {"readonly": True}, + } + + _attribute_map = { + "subnet_name": {"key": "subnetName", "type": "str"}, + "usage": {"key": "usage", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.subnet_name: Optional[str] = None + self.usage: Optional[int] = None + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - :ivar initial_recommended_time: Creation time of this recommendation in UTC date-time string - format. - :vartype initial_recommended_time: ~datetime.datetime - :ivar last_recommended_time: The last refresh of this recommendation in UTC date-time string - format. - :vartype last_recommended_time: ~datetime.datetime - :ivar times_recommended: The number of times this recommendation has encountered. - :vartype times_recommended: int - :ivar improved_query_ids: The ImprovedQueryIds. The list will only be populated for CREATE - INDEX recommendations. - :vartype improved_query_ids: list[int] - :ivar recommendation_reason: Reason for this recommendation. - :vartype recommendation_reason: str - :ivar recommendation_type: Type for this recommendation. Known values are: "CreateIndex", - "DropIndex", and "ReIndex". - :vartype recommendation_type: str or - ~azure.mgmt.postgresqlflexibleservers.models.RecommendationTypeEnum - :ivar implementation_details: Stores implementation details for the recommended action. - :vartype implementation_details: - ~azure.mgmt.postgresqlflexibleservers.models.IndexRecommendationResourcePropertiesImplementationDetails - :ivar analyzed_workload: Stores workload information for the recommended action. - :vartype analyzed_workload: - ~azure.mgmt.postgresqlflexibleservers.models.IndexRecommendationResourcePropertiesAnalyzedWorkload - :ivar estimated_impact: The estimated impact of this recommended action. - :vartype estimated_impact: list[~azure.mgmt.postgresqlflexibleservers.models.ImpactRecord] - :ivar details: Stores recommendation details for the recommended action. - :vartype details: ~azure.mgmt.postgresqlflexibleservers.models.IndexRecommendationDetails + :ivar info: The additional info. + :vartype info: JSON """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, - "estimated_impact": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + self.info: Optional[JSON] = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.postgresqlflexibleservers.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.postgresqlflexibleservers.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "initial_recommended_time": {"key": "properties.initialRecommendedTime", "type": "iso-8601"}, - "last_recommended_time": {"key": "properties.lastRecommendedTime", "type": "iso-8601"}, - "times_recommended": {"key": "properties.timesRecommended", "type": "int"}, - "improved_query_ids": {"key": "properties.improvedQueryIds", "type": "[int]"}, - "recommendation_reason": {"key": "properties.recommendationReason", "type": "str"}, - "recommendation_type": {"key": "properties.recommendationType", "type": "str"}, - "implementation_details": { - "key": "properties.implementationDetails", - "type": "IndexRecommendationResourcePropertiesImplementationDetails", - }, - "analyzed_workload": { - "key": "properties.analyzedWorkload", - "type": "IndexRecommendationResourcePropertiesAnalyzedWorkload", - }, - "estimated_impact": {"key": "properties.estimatedImpact", "type": "[ImpactRecord]"}, - "details": {"key": "properties.details", "type": "IndexRecommendationDetails"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - *, - initial_recommended_time: Optional[datetime.datetime] = None, - last_recommended_time: Optional[datetime.datetime] = None, - times_recommended: Optional[int] = None, - improved_query_ids: Optional[List[int]] = None, - recommendation_reason: Optional[str] = None, - recommendation_type: Optional[Union[str, "_models.RecommendationTypeEnum"]] = None, - implementation_details: Optional["_models.IndexRecommendationResourcePropertiesImplementationDetails"] = None, - analyzed_workload: Optional["_models.IndexRecommendationResourcePropertiesAnalyzedWorkload"] = None, - **kwargs: Any - ) -> None: - """ - :keyword initial_recommended_time: Creation time of this recommendation in UTC date-time string - format. - :paramtype initial_recommended_time: ~datetime.datetime - :keyword last_recommended_time: The last refresh of this recommendation in UTC date-time string - format. - :paramtype last_recommended_time: ~datetime.datetime - :keyword times_recommended: The number of times this recommendation has encountered. - :paramtype times_recommended: int - :keyword improved_query_ids: The ImprovedQueryIds. The list will only be populated for CREATE - INDEX recommendations. - :paramtype improved_query_ids: list[int] - :keyword recommendation_reason: Reason for this recommendation. - :paramtype recommendation_reason: str - :keyword recommendation_type: Type for this recommendation. Known values are: "CreateIndex", - "DropIndex", and "ReIndex". - :paramtype recommendation_type: str or - ~azure.mgmt.postgresqlflexibleservers.models.RecommendationTypeEnum - :keyword implementation_details: Stores implementation details for the recommended action. - :paramtype implementation_details: - ~azure.mgmt.postgresqlflexibleservers.models.IndexRecommendationResourcePropertiesImplementationDetails - :keyword analyzed_workload: Stores workload information for the recommended action. - :paramtype analyzed_workload: - ~azure.mgmt.postgresqlflexibleservers.models.IndexRecommendationResourcePropertiesAnalyzedWorkload - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.initial_recommended_time = initial_recommended_time - self.last_recommended_time = last_recommended_time - self.times_recommended = times_recommended - self.improved_query_ids = improved_query_ids - self.recommendation_reason = recommendation_reason - self.recommendation_type = recommendation_type - self.implementation_details = implementation_details - self.analyzed_workload = analyzed_workload - self.estimated_impact: Optional[List["_models.ImpactRecord"]] = None - self.details: Optional["_models.IndexRecommendationDetails"] = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[list["_models.ErrorDetail"]] = None + self.additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = None -class IndexRecommendationResourcePropertiesAnalyzedWorkload(_serialization.Model): # pylint: disable=name-too-long - """Stores workload information for the recommended action. +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). - :ivar start_time: Workload start time in UTC date-time string format. - :vartype start_time: ~datetime.datetime - :ivar end_time: Workload end time in UTC date-time string format. - :vartype end_time: ~datetime.datetime - :ivar query_count: Workload query examined count. For DROP INDEX will be 0. - :vartype query_count: int + :ivar error: The error object. + :vartype error: ~azure.mgmt.postgresqlflexibleservers.models.ErrorDetail """ _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "query_count": {"key": "queryCount", "type": "int"}, + "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__( - self, - *, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - query_count: Optional[int] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ - :keyword start_time: Workload start time in UTC date-time string format. - :paramtype start_time: ~datetime.datetime - :keyword end_time: Workload end time in UTC date-time string format. - :paramtype end_time: ~datetime.datetime - :keyword query_count: Workload query examined count. For DROP INDEX will be 0. - :paramtype query_count: int + :keyword error: The error object. + :paramtype error: ~azure.mgmt.postgresqlflexibleservers.models.ErrorDetail """ super().__init__(**kwargs) - self.start_time = start_time - self.end_time = end_time - self.query_count = query_count + self.error = error -class IndexRecommendationResourcePropertiesImplementationDetails(_serialization.Model): # pylint: disable=name-too-long - """Stores implementation details for the recommended action. +class FastProvisioningEditionCapability(CapabilityBase): + """Capability of a fast provisioning compute tier. - :ivar method: Method of implementation for recommended action. - :vartype method: str - :ivar script: Implementation script for the recommended action. - :vartype script: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The status of the capability. Known values are: "Visible", "Available", + "Default", and "Disabled". + :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus + :ivar reason: The reason for the capability not being available. + :vartype reason: str + :ivar supported_tier: Compute tier supporting fast provisioning. + :vartype supported_tier: str + :ivar supported_sku: Compute name (SKU) supporting fast provisioning. + :vartype supported_sku: str + :ivar supported_storage_gb: Storage size (in GB) supporting fast provisioning. + :vartype supported_storage_gb: int + :ivar supported_server_versions: Major version of PostgreSQL database engine supporting fast + provisioning. + :vartype supported_server_versions: str + :ivar server_count: Count of servers in cache matching this specification. + :vartype server_count: int """ + _validation = { + "status": {"readonly": True}, + "reason": {"readonly": True}, + "supported_tier": {"readonly": True}, + "supported_sku": {"readonly": True}, + "supported_storage_gb": {"readonly": True}, + "supported_server_versions": {"readonly": True}, + "server_count": {"readonly": True}, + } + _attribute_map = { - "method": {"key": "method", "type": "str"}, - "script": {"key": "script", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, + "supported_tier": {"key": "supportedTier", "type": "str"}, + "supported_sku": {"key": "supportedSku", "type": "str"}, + "supported_storage_gb": {"key": "supportedStorageGb", "type": "int"}, + "supported_server_versions": {"key": "supportedServerVersions", "type": "str"}, + "server_count": {"key": "serverCount", "type": "int"}, } - def __init__(self, *, method: Optional[str] = None, script: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword method: Method of implementation for recommended action. - :paramtype method: str - :keyword script: Implementation script for the recommended action. - :paramtype script: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.method = method - self.script = script + self.supported_tier: Optional[str] = None + self.supported_sku: Optional[str] = None + self.supported_storage_gb: Optional[int] = None + self.supported_server_versions: Optional[str] = None + self.server_count: Optional[int] = None -class LogFile(ProxyResource): - """Represents a logFile. +class FirewallRule(ProxyResource): + """Firewall rule. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to server. + :ivar id: Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str @@ -2057,16 +2192,12 @@ class LogFile(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - :ivar created_time: Creation timestamp of the log file. - :vartype created_time: ~datetime.datetime - :ivar last_modified_time: Last modified timestamp of the log file. - :vartype last_modified_time: ~datetime.datetime - :ivar size_in_kb: The size in kb of the logFile. - :vartype size_in_kb: int - :ivar type_properties_type: Type of the log file. - :vartype type_properties_type: str - :ivar url: The url to download the log file from. - :vartype url: str + :ivar start_ip_address: IP address defining the start of the range of addresses of a firewall + rule. Must be expressed in IPv4 format. Required. + :vartype start_ip_address: str + :ivar end_ip_address: IP address defining the end of the range of addresses of a firewall rule. + Must be expressed in IPv4 format. Required. + :vartype end_ip_address: str """ _validation = { @@ -2074,6 +2205,14 @@ class LogFile(ProxyResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "start_ip_address": { + "required": True, + "pattern": r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", + }, + "end_ip_address": { + "required": True, + "pattern": r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", + }, } _attribute_map = { @@ -2081,64 +2220,45 @@ class LogFile(ProxyResource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "created_time": {"key": "properties.createdTime", "type": "iso-8601"}, - "last_modified_time": {"key": "properties.lastModifiedTime", "type": "iso-8601"}, - "size_in_kb": {"key": "properties.sizeInKb", "type": "int"}, - "type_properties_type": {"key": "properties.type", "type": "str"}, - "url": {"key": "properties.url", "type": "str"}, + "start_ip_address": {"key": "properties.startIpAddress", "type": "str"}, + "end_ip_address": {"key": "properties.endIpAddress", "type": "str"}, } - def __init__( - self, - *, - created_time: Optional[datetime.datetime] = None, - last_modified_time: Optional[datetime.datetime] = None, - size_in_kb: Optional[int] = None, - type_properties_type: Optional[str] = None, - url: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, start_ip_address: str, end_ip_address: str, **kwargs: Any) -> None: """ - :keyword created_time: Creation timestamp of the log file. - :paramtype created_time: ~datetime.datetime - :keyword last_modified_time: Last modified timestamp of the log file. - :paramtype last_modified_time: ~datetime.datetime - :keyword size_in_kb: The size in kb of the logFile. - :paramtype size_in_kb: int - :keyword type_properties_type: Type of the log file. - :paramtype type_properties_type: str - :keyword url: The url to download the log file from. - :paramtype url: str + :keyword start_ip_address: IP address defining the start of the range of addresses of a + firewall rule. Must be expressed in IPv4 format. Required. + :paramtype start_ip_address: str + :keyword end_ip_address: IP address defining the end of the range of addresses of a firewall + rule. Must be expressed in IPv4 format. Required. + :paramtype end_ip_address: str """ super().__init__(**kwargs) - self.created_time = created_time - self.last_modified_time = last_modified_time - self.size_in_kb = size_in_kb - self.type_properties_type = type_properties_type - self.url = url + self.start_ip_address = start_ip_address + self.end_ip_address = end_ip_address -class LogFileListResult(_serialization.Model): - """A List of logFiles. +class FirewallRuleList(_serialization.Model): + """List of firewall rules. - :ivar value: The list of logFiles in a server. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.LogFile] - :ivar next_link: The link used to get the next page of operations. + :ivar value: List of firewall rules in a server. + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.FirewallRule] + :ivar next_link: Link to retrieve next page of results. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[LogFile]"}, + "value": {"key": "value", "type": "[FirewallRule]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, value: Optional[List["_models.LogFile"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.FirewallRule"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The list of logFiles in a server. - :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.LogFile] - :keyword next_link: The link used to get the next page of operations. + :keyword value: List of firewall rules in a server. + :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.FirewallRule] + :keyword next_link: Link to retrieve next page of results. :paramtype next_link: str """ super().__init__(**kwargs) @@ -2146,132 +2266,148 @@ def __init__( self.next_link = next_link -class LtrBackupRequest(BackupRequestBase): - """The request that is made for a long term retention backup. +class HighAvailability(_serialization.Model): + """High availability properties of a server. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar backup_settings: Backup Settings. Required. - :vartype backup_settings: ~azure.mgmt.postgresqlflexibleservers.models.BackupSettings - :ivar target_details: Backup store detail for target server. Required. - :vartype target_details: ~azure.mgmt.postgresqlflexibleservers.models.BackupStoreDetails + :ivar mode: High availability mode for a server. Known values are: "ZoneRedundant" and + "SameZone". + :vartype mode: str or ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityMode + :ivar state: Possible states of the standby server created when high availability is set to + SameZone or ZoneRedundant. Known values are: "NotEnabled", "CreatingStandby", + "ReplicatingData", "FailingOver", "Healthy", and "RemovingStandby". + :vartype state: str or ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityState + :ivar standby_availability_zone: Availability zone associated to the standby server created + when high availability is set to SameZone or ZoneRedundant. + :vartype standby_availability_zone: str """ _validation = { - "backup_settings": {"required": True}, - "target_details": {"required": True}, + "state": {"readonly": True}, + } + + _attribute_map = { + "mode": {"key": "mode", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "standby_availability_zone": {"key": "standbyAvailabilityZone", "type": "str"}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "_models.HighAvailabilityMode"]] = None, + standby_availability_zone: str = "", + **kwargs: Any + ) -> None: + """ + :keyword mode: High availability mode for a server. Known values are: "ZoneRedundant" and + "SameZone". + :paramtype mode: str or ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityMode + :keyword standby_availability_zone: Availability zone associated to the standby server created + when high availability is set to SameZone or ZoneRedundant. + :paramtype standby_availability_zone: str + """ + super().__init__(**kwargs) + self.mode = mode + self.state: Optional[Union[str, "_models.HighAvailabilityState"]] = None + self.standby_availability_zone = standby_availability_zone + + +class HighAvailabilityForPatch(_serialization.Model): + """High availability properties of a server. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar mode: High availability mode for a server. Known values are: "ZoneRedundant" and + "SameZone". + :vartype mode: str or ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityMode + :ivar state: Possible states of the standby server created when high availability is set to + SameZone or ZoneRedundant. Known values are: "NotEnabled", "CreatingStandby", + "ReplicatingData", "FailingOver", "Healthy", and "RemovingStandby". + :vartype state: str or ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityState + :ivar standby_availability_zone: Availability zone associated to the standby server created + when high availability is set to SameZone or ZoneRedundant. + :vartype standby_availability_zone: str + """ + + _validation = { + "state": {"readonly": True}, } _attribute_map = { - "backup_settings": {"key": "backupSettings", "type": "BackupSettings"}, - "target_details": {"key": "targetDetails", "type": "BackupStoreDetails"}, + "mode": {"key": "mode", "type": "str"}, + "state": {"key": "state", "type": "str"}, + "standby_availability_zone": {"key": "standbyAvailabilityZone", "type": "str"}, } def __init__( - self, *, backup_settings: "_models.BackupSettings", target_details: "_models.BackupStoreDetails", **kwargs: Any + self, + *, + mode: Optional[Union[str, "_models.HighAvailabilityMode"]] = None, + standby_availability_zone: str = "", + **kwargs: Any ) -> None: """ - :keyword backup_settings: Backup Settings. Required. - :paramtype backup_settings: ~azure.mgmt.postgresqlflexibleservers.models.BackupSettings - :keyword target_details: Backup store detail for target server. Required. - :paramtype target_details: ~azure.mgmt.postgresqlflexibleservers.models.BackupStoreDetails + :keyword mode: High availability mode for a server. Known values are: "ZoneRedundant" and + "SameZone". + :paramtype mode: str or ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityMode + :keyword standby_availability_zone: Availability zone associated to the standby server created + when high availability is set to SameZone or ZoneRedundant. + :paramtype standby_availability_zone: str """ - super().__init__(backup_settings=backup_settings, **kwargs) - self.target_details = target_details - + super().__init__(**kwargs) + self.mode = mode + self.state: Optional[Union[str, "_models.HighAvailabilityState"]] = None + self.standby_availability_zone = standby_availability_zone -class LtrBackupResponse(_serialization.Model): - """Response for the LTR backup API call. - Variables are only populated by the server, and will be ignored when sending a request. +class ImpactRecord(_serialization.Model): + """Impact on some metric if this recommended action is applied. - :ivar datasource_size_in_bytes: Size of datasource in bytes. - :vartype datasource_size_in_bytes: int - :ivar data_transferred_in_bytes: Data transferred in bytes. - :vartype data_transferred_in_bytes: int - :ivar backup_name: Name of Backup operation. - :vartype backup_name: str - :ivar backup_metadata: Metadata to be stored in RP. Store everything that will be required to - perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc. - :vartype backup_metadata: str - :ivar status: Service-set extensible enum indicating the status of operation. Known values are: - "Running", "Cancelled", "Failed", and "Succeeded". - :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.ExecutionStatus - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar percent_complete: PercentageCompleted. - :vartype percent_complete: float - :ivar error_code: The error code. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str + :ivar dimension_name: Dimension name. + :vartype dimension_name: str + :ivar unit: Dimension unit. + :vartype unit: str + :ivar query_id: Optional property that can be used to store the identifier of the query, if the + metric is for a specific query. + :vartype query_id: int + :ivar absolute_value: Absolute value. + :vartype absolute_value: float """ - _validation = { - "percent_complete": {"maximum": 100, "minimum": 0}, - "error_code": {"readonly": True}, - "error_message": {"readonly": True}, - } - _attribute_map = { - "datasource_size_in_bytes": {"key": "properties.datasourceSizeInBytes", "type": "int"}, - "data_transferred_in_bytes": {"key": "properties.dataTransferredInBytes", "type": "int"}, - "backup_name": {"key": "properties.backupName", "type": "str"}, - "backup_metadata": {"key": "properties.backupMetadata", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "percent_complete": {"key": "properties.percentComplete", "type": "float"}, - "error_code": {"key": "properties.errorCode", "type": "str"}, - "error_message": {"key": "properties.errorMessage", "type": "str"}, + "dimension_name": {"key": "dimensionName", "type": "str"}, + "unit": {"key": "unit", "type": "str"}, + "query_id": {"key": "queryId", "type": "int"}, + "absolute_value": {"key": "absoluteValue", "type": "float"}, } def __init__( self, *, - datasource_size_in_bytes: Optional[int] = None, - data_transferred_in_bytes: Optional[int] = None, - backup_name: Optional[str] = None, - backup_metadata: Optional[str] = None, - status: Optional[Union[str, "_models.ExecutionStatus"]] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - percent_complete: Optional[float] = None, + dimension_name: Optional[str] = None, + unit: Optional[str] = None, + query_id: Optional[int] = None, + absolute_value: Optional[float] = None, **kwargs: Any ) -> None: """ - :keyword datasource_size_in_bytes: Size of datasource in bytes. - :paramtype datasource_size_in_bytes: int - :keyword data_transferred_in_bytes: Data transferred in bytes. - :paramtype data_transferred_in_bytes: int - :keyword backup_name: Name of Backup operation. - :paramtype backup_name: str - :keyword backup_metadata: Metadata to be stored in RP. Store everything that will be required - to perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc. - :paramtype backup_metadata: str - :keyword status: Service-set extensible enum indicating the status of operation. Known values - are: "Running", "Cancelled", "Failed", and "Succeeded". - :paramtype status: str or ~azure.mgmt.postgresqlflexibleservers.models.ExecutionStatus - :keyword start_time: Start time of the operation. - :paramtype start_time: ~datetime.datetime - :keyword end_time: End time of the operation. - :paramtype end_time: ~datetime.datetime - :keyword percent_complete: PercentageCompleted. - :paramtype percent_complete: float + :keyword dimension_name: Dimension name. + :paramtype dimension_name: str + :keyword unit: Dimension unit. + :paramtype unit: str + :keyword query_id: Optional property that can be used to store the identifier of the query, if + the metric is for a specific query. + :paramtype query_id: int + :keyword absolute_value: Absolute value. + :paramtype absolute_value: float """ super().__init__(**kwargs) - self.datasource_size_in_bytes = datasource_size_in_bytes - self.data_transferred_in_bytes = data_transferred_in_bytes - self.backup_name = backup_name - self.backup_metadata = backup_metadata - self.status = status - self.start_time = start_time - self.end_time = end_time - self.percent_complete = percent_complete - self.error_code: Optional[str] = None - self.error_message: Optional[str] = None + self.dimension_name = dimension_name + self.unit = unit + self.query_id = query_id + self.absolute_value = absolute_value class LtrPreBackupRequest(BackupRequestBase): @@ -2314,143 +2450,32 @@ def __init__(self, *, number_of_containers: int, **kwargs: Any) -> None: self.number_of_containers = number_of_containers -class LtrServerBackupOperation(ProxyResource): - """Response for the LTR backup Operation API call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - :ivar datasource_size_in_bytes: Size of datasource in bytes. - :vartype datasource_size_in_bytes: int - :ivar data_transferred_in_bytes: Data transferred in bytes. - :vartype data_transferred_in_bytes: int - :ivar backup_name: Name of Backup operation. - :vartype backup_name: str - :ivar backup_metadata: Metadata to be stored in RP. Store everything that will be required to - perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc. - :vartype backup_metadata: str - :ivar status: Service-set extensible enum indicating the status of operation. Known values are: - "Running", "Cancelled", "Failed", and "Succeeded". - :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.ExecutionStatus - :ivar start_time: Start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: End time of the operation. - :vartype end_time: ~datetime.datetime - :ivar percent_complete: PercentageCompleted. - :vartype percent_complete: float - :ivar error_code: The error code. - :vartype error_code: str - :ivar error_message: The error message. - :vartype error_message: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "percent_complete": {"maximum": 100, "minimum": 0}, - "error_code": {"readonly": True}, - "error_message": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "datasource_size_in_bytes": {"key": "properties.datasourceSizeInBytes", "type": "int"}, - "data_transferred_in_bytes": {"key": "properties.dataTransferredInBytes", "type": "int"}, - "backup_name": {"key": "properties.backupName", "type": "str"}, - "backup_metadata": {"key": "properties.backupMetadata", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - "end_time": {"key": "properties.endTime", "type": "iso-8601"}, - "percent_complete": {"key": "properties.percentComplete", "type": "float"}, - "error_code": {"key": "properties.errorCode", "type": "str"}, - "error_message": {"key": "properties.errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - datasource_size_in_bytes: Optional[int] = None, - data_transferred_in_bytes: Optional[int] = None, - backup_name: Optional[str] = None, - backup_metadata: Optional[str] = None, - status: Optional[Union[str, "_models.ExecutionStatus"]] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - percent_complete: Optional[float] = None, - **kwargs: Any - ) -> None: - """ - :keyword datasource_size_in_bytes: Size of datasource in bytes. - :paramtype datasource_size_in_bytes: int - :keyword data_transferred_in_bytes: Data transferred in bytes. - :paramtype data_transferred_in_bytes: int - :keyword backup_name: Name of Backup operation. - :paramtype backup_name: str - :keyword backup_metadata: Metadata to be stored in RP. Store everything that will be required - to perform a successful restore using this Recovery point. e.g. Versions, DataFormat etc. - :paramtype backup_metadata: str - :keyword status: Service-set extensible enum indicating the status of operation. Known values - are: "Running", "Cancelled", "Failed", and "Succeeded". - :paramtype status: str or ~azure.mgmt.postgresqlflexibleservers.models.ExecutionStatus - :keyword start_time: Start time of the operation. - :paramtype start_time: ~datetime.datetime - :keyword end_time: End time of the operation. - :paramtype end_time: ~datetime.datetime - :keyword percent_complete: PercentageCompleted. - :paramtype percent_complete: float - """ - super().__init__(**kwargs) - self.datasource_size_in_bytes = datasource_size_in_bytes - self.data_transferred_in_bytes = data_transferred_in_bytes - self.backup_name = backup_name - self.backup_metadata = backup_metadata - self.status = status - self.start_time = start_time - self.end_time = end_time - self.percent_complete = percent_complete - self.error_code: Optional[str] = None - self.error_message: Optional[str] = None - - class LtrServerBackupOperationList(_serialization.Model): """A list of long term retention backup operations for server. :ivar value: The list of long term retention server backup operations. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.LtrServerBackupOperation] + :vartype value: + list[~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionOperation] :ivar next_link: The link used to get the next page of operations. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[LtrServerBackupOperation]"}, + "value": {"key": "value", "type": "[BackupsLongTermRetentionOperation]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - value: Optional[List["_models.LtrServerBackupOperation"]] = None, + value: Optional[list["_models.BackupsLongTermRetentionOperation"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: The list of long term retention server backup operations. - :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.LtrServerBackupOperation] + :paramtype value: + list[~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionOperation] :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str """ @@ -2462,13 +2487,13 @@ def __init__( class MaintenanceWindow(_serialization.Model): """Maintenance window properties of a server. - :ivar custom_window: indicates whether custom window is enabled or disabled. + :ivar custom_window: Indicates whether custom window is enabled or disabled. :vartype custom_window: str - :ivar start_hour: start hour for maintenance window. + :ivar start_hour: Start hour to be used for maintenance window. :vartype start_hour: int - :ivar start_minute: start minute for maintenance window. + :ivar start_minute: Start minute to be used for maintenance window. :vartype start_minute: int - :ivar day_of_week: day of week for maintenance window. + :ivar day_of_week: Day of the week to be used for maintenance window. :vartype day_of_week: int """ @@ -2489,13 +2514,13 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword custom_window: indicates whether custom window is enabled or disabled. + :keyword custom_window: Indicates whether custom window is enabled or disabled. :paramtype custom_window: str - :keyword start_hour: start hour for maintenance window. + :keyword start_hour: Start hour to be used for maintenance window. :paramtype start_hour: int - :keyword start_minute: start minute for maintenance window. + :keyword start_minute: Start minute to be used for maintenance window. :paramtype start_minute: int - :keyword day_of_week: day of week for maintenance window. + :keyword day_of_week: Day of the week to be used for maintenance window. :paramtype day_of_week: int """ super().__init__(**kwargs) @@ -2505,56 +2530,50 @@ def __init__( self.day_of_week = day_of_week -class MigrationNameAvailabilityResource(_serialization.Model): - """Represents a migration name's availability. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. +class MaintenanceWindowForPatch(_serialization.Model): + """Maintenance window properties of a server. - :ivar name: The resource name to verify. Required. - :vartype name: str - :ivar type: The type of the resource. Required. - :vartype type: str - :ivar name_available: Indicates whether the resource name is available. - :vartype name_available: bool - :ivar reason: Migration name availability reason. Known values are: "Invalid" and - "AlreadyExists". - :vartype reason: str or - ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityReason - :ivar message: Migration name availability message. - :vartype message: str + :ivar custom_window: Indicates whether custom window is enabled or disabled. + :vartype custom_window: str + :ivar start_hour: Start hour to be used for maintenance window. + :vartype start_hour: int + :ivar start_minute: Start minute to be used for maintenance window. + :vartype start_minute: int + :ivar day_of_week: Day of the week to be used for maintenance window. + :vartype day_of_week: int """ - _validation = { - "name": {"required": True}, - "type": {"required": True}, - "name_available": {"readonly": True}, - "reason": {"readonly": True}, - "message": {"readonly": True}, - } - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, + "custom_window": {"key": "customWindow", "type": "str"}, + "start_hour": {"key": "startHour", "type": "int"}, + "start_minute": {"key": "startMinute", "type": "int"}, + "day_of_week": {"key": "dayOfWeek", "type": "int"}, } - def __init__(self, *, name: str, type: str, **kwargs: Any) -> None: + def __init__( + self, + *, + custom_window: Optional[str] = None, + start_hour: Optional[int] = None, + start_minute: Optional[int] = None, + day_of_week: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword name: The resource name to verify. Required. - :paramtype name: str - :keyword type: The type of the resource. Required. - :paramtype type: str + :keyword custom_window: Indicates whether custom window is enabled or disabled. + :paramtype custom_window: str + :keyword start_hour: Start hour to be used for maintenance window. + :paramtype start_hour: int + :keyword start_minute: Start minute to be used for maintenance window. + :paramtype start_minute: int + :keyword day_of_week: Day of the week to be used for maintenance window. + :paramtype day_of_week: int """ super().__init__(**kwargs) - self.name = name - self.type = type - self.name_available: Optional[bool] = None - self.reason: Optional[Union[str, "_models.MigrationNameAvailabilityReason"]] = None - self.message: Optional[str] = None + self.custom_window = custom_window + self.start_hour = start_hour + self.start_minute = start_minute + self.day_of_week = day_of_week class TrackedResource(Resource): @@ -2599,7 +2618,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2611,8 +2630,8 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class MigrationResource(TrackedResource): - """Represents a migration resource. +class Migration(TrackedResource): + """Properties of a migration. Variables are only populated by the server, and will be ignored when sending a request. @@ -2633,91 +2652,91 @@ class MigrationResource(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar migration_id: ID for migration, a GUID. + :ivar migration_id: Identifier of a migration. :vartype migration_id: str - :ivar current_status: Current status of migration. + :ivar current_status: Current status of a migration. :vartype current_status: ~azure.mgmt.postgresqlflexibleservers.models.MigrationStatus - :ivar migration_instance_resource_id: ResourceId of the private endpoint migration instance. + :ivar migration_instance_resource_id: Identifier of the private endpoint migration instance. :vartype migration_instance_resource_id: str - :ivar migration_mode: There are two types of migration modes Online and Offline. Known values - are: "Offline" and "Online". + :ivar migration_mode: Mode used to perform the migration: Online or Offline. Known values are: + "Offline" and "Online". :vartype migration_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationMode - :ivar migration_option: This indicates the supported Migration option for the migration. Known - values are: "Validate", "Migrate", and "ValidateAndMigrate". + :ivar migration_option: Supported option for a migration. Known values are: "Validate", + "Migrate", and "ValidateAndMigrate". :vartype migration_option: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationOption - :ivar source_type: migration source server type : OnPremises, AWS, GCP, AzureVM, - PostgreSQLSingleServer, AWS_RDS, AWS_AURORA, AWS_EC2, GCP_CloudSQL, GCP_AlloyDB, GCP_Compute, - EDB, EDB_Oracle_Server, EDB_PostgreSQL, PostgreSQLFlexibleServer, PostgreSQLCosmosDB, - Huawei_RDS, Huawei_Compute, Heroku_PostgreSQL, Crunchy_PostgreSQL, ApsaraDB_RDS, - Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, or Supabase_PostgreSQL. Known values are: - "OnPremises", "AWS", "GCP", "AzureVM", "PostgreSQLSingleServer", "AWS_RDS", "AWS_AURORA", - "AWS_EC2", "GCP_CloudSQL", "GCP_AlloyDB", "GCP_Compute", "EDB", "EDB_Oracle_Server", - "EDB_PostgreSQL", "PostgreSQLFlexibleServer", "PostgreSQLCosmosDB", "Huawei_RDS", - "Huawei_Compute", "Heroku_PostgreSQL", "Crunchy_PostgreSQL", "ApsaraDB_RDS", + :ivar source_type: Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, + AWS_EC2, AWS_RDS, AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, + Digital_Ocean_PostgreSQL, EDB, EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, + GCP_CloudSQL, GCP_Compute, Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, + PostgreSQLCosmosDB, PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL. + Known values are: "OnPremises", "AWS", "GCP", "AzureVM", "PostgreSQLSingleServer", "AWS_RDS", + "AWS_AURORA", "AWS_EC2", "GCP_CloudSQL", "GCP_AlloyDB", "GCP_Compute", "EDB", + "EDB_Oracle_Server", "EDB_PostgreSQL", "PostgreSQLFlexibleServer", "PostgreSQLCosmosDB", + "Huawei_RDS", "Huawei_Compute", "Heroku_PostgreSQL", "Crunchy_PostgreSQL", "ApsaraDB_RDS", "Digital_Ocean_Droplets", "Digital_Ocean_PostgreSQL", and "Supabase_PostgreSQL". :vartype source_type: str or ~azure.mgmt.postgresqlflexibleservers.models.SourceType - :ivar ssl_mode: SSL modes for migration. Default SSL mode for PostgreSQLSingleServer is - VerifyFull and Prefer for other source types. Known values are: "Prefer", "Require", - "VerifyCA", and "VerifyFull". + :ivar ssl_mode: SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' is + 'VerifyFull'. Default SSL mode for other source types is 'Prefer'. Known values are: "Prefer", + "Require", "VerifyCA", and "VerifyFull". :vartype ssl_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.SslMode - :ivar source_db_server_metadata: Metadata of the source database server. + :ivar source_db_server_metadata: Metadata of source database server. :vartype source_db_server_metadata: ~azure.mgmt.postgresqlflexibleservers.models.DbServerMetadata - :ivar target_db_server_metadata: Metadata of the target database server. + :ivar target_db_server_metadata: Metadata of target database server. :vartype target_db_server_metadata: ~azure.mgmt.postgresqlflexibleservers.models.DbServerMetadata - :ivar source_db_server_resource_id: ResourceId of the source database server in case the - sourceType is PostgreSQLSingleServer. For other source types this should be + :ivar source_db_server_resource_id: Identifier of the source database server resource, when + 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username. :vartype source_db_server_resource_id: str - :ivar source_db_server_fully_qualified_domain_name: Source server fully qualified domain name - (FQDN) or IP address. It is a optional value, if customer provide it, migration service will - always use it for connection. + :ivar source_db_server_fully_qualified_domain_name: Fully qualified domain name (FQDN) or IP + address of the source server. This property is optional. When provided, the migration service + will always use it to connect to the source server. :vartype source_db_server_fully_qualified_domain_name: str - :ivar target_db_server_resource_id: ResourceId of the source database server. + :ivar target_db_server_resource_id: Identifier of the target database server resource. :vartype target_db_server_resource_id: str - :ivar target_db_server_fully_qualified_domain_name: Target server fully qualified domain name - (FQDN) or IP address. It is a optional value, if customer provide it, migration service will - always use it for connection. + :ivar target_db_server_fully_qualified_domain_name: Fully qualified domain name (FQDN) or IP + address of the target server. This property is optional. When provided, the migration service + will always use it to connect to the target server. :vartype target_db_server_fully_qualified_domain_name: str :ivar secret_parameters: Migration secret parameters. :vartype secret_parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationSecretParameters - :ivar dbs_to_migrate: Number of databases to migrate. + :ivar dbs_to_migrate: Names of databases to migrate. :vartype dbs_to_migrate: list[str] - :ivar setup_logical_replication_on_source_db_if_needed: Indicates whether to setup - LogicalReplicationOnSourceDb, if needed. Known values are: "True" and "False". + :ivar setup_logical_replication_on_source_db_if_needed: Indicates whether to setup logical + replication on source server, if needed. Known values are: "True" and "False". :vartype setup_logical_replication_on_source_db_if_needed: str or - ~azure.mgmt.postgresqlflexibleservers.models.LogicalReplicationOnSourceDbEnum - :ivar overwrite_dbs_in_target: Indicates whether the databases on the target server can be - overwritten, if already present. If set to False, the migration workflow will wait for a - confirmation, if it detects that the database already exists. Known values are: "True" and - "False". + ~azure.mgmt.postgresqlflexibleservers.models.LogicalReplicationOnSourceServer + :ivar overwrite_dbs_in_target: Indicates if databases on the target server can be overwritten + when already present. If set to 'False', when the migration workflow detects that the database + already exists on the target server, it will wait for a confirmation. Known values are: "True" + and "False". :vartype overwrite_dbs_in_target: str or - ~azure.mgmt.postgresqlflexibleservers.models.OverwriteDbsInTargetEnum - :ivar migration_window_start_time_in_utc: Start time in UTC for migration window. + ~azure.mgmt.postgresqlflexibleservers.models.OverwriteDatabasesOnTargetServer + :ivar migration_window_start_time_in_utc: Start time (UTC) for migration window. :vartype migration_window_start_time_in_utc: ~datetime.datetime - :ivar migration_window_end_time_in_utc: End time in UTC for migration window. + :ivar migration_window_end_time_in_utc: End time (UTC) for migration window. :vartype migration_window_end_time_in_utc: ~datetime.datetime - :ivar migrate_roles: To migrate roles and permissions we need to send this flag as True. Known - values are: "True" and "False". - :vartype migrate_roles: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrateRolesEnum - :ivar start_data_migration: Indicates whether the data migration should start right away. Known - values are: "True" and "False". + :ivar migrate_roles: Indicates if roles and permissions must be migrated. Known values are: + "True" and "False". + :vartype migrate_roles: str or + ~azure.mgmt.postgresqlflexibleservers.models.MigrateRolesAndPermissions + :ivar start_data_migration: Indicates if data migration must start right away. Known values + are: "True" and "False". :vartype start_data_migration: str or - ~azure.mgmt.postgresqlflexibleservers.models.StartDataMigrationEnum - :ivar trigger_cutover: To trigger cutover for entire migration we need to send this flag as - True. Known values are: "True" and "False". - :vartype trigger_cutover: str or - ~azure.mgmt.postgresqlflexibleservers.models.TriggerCutoverEnum - :ivar dbs_to_trigger_cutover_on: When you want to trigger cutover for specific databases send - triggerCutover flag as True and database names in this array. - :vartype dbs_to_trigger_cutover_on: list[str] - :ivar cancel: To trigger cancel for entire migration we need to send this flag as True. Known + ~azure.mgmt.postgresqlflexibleservers.models.StartDataMigration + :ivar trigger_cutover: Indicates if cutover must be triggered for the entire migration. Known values are: "True" and "False". - :vartype cancel: str or ~azure.mgmt.postgresqlflexibleservers.models.CancelEnum - :ivar dbs_to_cancel_migration_on: When you want to trigger cancel for specific databases send - cancel flag as True and database names in this array. + :vartype trigger_cutover: str or ~azure.mgmt.postgresqlflexibleservers.models.TriggerCutover + :ivar dbs_to_trigger_cutover_on: When you want to trigger cutover for specific databases set + 'triggerCutover' to 'True' and the names of the specific databases in this array. + :vartype dbs_to_trigger_cutover_on: list[str] + :ivar cancel: Indicates if cancel must be triggered for the entire migration. Known values are: + "True" and "False". + :vartype cancel: str or ~azure.mgmt.postgresqlflexibleservers.models.Cancel + :ivar dbs_to_cancel_migration_on: When you want to trigger cancel for specific databases set + 'triggerCutover' to 'True' and the names of the specific databases in this array. :vartype dbs_to_cancel_migration_on: list[str] """ @@ -2782,7 +2801,7 @@ def __init__( # pylint: disable=too-many-locals self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, migration_instance_resource_id: Optional[str] = None, migration_mode: Optional[Union[str, "_models.MigrationMode"]] = None, migration_option: Optional[Union[str, "_models.MigrationOption"]] = None, @@ -2792,19 +2811,19 @@ def __init__( # pylint: disable=too-many-locals source_db_server_fully_qualified_domain_name: Optional[str] = None, target_db_server_fully_qualified_domain_name: Optional[str] = None, secret_parameters: Optional["_models.MigrationSecretParameters"] = None, - dbs_to_migrate: Optional[List[str]] = None, + dbs_to_migrate: Optional[list[str]] = None, setup_logical_replication_on_source_db_if_needed: Optional[ - Union[str, "_models.LogicalReplicationOnSourceDbEnum"] + Union[str, "_models.LogicalReplicationOnSourceServer"] ] = None, - overwrite_dbs_in_target: Optional[Union[str, "_models.OverwriteDbsInTargetEnum"]] = None, + overwrite_dbs_in_target: Optional[Union[str, "_models.OverwriteDatabasesOnTargetServer"]] = None, migration_window_start_time_in_utc: Optional[datetime.datetime] = None, migration_window_end_time_in_utc: Optional[datetime.datetime] = None, - migrate_roles: Optional[Union[str, "_models.MigrateRolesEnum"]] = None, - start_data_migration: Optional[Union[str, "_models.StartDataMigrationEnum"]] = None, - trigger_cutover: Optional[Union[str, "_models.TriggerCutoverEnum"]] = None, - dbs_to_trigger_cutover_on: Optional[List[str]] = None, - cancel: Optional[Union[str, "_models.CancelEnum"]] = None, - dbs_to_cancel_migration_on: Optional[List[str]] = None, + migrate_roles: Optional[Union[str, "_models.MigrateRolesAndPermissions"]] = None, + start_data_migration: Optional[Union[str, "_models.StartDataMigration"]] = None, + trigger_cutover: Optional[Union[str, "_models.TriggerCutover"]] = None, + dbs_to_trigger_cutover_on: Optional[list[str]] = None, + cancel: Optional[Union[str, "_models.Cancel"]] = None, + dbs_to_cancel_migration_on: Optional[list[str]] = None, **kwargs: Any ) -> None: """ @@ -2812,80 +2831,80 @@ def __init__( # pylint: disable=too-many-locals :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword migration_instance_resource_id: ResourceId of the private endpoint migration instance. + :keyword migration_instance_resource_id: Identifier of the private endpoint migration instance. :paramtype migration_instance_resource_id: str - :keyword migration_mode: There are two types of migration modes Online and Offline. Known - values are: "Offline" and "Online". + :keyword migration_mode: Mode used to perform the migration: Online or Offline. Known values + are: "Offline" and "Online". :paramtype migration_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationMode - :keyword migration_option: This indicates the supported Migration option for the migration. - Known values are: "Validate", "Migrate", and "ValidateAndMigrate". + :keyword migration_option: Supported option for a migration. Known values are: "Validate", + "Migrate", and "ValidateAndMigrate". :paramtype migration_option: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationOption - :keyword source_type: migration source server type : OnPremises, AWS, GCP, AzureVM, - PostgreSQLSingleServer, AWS_RDS, AWS_AURORA, AWS_EC2, GCP_CloudSQL, GCP_AlloyDB, GCP_Compute, - EDB, EDB_Oracle_Server, EDB_PostgreSQL, PostgreSQLFlexibleServer, PostgreSQLCosmosDB, - Huawei_RDS, Huawei_Compute, Heroku_PostgreSQL, Crunchy_PostgreSQL, ApsaraDB_RDS, - Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, or Supabase_PostgreSQL. Known values are: - "OnPremises", "AWS", "GCP", "AzureVM", "PostgreSQLSingleServer", "AWS_RDS", "AWS_AURORA", - "AWS_EC2", "GCP_CloudSQL", "GCP_AlloyDB", "GCP_Compute", "EDB", "EDB_Oracle_Server", - "EDB_PostgreSQL", "PostgreSQLFlexibleServer", "PostgreSQLCosmosDB", "Huawei_RDS", - "Huawei_Compute", "Heroku_PostgreSQL", "Crunchy_PostgreSQL", "ApsaraDB_RDS", + :keyword source_type: Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, + AWS_EC2, AWS_RDS, AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, + Digital_Ocean_PostgreSQL, EDB, EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, + GCP_CloudSQL, GCP_Compute, Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, + PostgreSQLCosmosDB, PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL. + Known values are: "OnPremises", "AWS", "GCP", "AzureVM", "PostgreSQLSingleServer", "AWS_RDS", + "AWS_AURORA", "AWS_EC2", "GCP_CloudSQL", "GCP_AlloyDB", "GCP_Compute", "EDB", + "EDB_Oracle_Server", "EDB_PostgreSQL", "PostgreSQLFlexibleServer", "PostgreSQLCosmosDB", + "Huawei_RDS", "Huawei_Compute", "Heroku_PostgreSQL", "Crunchy_PostgreSQL", "ApsaraDB_RDS", "Digital_Ocean_Droplets", "Digital_Ocean_PostgreSQL", and "Supabase_PostgreSQL". :paramtype source_type: str or ~azure.mgmt.postgresqlflexibleservers.models.SourceType - :keyword ssl_mode: SSL modes for migration. Default SSL mode for PostgreSQLSingleServer is - VerifyFull and Prefer for other source types. Known values are: "Prefer", "Require", - "VerifyCA", and "VerifyFull". + :keyword ssl_mode: SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' + is 'VerifyFull'. Default SSL mode for other source types is 'Prefer'. Known values are: + "Prefer", "Require", "VerifyCA", and "VerifyFull". :paramtype ssl_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.SslMode - :keyword source_db_server_resource_id: ResourceId of the source database server in case the - sourceType is PostgreSQLSingleServer. For other source types this should be + :keyword source_db_server_resource_id: Identifier of the source database server resource, when + 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username. :paramtype source_db_server_resource_id: str - :keyword source_db_server_fully_qualified_domain_name: Source server fully qualified domain - name (FQDN) or IP address. It is a optional value, if customer provide it, migration service - will always use it for connection. + :keyword source_db_server_fully_qualified_domain_name: Fully qualified domain name (FQDN) or IP + address of the source server. This property is optional. When provided, the migration service + will always use it to connect to the source server. :paramtype source_db_server_fully_qualified_domain_name: str - :keyword target_db_server_fully_qualified_domain_name: Target server fully qualified domain - name (FQDN) or IP address. It is a optional value, if customer provide it, migration service - will always use it for connection. + :keyword target_db_server_fully_qualified_domain_name: Fully qualified domain name (FQDN) or IP + address of the target server. This property is optional. When provided, the migration service + will always use it to connect to the target server. :paramtype target_db_server_fully_qualified_domain_name: str :keyword secret_parameters: Migration secret parameters. :paramtype secret_parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationSecretParameters - :keyword dbs_to_migrate: Number of databases to migrate. + :keyword dbs_to_migrate: Names of databases to migrate. :paramtype dbs_to_migrate: list[str] - :keyword setup_logical_replication_on_source_db_if_needed: Indicates whether to setup - LogicalReplicationOnSourceDb, if needed. Known values are: "True" and "False". + :keyword setup_logical_replication_on_source_db_if_needed: Indicates whether to setup logical + replication on source server, if needed. Known values are: "True" and "False". :paramtype setup_logical_replication_on_source_db_if_needed: str or - ~azure.mgmt.postgresqlflexibleservers.models.LogicalReplicationOnSourceDbEnum - :keyword overwrite_dbs_in_target: Indicates whether the databases on the target server can be - overwritten, if already present. If set to False, the migration workflow will wait for a - confirmation, if it detects that the database already exists. Known values are: "True" and - "False". + ~azure.mgmt.postgresqlflexibleservers.models.LogicalReplicationOnSourceServer + :keyword overwrite_dbs_in_target: Indicates if databases on the target server can be + overwritten when already present. If set to 'False', when the migration workflow detects that + the database already exists on the target server, it will wait for a confirmation. Known values + are: "True" and "False". :paramtype overwrite_dbs_in_target: str or - ~azure.mgmt.postgresqlflexibleservers.models.OverwriteDbsInTargetEnum - :keyword migration_window_start_time_in_utc: Start time in UTC for migration window. + ~azure.mgmt.postgresqlflexibleservers.models.OverwriteDatabasesOnTargetServer + :keyword migration_window_start_time_in_utc: Start time (UTC) for migration window. :paramtype migration_window_start_time_in_utc: ~datetime.datetime - :keyword migration_window_end_time_in_utc: End time in UTC for migration window. + :keyword migration_window_end_time_in_utc: End time (UTC) for migration window. :paramtype migration_window_end_time_in_utc: ~datetime.datetime - :keyword migrate_roles: To migrate roles and permissions we need to send this flag as True. - Known values are: "True" and "False". - :paramtype migrate_roles: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrateRolesEnum - :keyword start_data_migration: Indicates whether the data migration should start right away. - Known values are: "True" and "False". + :keyword migrate_roles: Indicates if roles and permissions must be migrated. Known values are: + "True" and "False". + :paramtype migrate_roles: str or + ~azure.mgmt.postgresqlflexibleservers.models.MigrateRolesAndPermissions + :keyword start_data_migration: Indicates if data migration must start right away. Known values + are: "True" and "False". :paramtype start_data_migration: str or - ~azure.mgmt.postgresqlflexibleservers.models.StartDataMigrationEnum - :keyword trigger_cutover: To trigger cutover for entire migration we need to send this flag as - True. Known values are: "True" and "False". - :paramtype trigger_cutover: str or - ~azure.mgmt.postgresqlflexibleservers.models.TriggerCutoverEnum - :keyword dbs_to_trigger_cutover_on: When you want to trigger cutover for specific databases - send triggerCutover flag as True and database names in this array. - :paramtype dbs_to_trigger_cutover_on: list[str] - :keyword cancel: To trigger cancel for entire migration we need to send this flag as True. + ~azure.mgmt.postgresqlflexibleservers.models.StartDataMigration + :keyword trigger_cutover: Indicates if cutover must be triggered for the entire migration. Known values are: "True" and "False". - :paramtype cancel: str or ~azure.mgmt.postgresqlflexibleservers.models.CancelEnum - :keyword dbs_to_cancel_migration_on: When you want to trigger cancel for specific databases - send cancel flag as True and database names in this array. + :paramtype trigger_cutover: str or ~azure.mgmt.postgresqlflexibleservers.models.TriggerCutover + :keyword dbs_to_trigger_cutover_on: When you want to trigger cutover for specific databases set + 'triggerCutover' to 'True' and the names of the specific databases in this array. + :paramtype dbs_to_trigger_cutover_on: list[str] + :keyword cancel: Indicates if cancel must be triggered for the entire migration. Known values + are: "True" and "False". + :paramtype cancel: str or ~azure.mgmt.postgresqlflexibleservers.models.Cancel + :keyword dbs_to_cancel_migration_on: When you want to trigger cancel for specific databases set + 'triggerCutover' to 'True' and the names of the specific databases in this array. :paramtype dbs_to_cancel_migration_on: list[str] """ super().__init__(tags=tags, location=location, **kwargs) @@ -2916,60 +2935,144 @@ def __init__( # pylint: disable=too-many-locals self.dbs_to_cancel_migration_on = dbs_to_cancel_migration_on +class MigrationList(_serialization.Model): + """List of migrations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of migrations. + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.Migration] + :ivar next_link: Link used to get the next page of results. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Migration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link used to get the next page of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value: Optional[list["_models.Migration"]] = None + self.next_link = next_link + + +class MigrationNameAvailability(_serialization.Model): + """Availability of a migration name. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar name: Name of the migration to check for validity and availability. Required. + :vartype name: str + :ivar type: Type of resource. Required. + :vartype type: str + :ivar name_available: Indicates if the migration name is available. + :vartype name_available: bool + :ivar reason: Migration name availability reason. Known values are: "Invalid" and + "AlreadyExists". + :vartype reason: str or + ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityReason + :ivar message: Migration name availability message. + :vartype message: str + """ + + _validation = { + "name": {"required": True}, + "type": {"required": True}, + "name_available": {"readonly": True}, + "reason": {"readonly": True}, + "message": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, name: str, type: str, **kwargs: Any) -> None: + """ + :keyword name: Name of the migration to check for validity and availability. Required. + :paramtype name: str + :keyword type: Type of resource. Required. + :paramtype type: str + """ + super().__init__(**kwargs) + self.name = name + self.type = type + self.name_available: Optional[bool] = None + self.reason: Optional[Union[str, "_models.MigrationNameAvailabilityReason"]] = None + self.message: Optional[str] = None + + class MigrationResourceForPatch(_serialization.Model): - """Represents a migration resource for patch. + """Migration. :ivar tags: Application-specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar source_db_server_resource_id: ResourceId of the source database server. + :ivar source_db_server_resource_id: Identifier of the source database server resource, when + 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to + ipaddress:port@username or hostname:port@username. :vartype source_db_server_resource_id: str - :ivar source_db_server_fully_qualified_domain_name: Source server fully qualified domain name - (FQDN) or IP address. It is a optional value, if customer provide it, migration service will - always use it for connection. + :ivar source_db_server_fully_qualified_domain_name: Fully qualified domain name (FQDN) or IP + address of the source server. This property is optional. When provided, the migration service + will always use it to connect to the source server. :vartype source_db_server_fully_qualified_domain_name: str - :ivar target_db_server_fully_qualified_domain_name: Target server fully qualified domain name - (FQDN) or IP address. It is a optional value, if customer provide it, migration service will - always use it for connection. + :ivar target_db_server_fully_qualified_domain_name: Fully qualified domain name (FQDN) or IP + address of the target server. This property is optional. When provided, the migration service + will always use it to connect to the target server. :vartype target_db_server_fully_qualified_domain_name: str :ivar secret_parameters: Migration secret parameters. :vartype secret_parameters: - ~azure.mgmt.postgresqlflexibleservers.models.MigrationSecretParameters - :ivar dbs_to_migrate: Number of databases to migrate. + ~azure.mgmt.postgresqlflexibleservers.models.MigrationSecretParametersForPatch + :ivar dbs_to_migrate: Names of databases to migrate. :vartype dbs_to_migrate: list[str] - :ivar setup_logical_replication_on_source_db_if_needed: Indicates whether to setup - LogicalReplicationOnSourceDb, if needed. Known values are: "True" and "False". + :ivar setup_logical_replication_on_source_db_if_needed: Indicates whether to setup logical + replication on source server, if needed. Known values are: "True" and "False". :vartype setup_logical_replication_on_source_db_if_needed: str or - ~azure.mgmt.postgresqlflexibleservers.models.LogicalReplicationOnSourceDbEnum - :ivar overwrite_dbs_in_target: Indicates whether the databases on the target server can be - overwritten, if already present. If set to False, the migration workflow will wait for a - confirmation, if it detects that the database already exists. Known values are: "True" and - "False". + ~azure.mgmt.postgresqlflexibleservers.models.LogicalReplicationOnSourceServer + :ivar overwrite_dbs_in_target: Indicates if databases on the target server can be overwritten + when already present. If set to 'False', when the migration workflow detects that the database + already exists on the target server, it will wait for a confirmation. Known values are: "True" + and "False". :vartype overwrite_dbs_in_target: str or - ~azure.mgmt.postgresqlflexibleservers.models.OverwriteDbsInTargetEnum - :ivar migration_window_start_time_in_utc: Start time in UTC for migration window. + ~azure.mgmt.postgresqlflexibleservers.models.OverwriteDatabasesOnTargetServer + :ivar migration_window_start_time_in_utc: Start time (UTC) for migration window. :vartype migration_window_start_time_in_utc: ~datetime.datetime - :ivar migrate_roles: To migrate roles and permissions we need to send this flag as True. Known - values are: "True" and "False". - :vartype migrate_roles: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrateRolesEnum - :ivar start_data_migration: Indicates whether the data migration should start right away. Known - values are: "True" and "False". + :ivar migrate_roles: Indicates if roles and permissions must be migrated. Known values are: + "True" and "False". + :vartype migrate_roles: str or + ~azure.mgmt.postgresqlflexibleservers.models.MigrateRolesAndPermissions + :ivar start_data_migration: Indicates if data migration must start right away. Known values + are: "True" and "False". :vartype start_data_migration: str or - ~azure.mgmt.postgresqlflexibleservers.models.StartDataMigrationEnum - :ivar trigger_cutover: To trigger cutover for entire migration we need to send this flag as - True. Known values are: "True" and "False". - :vartype trigger_cutover: str or - ~azure.mgmt.postgresqlflexibleservers.models.TriggerCutoverEnum - :ivar dbs_to_trigger_cutover_on: When you want to trigger cutover for specific databases send - triggerCutover flag as True and database names in this array. - :vartype dbs_to_trigger_cutover_on: list[str] - :ivar cancel: To trigger cancel for entire migration we need to send this flag as True. Known + ~azure.mgmt.postgresqlflexibleservers.models.StartDataMigration + :ivar trigger_cutover: Indicates if cutover must be triggered for the entire migration. Known values are: "True" and "False". - :vartype cancel: str or ~azure.mgmt.postgresqlflexibleservers.models.CancelEnum - :ivar dbs_to_cancel_migration_on: When you want to trigger cancel for specific databases send - cancel flag as True and database names in this array. + :vartype trigger_cutover: str or ~azure.mgmt.postgresqlflexibleservers.models.TriggerCutover + :ivar dbs_to_trigger_cutover_on: When you want to trigger cutover for specific databases set + 'triggerCutover' to 'True' and the names of the specific databases in this array. + :vartype dbs_to_trigger_cutover_on: list[str] + :ivar cancel: Indicates if cancel must be triggered for the entire migration. Known values are: + "True" and "False". + :vartype cancel: str or ~azure.mgmt.postgresqlflexibleservers.models.Cancel + :ivar dbs_to_cancel_migration_on: When you want to trigger cancel for specific databases set + 'triggerCutover' to 'True' and the names of the specific databases in this array. :vartype dbs_to_cancel_migration_on: list[str] - :ivar migration_mode: There are two types of migration modes Online and Offline. Known values - are: "Offline" and "Online". + :ivar migration_mode: Mode used to perform the migration: Online or Offline. Known values are: + "Offline" and "Online". :vartype migration_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationMode """ @@ -2988,7 +3091,7 @@ class MigrationResourceForPatch(_serialization.Model): "key": "properties.targetDbServerFullyQualifiedDomainName", "type": "str", }, - "secret_parameters": {"key": "properties.secretParameters", "type": "MigrationSecretParameters"}, + "secret_parameters": {"key": "properties.secretParameters", "type": "MigrationSecretParametersForPatch"}, "dbs_to_migrate": {"key": "properties.dbsToMigrate", "type": "[str]"}, "setup_logical_replication_on_source_db_if_needed": { "key": "properties.setupLogicalReplicationOnSourceDbIfNeeded", @@ -3008,78 +3111,80 @@ class MigrationResourceForPatch(_serialization.Model): def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, source_db_server_resource_id: Optional[str] = None, source_db_server_fully_qualified_domain_name: Optional[str] = None, target_db_server_fully_qualified_domain_name: Optional[str] = None, - secret_parameters: Optional["_models.MigrationSecretParameters"] = None, - dbs_to_migrate: Optional[List[str]] = None, + secret_parameters: Optional["_models.MigrationSecretParametersForPatch"] = None, + dbs_to_migrate: Optional[list[str]] = None, setup_logical_replication_on_source_db_if_needed: Optional[ - Union[str, "_models.LogicalReplicationOnSourceDbEnum"] + Union[str, "_models.LogicalReplicationOnSourceServer"] ] = None, - overwrite_dbs_in_target: Optional[Union[str, "_models.OverwriteDbsInTargetEnum"]] = None, + overwrite_dbs_in_target: Optional[Union[str, "_models.OverwriteDatabasesOnTargetServer"]] = None, migration_window_start_time_in_utc: Optional[datetime.datetime] = None, - migrate_roles: Optional[Union[str, "_models.MigrateRolesEnum"]] = None, - start_data_migration: Optional[Union[str, "_models.StartDataMigrationEnum"]] = None, - trigger_cutover: Optional[Union[str, "_models.TriggerCutoverEnum"]] = None, - dbs_to_trigger_cutover_on: Optional[List[str]] = None, - cancel: Optional[Union[str, "_models.CancelEnum"]] = None, - dbs_to_cancel_migration_on: Optional[List[str]] = None, + migrate_roles: Optional[Union[str, "_models.MigrateRolesAndPermissions"]] = None, + start_data_migration: Optional[Union[str, "_models.StartDataMigration"]] = None, + trigger_cutover: Optional[Union[str, "_models.TriggerCutover"]] = None, + dbs_to_trigger_cutover_on: Optional[list[str]] = None, + cancel: Optional[Union[str, "_models.Cancel"]] = None, + dbs_to_cancel_migration_on: Optional[list[str]] = None, migration_mode: Optional[Union[str, "_models.MigrationMode"]] = None, **kwargs: Any ) -> None: """ :keyword tags: Application-specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword source_db_server_resource_id: ResourceId of the source database server. + :keyword source_db_server_resource_id: Identifier of the source database server resource, when + 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to + ipaddress:port@username or hostname:port@username. :paramtype source_db_server_resource_id: str - :keyword source_db_server_fully_qualified_domain_name: Source server fully qualified domain - name (FQDN) or IP address. It is a optional value, if customer provide it, migration service - will always use it for connection. + :keyword source_db_server_fully_qualified_domain_name: Fully qualified domain name (FQDN) or IP + address of the source server. This property is optional. When provided, the migration service + will always use it to connect to the source server. :paramtype source_db_server_fully_qualified_domain_name: str - :keyword target_db_server_fully_qualified_domain_name: Target server fully qualified domain - name (FQDN) or IP address. It is a optional value, if customer provide it, migration service - will always use it for connection. + :keyword target_db_server_fully_qualified_domain_name: Fully qualified domain name (FQDN) or IP + address of the target server. This property is optional. When provided, the migration service + will always use it to connect to the target server. :paramtype target_db_server_fully_qualified_domain_name: str :keyword secret_parameters: Migration secret parameters. :paramtype secret_parameters: - ~azure.mgmt.postgresqlflexibleservers.models.MigrationSecretParameters - :keyword dbs_to_migrate: Number of databases to migrate. + ~azure.mgmt.postgresqlflexibleservers.models.MigrationSecretParametersForPatch + :keyword dbs_to_migrate: Names of databases to migrate. :paramtype dbs_to_migrate: list[str] - :keyword setup_logical_replication_on_source_db_if_needed: Indicates whether to setup - LogicalReplicationOnSourceDb, if needed. Known values are: "True" and "False". + :keyword setup_logical_replication_on_source_db_if_needed: Indicates whether to setup logical + replication on source server, if needed. Known values are: "True" and "False". :paramtype setup_logical_replication_on_source_db_if_needed: str or - ~azure.mgmt.postgresqlflexibleservers.models.LogicalReplicationOnSourceDbEnum - :keyword overwrite_dbs_in_target: Indicates whether the databases on the target server can be - overwritten, if already present. If set to False, the migration workflow will wait for a - confirmation, if it detects that the database already exists. Known values are: "True" and - "False". + ~azure.mgmt.postgresqlflexibleservers.models.LogicalReplicationOnSourceServer + :keyword overwrite_dbs_in_target: Indicates if databases on the target server can be + overwritten when already present. If set to 'False', when the migration workflow detects that + the database already exists on the target server, it will wait for a confirmation. Known values + are: "True" and "False". :paramtype overwrite_dbs_in_target: str or - ~azure.mgmt.postgresqlflexibleservers.models.OverwriteDbsInTargetEnum - :keyword migration_window_start_time_in_utc: Start time in UTC for migration window. + ~azure.mgmt.postgresqlflexibleservers.models.OverwriteDatabasesOnTargetServer + :keyword migration_window_start_time_in_utc: Start time (UTC) for migration window. :paramtype migration_window_start_time_in_utc: ~datetime.datetime - :keyword migrate_roles: To migrate roles and permissions we need to send this flag as True. - Known values are: "True" and "False". - :paramtype migrate_roles: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrateRolesEnum - :keyword start_data_migration: Indicates whether the data migration should start right away. - Known values are: "True" and "False". + :keyword migrate_roles: Indicates if roles and permissions must be migrated. Known values are: + "True" and "False". + :paramtype migrate_roles: str or + ~azure.mgmt.postgresqlflexibleservers.models.MigrateRolesAndPermissions + :keyword start_data_migration: Indicates if data migration must start right away. Known values + are: "True" and "False". :paramtype start_data_migration: str or - ~azure.mgmt.postgresqlflexibleservers.models.StartDataMigrationEnum - :keyword trigger_cutover: To trigger cutover for entire migration we need to send this flag as - True. Known values are: "True" and "False". - :paramtype trigger_cutover: str or - ~azure.mgmt.postgresqlflexibleservers.models.TriggerCutoverEnum - :keyword dbs_to_trigger_cutover_on: When you want to trigger cutover for specific databases - send triggerCutover flag as True and database names in this array. - :paramtype dbs_to_trigger_cutover_on: list[str] - :keyword cancel: To trigger cancel for entire migration we need to send this flag as True. + ~azure.mgmt.postgresqlflexibleservers.models.StartDataMigration + :keyword trigger_cutover: Indicates if cutover must be triggered for the entire migration. Known values are: "True" and "False". - :paramtype cancel: str or ~azure.mgmt.postgresqlflexibleservers.models.CancelEnum - :keyword dbs_to_cancel_migration_on: When you want to trigger cancel for specific databases - send cancel flag as True and database names in this array. + :paramtype trigger_cutover: str or ~azure.mgmt.postgresqlflexibleservers.models.TriggerCutover + :keyword dbs_to_trigger_cutover_on: When you want to trigger cutover for specific databases set + 'triggerCutover' to 'True' and the names of the specific databases in this array. + :paramtype dbs_to_trigger_cutover_on: list[str] + :keyword cancel: Indicates if cancel must be triggered for the entire migration. Known values + are: "True" and "False". + :paramtype cancel: str or ~azure.mgmt.postgresqlflexibleservers.models.Cancel + :keyword dbs_to_cancel_migration_on: When you want to trigger cancel for specific databases set + 'triggerCutover' to 'True' and the names of the specific databases in this array. :paramtype dbs_to_cancel_migration_on: list[str] - :keyword migration_mode: There are two types of migration modes Online and Offline. Known - values are: "Offline" and "Online". + :keyword migration_mode: Mode used to perform the migration: Online or Offline. Known values + are: "Offline" and "Online". :paramtype migration_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationMode """ super().__init__(**kwargs) @@ -3101,297 +3206,630 @@ def __init__( self.migration_mode = migration_mode -class MigrationResourceListResult(_serialization.Model): - """A list of migration resources. +class MigrationSecretParameters(_serialization.Model): + """Migration secret parameters. + + All required parameters must be populated in order to send to server. + + :ivar admin_credentials: Credentials of administrator users for source and target servers. + Required. + :vartype admin_credentials: ~azure.mgmt.postgresqlflexibleservers.models.AdminCredentials + :ivar source_server_username: Gets or sets the name of the user for the source server. This + user doesn't need to be an administrator. + :vartype source_server_username: str + :ivar target_server_username: Gets or sets the name of the user for the target server. This + user doesn't need to be an administrator. + :vartype target_server_username: str + """ + + _validation = { + "admin_credentials": {"required": True}, + } + + _attribute_map = { + "admin_credentials": {"key": "adminCredentials", "type": "AdminCredentials"}, + "source_server_username": {"key": "sourceServerUsername", "type": "str"}, + "target_server_username": {"key": "targetServerUsername", "type": "str"}, + } + + def __init__( + self, + *, + admin_credentials: "_models.AdminCredentials", + source_server_username: Optional[str] = None, + target_server_username: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword admin_credentials: Credentials of administrator users for source and target servers. + Required. + :paramtype admin_credentials: ~azure.mgmt.postgresqlflexibleservers.models.AdminCredentials + :keyword source_server_username: Gets or sets the name of the user for the source server. This + user doesn't need to be an administrator. + :paramtype source_server_username: str + :keyword target_server_username: Gets or sets the name of the user for the target server. This + user doesn't need to be an administrator. + :paramtype target_server_username: str + """ + super().__init__(**kwargs) + self.admin_credentials = admin_credentials + self.source_server_username = source_server_username + self.target_server_username = target_server_username + + +class MigrationSecretParametersForPatch(_serialization.Model): + """Migration secret parameters. + + :ivar admin_credentials: Credentials of administrator users for source and target servers. + :vartype admin_credentials: + ~azure.mgmt.postgresqlflexibleservers.models.AdminCredentialsForPatch + :ivar source_server_username: Gets or sets the name of the user for the source server. This + user doesn't need to be an administrator. + :vartype source_server_username: str + :ivar target_server_username: Gets or sets the name of the user for the target server. This + user doesn't need to be an administrator. + :vartype target_server_username: str + """ + + _attribute_map = { + "admin_credentials": {"key": "adminCredentials", "type": "AdminCredentialsForPatch"}, + "source_server_username": {"key": "sourceServerUsername", "type": "str"}, + "target_server_username": {"key": "targetServerUsername", "type": "str"}, + } + + def __init__( + self, + *, + admin_credentials: Optional["_models.AdminCredentialsForPatch"] = None, + source_server_username: Optional[str] = None, + target_server_username: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword admin_credentials: Credentials of administrator users for source and target servers. + :paramtype admin_credentials: + ~azure.mgmt.postgresqlflexibleservers.models.AdminCredentialsForPatch + :keyword source_server_username: Gets or sets the name of the user for the source server. This + user doesn't need to be an administrator. + :paramtype source_server_username: str + :keyword target_server_username: Gets or sets the name of the user for the target server. This + user doesn't need to be an administrator. + :paramtype target_server_username: str + """ + super().__init__(**kwargs) + self.admin_credentials = admin_credentials + self.source_server_username = source_server_username + self.target_server_username = target_server_username + + +class MigrationStatus(_serialization.Model): + """State of migration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar state: State of migration. Known values are: "InProgress", "WaitingForUserAction", + "Canceled", "Failed", "Succeeded", "ValidationFailed", and "CleaningUp". + :vartype state: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationState + :ivar error: Error message, if any, for the migration state. + :vartype error: str + :ivar current_sub_state_details: Current migration sub state details. + :vartype current_sub_state_details: + ~azure.mgmt.postgresqlflexibleservers.models.MigrationSubstateDetails + """ + + _validation = { + "state": {"readonly": True}, + "error": {"readonly": True}, + "current_sub_state_details": {"readonly": True}, + } + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "current_sub_state_details": {"key": "currentSubStateDetails", "type": "MigrationSubstateDetails"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.state: Optional[Union[str, "_models.MigrationState"]] = None + self.error: Optional[str] = None + self.current_sub_state_details: Optional["_models.MigrationSubstateDetails"] = None + + +class MigrationSubstateDetails(_serialization.Model): + """Details of migration substate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar current_sub_state: Substate of migration. Known values are: + "PerformingPreRequisiteSteps", "WaitingForLogicalReplicationSetupRequestOnSourceDB", + "WaitingForDBsToMigrateSpecification", "WaitingForTargetDBOverwriteConfirmation", + "WaitingForDataMigrationScheduling", "WaitingForDataMigrationWindow", "MigratingData", + "WaitingForCutoverTrigger", "CompletingMigration", "Completed", + "CancelingRequestedDBMigrations", and "ValidationInProgress". + :vartype current_sub_state: str or + ~azure.mgmt.postgresqlflexibleservers.models.MigrationSubstate + :ivar db_details: Dictionary of :code:``. + :vartype db_details: dict[str, + ~azure.mgmt.postgresqlflexibleservers.models.DatabaseMigrationState] + :ivar validation_details: Details for the validation for migration. + :vartype validation_details: ~azure.mgmt.postgresqlflexibleservers.models.ValidationDetails + """ + + _validation = { + "current_sub_state": {"readonly": True}, + } + + _attribute_map = { + "current_sub_state": {"key": "currentSubState", "type": "str"}, + "db_details": {"key": "dbDetails", "type": "{DatabaseMigrationState}"}, + "validation_details": {"key": "validationDetails", "type": "ValidationDetails"}, + } + + def __init__( + self, + *, + db_details: Optional[dict[str, "_models.DatabaseMigrationState"]] = None, + validation_details: Optional["_models.ValidationDetails"] = None, + **kwargs: Any + ) -> None: + """ + :keyword db_details: Dictionary of :code:``. + :paramtype db_details: dict[str, + ~azure.mgmt.postgresqlflexibleservers.models.DatabaseMigrationState] + :keyword validation_details: Details for the validation for migration. + :paramtype validation_details: ~azure.mgmt.postgresqlflexibleservers.models.ValidationDetails + """ + super().__init__(**kwargs) + self.current_sub_state: Optional[Union[str, "_models.MigrationSubstate"]] = None + self.db_details = db_details + self.validation_details = validation_details + + +class NameAvailabilityModel(CheckNameAvailabilityResponse): + """Availability of a name. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: A list of migration resources. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.MigrationResource] - :ivar next_link: The link used to get the next page of migrations. - :vartype next_link: str + :ivar name_available: Indicates if the resource name is available. + :vartype name_available: bool + :ivar reason: The reason why the given name is not available. Known values are: "Invalid" and + "AlreadyExists". + :vartype reason: str or + ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityReason + :ivar message: Detailed reason why the given name is available. + :vartype message: str + :ivar name: Name for which validity and availability was checked. + :vartype name: str + :ivar type: Type of resource. It can be 'Microsoft.DBforPostgreSQL/flexibleServers' or + 'Microsoft.DBforPostgreSQL/flexibleServers/virtualendpoints'. + :vartype type: str """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[MigrationResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "name_available": {"key": "nameAvailable", "type": "bool"}, + "reason": {"key": "reason", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.MigrationResource"]] = None - self.next_link: Optional[str] = None - + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = None, + message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name_available: Indicates if the resource name is available. + :paramtype name_available: bool + :keyword reason: The reason why the given name is not available. Known values are: "Invalid" + and "AlreadyExists". + :paramtype reason: str or + ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityReason + :keyword message: Detailed reason why the given name is available. + :paramtype message: str + """ + super().__init__(name_available=name_available, reason=reason, message=message, **kwargs) + self.name: Optional[str] = None + self.type: Optional[str] = None -class MigrationSecretParameters(_serialization.Model): - """Migration secret parameters. - All required parameters must be populated in order to send to server. +class NameProperty(_serialization.Model): + """Name property for quota usage. - :ivar admin_credentials: Admin credentials for source and target servers. Required. - :vartype admin_credentials: ~azure.mgmt.postgresqlflexibleservers.models.AdminCredentials - :ivar source_server_username: Gets or sets the username for the source server. This user need - not be an admin. - :vartype source_server_username: str - :ivar target_server_username: Gets or sets the username for the target server. This user need - not be an admin. - :vartype target_server_username: str + :ivar value: Name value. + :vartype value: str + :ivar localized_value: Localized name. + :vartype localized_value: str """ - _validation = { - "admin_credentials": {"required": True}, + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, } + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: Name value. + :paramtype value: str + :keyword localized_value: Localized name. + :paramtype localized_value: str + """ + super().__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class Network(_serialization.Model): + """Network properties of a server. + + :ivar public_network_access: Indicates if public network access is enabled or not. This is only + supported for servers that are not integrated into a virtual network which is owned and + provided by customer when server is deployed. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.postgresqlflexibleservers.models.ServerPublicNetworkAccessState + :ivar delegated_subnet_resource_id: Resource identifier of the delegated subnet. Required + during creation of a new server, in case you want the server to be integrated into your own + virtual network. For an update operation, you only have to provide this property if you want to + change the value assigned for the private DNS zone. + :vartype delegated_subnet_resource_id: str + :ivar private_dns_zone_arm_resource_id: Identifier of the private DNS zone. Required during + creation of a new server, in case you want the server to be integrated into your own virtual + network. For an update operation, you only have to provide this property if you want to change + the value assigned for the private DNS zone. + :vartype private_dns_zone_arm_resource_id: str + """ + _attribute_map = { - "admin_credentials": {"key": "adminCredentials", "type": "AdminCredentials"}, - "source_server_username": {"key": "sourceServerUsername", "type": "str"}, - "target_server_username": {"key": "targetServerUsername", "type": "str"}, + "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, + "delegated_subnet_resource_id": {"key": "delegatedSubnetResourceId", "type": "str"}, + "private_dns_zone_arm_resource_id": {"key": "privateDnsZoneArmResourceId", "type": "str"}, } def __init__( self, *, - admin_credentials: "_models.AdminCredentials", - source_server_username: Optional[str] = None, - target_server_username: Optional[str] = None, + public_network_access: Optional[Union[str, "_models.ServerPublicNetworkAccessState"]] = None, + delegated_subnet_resource_id: Optional[str] = None, + private_dns_zone_arm_resource_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword admin_credentials: Admin credentials for source and target servers. Required. - :paramtype admin_credentials: ~azure.mgmt.postgresqlflexibleservers.models.AdminCredentials - :keyword source_server_username: Gets or sets the username for the source server. This user - need not be an admin. - :paramtype source_server_username: str - :keyword target_server_username: Gets or sets the username for the target server. This user - need not be an admin. - :paramtype target_server_username: str + :keyword public_network_access: Indicates if public network access is enabled or not. This is + only supported for servers that are not integrated into a virtual network which is owned and + provided by customer when server is deployed. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.postgresqlflexibleservers.models.ServerPublicNetworkAccessState + :keyword delegated_subnet_resource_id: Resource identifier of the delegated subnet. Required + during creation of a new server, in case you want the server to be integrated into your own + virtual network. For an update operation, you only have to provide this property if you want to + change the value assigned for the private DNS zone. + :paramtype delegated_subnet_resource_id: str + :keyword private_dns_zone_arm_resource_id: Identifier of the private DNS zone. Required during + creation of a new server, in case you want the server to be integrated into your own virtual + network. For an update operation, you only have to provide this property if you want to change + the value assigned for the private DNS zone. + :paramtype private_dns_zone_arm_resource_id: str """ super().__init__(**kwargs) - self.admin_credentials = admin_credentials - self.source_server_username = source_server_username - self.target_server_username = target_server_username + self.public_network_access = public_network_access + self.delegated_subnet_resource_id = delegated_subnet_resource_id + self.private_dns_zone_arm_resource_id = private_dns_zone_arm_resource_id -class MigrationStatus(_serialization.Model): - """Migration status. +class ObjectRecommendation(ProxyResource): + """Object recommendation properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar state: State of migration. Known values are: "InProgress", "WaitingForUserAction", - "Canceled", "Failed", "Succeeded", "ValidationFailed", and "CleaningUp". - :vartype state: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationState - :ivar error: Error message, if any, for the migration state. - :vartype error: str - :ivar current_sub_state_details: Current Migration sub state details. - :vartype current_sub_state_details: - ~azure.mgmt.postgresqlflexibleservers.models.MigrationSubStateDetails + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData + :ivar kind: Always empty. + :vartype kind: str + :ivar initial_recommended_time: Creation time (UTC) of this recommendation. + :vartype initial_recommended_time: ~datetime.datetime + :ivar last_recommended_time: Last time (UTC) that this recommendation was produced. + :vartype last_recommended_time: ~datetime.datetime + :ivar times_recommended: Number of times this recommendation has been produced. + :vartype times_recommended: int + :ivar improved_query_ids: List of identifiers for all queries identified as targets for + improvement if the recommendation is applied. The list is only populated for CREATE INDEX + recommendations. + :vartype improved_query_ids: list[int] + :ivar recommendation_reason: Reason for this recommendation. + :vartype recommendation_reason: str + :ivar current_state: Current state. + :vartype current_state: str + :ivar recommendation_type: Type for this recommendation. Known values are: "CreateIndex", + "DropIndex", "ReIndex", and "AnalyzeTable". + :vartype recommendation_type: str or + ~azure.mgmt.postgresqlflexibleservers.models.RecommendationTypeEnum + :ivar implementation_details: Implementation details for the recommended action. + :vartype implementation_details: + ~azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendationPropertiesImplementationDetails + :ivar analyzed_workload: Workload information for the recommended action. + :vartype analyzed_workload: + ~azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendationPropertiesAnalyzedWorkload + :ivar estimated_impact: Estimated impact of this recommended action. + :vartype estimated_impact: list[~azure.mgmt.postgresqlflexibleservers.models.ImpactRecord] + :ivar details: Recommendation details for the recommended action. + :vartype details: ~azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendationDetails """ _validation = { - "state": {"readonly": True}, - "error": {"readonly": True}, - "current_sub_state_details": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "estimated_impact": {"readonly": True}, + "details": {"readonly": True}, } _attribute_map = { - "state": {"key": "state", "type": "str"}, - "error": {"key": "error", "type": "str"}, - "current_sub_state_details": {"key": "currentSubStateDetails", "type": "MigrationSubStateDetails"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "kind": {"key": "kind", "type": "str"}, + "initial_recommended_time": {"key": "properties.initialRecommendedTime", "type": "iso-8601"}, + "last_recommended_time": {"key": "properties.lastRecommendedTime", "type": "iso-8601"}, + "times_recommended": {"key": "properties.timesRecommended", "type": "int"}, + "improved_query_ids": {"key": "properties.improvedQueryIds", "type": "[int]"}, + "recommendation_reason": {"key": "properties.recommendationReason", "type": "str"}, + "current_state": {"key": "properties.currentState", "type": "str"}, + "recommendation_type": {"key": "properties.recommendationType", "type": "str"}, + "implementation_details": { + "key": "properties.implementationDetails", + "type": "ObjectRecommendationPropertiesImplementationDetails", + }, + "analyzed_workload": { + "key": "properties.analyzedWorkload", + "type": "ObjectRecommendationPropertiesAnalyzedWorkload", + }, + "estimated_impact": {"key": "properties.estimatedImpact", "type": "[ImpactRecord]"}, + "details": {"key": "properties.details", "type": "ObjectRecommendationDetails"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + kind: Optional[str] = None, + initial_recommended_time: Optional[datetime.datetime] = None, + last_recommended_time: Optional[datetime.datetime] = None, + times_recommended: Optional[int] = None, + improved_query_ids: Optional[list[int]] = None, + recommendation_reason: Optional[str] = None, + current_state: Optional[str] = None, + recommendation_type: Optional[Union[str, "_models.RecommendationTypeEnum"]] = None, + implementation_details: Optional["_models.ObjectRecommendationPropertiesImplementationDetails"] = None, + analyzed_workload: Optional["_models.ObjectRecommendationPropertiesAnalyzedWorkload"] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: Always empty. + :paramtype kind: str + :keyword initial_recommended_time: Creation time (UTC) of this recommendation. + :paramtype initial_recommended_time: ~datetime.datetime + :keyword last_recommended_time: Last time (UTC) that this recommendation was produced. + :paramtype last_recommended_time: ~datetime.datetime + :keyword times_recommended: Number of times this recommendation has been produced. + :paramtype times_recommended: int + :keyword improved_query_ids: List of identifiers for all queries identified as targets for + improvement if the recommendation is applied. The list is only populated for CREATE INDEX + recommendations. + :paramtype improved_query_ids: list[int] + :keyword recommendation_reason: Reason for this recommendation. + :paramtype recommendation_reason: str + :keyword current_state: Current state. + :paramtype current_state: str + :keyword recommendation_type: Type for this recommendation. Known values are: "CreateIndex", + "DropIndex", "ReIndex", and "AnalyzeTable". + :paramtype recommendation_type: str or + ~azure.mgmt.postgresqlflexibleservers.models.RecommendationTypeEnum + :keyword implementation_details: Implementation details for the recommended action. + :paramtype implementation_details: + ~azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendationPropertiesImplementationDetails + :keyword analyzed_workload: Workload information for the recommended action. + :paramtype analyzed_workload: + ~azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendationPropertiesAnalyzedWorkload + """ super().__init__(**kwargs) - self.state: Optional[Union[str, "_models.MigrationState"]] = None - self.error: Optional[str] = None - self.current_sub_state_details: Optional["_models.MigrationSubStateDetails"] = None - + self.kind = kind + self.initial_recommended_time = initial_recommended_time + self.last_recommended_time = last_recommended_time + self.times_recommended = times_recommended + self.improved_query_ids = improved_query_ids + self.recommendation_reason = recommendation_reason + self.current_state = current_state + self.recommendation_type = recommendation_type + self.implementation_details = implementation_details + self.analyzed_workload = analyzed_workload + self.estimated_impact: Optional[list["_models.ImpactRecord"]] = None + self.details: Optional["_models.ObjectRecommendationDetails"] = None -class MigrationSubStateDetails(_serialization.Model): - """Migration sub state details. - Variables are only populated by the server, and will be ignored when sending a request. +class ObjectRecommendationDetails(_serialization.Model): + """Recommendation details for the recommended action. - :ivar current_sub_state: Migration sub state. Known values are: "PerformingPreRequisiteSteps", - "WaitingForLogicalReplicationSetupRequestOnSourceDB", "WaitingForDBsToMigrateSpecification", - "WaitingForTargetDBOverwriteConfirmation", "WaitingForDataMigrationScheduling", - "WaitingForDataMigrationWindow", "MigratingData", "WaitingForCutoverTrigger", - "CompletingMigration", "Completed", "CancelingRequestedDBMigrations", and - "ValidationInProgress". - :vartype current_sub_state: str or - ~azure.mgmt.postgresqlflexibleservers.models.MigrationSubState - :ivar db_details: Dictionary of :code:``. - :vartype db_details: dict[str, ~azure.mgmt.postgresqlflexibleservers.models.DbMigrationStatus] - :ivar validation_details: Details for the validation for migration. - :vartype validation_details: ~azure.mgmt.postgresqlflexibleservers.models.ValidationDetails + :ivar database_name: Database name. + :vartype database_name: str + :ivar schema: Schema name. + :vartype schema: str + :ivar table: Table name. + :vartype table: str + :ivar index_type: Index type. + :vartype index_type: str + :ivar index_name: Index name. + :vartype index_name: str + :ivar index_columns: Index columns. + :vartype index_columns: list[str] + :ivar included_columns: Index included columns. + :vartype included_columns: list[str] """ - _validation = { - "current_sub_state": {"readonly": True}, - } - _attribute_map = { - "current_sub_state": {"key": "currentSubState", "type": "str"}, - "db_details": {"key": "dbDetails", "type": "{DbMigrationStatus}"}, - "validation_details": {"key": "validationDetails", "type": "ValidationDetails"}, + "database_name": {"key": "databaseName", "type": "str"}, + "schema": {"key": "schema", "type": "str"}, + "table": {"key": "table", "type": "str"}, + "index_type": {"key": "indexType", "type": "str"}, + "index_name": {"key": "indexName", "type": "str"}, + "index_columns": {"key": "indexColumns", "type": "[str]"}, + "included_columns": {"key": "includedColumns", "type": "[str]"}, } def __init__( self, *, - db_details: Optional[Dict[str, "_models.DbMigrationStatus"]] = None, - validation_details: Optional["_models.ValidationDetails"] = None, + database_name: Optional[str] = None, + schema: Optional[str] = None, + table: Optional[str] = None, + index_type: Optional[str] = None, + index_name: Optional[str] = None, + index_columns: Optional[list[str]] = None, + included_columns: Optional[list[str]] = None, **kwargs: Any ) -> None: """ - :keyword db_details: Dictionary of :code:``. - :paramtype db_details: dict[str, - ~azure.mgmt.postgresqlflexibleservers.models.DbMigrationStatus] - :keyword validation_details: Details for the validation for migration. - :paramtype validation_details: ~azure.mgmt.postgresqlflexibleservers.models.ValidationDetails + :keyword database_name: Database name. + :paramtype database_name: str + :keyword schema: Schema name. + :paramtype schema: str + :keyword table: Table name. + :paramtype table: str + :keyword index_type: Index type. + :paramtype index_type: str + :keyword index_name: Index name. + :paramtype index_name: str + :keyword index_columns: Index columns. + :paramtype index_columns: list[str] + :keyword included_columns: Index included columns. + :paramtype included_columns: list[str] """ super().__init__(**kwargs) - self.current_sub_state: Optional[Union[str, "_models.MigrationSubState"]] = None - self.db_details = db_details - self.validation_details = validation_details - + self.database_name = database_name + self.schema = schema + self.table = table + self.index_type = index_type + self.index_name = index_name + self.index_columns = index_columns + self.included_columns = included_columns -class NameAvailability(CheckNameAvailabilityResponse): - """Represents a resource name availability. - Variables are only populated by the server, and will be ignored when sending a request. +class ObjectRecommendationList(_serialization.Model): + """List of available object recommendations. - :ivar name_available: Indicates if the resource name is available. - :vartype name_available: bool - :ivar reason: The reason why the given name is not available. Known values are: "Invalid" and - "AlreadyExists". - :vartype reason: str or - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityReason - :ivar message: Detailed reason why the given name is available. - :vartype message: str - :ivar name: name of the PostgreSQL server. - :vartype name: str - :ivar type: type of the server. - :vartype type: str + :ivar value: List of available object recommendations. + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendation] + :ivar next_link: Link used to get the next page of results. + :vartype next_link: str """ - _validation = { - "name": {"readonly": True}, - "type": {"readonly": True}, - } - _attribute_map = { - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "value": {"key": "value", "type": "[ObjectRecommendation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( self, *, - name_available: Optional[bool] = None, - reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = None, - message: Optional[str] = None, + value: Optional[list["_models.ObjectRecommendation"]] = None, + next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name_available: Indicates if the resource name is available. - :paramtype name_available: bool - :keyword reason: The reason why the given name is not available. Known values are: "Invalid" - and "AlreadyExists". - :paramtype reason: str or - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityReason - :keyword message: Detailed reason why the given name is available. - :paramtype message: str + :keyword value: List of available object recommendations. + :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendation] + :keyword next_link: Link used to get the next page of results. + :paramtype next_link: str """ - super().__init__(name_available=name_available, reason=reason, message=message, **kwargs) - self.name: Optional[str] = None - self.type: Optional[str] = None + super().__init__(**kwargs) + self.value = value + self.next_link = next_link -class NameProperty(_serialization.Model): - """Name property for quota usage. +class ObjectRecommendationPropertiesAnalyzedWorkload(_serialization.Model): # pylint: disable=name-too-long + """Workload information for the recommended action. - :ivar value: Name value. - :vartype value: str - :ivar localized_value: Localized name. - :vartype localized_value: str + :ivar start_time: Start time (UTC) of the workload analyzed. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time (UTC) of the workload analyzed. + :vartype end_time: ~datetime.datetime + :ivar query_count: Number of queries from the workload that were examined to produce this + recommendation. For DROP INDEX recommendations it's 0 (zero). + :vartype query_count: int """ _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "type": "str"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "query_count": {"key": "queryCount", "type": "int"}, } - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + query_count: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword value: Name value. - :paramtype value: str - :keyword localized_value: Localized name. - :paramtype localized_value: str + :keyword start_time: Start time (UTC) of the workload analyzed. + :paramtype start_time: ~datetime.datetime + :keyword end_time: End time (UTC) of the workload analyzed. + :paramtype end_time: ~datetime.datetime + :keyword query_count: Number of queries from the workload that were examined to produce this + recommendation. For DROP INDEX recommendations it's 0 (zero). + :paramtype query_count: int """ super().__init__(**kwargs) - self.value = value - self.localized_value = localized_value + self.start_time = start_time + self.end_time = end_time + self.query_count = query_count -class Network(_serialization.Model): - """Network properties of a server. +class ObjectRecommendationPropertiesImplementationDetails(_serialization.Model): # pylint: disable=name-too-long + """Implementation details for the recommended action. - :ivar public_network_access: public network access is enabled or not. Known values are: - "Enabled" and "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.postgresqlflexibleservers.models.ServerPublicNetworkAccessState - :ivar delegated_subnet_resource_id: Delegated subnet arm resource id. This is required to be - passed during create, in case we want the server to be VNET injected, i.e. Private access - server. During update, pass this only if we want to update the value for Private DNS zone. - :vartype delegated_subnet_resource_id: str - :ivar private_dns_zone_arm_resource_id: Private dns zone arm resource id. This is required to - be passed during create, in case we want the server to be VNET injected, i.e. Private access - server. During update, pass this only if we want to update the value for Private DNS zone. - :vartype private_dns_zone_arm_resource_id: str + :ivar method: Method of implementation for recommended action. + :vartype method: str + :ivar script: Implementation script for the recommended action. + :vartype script: str """ _attribute_map = { - "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, - "delegated_subnet_resource_id": {"key": "delegatedSubnetResourceId", "type": "str"}, - "private_dns_zone_arm_resource_id": {"key": "privateDnsZoneArmResourceId", "type": "str"}, + "method": {"key": "method", "type": "str"}, + "script": {"key": "script", "type": "str"}, } - def __init__( - self, - *, - public_network_access: Optional[Union[str, "_models.ServerPublicNetworkAccessState"]] = None, - delegated_subnet_resource_id: Optional[str] = None, - private_dns_zone_arm_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, method: Optional[str] = None, script: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword public_network_access: public network access is enabled or not. Known values are: - "Enabled" and "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.postgresqlflexibleservers.models.ServerPublicNetworkAccessState - :keyword delegated_subnet_resource_id: Delegated subnet arm resource id. This is required to be - passed during create, in case we want the server to be VNET injected, i.e. Private access - server. During update, pass this only if we want to update the value for Private DNS zone. - :paramtype delegated_subnet_resource_id: str - :keyword private_dns_zone_arm_resource_id: Private dns zone arm resource id. This is required - to be passed during create, in case we want the server to be VNET injected, i.e. Private access - server. During update, pass this only if we want to update the value for Private DNS zone. - :paramtype private_dns_zone_arm_resource_id: str + :keyword method: Method of implementation for recommended action. + :paramtype method: str + :keyword script: Implementation script for the recommended action. + :paramtype script: str """ super().__init__(**kwargs) - self.public_network_access = public_network_access - self.delegated_subnet_resource_id = delegated_subnet_resource_id - self.private_dns_zone_arm_resource_id = private_dns_zone_arm_resource_id + self.method = method + self.script = script class Operation(_serialization.Model): @@ -3399,14 +3837,14 @@ class Operation(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The name of the operation being performed on this particular object. + :ivar name: Name of the operation being performed on this particular object. :vartype name: str - :ivar display: The localized display information for this particular operation or action. + :ivar display: Localized display information for this particular operation or action. :vartype display: ~azure.mgmt.postgresqlflexibleservers.models.OperationDisplay - :ivar is_data_action: Indicates whether the operation is a data action. + :ivar is_data_action: Indicates if the operation is a data action. :vartype is_data_action: bool - :ivar origin: The intended executor of the operation. Known values are: "NotSpecified", "user", - and "system". + :ivar origin: Intended executor of the operation. Known values are: "NotSpecified", "user", and + "system". :vartype origin: str or ~azure.mgmt.postgresqlflexibleservers.models.OperationOrigin :ivar properties: Additional descriptions for the operation. :vartype properties: dict[str, JSON] @@ -3429,7 +3867,7 @@ class Operation(_serialization.Model): def __init__(self, *, is_data_action: Optional[bool] = None, **kwargs: Any) -> None: """ - :keyword is_data_action: Indicates whether the operation is a data action. + :keyword is_data_action: Indicates if the operation is a data action. :paramtype is_data_action: bool """ super().__init__(**kwargs) @@ -3437,7 +3875,7 @@ def __init__(self, *, is_data_action: Optional[bool] = None, **kwargs: Any) -> N self.display: Optional["_models.OperationDisplay"] = None self.is_data_action = is_data_action self.origin: Optional[Union[str, "_models.OperationOrigin"]] = None - self.properties: Optional[Dict[str, JSON]] = None + self.properties: Optional[dict[str, JSON]] = None class OperationDisplay(_serialization.Model): @@ -3445,13 +3883,13 @@ class OperationDisplay(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar provider: Operation resource provider name. + :ivar provider: Name of the resource provider. :vartype provider: str - :ivar resource: Resource on which the operation is performed. + :ivar resource: Type of resource on which the operation is performed. :vartype resource: str - :ivar operation: Localized friendly name for the operation. + :ivar operation: Name of the operation. :vartype operation: str - :ivar description: Operation description. + :ivar description: Description of the operation. :vartype description: str """ @@ -3478,13 +3916,12 @@ def __init__(self, **kwargs: Any) -> None: self.description: Optional[str] = None -class OperationListResult(_serialization.Model): - """A list of resource provider operations. +class OperationList(_serialization.Model): + """List of resource provider operations. :ivar value: Collection of available operation details. :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.Operation] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. + :ivar next_link: Link used to get the next page of results. :vartype next_link: str """ @@ -3494,13 +3931,12 @@ class OperationListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: Collection of available operation details. :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.Operation] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. + :keyword next_link: Link used to get the next page of results. :paramtype next_link: str """ super().__init__(**kwargs) @@ -3600,26 +4036,25 @@ def __init__( ~azure.mgmt.postgresqlflexibleservers.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.group_ids: Optional[List[str]] = None + self.group_ids: Optional[list[str]] = None self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None -class PrivateEndpointConnectionListResult(_serialization.Model): - """A list of private endpoint connections. +class PrivateEndpointConnectionList(_serialization.Model): + """List of private endpoint connections. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Array of results. :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection] - :ivar next_link: The URL to get the next set of results. + :ivar next_link: Link used to get the next page of results. :vartype next_link: str """ _validation = { "value": {"readonly": True}, - "next_link": {"readonly": True}, } _attribute_map = { @@ -3627,11 +4062,14 @@ class PrivateEndpointConnectionListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link used to get the next page of results. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value: Optional[List["_models.PrivateEndpointConnection"]] = None - self.next_link: Optional[str] = None + self.value: Optional[list["_models.PrivateEndpointConnection"]] = None + self.next_link = next_link class PrivateLinkResource(Resource): @@ -3677,18 +4115,18 @@ class PrivateLinkResource(Resource): "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: + def __init__(self, *, required_zone_names: Optional[list[str]] = None, **kwargs: Any) -> None: """ :keyword required_zone_names: The private link resource private link DNS zone name. :paramtype required_zone_names: list[str] """ super().__init__(**kwargs) self.group_id: Optional[str] = None - self.required_members: Optional[List[str]] = None + self.required_members: Optional[list[str]] = None self.required_zone_names = required_zone_names -class PrivateLinkResourceListResult(_serialization.Model): +class PrivateLinkResourceList(_serialization.Model): """A list of private link resources. Variables are only populated by the server, and will be ignored when sending a request. @@ -3701,7 +4139,6 @@ class PrivateLinkResourceListResult(_serialization.Model): _validation = { "value": {"readonly": True}, - "next_link": {"readonly": True}, } _attribute_map = { @@ -3709,11 +4146,14 @@ class PrivateLinkResourceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link to retrieve next page of results. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value: Optional[List["_models.PrivateLinkResource"]] = None - self.next_link: Optional[str] = None + self.value: Optional[list["_models.PrivateLinkResource"]] = None + self.next_link = next_link class PrivateLinkServiceConnectionState(_serialization.Model): @@ -3763,9 +4203,9 @@ def __init__( class QuotaUsage(_serialization.Model): - """Quota usage for flexible servers. + """Quota usage for servers. - :ivar name: Name of quota usage for flexible servers. + :ivar name: Name of quota usage for servers. :vartype name: ~azure.mgmt.postgresqlflexibleservers.models.NameProperty :ivar limit: Quota limit. :vartype limit: int @@ -3796,7 +4236,7 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword name: Name of quota usage for flexible servers. + :keyword name: Name of quota usage for servers. :paramtype name: ~azure.mgmt.postgresqlflexibleservers.models.NameProperty :keyword limit: Quota limit. :paramtype limit: int @@ -3815,7 +4255,7 @@ def __init__( self.id = id -class QuotaUsagesListResult(_serialization.Model): +class QuotaUsageList(_serialization.Model): """Capability for the PostgreSQL server. Variables are only populated by the server, and will be ignored when sending a request. @@ -3828,7 +4268,6 @@ class QuotaUsagesListResult(_serialization.Model): _validation = { "value": {"readonly": True}, - "next_link": {"readonly": True}, } _attribute_map = { @@ -3836,11 +4275,14 @@ class QuotaUsagesListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: Link to retrieve next page of results. + :paramtype next_link: str + """ super().__init__(**kwargs) - self.value: Optional[List["_models.QuotaUsage"]] = None - self.next_link: Optional[str] = None + self.value: Optional[list["_models.QuotaUsage"]] = None + self.next_link = next_link class Replica(_serialization.Model): @@ -3848,25 +4290,28 @@ class Replica(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar role: Used to indicate role of the server in replication set. Known values are: "None", - "Primary", "AsyncReplica", and "GeoAsyncReplica". + :ivar role: Role of the server in a replication set. Known values are: "None", "Primary", + "AsyncReplica", and "GeoAsyncReplica". :vartype role: str or ~azure.mgmt.postgresqlflexibleservers.models.ReplicationRole - :ivar capacity: Replicas allowed for a server. + :ivar capacity: Maximum number of read replicas allowed for a server. :vartype capacity: int - :ivar replication_state: Gets the replication state of a replica server. This property is - returned only for replicas api call. Supported values are Active, Catchup, Provisioning, - Updating, Broken, Reconfiguring. Known values are: "Active", "Catchup", "Provisioning", - "Updating", "Broken", and "Reconfiguring". + :ivar replication_state: Indicates the replication state of a read replica. This property is + returned only when the target server is a read replica. Possible values are Active, Broken, + Catchup, Provisioning, Reconfiguring, and Updating. Known values are: "Active", "Catchup", + "Provisioning", "Updating", "Broken", and "Reconfiguring". :vartype replication_state: str or ~azure.mgmt.postgresqlflexibleservers.models.ReplicationState - :ivar promote_mode: Sets the promote mode for a replica server. This is a write only property. - Known values are: "standalone" and "switchover". + :ivar promote_mode: Type of operation to apply on the read replica. This property is write + only. Standalone means that the read replica will be promoted to a standalone server, and will + become a completely independent entity from the replication set. Switchover means that the read + replica will roles with the primary server. Known values are: "Standalone" and "Switchover". :vartype promote_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.ReadReplicaPromoteMode - :ivar promote_option: Sets the promote options for a replica server. This is a write only - property. Known values are: "planned" and "forced". + :ivar promote_option: Data synchronization option to use when processing the operation + specified in the promoteMode property. This property is write only. Known values are: "Planned" + and "Forced". :vartype promote_option: str or - ~azure.mgmt.postgresqlflexibleservers.models.ReplicationPromoteOption + ~azure.mgmt.postgresqlflexibleservers.models.ReadReplicaPromoteOption """ _validation = { @@ -3887,21 +4332,24 @@ def __init__( *, role: Optional[Union[str, "_models.ReplicationRole"]] = None, promote_mode: Optional[Union[str, "_models.ReadReplicaPromoteMode"]] = None, - promote_option: Optional[Union[str, "_models.ReplicationPromoteOption"]] = None, + promote_option: Optional[Union[str, "_models.ReadReplicaPromoteOption"]] = None, **kwargs: Any ) -> None: """ - :keyword role: Used to indicate role of the server in replication set. Known values are: - "None", "Primary", "AsyncReplica", and "GeoAsyncReplica". + :keyword role: Role of the server in a replication set. Known values are: "None", "Primary", + "AsyncReplica", and "GeoAsyncReplica". :paramtype role: str or ~azure.mgmt.postgresqlflexibleservers.models.ReplicationRole - :keyword promote_mode: Sets the promote mode for a replica server. This is a write only - property. Known values are: "standalone" and "switchover". + :keyword promote_mode: Type of operation to apply on the read replica. This property is write + only. Standalone means that the read replica will be promoted to a standalone server, and will + become a completely independent entity from the replication set. Switchover means that the read + replica will roles with the primary server. Known values are: "Standalone" and "Switchover". :paramtype promote_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.ReadReplicaPromoteMode - :keyword promote_option: Sets the promote options for a replica server. This is a write only - property. Known values are: "planned" and "forced". + :keyword promote_option: Data synchronization option to use when processing the operation + specified in the promoteMode property. This property is write only. Known values are: "Planned" + and "Forced". :paramtype promote_option: str or - ~azure.mgmt.postgresqlflexibleservers.models.ReplicationPromoteOption + ~azure.mgmt.postgresqlflexibleservers.models.ReadReplicaPromoteOption """ super().__init__(**kwargs) self.role = role @@ -3912,9 +4360,11 @@ def __init__( class RestartParameter(_serialization.Model): - """Represents server restart parameters. + """PostgreSQL database engine restart parameters. - :ivar restart_with_failover: Indicates whether to restart the server with failover. + :ivar restart_with_failover: Indicates if restart the PostgreSQL database engine should + failover or switch over from primary to standby. This only works if server has high + availability enabled. :vartype restart_with_failover: bool :ivar failover_mode: Failover mode. Known values are: "PlannedFailover", "ForcedFailover", "PlannedSwitchover", and "ForcedSwitchover". @@ -3934,7 +4384,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword restart_with_failover: Indicates whether to restart the server with failover. + :keyword restart_with_failover: Indicates if restart the PostgreSQL database engine should + failover or switch over from primary to standby. This only works if server has high + availability enabled. :paramtype restart_with_failover: bool :keyword failover_mode: Failover mode. Known values are: "PlannedFailover", "ForcedFailover", "PlannedSwitchover", and "ForcedSwitchover". @@ -3946,7 +4398,7 @@ def __init__( class Server(TrackedResource): - """Represents a server. + """Properties of a server. Variables are only populated by the server, and will be ignored when sending a request. @@ -3967,65 +4419,68 @@ class Server(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar sku: The SKU (pricing tier) of the server. + :ivar sku: Compute tier and size of a server. :vartype sku: ~azure.mgmt.postgresqlflexibleservers.models.Sku - :ivar identity: Describes the identity of the application. + :ivar identity: User assigned managed identities assigned to the server. :vartype identity: ~azure.mgmt.postgresqlflexibleservers.models.UserAssignedIdentity - :ivar administrator_login: The administrator's login name of a server. Can only be specified - when the server is being created (and is required for creation). + :ivar administrator_login: Name of the login designated as the first password based + administrator assigned to your instance of PostgreSQL. Must be specified the first time that + you enable password based authentication on a server. Once set to a given value, it cannot be + changed for the rest of the life of a server. If you disable password based authentication on a + server which had it enabled, this password based role isn't deleted. :vartype administrator_login: str - :ivar administrator_login_password: The administrator login password (required for server - creation). + :ivar administrator_login_password: Password assigned to the administrator login. As long as + password authentication is enabled, this password can be changed at any time. :vartype administrator_login_password: str - :ivar version: PostgreSQL Server version. Known values are: "17", "16", "15", "14", "13", "12", - and "11". - :vartype version: str or ~azure.mgmt.postgresqlflexibleservers.models.ServerVersion - :ivar minor_version: The minor version of the server. + :ivar version: Major version of PostgreSQL database engine. Known values are: "18", "17", "16", + "15", "14", "13", "12", and "11". + :vartype version: str or ~azure.mgmt.postgresqlflexibleservers.models.PostgresMajorVersion + :ivar minor_version: Minor version of PostgreSQL database engine. :vartype minor_version: str - :ivar state: A state of a server that is visible to user. Known values are: "Ready", - "Dropping", "Disabled", "Starting", "Stopping", "Stopped", "Updating", "Restarting", - "Inaccessible", and "Provisioning". + :ivar state: Possible states of a server. Known values are: "Ready", "Dropping", "Disabled", + "Starting", "Stopping", "Stopped", "Updating", "Restarting", "Inaccessible", and + "Provisioning". :vartype state: str or ~azure.mgmt.postgresqlflexibleservers.models.ServerState - :ivar fully_qualified_domain_name: The fully qualified domain name of a server. + :ivar fully_qualified_domain_name: Fully qualified domain name of a server. :vartype fully_qualified_domain_name: str :ivar storage: Storage properties of a server. :vartype storage: ~azure.mgmt.postgresqlflexibleservers.models.Storage - :ivar auth_config: AuthConfig properties of a server. + :ivar auth_config: Authentication configuration properties of a server. :vartype auth_config: ~azure.mgmt.postgresqlflexibleservers.models.AuthConfig :ivar data_encryption: Data encryption properties of a server. :vartype data_encryption: ~azure.mgmt.postgresqlflexibleservers.models.DataEncryption :ivar backup: Backup properties of a server. :vartype backup: ~azure.mgmt.postgresqlflexibleservers.models.Backup - :ivar network: Network properties of a server. This Network property is required to be passed - only in case you want the server to be Private access server. + :ivar network: Network properties of a server. Only required if you want your server to be + integrated into a virtual network provided by customer. :vartype network: ~azure.mgmt.postgresqlflexibleservers.models.Network :ivar high_availability: High availability properties of a server. :vartype high_availability: ~azure.mgmt.postgresqlflexibleservers.models.HighAvailability :ivar maintenance_window: Maintenance window properties of a server. :vartype maintenance_window: ~azure.mgmt.postgresqlflexibleservers.models.MaintenanceWindow - :ivar source_server_resource_id: The source server resource ID to restore from. It's required - when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or 'ReviveDropped'. This - property is returned only for Replica server. + :ivar source_server_resource_id: Identifier of the server to be used as the source of the new + server. Required when 'createMode' is 'PointInTimeRestore', 'GeoRestore', 'Replica', or + 'ReviveDropped'. This property is returned only when the target server is a read replica. :vartype source_server_resource_id: str - :ivar point_in_time_utc: Restore point creation time (ISO8601 format), specifying the time to - restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or - 'ReviveDropped'. + :ivar point_in_time_utc: Creation time (in ISO8601 format) of the backup which you want to + restore in the new server. It's required when 'createMode' is 'PointInTimeRestore', + 'GeoRestore', or 'ReviveDropped'. :vartype point_in_time_utc: ~datetime.datetime - :ivar availability_zone: availability zone information of the server. + :ivar availability_zone: Availability zone of a server. :vartype availability_zone: str - :ivar replication_role: Replication role of the server. Known values are: "None", "Primary", - "AsyncReplica", and "GeoAsyncReplica". + :ivar replication_role: Role of the server in a replication set. Known values are: "None", + "Primary", "AsyncReplica", and "GeoAsyncReplica". :vartype replication_role: str or ~azure.mgmt.postgresqlflexibleservers.models.ReplicationRole - :ivar replica_capacity: Replicas allowed for a server. + :ivar replica_capacity: Maximum number of read replicas allowed for a server. :vartype replica_capacity: int - :ivar replica: Replica properties of a server. These Replica properties are required to be - passed only in case you want to Promote a server. + :ivar replica: Read replica properties of a server. Required only in case that you want to + promote a server. :vartype replica: ~azure.mgmt.postgresqlflexibleservers.models.Replica - :ivar create_mode: The mode to create a new PostgreSQL server. Known values are: "Default", - "Create", "Update", "PointInTimeRestore", "GeoRestore", "Replica", and "ReviveDropped". + :ivar create_mode: Creation mode of a new server. Known values are: "Default", "Create", + "Update", "PointInTimeRestore", "GeoRestore", "Replica", and "ReviveDropped". :vartype create_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.CreateMode :ivar private_endpoint_connections: List of private endpoint connections associated with the - specified resource. + specified server. :vartype private_endpoint_connections: list[~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection] :ivar cluster: Cluster properties of a server. @@ -4085,12 +4540,12 @@ def __init__( # pylint: disable=too-many-locals self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, sku: Optional["_models.Sku"] = None, identity: Optional["_models.UserAssignedIdentity"] = None, administrator_login: Optional[str] = None, administrator_login_password: Optional[str] = None, - version: Optional[Union[str, "_models.ServerVersion"]] = None, + version: Optional[Union[str, "_models.PostgresMajorVersion"]] = None, storage: Optional["_models.Storage"] = None, auth_config: Optional["_models.AuthConfig"] = None, data_encryption: Optional["_models.DataEncryption"] = None, @@ -4112,53 +4567,56 @@ def __init__( # pylint: disable=too-many-locals :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword sku: The SKU (pricing tier) of the server. + :keyword sku: Compute tier and size of a server. :paramtype sku: ~azure.mgmt.postgresqlflexibleservers.models.Sku - :keyword identity: Describes the identity of the application. + :keyword identity: User assigned managed identities assigned to the server. :paramtype identity: ~azure.mgmt.postgresqlflexibleservers.models.UserAssignedIdentity - :keyword administrator_login: The administrator's login name of a server. Can only be specified - when the server is being created (and is required for creation). + :keyword administrator_login: Name of the login designated as the first password based + administrator assigned to your instance of PostgreSQL. Must be specified the first time that + you enable password based authentication on a server. Once set to a given value, it cannot be + changed for the rest of the life of a server. If you disable password based authentication on a + server which had it enabled, this password based role isn't deleted. :paramtype administrator_login: str - :keyword administrator_login_password: The administrator login password (required for server - creation). + :keyword administrator_login_password: Password assigned to the administrator login. As long as + password authentication is enabled, this password can be changed at any time. :paramtype administrator_login_password: str - :keyword version: PostgreSQL Server version. Known values are: "17", "16", "15", "14", "13", - "12", and "11". - :paramtype version: str or ~azure.mgmt.postgresqlflexibleservers.models.ServerVersion + :keyword version: Major version of PostgreSQL database engine. Known values are: "18", "17", + "16", "15", "14", "13", "12", and "11". + :paramtype version: str or ~azure.mgmt.postgresqlflexibleservers.models.PostgresMajorVersion :keyword storage: Storage properties of a server. :paramtype storage: ~azure.mgmt.postgresqlflexibleservers.models.Storage - :keyword auth_config: AuthConfig properties of a server. + :keyword auth_config: Authentication configuration properties of a server. :paramtype auth_config: ~azure.mgmt.postgresqlflexibleservers.models.AuthConfig :keyword data_encryption: Data encryption properties of a server. :paramtype data_encryption: ~azure.mgmt.postgresqlflexibleservers.models.DataEncryption :keyword backup: Backup properties of a server. :paramtype backup: ~azure.mgmt.postgresqlflexibleservers.models.Backup - :keyword network: Network properties of a server. This Network property is required to be - passed only in case you want the server to be Private access server. + :keyword network: Network properties of a server. Only required if you want your server to be + integrated into a virtual network provided by customer. :paramtype network: ~azure.mgmt.postgresqlflexibleservers.models.Network :keyword high_availability: High availability properties of a server. :paramtype high_availability: ~azure.mgmt.postgresqlflexibleservers.models.HighAvailability :keyword maintenance_window: Maintenance window properties of a server. :paramtype maintenance_window: ~azure.mgmt.postgresqlflexibleservers.models.MaintenanceWindow - :keyword source_server_resource_id: The source server resource ID to restore from. It's - required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or 'Replica' or - 'ReviveDropped'. This property is returned only for Replica server. + :keyword source_server_resource_id: Identifier of the server to be used as the source of the + new server. Required when 'createMode' is 'PointInTimeRestore', 'GeoRestore', 'Replica', or + 'ReviveDropped'. This property is returned only when the target server is a read replica. :paramtype source_server_resource_id: str - :keyword point_in_time_utc: Restore point creation time (ISO8601 format), specifying the time - to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'GeoRestore' or - 'ReviveDropped'. + :keyword point_in_time_utc: Creation time (in ISO8601 format) of the backup which you want to + restore in the new server. It's required when 'createMode' is 'PointInTimeRestore', + 'GeoRestore', or 'ReviveDropped'. :paramtype point_in_time_utc: ~datetime.datetime - :keyword availability_zone: availability zone information of the server. + :keyword availability_zone: Availability zone of a server. :paramtype availability_zone: str - :keyword replication_role: Replication role of the server. Known values are: "None", "Primary", - "AsyncReplica", and "GeoAsyncReplica". + :keyword replication_role: Role of the server in a replication set. Known values are: "None", + "Primary", "AsyncReplica", and "GeoAsyncReplica". :paramtype replication_role: str or ~azure.mgmt.postgresqlflexibleservers.models.ReplicationRole - :keyword replica: Replica properties of a server. These Replica properties are required to be - passed only in case you want to Promote a server. + :keyword replica: Read replica properties of a server. Required only in case that you want to + promote a server. :paramtype replica: ~azure.mgmt.postgresqlflexibleservers.models.Replica - :keyword create_mode: The mode to create a new PostgreSQL server. Known values are: "Default", - "Create", "Update", "PointInTimeRestore", "GeoRestore", "Replica", and "ReviveDropped". + :keyword create_mode: Creation mode of a new server. Known values are: "Default", "Create", + "Update", "PointInTimeRestore", "GeoRestore", "Replica", and "ReviveDropped". :paramtype create_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.CreateMode :keyword cluster: Cluster properties of a server. :paramtype cluster: ~azure.mgmt.postgresqlflexibleservers.models.Cluster @@ -4186,160 +4644,126 @@ def __init__( # pylint: disable=too-many-locals self.replica_capacity: Optional[int] = None self.replica = replica self.create_mode = create_mode - self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None + self.private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = None self.cluster = cluster -class ServerBackup(ProxyResource): - """Server backup properties. +class ServerEditionCapability(CapabilityBase): + """Capabilities in terms of compute tier. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. + :ivar status: The status of the capability. Known values are: "Visible", "Available", + "Default", and "Disabled". + :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus + :ivar reason: The reason for the capability not being available. + :vartype reason: str + :ivar name: Name of compute tier. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - :ivar backup_type: Backup type. Known values are: "Full" and "Customer On-Demand". - :vartype backup_type: str or ~azure.mgmt.postgresqlflexibleservers.models.Origin - :ivar completed_time: Backup completed time (ISO8601 format). - :vartype completed_time: ~datetime.datetime - :ivar source: Backup source. - :vartype source: str + :ivar default_sku_name: Default compute name (SKU) for this computer tier. + :vartype default_sku_name: str + :ivar supported_storage_editions: List of storage editions supported by this compute tier and + compute name. + :vartype supported_storage_editions: + list[~azure.mgmt.postgresqlflexibleservers.models.StorageEditionCapability] + :ivar supported_server_skus: List of supported compute names (SKUs). + :vartype supported_server_skus: + list[~azure.mgmt.postgresqlflexibleservers.models.ServerSkuCapability] """ _validation = { - "id": {"readonly": True}, + "status": {"readonly": True}, + "reason": {"readonly": True}, "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, + "default_sku_name": {"readonly": True}, + "supported_storage_editions": {"readonly": True}, + "supported_server_skus": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "reason": {"key": "reason", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "backup_type": {"key": "properties.backupType", "type": "str"}, - "completed_time": {"key": "properties.completedTime", "type": "iso-8601"}, - "source": {"key": "properties.source", "type": "str"}, - } - - def __init__( - self, - *, - backup_type: Optional[Union[str, "_models.Origin"]] = None, - completed_time: Optional[datetime.datetime] = None, - source: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword backup_type: Backup type. Known values are: "Full" and "Customer On-Demand". - :paramtype backup_type: str or ~azure.mgmt.postgresqlflexibleservers.models.Origin - :keyword completed_time: Backup completed time (ISO8601 format). - :paramtype completed_time: ~datetime.datetime - :keyword source: Backup source. - :paramtype source: str - """ - super().__init__(**kwargs) - self.backup_type = backup_type - self.completed_time = completed_time - self.source = source - - -class ServerBackupListResult(_serialization.Model): - """A list of server backups. - - :ivar value: The list of backups of a server. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.ServerBackup] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ServerBackup]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "default_sku_name": {"key": "defaultSkuName", "type": "str"}, + "supported_storage_editions": {"key": "supportedStorageEditions", "type": "[StorageEditionCapability]"}, + "supported_server_skus": {"key": "supportedServerSkus", "type": "[ServerSkuCapability]"}, } - def __init__( - self, *, value: Optional[List["_models.ServerBackup"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of backups of a server. - :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.ServerBackup] - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.name: Optional[str] = None + self.default_sku_name: Optional[str] = None + self.supported_storage_editions: Optional[list["_models.StorageEditionCapability"]] = None + self.supported_server_skus: Optional[list["_models.ServerSkuCapability"]] = None -class ServerForUpdate(_serialization.Model): +class ServerForPatch(_serialization.Model): """Represents a server to be updated. - :ivar sku: The SKU (pricing tier) of the server. - :vartype sku: ~azure.mgmt.postgresqlflexibleservers.models.Sku + :ivar sku: Compute tier and size of a server. + :vartype sku: ~azure.mgmt.postgresqlflexibleservers.models.SkuForPatch :ivar identity: Describes the identity of the application. :vartype identity: ~azure.mgmt.postgresqlflexibleservers.models.UserAssignedIdentity :ivar tags: Application-specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :ivar administrator_login: The administrator's login name of a server. Can only be specified - when the server is trying to switch to password authentication and does not have default - administrator login. + :ivar administrator_login: Name of the login designated as the first password based + administrator assigned to your instance of PostgreSQL. Must be specified the first time that + you enable password based authentication on a server. Once set to a given value, it cannot be + changed for the rest of the life of a server. If you disable password based authentication on a + server which had it enabled, this password based role isn't deleted. :vartype administrator_login: str - :ivar administrator_login_password: The password of the administrator login. + :ivar administrator_login_password: Password assigned to the administrator login. As long as + password authentication is enabled, this password can be changed at any time. :vartype administrator_login_password: str - :ivar version: PostgreSQL Server version. Version 17 is currently not supported for MVU. Known - values are: "17", "16", "15", "14", "13", "12", and "11". - :vartype version: str or ~azure.mgmt.postgresqlflexibleservers.models.ServerVersion + :ivar version: Major version of PostgreSQL database engine. Known values are: "18", "17", "16", + "15", "14", "13", "12", and "11". + :vartype version: str or ~azure.mgmt.postgresqlflexibleservers.models.PostgresMajorVersion :ivar storage: Storage properties of a server. :vartype storage: ~azure.mgmt.postgresqlflexibleservers.models.Storage :ivar backup: Backup properties of a server. - :vartype backup: ~azure.mgmt.postgresqlflexibleservers.models.Backup + :vartype backup: ~azure.mgmt.postgresqlflexibleservers.models.BackupForPatch :ivar high_availability: High availability properties of a server. - :vartype high_availability: ~azure.mgmt.postgresqlflexibleservers.models.HighAvailability + :vartype high_availability: + ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityForPatch :ivar maintenance_window: Maintenance window properties of a server. - :vartype maintenance_window: ~azure.mgmt.postgresqlflexibleservers.models.MaintenanceWindow - :ivar auth_config: AuthConfig properties of a server. - :vartype auth_config: ~azure.mgmt.postgresqlflexibleservers.models.AuthConfig + :vartype maintenance_window: + ~azure.mgmt.postgresqlflexibleservers.models.MaintenanceWindowForPatch + :ivar auth_config: Authentication configuration properties of a server. + :vartype auth_config: ~azure.mgmt.postgresqlflexibleservers.models.AuthConfigForPatch :ivar data_encryption: Data encryption properties of a server. :vartype data_encryption: ~azure.mgmt.postgresqlflexibleservers.models.DataEncryption - :ivar create_mode: The mode to update a new PostgreSQL server. Known values are: "Default" and - "Update". - :vartype create_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.CreateModeForUpdate - :ivar replication_role: Replication role of the server. Known values are: "None", "Primary", - "AsyncReplica", and "GeoAsyncReplica". + :ivar availability_zone: Availability zone of a server. + :vartype availability_zone: str + :ivar create_mode: Update mode of an existing server. Known values are: "Default" and "Update". + :vartype create_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.CreateModeForPatch + :ivar replication_role: Role of the server in a replication set. Known values are: "None", + "Primary", "AsyncReplica", and "GeoAsyncReplica". :vartype replication_role: str or ~azure.mgmt.postgresqlflexibleservers.models.ReplicationRole - :ivar replica: Replica properties of a server. These Replica properties are required to be - passed only in case you want to Promote a server. + :ivar replica: Read replica properties of a server. Required only in case that you want to + promote a server. :vartype replica: ~azure.mgmt.postgresqlflexibleservers.models.Replica - :ivar network: Network properties of a server. These are required to be passed only in case if - server is a private access server. + :ivar network: Network properties of a server. Only required if you want your server to be + integrated into a virtual network provided by customer. :vartype network: ~azure.mgmt.postgresqlflexibleservers.models.Network :ivar cluster: Cluster properties of a server. :vartype cluster: ~azure.mgmt.postgresqlflexibleservers.models.Cluster """ _attribute_map = { - "sku": {"key": "sku", "type": "Sku"}, + "sku": {"key": "sku", "type": "SkuForPatch"}, "identity": {"key": "identity", "type": "UserAssignedIdentity"}, "tags": {"key": "tags", "type": "{str}"}, "administrator_login": {"key": "properties.administratorLogin", "type": "str"}, "administrator_login_password": {"key": "properties.administratorLoginPassword", "type": "str"}, "version": {"key": "properties.version", "type": "str"}, "storage": {"key": "properties.storage", "type": "Storage"}, - "backup": {"key": "properties.backup", "type": "Backup"}, - "high_availability": {"key": "properties.highAvailability", "type": "HighAvailability"}, - "maintenance_window": {"key": "properties.maintenanceWindow", "type": "MaintenanceWindow"}, - "auth_config": {"key": "properties.authConfig", "type": "AuthConfig"}, + "backup": {"key": "properties.backup", "type": "BackupForPatch"}, + "high_availability": {"key": "properties.highAvailability", "type": "HighAvailabilityForPatch"}, + "maintenance_window": {"key": "properties.maintenanceWindow", "type": "MaintenanceWindowForPatch"}, + "auth_config": {"key": "properties.authConfig", "type": "AuthConfigForPatch"}, "data_encryption": {"key": "properties.dataEncryption", "type": "DataEncryption"}, + "availability_zone": {"key": "properties.availabilityZone", "type": "str"}, "create_mode": {"key": "properties.createMode", "type": "str"}, "replication_role": {"key": "properties.replicationRole", "type": "str"}, "replica": {"key": "properties.replica", "type": "Replica"}, @@ -4350,19 +4774,20 @@ class ServerForUpdate(_serialization.Model): def __init__( self, *, - sku: Optional["_models.Sku"] = None, + sku: Optional["_models.SkuForPatch"] = None, identity: Optional["_models.UserAssignedIdentity"] = None, - tags: Optional[Dict[str, str]] = None, - administrator_login: Optional[str] = None, - administrator_login_password: Optional[str] = None, - version: Optional[Union[str, "_models.ServerVersion"]] = None, - storage: Optional["_models.Storage"] = None, - backup: Optional["_models.Backup"] = None, - high_availability: Optional["_models.HighAvailability"] = None, - maintenance_window: Optional["_models.MaintenanceWindow"] = None, - auth_config: Optional["_models.AuthConfig"] = None, + tags: Optional[dict[str, str]] = None, + administrator_login: Optional[str] = None, + administrator_login_password: Optional[str] = None, + version: Optional[Union[str, "_models.PostgresMajorVersion"]] = None, + storage: Optional["_models.Storage"] = None, + backup: Optional["_models.BackupForPatch"] = None, + high_availability: Optional["_models.HighAvailabilityForPatch"] = None, + maintenance_window: Optional["_models.MaintenanceWindowForPatch"] = None, + auth_config: Optional["_models.AuthConfigForPatch"] = None, data_encryption: Optional["_models.DataEncryption"] = None, - create_mode: Optional[Union[str, "_models.CreateModeForUpdate"]] = None, + availability_zone: str = "", + create_mode: Optional[Union[str, "_models.CreateModeForPatch"]] = None, replication_role: Optional[Union[str, "_models.ReplicationRole"]] = None, replica: Optional["_models.Replica"] = None, network: Optional["_models.Network"] = None, @@ -4370,45 +4795,52 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword sku: The SKU (pricing tier) of the server. - :paramtype sku: ~azure.mgmt.postgresqlflexibleservers.models.Sku + :keyword sku: Compute tier and size of a server. + :paramtype sku: ~azure.mgmt.postgresqlflexibleservers.models.SkuForPatch :keyword identity: Describes the identity of the application. :paramtype identity: ~azure.mgmt.postgresqlflexibleservers.models.UserAssignedIdentity :keyword tags: Application-specific metadata in the form of key-value pairs. :paramtype tags: dict[str, str] - :keyword administrator_login: The administrator's login name of a server. Can only be specified - when the server is trying to switch to password authentication and does not have default - administrator login. + :keyword administrator_login: Name of the login designated as the first password based + administrator assigned to your instance of PostgreSQL. Must be specified the first time that + you enable password based authentication on a server. Once set to a given value, it cannot be + changed for the rest of the life of a server. If you disable password based authentication on a + server which had it enabled, this password based role isn't deleted. :paramtype administrator_login: str - :keyword administrator_login_password: The password of the administrator login. + :keyword administrator_login_password: Password assigned to the administrator login. As long as + password authentication is enabled, this password can be changed at any time. :paramtype administrator_login_password: str - :keyword version: PostgreSQL Server version. Version 17 is currently not supported for MVU. - Known values are: "17", "16", "15", "14", "13", "12", and "11". - :paramtype version: str or ~azure.mgmt.postgresqlflexibleservers.models.ServerVersion + :keyword version: Major version of PostgreSQL database engine. Known values are: "18", "17", + "16", "15", "14", "13", "12", and "11". + :paramtype version: str or ~azure.mgmt.postgresqlflexibleservers.models.PostgresMajorVersion :keyword storage: Storage properties of a server. :paramtype storage: ~azure.mgmt.postgresqlflexibleservers.models.Storage :keyword backup: Backup properties of a server. - :paramtype backup: ~azure.mgmt.postgresqlflexibleservers.models.Backup + :paramtype backup: ~azure.mgmt.postgresqlflexibleservers.models.BackupForPatch :keyword high_availability: High availability properties of a server. - :paramtype high_availability: ~azure.mgmt.postgresqlflexibleservers.models.HighAvailability + :paramtype high_availability: + ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityForPatch :keyword maintenance_window: Maintenance window properties of a server. - :paramtype maintenance_window: ~azure.mgmt.postgresqlflexibleservers.models.MaintenanceWindow - :keyword auth_config: AuthConfig properties of a server. - :paramtype auth_config: ~azure.mgmt.postgresqlflexibleservers.models.AuthConfig + :paramtype maintenance_window: + ~azure.mgmt.postgresqlflexibleservers.models.MaintenanceWindowForPatch + :keyword auth_config: Authentication configuration properties of a server. + :paramtype auth_config: ~azure.mgmt.postgresqlflexibleservers.models.AuthConfigForPatch :keyword data_encryption: Data encryption properties of a server. :paramtype data_encryption: ~azure.mgmt.postgresqlflexibleservers.models.DataEncryption - :keyword create_mode: The mode to update a new PostgreSQL server. Known values are: "Default" - and "Update". - :paramtype create_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.CreateModeForUpdate - :keyword replication_role: Replication role of the server. Known values are: "None", "Primary", - "AsyncReplica", and "GeoAsyncReplica". + :keyword availability_zone: Availability zone of a server. + :paramtype availability_zone: str + :keyword create_mode: Update mode of an existing server. Known values are: "Default" and + "Update". + :paramtype create_mode: str or ~azure.mgmt.postgresqlflexibleservers.models.CreateModeForPatch + :keyword replication_role: Role of the server in a replication set. Known values are: "None", + "Primary", "AsyncReplica", and "GeoAsyncReplica". :paramtype replication_role: str or ~azure.mgmt.postgresqlflexibleservers.models.ReplicationRole - :keyword replica: Replica properties of a server. These Replica properties are required to be - passed only in case you want to Promote a server. + :keyword replica: Read replica properties of a server. Required only in case that you want to + promote a server. :paramtype replica: ~azure.mgmt.postgresqlflexibleservers.models.Replica - :keyword network: Network properties of a server. These are required to be passed only in case - if server is a private access server. + :keyword network: Network properties of a server. Only required if you want your server to be + integrated into a virtual network provided by customer. :paramtype network: ~azure.mgmt.postgresqlflexibleservers.models.Network :keyword cluster: Cluster properties of a server. :paramtype cluster: ~azure.mgmt.postgresqlflexibleservers.models.Cluster @@ -4426,6 +4858,7 @@ def __init__( self.maintenance_window = maintenance_window self.auth_config = auth_config self.data_encryption = data_encryption + self.availability_zone = availability_zone self.create_mode = create_mode self.replication_role = replication_role self.replica = replica @@ -4433,10 +4866,10 @@ def __init__( self.cluster = cluster -class ServerListResult(_serialization.Model): +class ServerList(_serialization.Model): """A list of servers. - :ivar value: The list of flexible servers. + :ivar value: The list of servers. :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.Server] :ivar next_link: The link used to get the next page of operations. :vartype next_link: str @@ -4448,10 +4881,10 @@ class ServerListResult(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.Server"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Server"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The list of flexible servers. + :keyword value: The list of servers. :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.Server] :keyword next_link: The link used to get the next page of operations. :paramtype next_link: str @@ -4462,11 +4895,12 @@ def __init__( class ServerSku(_serialization.Model): - """Sku information related properties of a server. + """Compute information of a server. - :ivar name: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. + :ivar name: Compute tier and size of the database server. This object is empty for an Azure + Database for PostgreSQL single server. :vartype name: str - :ivar tier: The tier of the particular SKU, e.g. Burstable. Known values are: "Burstable", + :ivar tier: Tier of the compute assigned to a server. Known values are: "Burstable", "GeneralPurpose", and "MemoryOptimized". :vartype tier: str or ~azure.mgmt.postgresqlflexibleservers.models.SkuTier """ @@ -4480,9 +4914,10 @@ def __init__( self, *, name: Optional[str] = None, tier: Optional[Union[str, "_models.SkuTier"]] = None, **kwargs: Any ) -> None: """ - :keyword name: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. + :keyword name: Compute tier and size of the database server. This object is empty for an Azure + Database for PostgreSQL single server. :paramtype name: str - :keyword tier: The tier of the particular SKU, e.g. Burstable. Known values are: "Burstable", + :keyword tier: Tier of the compute assigned to a server. Known values are: "Burstable", "GeneralPurpose", and "MemoryOptimized". :paramtype tier: str or ~azure.mgmt.postgresqlflexibleservers.models.SkuTier """ @@ -4492,7 +4927,7 @@ def __init__( class ServerSkuCapability(CapabilityBase): - """Sku capability. + """Capabilities in terms of compute. Variables are only populated by the server, and will be ignored when sending a request. @@ -4501,22 +4936,25 @@ class ServerSkuCapability(CapabilityBase): :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus :ivar reason: The reason for the capability not being available. :vartype reason: str - :ivar name: Sku name. + :ivar name: Name of the compute (SKU). :vartype name: str - :ivar v_cores: Supported vCores. + :ivar v_cores: vCores available for this compute. :vartype v_cores: int - :ivar supported_iops: Supported IOPS. + :ivar supported_iops: Maximum IOPS supported by this compute. :vartype supported_iops: int - :ivar supported_memory_per_vcore_mb: Supported memory per vCore in MB. + :ivar supported_memory_per_vcore_mb: Supported memory (in MB) per virtual core assigned to this + compute. :vartype supported_memory_per_vcore_mb: int - :ivar supported_zones: List of supported Availability Zones. E.g. "1", "2", "3". + :ivar supported_zones: List of supported availability zones. E.g. '1', '2', '3'. :vartype supported_zones: list[str] - :ivar supported_ha_mode: Supported high availability mode. - :vartype supported_ha_mode: list[str or ~azure.mgmt.postgresqlflexibleservers.models.HaMode] - :ivar supported_features: The supported features. + :ivar supported_ha_mode: Modes of high availability supported for this compute. + :vartype supported_ha_mode: list[str or + ~azure.mgmt.postgresqlflexibleservers.models.HighAvailabilityMode] + :ivar supported_features: Features supported. :vartype supported_features: list[~azure.mgmt.postgresqlflexibleservers.models.SupportedFeature] - :ivar security_profile: The value of security profile indicating if its confidential vm. + :ivar security_profile: Security profile of the compute. Indicates if it's a Confidential + Compute virtual machine. :vartype security_profile: str """ @@ -4553,96 +4991,14 @@ def __init__(self, **kwargs: Any) -> None: self.v_cores: Optional[int] = None self.supported_iops: Optional[int] = None self.supported_memory_per_vcore_mb: Optional[int] = None - self.supported_zones: Optional[List[str]] = None - self.supported_ha_mode: Optional[List[Union[str, "_models.HaMode"]]] = None - self.supported_features: Optional[List["_models.SupportedFeature"]] = None + self.supported_zones: Optional[list[str]] = None + self.supported_ha_mode: Optional[list[Union[str, "_models.HighAvailabilityMode"]]] = None + self.supported_features: Optional[list["_models.SupportedFeature"]] = None self.security_profile: Optional[str] = None -class ServerThreatProtectionListResult(_serialization.Model): - """A list of the server's Advanced Threat Protection settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: - list[~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ServerThreatProtectionSettingsModel]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.ServerThreatProtectionSettingsModel"]] = None - self.next_link: Optional[str] = None - - -class ServerThreatProtectionSettingsModel(ProxyResource): - """Server's Advanced Threat Protection settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - :ivar state: Specifies the state of the Threat Protection, whether it is enabled or disabled or - a state has not been applied yet on the specific server. Known values are: "Enabled" and - "Disabled". - :vartype state: str or ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionState - :ivar creation_time: Specifies the UTC creation time of the policy. - :vartype creation_time: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "creation_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "state": {"key": "properties.state", "type": "str"}, - "creation_time": {"key": "properties.creationTime", "type": "iso-8601"}, - } - - def __init__(self, *, state: Optional[Union[str, "_models.ThreatProtectionState"]] = None, **kwargs: Any) -> None: - """ - :keyword state: Specifies the state of the Threat Protection, whether it is enabled or disabled - or a state has not been applied yet on the specific server. Known values are: "Enabled" and - "Disabled". - :paramtype state: str or ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionState - """ - super().__init__(**kwargs) - self.state = state - self.creation_time: Optional[datetime.datetime] = None - - class ServerVersionCapability(CapabilityBase): - """Server version capabilities. + """Capabilities in terms of major versions of PostgreSQL database engine. Variables are only populated by the server, and will be ignored when sending a request. @@ -4651,11 +5007,12 @@ class ServerVersionCapability(CapabilityBase): :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus :ivar reason: The reason for the capability not being available. :vartype reason: str - :ivar name: Server version. + :ivar name: Major version of PostgreSQL database engine. :vartype name: str - :ivar supported_versions_to_upgrade: Supported servers versions to upgrade. + :ivar supported_versions_to_upgrade: Major versions of PostgreSQL database engine to which this + version can be automatically upgraded. :vartype supported_versions_to_upgrade: list[str] - :ivar supported_features: The supported features. + :ivar supported_features: Features supported. :vartype supported_features: list[~azure.mgmt.postgresqlflexibleservers.models.SupportedFeature] """ @@ -4680,231 +5037,68 @@ def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name: Optional[str] = None - self.supported_versions_to_upgrade: Optional[List[str]] = None - self.supported_features: Optional[List["_models.SupportedFeature"]] = None - - -class SessionDetailsListResult(_serialization.Model): - """A list of tuning configuration sessions. - - :ivar value: A list of details of the session. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.SessionDetailsResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SessionDetailsResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SessionDetailsResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: A list of details of the session. - :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.SessionDetailsResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link + self.supported_versions_to_upgrade: Optional[list[str]] = None + self.supported_features: Optional[list["_models.SupportedFeature"]] = None -class SessionDetailsResource(_serialization.Model): - """Session details properties. - - :ivar iteration_id: Iteration id. - :vartype iteration_id: str - :ivar session_id: Session id. - :vartype session_id: str - :ivar applied_configuration: Applied configuration for the iteration. - :vartype applied_configuration: str - :ivar iteration_start_time: Iteration start time. - :vartype iteration_start_time: str - :ivar average_query_runtime_ms: The aqr for the iteration. - :vartype average_query_runtime_ms: str - :ivar transactions_per_second: The tps for the iteration. - :vartype transactions_per_second: str - """ +class Sku(_serialization.Model): + """Compute information of a server. - _attribute_map = { - "iteration_id": {"key": "iterationId", "type": "str"}, - "session_id": {"key": "sessionId", "type": "str"}, - "applied_configuration": {"key": "appliedConfiguration", "type": "str"}, - "iteration_start_time": {"key": "iterationStartTime", "type": "str"}, - "average_query_runtime_ms": {"key": "averageQueryRuntimeMs", "type": "str"}, - "transactions_per_second": {"key": "transactionsPerSecond", "type": "str"}, - } + All required parameters must be populated in order to send to server. - def __init__( - self, - *, - iteration_id: Optional[str] = None, - session_id: Optional[str] = None, - applied_configuration: Optional[str] = None, - iteration_start_time: Optional[str] = None, - average_query_runtime_ms: Optional[str] = None, - transactions_per_second: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword iteration_id: Iteration id. - :paramtype iteration_id: str - :keyword session_id: Session id. - :paramtype session_id: str - :keyword applied_configuration: Applied configuration for the iteration. - :paramtype applied_configuration: str - :keyword iteration_start_time: Iteration start time. - :paramtype iteration_start_time: str - :keyword average_query_runtime_ms: The aqr for the iteration. - :paramtype average_query_runtime_ms: str - :keyword transactions_per_second: The tps for the iteration. - :paramtype transactions_per_second: str - """ - super().__init__(**kwargs) - self.iteration_id = iteration_id - self.session_id = session_id - self.applied_configuration = applied_configuration - self.iteration_start_time = iteration_start_time - self.average_query_runtime_ms = average_query_runtime_ms - self.transactions_per_second = transactions_per_second - - -class SessionResource(_serialization.Model): - """Session resource properties. - - :ivar session_start_time: the tuning session start time. - :vartype session_start_time: str - :ivar session_id: Session id. - :vartype session_id: str - :ivar status: The status of the tuning session. - :vartype status: str - :ivar pre_tuning_aqr: The pre tuning aqr. - :vartype pre_tuning_aqr: str - :ivar post_tuning_aqr: The post tuning aqr. - :vartype post_tuning_aqr: str - :ivar pre_tuning_tps: The pre tuning tps. - :vartype pre_tuning_tps: str - :ivar post_tuning_tps: The post tuning tps. - :vartype post_tuning_tps: str + :ivar name: Name by which is known a given compute size assigned to a server. Required. + :vartype name: str + :ivar tier: Tier of the compute assigned to a server. Required. Known values are: "Burstable", + "GeneralPurpose", and "MemoryOptimized". + :vartype tier: str or ~azure.mgmt.postgresqlflexibleservers.models.SkuTier """ - _attribute_map = { - "session_start_time": {"key": "sessionStartTime", "type": "str"}, - "session_id": {"key": "sessionId", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "pre_tuning_aqr": {"key": "preTuningAqr", "type": "str"}, - "post_tuning_aqr": {"key": "postTuningAqr", "type": "str"}, - "pre_tuning_tps": {"key": "preTuningTps", "type": "str"}, - "post_tuning_tps": {"key": "postTuningTps", "type": "str"}, + _validation = { + "name": {"required": True}, + "tier": {"required": True}, } - def __init__( - self, - *, - session_start_time: Optional[str] = None, - session_id: Optional[str] = None, - status: Optional[str] = None, - pre_tuning_aqr: Optional[str] = None, - post_tuning_aqr: Optional[str] = None, - pre_tuning_tps: Optional[str] = None, - post_tuning_tps: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword session_start_time: the tuning session start time. - :paramtype session_start_time: str - :keyword session_id: Session id. - :paramtype session_id: str - :keyword status: The status of the tuning session. - :paramtype status: str - :keyword pre_tuning_aqr: The pre tuning aqr. - :paramtype pre_tuning_aqr: str - :keyword post_tuning_aqr: The post tuning aqr. - :paramtype post_tuning_aqr: str - :keyword pre_tuning_tps: The pre tuning tps. - :paramtype pre_tuning_tps: str - :keyword post_tuning_tps: The post tuning tps. - :paramtype post_tuning_tps: str - """ - super().__init__(**kwargs) - self.session_start_time = session_start_time - self.session_id = session_id - self.status = status - self.pre_tuning_aqr = pre_tuning_aqr - self.post_tuning_aqr = post_tuning_aqr - self.pre_tuning_tps = pre_tuning_tps - self.post_tuning_tps = post_tuning_tps - - -class SessionsListResult(_serialization.Model): - """A list of tuning configuration sessions. - - :ivar value: A list of tuning configuration sessions. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.SessionResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - _attribute_map = { - "value": {"key": "value", "type": "[SessionResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } - def __init__( - self, *, value: Optional[List["_models.SessionResource"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, name: str, tier: Union[str, "_models.SkuTier"], **kwargs: Any) -> None: """ - :keyword value: A list of tuning configuration sessions. - :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.SessionResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str + :keyword name: Name by which is known a given compute size assigned to a server. Required. + :paramtype name: str + :keyword tier: Tier of the compute assigned to a server. Required. Known values are: + "Burstable", "GeneralPurpose", and "MemoryOptimized". + :paramtype tier: str or ~azure.mgmt.postgresqlflexibleservers.models.SkuTier """ super().__init__(**kwargs) - self.value = value - self.next_link = next_link - + self.name = name + self.tier = tier -class Sku(_serialization.Model): - """Sku information related properties of a server. - All required parameters must be populated in order to send to server. +class SkuForPatch(_serialization.Model): + """Compute information of a server. - :ivar name: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. - Required. + :ivar name: Name by which is known a given compute size assigned to a server. :vartype name: str - :ivar tier: The tier of the particular SKU, e.g. Burstable. Required. Known values are: - "Burstable", "GeneralPurpose", and "MemoryOptimized". + :ivar tier: Tier of the compute assigned to a server. Known values are: "Burstable", + "GeneralPurpose", and "MemoryOptimized". :vartype tier: str or ~azure.mgmt.postgresqlflexibleservers.models.SkuTier """ - _validation = { - "name": {"required": True}, - "tier": {"required": True}, - } - _attribute_map = { "name": {"key": "name", "type": "str"}, "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, name: str, tier: Union[str, "_models.SkuTier"], **kwargs: Any) -> None: + def __init__( + self, *, name: Optional[str] = None, tier: Optional[Union[str, "_models.SkuTier"]] = None, **kwargs: Any + ) -> None: """ - :keyword name: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. - Required. + :keyword name: Name by which is known a given compute size assigned to a server. :paramtype name: str - :keyword tier: The tier of the particular SKU, e.g. Burstable. Required. Known values are: - "Burstable", "GeneralPurpose", and "MemoryOptimized". + :keyword tier: Tier of the compute assigned to a server. Known values are: "Burstable", + "GeneralPurpose", and "MemoryOptimized". :paramtype tier: str or ~azure.mgmt.postgresqlflexibleservers.models.SkuTier """ super().__init__(**kwargs) @@ -4915,24 +5109,25 @@ def __init__(self, *, name: str, tier: Union[str, "_models.SkuTier"], **kwargs: class Storage(_serialization.Model): """Storage properties of a server. - :ivar storage_size_gb: Max storage allowed for a server. + :ivar storage_size_gb: Size of storage assigned to a server. :vartype storage_size_gb: int - :ivar auto_grow: Flag to enable / disable Storage Auto grow for flexible server. Known values - are: "Enabled" and "Disabled". + :ivar auto_grow: Flag to enable or disable the automatic growth of storage size of a server + when available space is nearing zero and conditions allow for automatically growing storage + size. Known values are: "Enabled" and "Disabled". :vartype auto_grow: str or ~azure.mgmt.postgresqlflexibleservers.models.StorageAutoGrow - :ivar tier: Name of storage tier for IOPS. Known values are: "P1", "P2", "P3", "P4", "P6", - "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", and "P80". + :ivar tier: Storage tier of a server. Known values are: "P1", "P2", "P3", "P4", "P6", "P10", + "P15", "P20", "P30", "P40", "P50", "P60", "P70", and "P80". :vartype tier: str or - ~azure.mgmt.postgresqlflexibleservers.models.AzureManagedDiskPerformanceTiers - :ivar iops: Storage IOPS quantity. This property is required to be set for storage Type - PremiumV2_LRS and UltraSSD_LRS. + ~azure.mgmt.postgresqlflexibleservers.models.AzureManagedDiskPerformanceTier + :ivar iops: Maximum IOPS supported for storage. Required when type of storage is PremiumV2_LRS + or UltraSSD_LRS. :vartype iops: int - :ivar throughput: Storage throughput for the server. This is required to be set for storage - Type PremiumV2_LRS and UltraSSD_LRS. + :ivar throughput: Maximum throughput supported for storage. Required when type of storage is + PremiumV2_LRS or UltraSSD_LRS. :vartype throughput: int - :ivar type: Storage type for the server. Allowed values are Premium_LRS, PremiumV2_LRS, and - UltraSSD_LRS. Default is Premium_LRS if not specified. Known values are: "Premium_LRS", - "PremiumV2_LRS", and "UltraSSD_LRS". + :ivar type: Type of storage assigned to a server. Allowed values are Premium_LRS, + PremiumV2_LRS, or UltraSSD_LRS. If not specified, it defaults to Premium_LRS. Known values are: + "Premium_LRS", "PremiumV2_LRS", and "UltraSSD_LRS". :vartype type: str or ~azure.mgmt.postgresqlflexibleservers.models.StorageType """ @@ -4950,31 +5145,32 @@ def __init__( *, storage_size_gb: Optional[int] = None, auto_grow: Optional[Union[str, "_models.StorageAutoGrow"]] = None, - tier: Optional[Union[str, "_models.AzureManagedDiskPerformanceTiers"]] = None, + tier: Optional[Union[str, "_models.AzureManagedDiskPerformanceTier"]] = None, iops: Optional[int] = None, throughput: Optional[int] = None, type: Optional[Union[str, "_models.StorageType"]] = None, **kwargs: Any ) -> None: """ - :keyword storage_size_gb: Max storage allowed for a server. + :keyword storage_size_gb: Size of storage assigned to a server. :paramtype storage_size_gb: int - :keyword auto_grow: Flag to enable / disable Storage Auto grow for flexible server. Known - values are: "Enabled" and "Disabled". + :keyword auto_grow: Flag to enable or disable the automatic growth of storage size of a server + when available space is nearing zero and conditions allow for automatically growing storage + size. Known values are: "Enabled" and "Disabled". :paramtype auto_grow: str or ~azure.mgmt.postgresqlflexibleservers.models.StorageAutoGrow - :keyword tier: Name of storage tier for IOPS. Known values are: "P1", "P2", "P3", "P4", "P6", - "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", and "P80". + :keyword tier: Storage tier of a server. Known values are: "P1", "P2", "P3", "P4", "P6", "P10", + "P15", "P20", "P30", "P40", "P50", "P60", "P70", and "P80". :paramtype tier: str or - ~azure.mgmt.postgresqlflexibleservers.models.AzureManagedDiskPerformanceTiers - :keyword iops: Storage IOPS quantity. This property is required to be set for storage Type - PremiumV2_LRS and UltraSSD_LRS. + ~azure.mgmt.postgresqlflexibleservers.models.AzureManagedDiskPerformanceTier + :keyword iops: Maximum IOPS supported for storage. Required when type of storage is + PremiumV2_LRS or UltraSSD_LRS. :paramtype iops: int - :keyword throughput: Storage throughput for the server. This is required to be set for storage - Type PremiumV2_LRS and UltraSSD_LRS. + :keyword throughput: Maximum throughput supported for storage. Required when type of storage is + PremiumV2_LRS or UltraSSD_LRS. :paramtype throughput: int - :keyword type: Storage type for the server. Allowed values are Premium_LRS, PremiumV2_LRS, and - UltraSSD_LRS. Default is Premium_LRS if not specified. Known values are: "Premium_LRS", - "PremiumV2_LRS", and "UltraSSD_LRS". + :keyword type: Type of storage assigned to a server. Allowed values are Premium_LRS, + PremiumV2_LRS, or UltraSSD_LRS. If not specified, it defaults to Premium_LRS. Known values are: + "Premium_LRS", "PremiumV2_LRS", and "UltraSSD_LRS". :paramtype type: str or ~azure.mgmt.postgresqlflexibleservers.models.StorageType """ super().__init__(**kwargs) @@ -4987,7 +5183,7 @@ def __init__( class StorageEditionCapability(CapabilityBase): - """Storage edition capability. + """Capabilities in terms of storage tier. Variables are only populated by the server, and will be ignored when sending a request. @@ -4996,11 +5192,11 @@ class StorageEditionCapability(CapabilityBase): :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus :ivar reason: The reason for the capability not being available. :vartype reason: str - :ivar name: Storage edition name. + :ivar name: Name of storage tier. :vartype name: str - :ivar default_storage_size_mb: Default storage size in MB for storage edition. + :ivar default_storage_size_mb: Default storage size (in MB) for this storage tier. :vartype default_storage_size_mb: int - :ivar supported_storage_mb: Flexible server supported storage range in MB. + :ivar supported_storage_mb: Configurations of storage supported for this storage tier. :vartype supported_storage_mb: list[~azure.mgmt.postgresqlflexibleservers.models.StorageMbCapability] """ @@ -5026,11 +5222,11 @@ def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.name: Optional[str] = None self.default_storage_size_mb: Optional[int] = None - self.supported_storage_mb: Optional[List["_models.StorageMbCapability"]] = None + self.supported_storage_mb: Optional[list["_models.StorageMbCapability"]] = None class StorageMbCapability(CapabilityBase): - """storage size in MB capability. + """Storage size (in MB) capability. Variables are only populated by the server, and will be ignored when sending a request. @@ -5039,22 +5235,21 @@ class StorageMbCapability(CapabilityBase): :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus :ivar reason: The reason for the capability not being available. :vartype reason: str - :ivar supported_iops: Supported IOPS. + :ivar supported_iops: Minimum IOPS supported by the storage size. :vartype supported_iops: int - :ivar supported_maximum_iops: Maximum IOPS supported by this #Vcores or PremiumV2_LRS Storage - Size. + :ivar supported_maximum_iops: Maximum IOPS supported by the storage size. :vartype supported_maximum_iops: int - :ivar storage_size_mb: Storage size in MB. + :ivar storage_size_mb: Minimum supported size (in MB) of storage. :vartype storage_size_mb: int - :ivar maximum_storage_size_mb: Maximum value of Storage size in MB. + :ivar maximum_storage_size_mb: Maximum supported size (in MB) of storage. :vartype maximum_storage_size_mb: int - :ivar supported_throughput: Values of throughput in MB/s. + :ivar supported_throughput: Minimum supported throughput (in MB/s) of storage. :vartype supported_throughput: int - :ivar supported_maximum_throughput: Maximum values of throughput in MB/s. + :ivar supported_maximum_throughput: Maximum supported throughput (in MB/s) of storage. :vartype supported_maximum_throughput: int - :ivar default_iops_tier: Default tier for IOPS. + :ivar default_iops_tier: Default IOPS for this tier and storage size. :vartype default_iops_tier: str - :ivar supported_iops_tiers: List of available options to upgrade the storage performance. + :ivar supported_iops_tiers: List of all supported storage tiers for this tier and storage size. :vartype supported_iops_tiers: list[~azure.mgmt.postgresqlflexibleservers.models.StorageTierCapability] """ @@ -5095,11 +5290,11 @@ def __init__(self, **kwargs: Any) -> None: self.supported_throughput: Optional[int] = None self.supported_maximum_throughput: Optional[int] = None self.default_iops_tier: Optional[str] = None - self.supported_iops_tiers: Optional[List["_models.StorageTierCapability"]] = None + self.supported_iops_tiers: Optional[list["_models.StorageTierCapability"]] = None class StorageTierCapability(CapabilityBase): - """Represents capability of a storage tier. + """Capability of a storage tier. Variables are only populated by the server, and will be ignored when sending a request. @@ -5108,9 +5303,9 @@ class StorageTierCapability(CapabilityBase): :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.CapabilityStatus :ivar reason: The reason for the capability not being available. :vartype reason: str - :ivar name: Name to represent Storage tier capability. + :ivar name: Name of the storage tier. :vartype name: str - :ivar iops: Supported IOPS for this storage tier. + :ivar iops: Supported IOPS for the storage tier. :vartype iops: int """ @@ -5136,14 +5331,15 @@ def __init__(self, **kwargs: Any) -> None: class SupportedFeature(_serialization.Model): - """The supported features. + """Features supported. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of feature. + :ivar name: Name of the feature. :vartype name: str - :ivar status: Status of feature. Known values are: "Enabled" and "Disabled". - :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.SupportedFeatureStatusEnum + :ivar status: Status of the feature. Indicates if the feature is enabled or not. Known values + are: "Enabled" and "Disabled". + :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.FeatureStatus """ _validation = { @@ -5160,7 +5356,7 @@ def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name: Optional[str] = None - self.status: Optional[Union[str, "_models.SupportedFeatureStatusEnum"]] = None + self.status: Optional[Union[str, "_models.FeatureStatus"]] = None class SystemData(_serialization.Model): @@ -5229,33 +5425,46 @@ def __init__( self.last_modified_at = last_modified_at -class TuningOptionsListResult(_serialization.Model): - """A list of server tuning options. +class TuningOptions(ProxyResource): + """Impact on some metric if this recommended action is applied. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData + """ + - :ivar value: A list of available tuning options. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.TuningOptionsResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. +class TuningOptionsList(_serialization.Model): + """List of server tuning options. + + :ivar value: List of available tuning options. + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.TuningOptions] + :ivar next_link: Link used to get the next page of results. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[TuningOptionsResource]"}, + "value": {"key": "value", "type": "[TuningOptions]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.TuningOptionsResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any + self, *, value: Optional[list["_models.TuningOptions"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: A list of available tuning options. - :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.TuningOptionsResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. + :keyword value: List of available tuning options. + :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.TuningOptions] + :keyword next_link: Link used to get the next page of results. :paramtype next_link: str """ super().__init__(**kwargs) @@ -5263,41 +5472,23 @@ def __init__( self.next_link = next_link -class TuningOptionsResource(ProxyResource): - """Stores property that features impact on some metric if this recommended action is applied. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - """ - - class UserAssignedIdentity(_serialization.Model): - """Information describing the identities associated with this application. + """Identities associated with a server. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to server. - :ivar user_assigned_identities: represents user assigned identities map. + :ivar user_assigned_identities: Map of user assigned managed identities. :vartype user_assigned_identities: dict[str, ~azure.mgmt.postgresqlflexibleservers.models.UserIdentity] - :ivar principal_id: the identity principal Id of the server. + :ivar principal_id: Identifier of the object of the service principal associated to the user + assigned managed identity. :vartype principal_id: str - :ivar type: the types of identities associated with this resource. Required. Known values are: - "None", "UserAssigned", "SystemAssigned", and "SystemAssigned,UserAssigned". + :ivar type: Types of identities associated with a server. Required. Known values are: "None", + "UserAssigned", "SystemAssigned", and "SystemAssigned,UserAssigned". :vartype type: str or ~azure.mgmt.postgresqlflexibleservers.models.IdentityType - :ivar tenant_id: Tenant id of the server. + :ivar tenant_id: Identifier of the tenant of a server. :vartype tenant_id: str """ @@ -5317,18 +5508,19 @@ def __init__( self, *, type: Union[str, "_models.IdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserIdentity"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserIdentity"]] = None, principal_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword user_assigned_identities: represents user assigned identities map. + :keyword user_assigned_identities: Map of user assigned managed identities. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.postgresqlflexibleservers.models.UserIdentity] - :keyword principal_id: the identity principal Id of the server. + :keyword principal_id: Identifier of the object of the service principal associated to the user + assigned managed identity. :paramtype principal_id: str - :keyword type: the types of identities associated with this resource. Required. Known values - are: "None", "UserAssigned", "SystemAssigned", and "SystemAssigned,UserAssigned". + :keyword type: Types of identities associated with a server. Required. Known values are: + "None", "UserAssigned", "SystemAssigned", and "SystemAssigned,UserAssigned". :paramtype type: str or ~azure.mgmt.postgresqlflexibleservers.models.IdentityType """ super().__init__(**kwargs) @@ -5339,12 +5531,13 @@ def __init__( class UserIdentity(_serialization.Model): - """Describes a single user-assigned identity associated with the application. + """User assigned managed identity associated with a server. - :ivar principal_id: the object identifier of the Service Principal which this identity - represents. + :ivar principal_id: Identifier of the object of the service principal associated to the user + assigned managed identity. :vartype principal_id: str - :ivar client_id: the client identifier of the Service Principal which this identity represents. + :ivar client_id: Identifier of the client of the service principal associated to the user + assigned managed identity. :vartype client_id: str """ @@ -5355,11 +5548,11 @@ class UserIdentity(_serialization.Model): def __init__(self, *, principal_id: Optional[str] = None, client_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword principal_id: the object identifier of the Service Principal which this identity - represents. + :keyword principal_id: Identifier of the object of the service principal associated to the user + assigned managed identity. :paramtype principal_id: str - :keyword client_id: the client identifier of the Service Principal which this identity - represents. + :keyword client_id: Identifier of the client of the service principal associated to the user + assigned managed identity. :paramtype client_id: str """ super().__init__(**kwargs) @@ -5373,9 +5566,9 @@ class ValidationDetails(_serialization.Model): :ivar status: Validation status for migration. Known values are: "Failed", "Succeeded", and "Warning". :vartype status: str or ~azure.mgmt.postgresqlflexibleservers.models.ValidationState - :ivar validation_start_time_in_utc: Validation Start date-time in UTC. + :ivar validation_start_time_in_utc: Start time (UTC) for validation. :vartype validation_start_time_in_utc: ~datetime.datetime - :ivar validation_end_time_in_utc: Validation End date-time in UTC. + :ivar validation_end_time_in_utc: End time (UTC) for validation. :vartype validation_end_time_in_utc: ~datetime.datetime :ivar server_level_validation_details: Details of server level validations. :vartype server_level_validation_details: @@ -5399,17 +5592,17 @@ def __init__( status: Optional[Union[str, "_models.ValidationState"]] = None, validation_start_time_in_utc: Optional[datetime.datetime] = None, validation_end_time_in_utc: Optional[datetime.datetime] = None, - server_level_validation_details: Optional[List["_models.ValidationSummaryItem"]] = None, - db_level_validation_details: Optional[List["_models.DbLevelValidationStatus"]] = None, + server_level_validation_details: Optional[list["_models.ValidationSummaryItem"]] = None, + db_level_validation_details: Optional[list["_models.DbLevelValidationStatus"]] = None, **kwargs: Any ) -> None: """ :keyword status: Validation status for migration. Known values are: "Failed", "Succeeded", and "Warning". :paramtype status: str or ~azure.mgmt.postgresqlflexibleservers.models.ValidationState - :keyword validation_start_time_in_utc: Validation Start date-time in UTC. + :keyword validation_start_time_in_utc: Start time (UTC) for validation. :paramtype validation_start_time_in_utc: ~datetime.datetime - :keyword validation_end_time_in_utc: Validation End date-time in UTC. + :keyword validation_end_time_in_utc: End time (UTC) for validation. :paramtype validation_end_time_in_utc: ~datetime.datetime :keyword server_level_validation_details: Details of server level validations. :paramtype server_level_validation_details: @@ -5483,7 +5676,7 @@ def __init__( *, type: Optional[str] = None, state: Optional[Union[str, "_models.ValidationState"]] = None, - messages: Optional[List["_models.ValidationMessage"]] = None, + messages: Optional[list["_models.ValidationMessage"]] = None, **kwargs: Any ) -> None: """ @@ -5502,13 +5695,13 @@ def __init__( class VirtualEndpointResourceForPatch(_serialization.Model): - """Represents a virtual endpoint for a server. + """Pair of virtual endpoints for a server. Variables are only populated by the server, and will be ignored when sending a request. - :ivar endpoint_type: The endpoint type for the virtual endpoint. "ReadWrite" + :ivar endpoint_type: Type of endpoint for the virtual endpoints. "ReadWrite" :vartype endpoint_type: str or ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointType - :ivar members: List of members for a virtual endpoint. + :ivar members: List of servers that one of the virtual endpoints can refer to. :vartype members: list[str] :ivar virtual_endpoints: List of virtual endpoints for a server. :vartype virtual_endpoints: list[str] @@ -5528,24 +5721,24 @@ def __init__( self, *, endpoint_type: Optional[Union[str, "_models.VirtualEndpointType"]] = None, - members: Optional[List[str]] = None, + members: Optional[list[str]] = None, **kwargs: Any ) -> None: """ - :keyword endpoint_type: The endpoint type for the virtual endpoint. "ReadWrite" + :keyword endpoint_type: Type of endpoint for the virtual endpoints. "ReadWrite" :paramtype endpoint_type: str or ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointType - :keyword members: List of members for a virtual endpoint. + :keyword members: List of servers that one of the virtual endpoints can refer to. :paramtype members: list[str] """ super().__init__(**kwargs) self.endpoint_type = endpoint_type self.members = members - self.virtual_endpoints: Optional[List[str]] = None + self.virtual_endpoints: Optional[list[str]] = None -class VirtualEndpointResource(VirtualEndpointResourceForPatch, Resource): - """Represents a virtual endpoint for a server. +class VirtualEndpoint(VirtualEndpointResourceForPatch, Resource): + """Pair of virtual endpoints for a server. Variables are only populated by the server, and will be ignored when sending a request. @@ -5560,9 +5753,9 @@ class VirtualEndpointResource(VirtualEndpointResourceForPatch, Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.postgresqlflexibleservers.models.SystemData - :ivar endpoint_type: The endpoint type for the virtual endpoint. "ReadWrite" + :ivar endpoint_type: Type of endpoint for the virtual endpoints. "ReadWrite" :vartype endpoint_type: str or ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointType - :ivar members: List of members for a virtual endpoint. + :ivar members: List of servers that one of the virtual endpoints can refer to. :vartype members: list[str] :ivar virtual_endpoints: List of virtual endpoints for a server. :vartype virtual_endpoints: list[str] @@ -5590,14 +5783,14 @@ def __init__( self, *, endpoint_type: Optional[Union[str, "_models.VirtualEndpointType"]] = None, - members: Optional[List[str]] = None, + members: Optional[list[str]] = None, **kwargs: Any ) -> None: """ - :keyword endpoint_type: The endpoint type for the virtual endpoint. "ReadWrite" + :keyword endpoint_type: Type of endpoint for the virtual endpoints. "ReadWrite" :paramtype endpoint_type: str or ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointType - :keyword members: List of members for a virtual endpoint. + :keyword members: List of servers that one of the virtual endpoints can refer to. :paramtype members: list[str] """ super().__init__(endpoint_type=endpoint_type, members=members, **kwargs) @@ -5607,34 +5800,30 @@ def __init__( self.system_data: Optional["_models.SystemData"] = None self.endpoint_type = endpoint_type self.members = members - self.virtual_endpoints: Optional[List[str]] = None + self.virtual_endpoints: Optional[list[str]] = None -class VirtualEndpointsListResult(_serialization.Model): - """A list of virtual endpoints. +class VirtualEndpointsList(_serialization.Model): + """List of virtual endpoints. - :ivar value: The list of virtual endpoints. - :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] - :ivar next_link: The link used to get the next page of operations. + :ivar value: List of virtual endpoints. + :vartype value: list[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint] + :ivar next_link: Link used to get the next page of results. :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[VirtualEndpointResource]"}, + "value": {"key": "value", "type": "[VirtualEndpoint]"}, "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, - *, - value: Optional[List["_models.VirtualEndpointResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any + self, *, value: Optional[list["_models.VirtualEndpoint"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword value: The list of virtual endpoints. - :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] - :keyword next_link: The link used to get the next page of operations. + :keyword value: List of virtual endpoints. + :paramtype value: list[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint] + :keyword next_link: Link used to get the next page of results. :paramtype next_link: str """ super().__init__(**kwargs) @@ -5642,27 +5831,7 @@ def __init__( self.next_link = next_link -class VirtualNetworkSubnetUsageParameter(_serialization.Model): - """Virtual network subnet usage parameter. - - :ivar virtual_network_arm_resource_id: Virtual network resource id. - :vartype virtual_network_arm_resource_id: str - """ - - _attribute_map = { - "virtual_network_arm_resource_id": {"key": "virtualNetworkArmResourceId", "type": "str"}, - } - - def __init__(self, *, virtual_network_arm_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword virtual_network_arm_resource_id: Virtual network resource id. - :paramtype virtual_network_arm_resource_id: str - """ - super().__init__(**kwargs) - self.virtual_network_arm_resource_id = virtual_network_arm_resource_id - - -class VirtualNetworkSubnetUsageResult(_serialization.Model): +class VirtualNetworkSubnetUsageModel(_serialization.Model): """Virtual network subnet usage data. Variables are only populated by the server, and will be ignored when sending a request. @@ -5691,6 +5860,26 @@ class VirtualNetworkSubnetUsageResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.delegated_subnets_usage: Optional[List["_models.DelegatedSubnetUsage"]] = None + self.delegated_subnets_usage: Optional[list["_models.DelegatedSubnetUsage"]] = None self.location: Optional[str] = None self.subscription_id: Optional[str] = None + + +class VirtualNetworkSubnetUsageParameter(_serialization.Model): + """Virtual network subnet usage parameter. + + :ivar virtual_network_arm_resource_id: Virtual network resource id. + :vartype virtual_network_arm_resource_id: str + """ + + _attribute_map = { + "virtual_network_arm_resource_id": {"key": "virtualNetworkArmResourceId", "type": "str"}, + } + + def __init__(self, *, virtual_network_arm_resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword virtual_network_arm_resource_id: Virtual network resource id. + :paramtype virtual_network_arm_resource_id: str + """ + super().__init__(**kwargs) + self.virtual_network_arm_resource_id = virtual_network_arm_resource_id diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/_postgre_sql_management_client_enums.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/_postgre_sql_management_client_enums.py index 3b46cfaf1720..215777676a1c 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/_postgre_sql_management_client_enums.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/models/_postgre_sql_management_client_enums.py @@ -10,44 +10,58 @@ from azure.core import CaseInsensitiveEnumMeta -class ActiveDirectoryAuthEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """If Enabled, Microsoft Entra authentication is enabled.""" - - ENABLED = "Enabled" - DISABLED = "Disabled" - - -class ArmServerKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Data encryption type to depict if it is System Managed vs Azure Key vault.""" - - SYSTEM_MANAGED = "SystemManaged" - AZURE_KEY_VAULT = "AzureKeyVault" - - -class AzureManagedDiskPerformanceTiers(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Name of storage tier for IOPS.""" +class AzureManagedDiskPerformanceTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Storage tier of a server.""" P1 = "P1" + """Entry-level SSD for minimal IOPS, ideal for light development or testing workloads.""" P2 = "P2" + """Slightly higher IOPS for small-scale applications needing consistent low latency.""" P3 = "P3" + """Balanced performance for basic production workloads with moderate throughput.""" P4 = "P4" + """Enhanced IOPS for growing apps with predictable performance needs.""" P6 = "P6" + """Mid-tier SSD for steady workloads requiring reliable throughput and latency.""" P10 = "P10" + """Popular choice for general-purpose production workloads with scalable performance.""" P15 = "P15" + """High IOPS tier for demanding apps with frequent read/write operations.""" P20 = "P20" + """Entry point for high-performance Solid State Disks (SSDs), suitable for small-scale + I/O-intensive workloads.""" P30 = "P30" + """Balanced tier for moderate throughput and latency-sensitive applications.""" P40 = "P40" + """Enhanced performance for growing production workloads with consistent IOPS demands.""" P50 = "P50" + """Optimized for enterprise-grade applications needing sustained high throughput.""" P60 = "P60" + """High-capacity tier for large databases and analytics workloads with elevated IOPS.""" P70 = "P70" + """Designed for mission-critical systems requiring ultra-low latency and high concurrency.""" P80 = "P80" + """Top-tier SSD for maximum IOPS and throughput, ideal for the most demanding workloads.""" + + +class BackupType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of backup.""" + + FULL = "Full" + """A full backup taken automatically by the service. These backups are retained for a period of + time as defined by the backup retention policy, and they cannot be deleted by the customer.""" + CUSTOMER_ON_DEMAND = "Customer On-Demand" + """A full backup triggered by the customer. These backups are retained for a period of time as + defined by the backup retention policy, and they can also be deleted by the customer.""" -class CancelEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """To trigger cancel for entire migration we need to send this flag as True.""" +class Cancel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if cancel must be triggered for the entire migration.""" TRUE = "True" + """Cancel must be triggered for the entire migration.""" FALSE = "False" + """Cancel must not be triggered for the entire migration.""" class CapabilityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -67,12 +81,20 @@ class CheckNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ConfigurationDataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Data type of the configuration.""" + """Data type of the configuration (also known as server parameter).""" BOOLEAN = "Boolean" + """A boolean value.""" NUMERIC = "Numeric" + """A numeric value.""" INTEGER = "Integer" + """An integer value.""" ENUMERATION = "Enumeration" + """An enumeration value.""" + STRING = "String" + """A string value.""" + SET = "Set" + """A set of values.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -85,241 +107,413 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The mode to create a new PostgreSQL server.""" + """Creation mode of a new server.""" DEFAULT = "Default" + """If the operation is triggered on a non-existing server, it's equivalent to 'Create'. If the + operation is triggered on an existing server, it's equivalent to 'Update'.""" CREATE = "Create" + """Operation creates a new server.""" UPDATE = "Update" + """Operation updates an existing server.""" POINT_IN_TIME_RESTORE = "PointInTimeRestore" + """Operation restores an existing backup of an existing server. This operation creates a new + server, and then restores on it the backup of an existing server at a specific point in time.""" GEO_RESTORE = "GeoRestore" + """Operation restores an existing backup of an existing server, on the paired region of the + existing server. This operation creates a new server on the paired region of the existing + server, and then restores on it the backup of an existing server at a specific point in time, + in a different region. This operation is only supported on existing servers that were created + with geographically redundant backups enabled.""" REPLICA = "Replica" + """Operation creates a replica of an existing server. This operation creates a new server, + restores a base backup of the existing server (referred to as primary), and configures physical + replication to asynchronously stream all changes which are recorded in the transaction log of + the primary.""" REVIVE_DROPPED = "ReviveDropped" + """Operation creates a new server, initialized with the backup of a server that was recently + deleted.""" -class CreateModeForUpdate(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The mode to update a new PostgreSQL server.""" +class CreateModeForPatch(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Update mode of an existing server.""" DEFAULT = "Default" + """It's equivalent to 'Update'.""" UPDATE = "Update" + """Operation updates an existing server.""" + + +class DataEncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Data encryption type used by a server.""" + + SYSTEM_MANAGED = "SystemManaged" + """Encryption managed by Azure using platform managed keys for simplicity and compliance.""" + AZURE_KEY_VAULT = "AzureKeyVault" + """Encryption using customer managed keys stored in Azure Key Vault for enhanced control and + security.""" + + +class EncryptionKeyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of key used by a server configured with data encryption based on customer managed key, + to encrypt the primary storage associated to the server. + """ + + VALID = "Valid" + """Key is valid and can be used for encryption.""" + INVALID = "Invalid" + """Key is invalid and cannot be used for encryption. Possible causes include key deletion, + permission changes, key being disabled, key type not supported, or current date being outside + of validity period associated to the key.""" class ExecutionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Service-set extensible enum indicating the status of operation.""" RUNNING = "Running" + """The operation is currently running.""" CANCELLED = "Cancelled" + """The operation was cancelled.""" FAILED = "Failed" + """The operation failed.""" SUCCEEDED = "Succeeded" + """The operation succeeded.""" class FailoverMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Failover mode.""" PLANNED_FAILOVER = "PlannedFailover" + """Triggers a failover from primary to standby without killing the primary database process first. + This is a graceful failover that attempts to preserve data consistency.""" FORCED_FAILOVER = "ForcedFailover" + """Kills the primary database process first, then triggers the failover. This is more aggressive + and used when the primary is unresponsive or in an unhealthy state.""" PLANNED_SWITCHOVER = "PlannedSwitchover" + """Similar to 'PlannedFailover' but prefers a switch over operation where roles are swapped + between primary and standby.""" FORCED_SWITCHOVER = "ForcedSwitchover" + """Kills the primary database process and then triggers a switch over with role swapping.""" -class FastProvisioningSupportedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets a value indicating whether fast provisioning is supported. "Enabled" means fast - provisioning is supported. "Disabled" stands for fast provisioning is not supported. Will be - deprecated in future, please look to Supported Features for "FastProvisioning". +class FastProvisioningSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if fast provisioning is supported. 'Enabled' means fast provisioning is supported. + 'Disabled' stands for fast provisioning is not supported. Will be deprecated in the future. + Look to Supported Features for 'FastProvisioning'. """ ENABLED = "Enabled" + """Fast provisioning is supported.""" DISABLED = "Disabled" + """Fast provisioning is not supported.""" -class GeoBackupSupportedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Determines if geo-backup is supported in this region. "Enabled" means geo-backup is supported. - "Disabled" stands for geo-back is not supported. Will be deprecated in future, please look to - Supported Features for "GeoBackup". - """ +class FeatureStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the feature. Indicates if the feature is enabled or not.""" ENABLED = "Enabled" + """Feature is enabled.""" DISABLED = "Disabled" + """Feature is disabled.""" -class GeoRedundantBackupEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A value indicating whether Geo-Redundant backup is enabled on the server.""" +class GeographicallyRedundantBackup(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if the server is configured to create geographically redundant backups.""" ENABLED = "Enabled" + """Server is configured to create geographically redundant backups.""" DISABLED = "Disabled" + """Server is not configured to create geographically redundant backups.""" -class HaMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """HA mode supported for a server.""" +class GeographicallyRedundantBackupSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if geographically redundant backups are supported in this location. 'Enabled' means + geographically redundant backups are supported. 'Disabled' stands for geographically redundant + backup is not supported. Will be deprecated in the future. Look to Supported Features for + 'GeoBackup'. + """ - SAME_ZONE = "SameZone" - ZONE_REDUNDANT = "ZoneRedundant" + ENABLED = "Enabled" + """Geographically redundant backups are supported.""" + DISABLED = "Disabled" + """Geographically redundant backups are not supported.""" class HighAvailabilityMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The HA mode for the server.""" + """Modes of high availability supported for this compute.""" - DISABLED = "Disabled" ZONE_REDUNDANT = "ZoneRedundant" + """High availability is enabled for the server, with standby server in a different availability + zone than that of the primary.""" SAME_ZONE = "SameZone" + """High availability is enabled for the server, with standby server in the same availability zone + as the primary.""" + + +class HighAvailabilityState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Possible states of the standby server created when high availability is set to SameZone or + ZoneRedundant. + """ + + NOT_ENABLED = "NotEnabled" + """High availability is not enabled for the server.""" + CREATING_STANDBY = "CreatingStandby" + """Standby server is being created.""" + REPLICATING_DATA = "ReplicatingData" + """Data is being replicated to the standby server.""" + FAILING_OVER = "FailingOver" + """Failover operation to the standby server is in progress.""" + HEALTHY = "Healthy" + """Standby server is healthy and ready to take over in case of a failover.""" + REMOVING_STANDBY = "RemovingStandby" + """Standby server is being removed.""" class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the types of identities associated with this resource.""" + """Types of identities associated with a server.""" NONE = "None" + """No managed identity is assigned to the server.""" USER_ASSIGNED = "UserAssigned" + """One or more managed identities provided by the user are assigned to the server.""" SYSTEM_ASSIGNED = "SystemAssigned" + """Azure automatically creates and manages the identity associated to the lifecycle of the server.""" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + """Both system-assigned and user-assigned identities are assigned to the server.""" -class KeyStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Primary encryption key status for Data encryption enabled server.""" +class LocationRestricted(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if this location is restricted. 'Enabled' means location is restricted. 'Disabled' + stands for location is not restricted. Will be deprecated in the future. Look to Supported + Features for 'Restricted'. + """ - VALID = "Valid" - INVALID = "Invalid" + ENABLED = "Enabled" + """Location is restricted.""" + DISABLED = "Disabled" + """Location is not restricted.""" -class LogicalReplicationOnSourceDbEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether to setup LogicalReplicationOnSourceDb, if needed.""" +class LogicalReplicationOnSourceServer(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether to setup logical replication on source server, if needed.""" TRUE = "True" + """Logical replication will be set up on the source server.""" FALSE = "False" + """Logical replication will not be set up on the source server.""" -class MigrateRolesEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """To migrate roles and permissions we need to send this flag as True.""" +class MicrosoftEntraAuth(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if the server supports Microsoft Entra authentication.""" + + ENABLED = "Enabled" + """Server supports Microsoft Entra authentication.""" + DISABLED = "Disabled" + """Server doesn't support Microsoft Entra authentication.""" + + +class MigrateRolesAndPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if roles and permissions must be migrated.""" TRUE = "True" + """Roles and permissions will be migrated.""" FALSE = "False" + """Roles and permissions will not be migrated.""" -class MigrationDbState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Migration db state of an individual database.""" +class MigrationDatabaseState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Migration state of a database.""" IN_PROGRESS = "InProgress" + """Migration is in progress for the database.""" WAITING_FOR_CUTOVER_TRIGGER = "WaitingForCutoverTrigger" + """Migration is waiting for cutover trigger for the database.""" FAILED = "Failed" + """Migration has failed for the database.""" CANCELED = "Canceled" + """Migration has been canceled for the database.""" SUCCEEDED = "Succeeded" + """Migration has succeeded for the database.""" CANCELING = "Canceling" + """Migration is canceling for the database.""" class MigrationDetailsLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Migration details level.""" + """Level of details of a migration.""" DEFAULT = "Default" + """Default level of details.""" SUMMARY = "Summary" + """Summary level of details.""" FULL = "Full" + """Full level of details.""" class MigrationListFilter(str, Enum, metaclass=CaseInsensitiveEnumMeta): """MigrationListFilter.""" ACTIVE = "Active" + """Only active (in-progress) migrations.""" ALL = "All" + """All migrations.""" class MigrationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """There are two types of migration modes Online and Offline.""" + """Mode used to perform the migration: Online or Offline.""" OFFLINE = "Offline" + """Offline migration mode.""" ONLINE = "Online" + """Online migration mode.""" class MigrationNameAvailabilityReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Migration name availability reason.""" INVALID = "Invalid" + """Migration name is invalid.""" ALREADY_EXISTS = "AlreadyExists" + """Migration name already exists.""" class MigrationOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Supported types of migration request include Validate, Migrate and ValidateAndMigrate.""" + """Supported option for a migration.""" VALIDATE = "Validate" + """Validate the migration without performing it.""" MIGRATE = "Migrate" + """Perform the migration.""" VALIDATE_AND_MIGRATE = "ValidateAndMigrate" + """Validate and perform the migration.""" class MigrationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Migration state.""" + """State of migration.""" IN_PROGRESS = "InProgress" + """Migration is in progress.""" WAITING_FOR_USER_ACTION = "WaitingForUserAction" + """Migration is waiting for user action.""" CANCELED = "Canceled" + """Migration has been canceled.""" FAILED = "Failed" + """Migration has failed.""" SUCCEEDED = "Succeeded" + """Migration has succeeded.""" VALIDATION_FAILED = "ValidationFailed" + """Validation for migration has failed.""" CLEANING_UP = "CleaningUp" + """Migration is cleaning up resources.""" -class MigrationSubState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Migration sub state.""" +class MigrationSubstate(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Substate of migration.""" PERFORMING_PRE_REQUISITE_STEPS = "PerformingPreRequisiteSteps" + """Performing pre-requisite steps for migration.""" WAITING_FOR_LOGICAL_REPLICATION_SETUP_REQUEST_ON_SOURCE_DB = "WaitingForLogicalReplicationSetupRequestOnSourceDB" + """Waiting for logical replication setup request on source database.""" WAITING_FOR_DBS_TO_MIGRATE_SPECIFICATION = "WaitingForDBsToMigrateSpecification" + """Waiting for databases to migrate specification.""" WAITING_FOR_TARGET_DB_OVERWRITE_CONFIRMATION = "WaitingForTargetDBOverwriteConfirmation" + """Waiting for target database overwrite confirmation.""" WAITING_FOR_DATA_MIGRATION_SCHEDULING = "WaitingForDataMigrationScheduling" + """Waiting for data migration scheduling.""" WAITING_FOR_DATA_MIGRATION_WINDOW = "WaitingForDataMigrationWindow" + """Waiting for data migration window.""" MIGRATING_DATA = "MigratingData" + """Migrating data.""" WAITING_FOR_CUTOVER_TRIGGER = "WaitingForCutoverTrigger" + """Waiting for cutover trigger.""" COMPLETING_MIGRATION = "CompletingMigration" + """Completing migration.""" COMPLETED = "Completed" + """Migration completed.""" CANCELING_REQUESTED_DB_MIGRATIONS = "CancelingRequestedDBMigrations" + """Canceling requested database migrations.""" VALIDATION_IN_PROGRESS = "ValidationInProgress" + """Validation in progress.""" -class OnlineResizeSupportedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A value indicating whether online resize is supported in this region for the given - subscription. "Enabled" means storage online resize is supported. "Disabled" means storage - online resize is not supported. Will be deprecated in future, please look to Supported Features - for "OnlineResize". +class OnlineStorageResizeSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if resizing the storage, without interrupting the operation of the database engine, + is supported in this location for the given subscription. 'Enabled' means resizing the storage + without interrupting the operation of the database engine is supported. 'Disabled' means + resizing the storage without interrupting the operation of the database engine is not + supported. Will be deprecated in the future. Look to Supported Features for 'OnlineResize'. """ ENABLED = "Enabled" + """Resizing the storage without interrupting the operation of the database engine is supported.""" DISABLED = "Disabled" + """Resizing the storage without interrupting the operation of the database engine is not + supported.""" class OperationOrigin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The intended executor of the operation.""" + """Intended executor of the operation.""" NOT_SPECIFIED = "NotSpecified" + """The origin is not specified.""" USER = "user" + """The operation is initiated by a user.""" SYSTEM = "system" + """The operation is initiated by the system.""" -class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Backup type.""" - - FULL = "Full" - CUSTOMER_ON_DEMAND = "Customer On-Demand" - - -class OverwriteDbsInTargetEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether the databases on the target server can be overwritten, if already present. If - set to False, the migration workflow will wait for a confirmation, if it detects that the - database already exists. +class OverwriteDatabasesOnTargetServer(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if databases on the target server can be overwritten when already present. If set to + 'False', when the migration workflow detects that the database already exists on the target + server, it will wait for a confirmation. """ TRUE = "True" + """Databases on the target server can be overwritten when already present.""" FALSE = "False" + """Databases on the target server cannot be overwritten when already present.""" -class PasswordAuthEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """If Enabled, Password authentication is enabled.""" +class PasswordBasedAuth(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if the server supports password based authentication.""" ENABLED = "Enabled" + """Server supports password based authentication.""" DISABLED = "Disabled" + """Server doesn't support password based authentication.""" + + +class PostgresMajorVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Major version of PostgreSQL database engine.""" + + EIGHTEEN = "18" + """PostgreSQL 18.""" + SEVENTEEN = "17" + """PostgreSQL 17.""" + SIXTEEN = "16" + """PostgreSQL 16.""" + FIFTEEN = "15" + """PostgreSQL 15.""" + FOURTEEN = "14" + """PostgreSQL 14.""" + THIRTEEN = "13" + """PostgreSQL 13.""" + TWELVE = "12" + """PostgreSQL 12.""" + ELEVEN = "11" + """PostgreSQL 11.""" class PrincipalType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The principal type used to represent the type of Microsoft Entra Administrator.""" + """Type of Microsoft Entra principal to which the server administrator is associated.""" UNKNOWN = "Unknown" + """The principal type is not known or not specified.""" USER = "User" + """A Microsoft Entra user.""" GROUP = "Group" + """A Microsoft Entra group.""" SERVICE_PRINCIPAL = "ServicePrincipal" + """A Microsoft Entra service principal, typically representing an application or service identity""" class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -340,17 +534,29 @@ class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiv class ReadReplicaPromoteMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Sets the promote mode for a replica server. This is a write only property.""" + """Type of operation to apply on the read replica. This property is write only. Standalone means + that the read replica will be promoted to a standalone server, and will become a completely + independent entity from the replication set. Switchover means that the read replica will roles + with the primary server. + """ - STANDALONE = "standalone" - SWITCHOVER = "switchover" + STANDALONE = "Standalone" + """Read replica will become an independent server.""" + SWITCHOVER = "Switchover" + """Read replica will swap roles with primary server.""" -class RecommendationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RecommendationType.""" +class ReadReplicaPromoteOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Data synchronization option to use when processing the operation specified in the promoteMode + property. This property is write only. + """ - CREATE_INDEX = "CreateIndex" - DROP_INDEX = "DropIndex" + PLANNED = "Planned" + """The operation will wait for data in the read replica to be fully synchronized with its source + server, before it initiates the operation.""" + FORCED = "Forced" + """The operation will not wait for data in the read replica to be synchronized with its source + server, before it initiates the operation.""" class RecommendationTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -359,94 +565,107 @@ class RecommendationTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): CREATE_INDEX = "CreateIndex" DROP_INDEX = "DropIndex" RE_INDEX = "ReIndex" + ANALYZE_TABLE = "AnalyzeTable" -class ReplicationPromoteOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Sets the promote options for a replica server. This is a write only property.""" +class RecommendationTypeParameterEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RecommendationTypeParameterEnum.""" - PLANNED = "planned" - FORCED = "forced" + CREATE_INDEX = "CreateIndex" + DROP_INDEX = "DropIndex" + RE_INDEX = "ReIndex" + ANALYZE_TABLE = "AnalyzeTable" class ReplicationRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Used to indicate role of the server in replication set.""" + """Role of the server in a replication set.""" NONE = "None" + """No replication role assigned; the server operates independently.""" PRIMARY = "Primary" + """Acts as the source server for replication to one or more replicas.""" ASYNC_REPLICA = "AsyncReplica" + """Receives data asynchronously from a primary server within the same region.""" GEO_ASYNC_REPLICA = "GeoAsyncReplica" + """Receives data asynchronously from a primary server in a different region for geographical + redundancy.""" class ReplicationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Gets the replication state of a replica server. This property is returned only for replicas api - call. Supported values are Active, Catchup, Provisioning, Updating, Broken, Reconfiguring. + """Indicates the replication state of a read replica. This property is returned only when the + target server is a read replica. Possible values are Active, Broken, Catchup, Provisioning, + Reconfiguring, and Updating. """ ACTIVE = "Active" + """Read replica is fully synchronized and actively replicating data from the primary server.""" CATCHUP = "Catchup" + """Read replica is behind the primary server and is currently catching up with pending changes.""" PROVISIONING = "Provisioning" + """Read replica is being created and is in process of getting initialized.""" UPDATING = "Updating" + """Read replica is undergoing some changes it can be changing compute size of promoting it to + primary server.""" BROKEN = "Broken" + """Replication has failed or been interrupted.""" RECONFIGURING = "Reconfiguring" - - -class RestrictedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A value indicating whether this region is restricted. "Enabled" means region is restricted. - "Disabled" stands for region is not restricted. Will be deprecated in future, please look to - Supported Features for "Restricted". - """ - - ENABLED = "Enabled" - DISABLED = "Disabled" - - -class ServerHAState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A state of a HA server that is visible to user.""" - - NOT_ENABLED = "NotEnabled" - CREATING_STANDBY = "CreatingStandby" - REPLICATING_DATA = "ReplicatingData" - FAILING_OVER = "FailingOver" - HEALTHY = "Healthy" - REMOVING_STANDBY = "RemovingStandby" + """Read replica is being reconfigured, possibly due to changes in source or settings.""" class ServerPublicNetworkAccessState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """public network access is enabled or not.""" + """Indicates if public network access is enabled or not. This is only supported for servers that + are not integrated into a virtual network which is owned and provided by customer when server + is deployed. + """ ENABLED = "Enabled" + """Public network access is enabled. This allows the server to be accessed from the public + internet, provided the necessary firewall rule that allows incoming traffic originating from + the connecting client is in place. This is compatible with the use of private endpoints to + connect to this server.""" DISABLED = "Disabled" + """Public network access is disabled. This means the server cannot be accessed from the public + internet, but only via private endpoints.""" class ServerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A state of a server that is visible to user.""" + """Possible states of a server.""" READY = "Ready" + """Server is healthy and not undergoing any operations at the management or control plane level. + This doesn't mean that the server is fully operational at the data plane level.""" DROPPING = "Dropping" + """Server is being deleted.""" DISABLED = "Disabled" + """Server is disabled. Typical reasons include: the subscription on which the server is deployed + is explicitly disabled or canceled by the administrator, the spending limit has been reached, + or the bill is past due. May also happen when the server is being moved to another resource + group or subscription.""" STARTING = "Starting" + """PostgreSQL database engine is being restarted.""" STOPPING = "Stopping" + """Compute resources associated with the server are being stopped and deallocated. If the server + has high availability enabled, the compute resources of the standby server are also stopped and + deallocated.""" STOPPED = "Stopped" + """Compute resources associated with the server are being stopped and deallocated.""" UPDATING = "Updating" + """Server is undergoing some changes which may or may not impact the availability of the + PostgreSQL database engine. For example, the compute resources of the server are being scaled + up or down, which may cause temporary unavailability of the database engine. Or, for example, a + firewall rule is being added or removed, which doesn't cause any unavailability of the database + engine.""" RESTARTING = "Restarting" + """PostgreSQL database engine is being restarted.""" INACCESSIBLE = "Inaccessible" + """Server isn't accessible, because the key provided to encrypt and decrypt the data is in invalid + state.""" PROVISIONING = "Provisioning" - - -class ServerVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The version of a server.""" - - SEVENTEEN = "17" - SIXTEEN = "16" - FIFTEEN = "15" - FOURTEEN = "14" - THIRTEEN = "13" - TWELVE = "12" - ELEVEN = "11" + """Server is in the process of being created.""" class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The tier of the particular SKU, e.g. Burstable.""" + """Tier of the compute assigned to a server.""" BURSTABLE = "Burstable" GENERAL_PURPOSE = "GeneralPurpose" @@ -454,150 +673,208 @@ class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Migration source server type : OnPremises, AWS, GCP, AzureVM, PostgreSQLSingleServer, AWS_RDS, - AWS_AURORA, AWS_EC2, GCP_CloudSQL, GCP_AlloyDB, GCP_Compute, EDB, EDB_Oracle_Server, - EDB_PostgreSQL, PostgreSQLFlexibleServer, PostgreSQLCosmosDB, Huawei_RDS, Huawei_Compute, - Heroku_PostgreSQL, Crunchy_PostgreSQL, ApsaraDB_RDS, Digital_Ocean_Droplets, - Digital_Ocean_PostgreSQL, or Supabase_PostgreSQL. + """Source server type used for the migration: ApsaraDB_RDS, AWS, AWS_AURORA, AWS_EC2, AWS_RDS, + AzureVM, Crunchy_PostgreSQL, Digital_Ocean_Droplets, Digital_Ocean_PostgreSQL, EDB, + EDB_Oracle_Server, EDB_PostgreSQL, GCP, GCP_AlloyDB, GCP_CloudSQL, GCP_Compute, + Heroku_PostgreSQL, Huawei_Compute, Huawei_RDS, OnPremises, PostgreSQLCosmosDB, + PostgreSQLFlexibleServer, PostgreSQLSingleServer, or Supabase_PostgreSQL. """ ON_PREMISES = "OnPremises" + """On-premises PostgreSQL server.""" AWS = "AWS" + """Amazon Web Services PostgreSQL server.""" GCP = "GCP" + """Google Cloud Platform PostgreSQL server.""" AZURE_VM = "AzureVM" + """Azure Virtual Machine PostgreSQL server.""" POSTGRE_SQL_SINGLE_SERVER = "PostgreSQLSingleServer" + """Azure Database for PostgreSQL single server.""" AWS_RDS = "AWS_RDS" + """Amazon RDS for PostgreSQL.""" AWS_AURORA = "AWS_AURORA" + """Amazon Aurora for PostgreSQL.""" AWS_EC2 = "AWS_EC2" + """Amazon EC2 for PostgreSQL.""" GCP_CLOUD_SQL = "GCP_CloudSQL" + """Google Cloud SQL for PostgreSQL.""" GCP_ALLOY_DB = "GCP_AlloyDB" + """Google Cloud AlloyDB for PostgreSQL.""" GCP_COMPUTE = "GCP_Compute" + """Google Compute Engine for PostgreSQL.""" EDB = "EDB" + """EnterpriseDB PostgreSQL server.""" EDB_ORACLE_SERVER = "EDB_Oracle_Server" + """EnterpriseDB Oracle Server.""" EDB_POSTGRE_SQL = "EDB_PostgreSQL" + """EnterpriseDB PostgreSQL server.""" POSTGRE_SQL_FLEXIBLE_SERVER = "PostgreSQLFlexibleServer" + """Azure Database for PostgreSQL flexible server.""" POSTGRE_SQL_COSMOS_DB = "PostgreSQLCosmosDB" + """.NET Cosmos DB for PostgreSQL""" HUAWEI_RDS = "Huawei_RDS" + """Huawei RDS for PostgreSQL""" HUAWEI_COMPUTE = "Huawei_Compute" + """Huawei Compute for PostgreSQL""" HEROKU_POSTGRE_SQL = "Heroku_PostgreSQL" + """Heroku PostgreSQL""" CRUNCHY_POSTGRE_SQL = "Crunchy_PostgreSQL" + """Crunchy PostgreSQL""" APSARA_DB_RDS = "ApsaraDB_RDS" + """ApsaraDB RDS for PostgreSQL""" DIGITAL_OCEAN_DROPLETS = "Digital_Ocean_Droplets" + """Digital Ocean Droplets for PostgreSQL""" DIGITAL_OCEAN_POSTGRE_SQL = "Digital_Ocean_PostgreSQL" + """Digital Ocean PostgreSQL""" SUPABASE_POSTGRE_SQL = "Supabase_PostgreSQL" + """Supabase PostgreSQL""" class SslMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Supported SSL modes for migration. VerifyFull is the recommended SSL mode for Single server - migration. Prefer, Require are recommended SSL modes for other source types. + """SSL mode used by a migration. Default SSL mode for 'PostgreSQLSingleServer' is 'VerifyFull'. + Default SSL mode for other source types is 'Prefer'. """ PREFER = "Prefer" + """Prefer SSL connection. If the server does not support SSL, the connection will be established + without SSL.""" REQUIRE = "Require" + """Require SSL connection. If the server does not support SSL, the connection will fail.""" VERIFY_CA = "VerifyCA" + """Require SSL connection and verify the server certificate against the CA certificate.""" VERIFY_FULL = "VerifyFull" + """Require SSL connection, verify the server certificate against the CA certificate, and verify + that the server hostname matches the certificate.""" -class StartDataMigrationEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates whether the data migration should start right away.""" +class StartDataMigration(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if data migration must start right away.""" TRUE = "True" + """Data migration must start right away.""" FALSE = "False" + """Data migration must not start right away.""" class StorageAutoGrow(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Flag to enable / disable Storage Auto grow for flexible server.""" + """Flag to enable or disable the automatic growth of storage size of a server when available space + is nearing zero and conditions allow for automatically growing storage size. + """ ENABLED = "Enabled" + """Server should automatically grow storage size when available space is nearing zero and + conditions allow for automatically growing storage size.""" DISABLED = "Disabled" + """Server should not automatically grow storage size when available space is nearing zero.""" -class StorageAutoGrowthSupportedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A value indicating whether storage auto-grow is supported in this region. "Enabled" means - storage auto-grow is supported. "Disabled" stands for storage auto-grow is not supported. Will - be deprecated in future, please look to Supported Features for "StorageAutoGrowth". +class StorageAutoGrowthSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if storage autogrow is supported in this location. 'Enabled' means storage autogrow + is supported. 'Disabled' stands for storage autogrow is not supported. Will be deprecated in + the future. Look to Supported Features for 'StorageAutoGrowth'. """ ENABLED = "Enabled" + """Storage autogrow is supported.""" DISABLED = "Disabled" + """Storage autogrow is not supported.""" class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Storage type for the server. Allowed values are Premium_LRS, PremiumV2_LRS, and UltraSSD_LRS. - Default is Premium_LRS if not specified. + """Type of storage assigned to a server. Allowed values are Premium_LRS, PremiumV2_LRS, or + UltraSSD_LRS. If not specified, it defaults to Premium_LRS. """ PREMIUM_LRS = "Premium_LRS" + """Standard Solid State Disk (SSD) backed storage offering consistent performance for general + purpose workloads.""" PREMIUM_V2_LRS = "PremiumV2_LRS" + """Next generation Solid State Disk (SSD) storage with improved scalability and performance for + demanding enterprise workloads.""" ULTRA_SSD_LRS = "UltraSSD_LRS" - - -class SupportedFeatureStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of feature.""" - - ENABLED = "Enabled" - DISABLED = "Disabled" + """High-end Solid State Disk (SSD) storage designed for extreme IOPS and latency-sensitive + applications.""" class ThreatProtectionName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ThreatProtectionName.""" DEFAULT = "Default" + """Default advanced threat protection settings.""" class ThreatProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the state of the Threat Protection, whether it is enabled or disabled or a state has - not been applied yet on the specific server. + """Specifies the state of the advanced threat protection, whether it is enabled, disabled, or a + state has not been applied yet on the server. """ ENABLED = "Enabled" + """Advanced threat protection is enabled.""" DISABLED = "Disabled" + """Advanced threat protection is disabled.""" -class TriggerCutoverEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """To trigger cutover for entire migration we need to send this flag as True.""" +class TriggerCutover(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if cutover must be triggered for the entire migration.""" TRUE = "True" + """Cutover must be triggered for the entire migration.""" FALSE = "False" + """Cutover must not be triggered for the entire migration.""" -class TuningOptionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """TuningOptionEnum.""" +class TuningOptionParameterEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """TuningOptionParameterEnum.""" INDEX = "index" - CONFIGURATION = "configuration" + TABLE = "table" class ValidationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Validation status for migration.""" FAILED = "Failed" + """Validation has failed.""" SUCCEEDED = "Succeeded" + """Validation has succeeded.""" WARNING = "Warning" + """Validation has succeeded with warnings.""" class VirtualEndpointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The endpoint type for the virtual endpoint.""" + """Type of endpoint for the virtual endpoints.""" READ_WRITE = "ReadWrite" - - -class ZoneRedundantHaAndGeoBackupSupportedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A value indicating whether Zone Redundant HA and Geo-backup is supported in this region. - "Enabled" means zone redundant HA and geo-backup is supported. "Disabled" stands for zone - redundant HA and geo-backup is not supported. Will be deprecated in future, please look to - Supported Features for "ZoneRedundantHaAndGeoBackup". + """Read-write endpoint.""" + + +class ZoneRedundantHighAvailabilityAndGeographicallyRedundantBackupSupport( + str, Enum, metaclass=CaseInsensitiveEnumMeta +): + """Indicates if high availability with zone redundancy is supported in conjunction with + geographically redundant backups in this location. 'Enabled' means high availability with zone + redundancy is supported in conjunction with geographically redundant backups is supported. + 'Disabled' stands for high availability with zone redundancy is supported in conjunction with + geographically redundant backups is not supported. Will be deprecated in the future. Look to + Supported Features for 'ZoneRedundantHaAndGeoBackup'. """ ENABLED = "Enabled" + """High availability with zone redundancy is supported in conjunction with geographically + redundant backups.""" DISABLED = "Disabled" + """High availability with zone redundancy is not supported in conjunction with geographically + redundant backups.""" -class ZoneRedundantHaSupportedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A value indicating whether Zone Redundant HA is supported in this region. "Enabled" means zone - redundant HA is supported. "Disabled" stands for zone redundant HA is not supported. Will be - deprecated in future, please look to Supported Features for "ZoneRedundantHa". +class ZoneRedundantHighAvailabilitySupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates if high availability with zone redundancy is supported in this location. 'Enabled' + means high availability with zone redundancy is supported. 'Disabled' stands for high + availability with zone redundancy is not supported. Will be deprecated in the future. Look to + Supported Features for 'ZoneRedundantHa'. """ ENABLED = "Enabled" + """High availability with zone redundancy is supported.""" DISABLED = "Disabled" + """High availability with zone redundancy is not supported.""" diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/__init__.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/__init__.py index 3ffb79f125ba..e3f2cc110001 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/__init__.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/__init__.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -13,32 +12,27 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._administrators_operations import AdministratorsOperations # type: ignore -from ._backups_operations import BackupsOperations # type: ignore -from ._location_based_capabilities_operations import LocationBasedCapabilitiesOperations # type: ignore -from ._server_capabilities_operations import ServerCapabilitiesOperations # type: ignore -from ._check_name_availability_operations import CheckNameAvailabilityOperations # type: ignore -from ._check_name_availability_with_location_operations import CheckNameAvailabilityWithLocationOperations # type: ignore +from ._administrators_microsoft_entra_operations import AdministratorsMicrosoftEntraOperations # type: ignore +from ._advanced_threat_protection_settings_operations import AdvancedThreatProtectionSettingsOperations # type: ignore +from ._server_threat_protection_settings_operations import ServerThreatProtectionSettingsOperations # type: ignore +from ._backups_automatic_and_on_demand_operations import BackupsAutomaticAndOnDemandOperations # type: ignore +from ._capabilities_by_location_operations import CapabilitiesByLocationOperations # type: ignore +from ._capabilities_by_server_operations import CapabilitiesByServerOperations # type: ignore +from ._captured_logs_operations import CapturedLogsOperations # type: ignore from ._configurations_operations import ConfigurationsOperations # type: ignore from ._databases_operations import DatabasesOperations # type: ignore from ._firewall_rules_operations import FirewallRulesOperations # type: ignore -from ._servers_operations import ServersOperations # type: ignore -from ._flexible_server_operations import FlexibleServerOperations # type: ignore -from ._ltr_backup_operations_operations import LtrBackupOperationsOperations # type: ignore +from ._backups_long_term_retention_operations import BackupsLongTermRetentionOperations # type: ignore from ._migrations_operations import MigrationsOperations # type: ignore -from ._postgre_sql_management_client_operations import PostgreSQLManagementClientOperationsMixin # type: ignore +from ._name_availability_operations import NameAvailabilityOperations # type: ignore from ._operations import Operations # type: ignore -from ._get_private_dns_zone_suffix_operations import GetPrivateDnsZoneSuffixOperations # type: ignore +from ._private_dns_zone_suffix_operations import PrivateDnsZoneSuffixOperations # type: ignore from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._private_endpoint_connection_operations import PrivateEndpointConnectionOperations # type: ignore from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore from ._quota_usages_operations import QuotaUsagesOperations # type: ignore from ._replicas_operations import ReplicasOperations # type: ignore -from ._log_files_operations import LogFilesOperations # type: ignore -from ._server_threat_protection_settings_operations import ServerThreatProtectionSettingsOperations # type: ignore +from ._servers_operations import ServersOperations # type: ignore from ._tuning_options_operations import TuningOptionsOperations # type: ignore -from ._tuning_index_operations import TuningIndexOperations # type: ignore -from ._tuning_configuration_operations import TuningConfigurationOperations # type: ignore from ._virtual_endpoints_operations import VirtualEndpointsOperations # type: ignore from ._virtual_network_subnet_usage_operations import VirtualNetworkSubnetUsageOperations # type: ignore @@ -47,32 +41,27 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AdministratorsOperations", - "BackupsOperations", - "LocationBasedCapabilitiesOperations", - "ServerCapabilitiesOperations", - "CheckNameAvailabilityOperations", - "CheckNameAvailabilityWithLocationOperations", + "AdministratorsMicrosoftEntraOperations", + "AdvancedThreatProtectionSettingsOperations", + "ServerThreatProtectionSettingsOperations", + "BackupsAutomaticAndOnDemandOperations", + "CapabilitiesByLocationOperations", + "CapabilitiesByServerOperations", + "CapturedLogsOperations", "ConfigurationsOperations", "DatabasesOperations", "FirewallRulesOperations", - "ServersOperations", - "FlexibleServerOperations", - "LtrBackupOperationsOperations", + "BackupsLongTermRetentionOperations", "MigrationsOperations", - "PostgreSQLManagementClientOperationsMixin", + "NameAvailabilityOperations", "Operations", - "GetPrivateDnsZoneSuffixOperations", + "PrivateDnsZoneSuffixOperations", "PrivateEndpointConnectionsOperations", - "PrivateEndpointConnectionOperations", "PrivateLinkResourcesOperations", "QuotaUsagesOperations", "ReplicasOperations", - "LogFilesOperations", - "ServerThreatProtectionSettingsOperations", + "ServersOperations", "TuningOptionsOperations", - "TuningIndexOperations", - "TuningConfigurationOperations", "VirtualEndpointsOperations", "VirtualNetworkSubnetUsageOperations", ] diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_administrators_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_administrators_microsoft_entra_operations.py similarity index 82% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_administrators_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_administrators_microsoft_entra_operations.py index 398a1a7d6372..4a9410f3a0e8 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_administrators_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_administrators_microsoft_entra_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -36,19 +36,20 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_create_request( +def build_create_or_update_request( resource_group_name: str, server_name: str, object_id: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -87,7 +88,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +124,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +160,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,19 +189,19 @@ def build_list_by_server_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class AdministratorsOperations: +class AdministratorsMicrosoftEntraOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`administrators` attribute. + :attr:`administrators_microsoft_entra` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -209,12 +210,12 @@ def __init__(self, *args, **kwargs): self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def _create_initial( + def _create_or_update_initial( self, resource_group_name: str, server_name: str, object_id: str, - parameters: Union[_models.ActiveDirectoryAdministratorAdd, IO[bytes]], + parameters: Union[_models.AdministratorMicrosoftEntraAdd, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -238,9 +239,9 @@ def _create_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "ActiveDirectoryAdministratorAdd") + _json = self._serialize.body(parameters, "AdministratorMicrosoftEntraAdd") - _request = build_create_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, object_id=object_id, @@ -262,18 +263,23 @@ def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -283,40 +289,38 @@ def _create_initial( return deserialized # type: ignore @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, server_name: str, object_id: str, - parameters: _models.ActiveDirectoryAdministratorAdd, + parameters: _models.AdministratorMicrosoftEntraAdd, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ActiveDirectoryAdministrator]: - """Creates a new server. + ) -> LROPoller[None]: + """Creates a new server administrator associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param object_id: Guid of the objectId for the administrator. Required. + :param object_id: Object identifier of the Microsoft Entra principal. Required. :type object_id: str - :param parameters: The required parameters for adding an Microsoft Entra Administrator for a - server. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministratorAdd + :param parameters: Required parameters for adding a server administrator associated to a + Microsoft Entra principal. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntraAdd :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either ActiveDirectoryAdministrator or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -325,55 +329,52 @@ def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ActiveDirectoryAdministrator]: - """Creates a new server. + ) -> LROPoller[None]: + """Creates a new server administrator associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param object_id: Guid of the objectId for the administrator. Required. + :param object_id: Object identifier of the Microsoft Entra principal. Required. :type object_id: str - :param parameters: The required parameters for adding an Microsoft Entra Administrator for a - server. Required. + :param parameters: Required parameters for adding a server administrator associated to a + Microsoft Entra principal. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either ActiveDirectoryAdministrator or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create( + def begin_create_or_update( self, resource_group_name: str, server_name: str, object_id: str, - parameters: Union[_models.ActiveDirectoryAdministratorAdd, IO[bytes]], + parameters: Union[_models.AdministratorMicrosoftEntraAdd, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.ActiveDirectoryAdministrator]: - """Creates a new server. + ) -> LROPoller[None]: + """Creates a new server administrator associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param object_id: Guid of the objectId for the administrator. Required. + :param object_id: Object identifier of the Microsoft Entra principal. Required. :type object_id: str - :param parameters: The required parameters for adding an Microsoft Entra Administrator for a - server. Is either a ActiveDirectoryAdministratorAdd type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministratorAdd + :param parameters: Required parameters for adding a server administrator associated to a + Microsoft Entra principal. Is either a AdministratorMicrosoftEntraAdd type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntraAdd or IO[bytes] - :return: An instance of LROPoller that returns either ActiveDirectoryAdministrator or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -381,12 +382,12 @@ def begin_create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ActiveDirectoryAdministrator] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, object_id=object_id, @@ -401,11 +402,9 @@ def begin_create( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -416,15 +415,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ActiveDirectoryAdministrator].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ActiveDirectoryAdministrator]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete_initial( self, resource_group_name: str, server_name: str, object_id: str, **kwargs: Any @@ -462,18 +459,24 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -486,14 +489,14 @@ def _delete_initial( def begin_delete( self, resource_group_name: str, server_name: str, object_id: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an Microsoft Entra Administrator associated with the server. + """Deletes an existing server administrator associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param object_id: Guid of the objectId for the administrator. Required. + :param object_id: Object identifier of the Microsoft Entra principal. Required. :type object_id: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] @@ -545,18 +548,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace def get( self, resource_group_name: str, server_name: str, object_id: str, **kwargs: Any - ) -> _models.ActiveDirectoryAdministrator: - """Gets information about a server. + ) -> _models.AdministratorMicrosoftEntra: + """Gets information about a server administrator associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param object_id: Guid of the objectId for the administrator. Required. + :param object_id: Object identifier of the Microsoft Entra principal. Required. :type object_id: str - :return: ActiveDirectoryAdministrator or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator + :return: AdministratorMicrosoftEntra or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntra :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -571,7 +574,7 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ActiveDirectoryAdministrator] = kwargs.pop("cls", None) + cls: ClsType[_models.AdministratorMicrosoftEntra] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -593,10 +596,13 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ActiveDirectoryAdministrator", pipeline_response.http_response) + deserialized = self._deserialize("AdministratorMicrosoftEntra", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -606,25 +612,25 @@ def get( @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.ActiveDirectoryAdministrator"]: - """List all the AAD administrators for a given server. + ) -> ItemPaged["_models.AdministratorMicrosoftEntra"]: + """List all server administrators associated to a Microsoft Entra principal. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either ActiveDirectoryAdministrator or the result of + :return: An iterator like instance of either AdministratorMicrosoftEntra or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.ActiveDirectoryAdministrator] + ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.AdministratorMicrosoftEntra] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AdministratorListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.AdministratorMicrosoftEntraList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -665,7 +671,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("AdministratorListResult", pipeline_response) + deserialized = self._deserialize("AdministratorMicrosoftEntraList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -682,7 +688,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_ltr_backup_operations_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_advanced_threat_protection_settings_operations.py similarity index 79% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_ltr_backup_operations_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_advanced_threat_protection_settings_operations.py index aa9aab9c8e53..042cda8f8d84 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_ltr_backup_operations_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_advanced_threat_protection_settings_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar, Union import urllib.parse from azure.core import PipelineClient @@ -31,25 +31,26 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, server_name: str, backup_name: str, subscription_id: str, **kwargs: Any +def build_list_by_server_request( + resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations/{backupName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings", ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -59,7 +60,6 @@ def build_get_request( "serverName": _SERIALIZER.url( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), - "backupName": _SERIALIZER.url("backup_name", backup_name, "str", pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -73,19 +73,23 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_server_request( - resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any +def build_get_request( + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}", ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -95,6 +99,7 @@ def build_list_by_server_request( "serverName": _SERIALIZER.url( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), + "threatProtectionName": _SERIALIZER.url("threat_protection_name", threat_protection_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -108,19 +113,19 @@ def build_list_by_server_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class LtrBackupOperationsOperations: +class AdvancedThreatProtectionSettingsOperations: # pylint: disable=name-too-long """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`ltr_backup_operations` attribute. + :attr:`advanced_threat_protection_settings` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -129,89 +134,28 @@ def __init__(self, *args, **kwargs): self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get( - self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any - ) -> _models.LtrServerBackupOperation: - """Gets the result of the give long term retention backup operation for the flexible server. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param backup_name: The name of the backup. Required. - :type backup_name: str - :return: LtrServerBackupOperation or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.LtrServerBackupOperation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LtrServerBackupOperation] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - server_name=server_name, - backup_name=backup_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LtrServerBackupOperation", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.LtrServerBackupOperation"]: - """Gets the result of the give long term retention backup operations for the flexible server. + ) -> ItemPaged["_models.AdvancedThreatProtectionSettingsModel"]: + """Lists state of advanced threat protection settings for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either LtrServerBackupOperation or the result of - cls(response) + :return: An iterator like instance of either AdvancedThreatProtectionSettingsModel or the + result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.LtrServerBackupOperation] + ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsModel] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LtrServerBackupOperationList] = kwargs.pop("cls", None) + cls: ClsType[_models.AdvancedThreatProtectionSettingsList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -252,7 +196,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("LtrServerBackupOperationList", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtectionSettingsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -269,9 +213,82 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, + resource_group_name: str, + server_name: str, + threat_protection_name: Union[str, _models.ThreatProtectionName], + **kwargs: Any + ) -> _models.AdvancedThreatProtectionSettingsModel: + """Gets state of advanced threat protection settings for a server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param threat_protection_name: Name of the advanced threat protection settings. "Default" + Required. + :type threat_protection_name: str or + ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName + :return: AdvancedThreatProtectionSettingsModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AdvancedThreatProtectionSettingsModel] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + threat_protection_name=threat_protection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("AdvancedThreatProtectionSettingsModel", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_backups_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_backups_automatic_and_on_demand_operations.py similarity index 85% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_backups_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_backups_automatic_and_on_demand_operations.py index fa539a82ad13..38a558f449b8 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_backups_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_backups_automatic_and_on_demand_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast +from typing import Any, Callable, Iterator, Optional, TypeVar, Union, cast import urllib.parse from azure.core import PipelineClient @@ -35,7 +35,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -47,7 +48,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +64,9 @@ def build_create_request( "serverName": _SERIALIZER.url( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), - "backupName": _SERIALIZER.url("backup_name", backup_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), + "backupName": _SERIALIZER.url( + "backup_name", backup_name, "str", max_length=128, min_length=1, pattern=r"^[-\w\._]+$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -83,7 +86,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +102,9 @@ def build_delete_request( "serverName": _SERIALIZER.url( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), - "backupName": _SERIALIZER.url("backup_name", backup_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), + "backupName": _SERIALIZER.url( + "backup_name", backup_name, "str", max_length=128, min_length=1, pattern=r"^[-\w\._]+$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -119,7 +124,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +140,9 @@ def build_get_request( "serverName": _SERIALIZER.url( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), - "backupName": _SERIALIZER.url("backup_name", backup_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), + "backupName": _SERIALIZER.url( + "backup_name", backup_name, "str", max_length=128, min_length=1, pattern=r"^[-\w\._]+$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -155,7 +162,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,19 +191,19 @@ def build_list_by_server_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class BackupsOperations: +class BackupsAutomaticAndOnDemandOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`backups` attribute. + :attr:`backups_automatic_and_on_demand` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -241,18 +248,23 @@ def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -264,27 +276,25 @@ def _create_initial( @distributed_trace def begin_create( self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any - ) -> LROPoller[_models.ServerBackup]: - """Create a specific backup for PostgreSQL flexible server. + ) -> LROPoller[None]: + """Creates an on demand backup of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param backup_name: The name of the backup. Required. + :param backup_name: Name of the backup. Required. :type backup_name: str - :return: An instance of LROPoller that returns either ServerBackup or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.ServerBackup] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerBackup] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -302,11 +312,9 @@ def begin_create( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerBackup", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -317,15 +325,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ServerBackup].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ServerBackup]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete_initial( self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any @@ -369,12 +375,18 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -387,14 +399,14 @@ def _delete_initial( def begin_delete( self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes a specific backup. + """Deletes a specific backup, given its name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param backup_name: The name of the backup. Required. + :param backup_name: Name of the backup. Required. :type backup_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] @@ -444,18 +456,20 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def get(self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any) -> _models.ServerBackup: - """Get specific backup for a given server. + def get( + self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any + ) -> _models.BackupAutomaticAndOnDemand: + """Gets information of an on demand backup, given its name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param backup_name: The name of the backup. Required. + :param backup_name: Name of the backup. Required. :type backup_name: str - :return: ServerBackup or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.ServerBackup + :return: BackupAutomaticAndOnDemand or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.BackupAutomaticAndOnDemand :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -470,7 +484,7 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerBackup] = kwargs.pop("cls", None) + cls: ClsType[_models.BackupAutomaticAndOnDemand] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -492,10 +506,13 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerBackup", pipeline_response.http_response) + deserialized = self._deserialize("BackupAutomaticAndOnDemand", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -505,23 +522,25 @@ def get(self, resource_group_name: str, server_name: str, backup_name: str, **kw @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.ServerBackup"]: - """List all the backups for a given server. + ) -> ItemPaged["_models.BackupAutomaticAndOnDemand"]: + """Lists all available backups of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either ServerBackup or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.ServerBackup] + :return: An iterator like instance of either BackupAutomaticAndOnDemand or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.BackupAutomaticAndOnDemand] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerBackupListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.BackupAutomaticAndOnDemandList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -562,7 +581,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ServerBackupListResult", pipeline_response) + deserialized = self._deserialize("BackupAutomaticAndOnDemandList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -579,7 +598,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_flexible_server_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_backups_long_term_retention_operations.py similarity index 59% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_flexible_server_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_backups_long_term_retention_operations.py index b96538ad2d63..2c8134f6c087 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_flexible_server_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_backups_long_term_retention_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -21,6 +22,7 @@ StreamConsumedError, map_error, ) +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse @@ -34,19 +36,20 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_trigger_ltr_pre_backup_request( +def build_check_prerequisites_request( resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -78,13 +81,11 @@ def build_trigger_ltr_pre_backup_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_start_ltr_backup_request( - resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +def build_start_request(resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -116,19 +117,90 @@ def build_start_ltr_backup_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class FlexibleServerOperations: +def build_get_request( + resource_group_name: str, server_name: str, backup_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations/{backupName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "backupName": _SERIALIZER.url("backup_name", backup_name, "str", pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_server_request( + resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/ltrBackupOperations", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class BackupsLongTermRetentionOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`flexible_server` attribute. + :attr:`backups_long_term_retention` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -138,7 +210,7 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - def trigger_ltr_pre_backup( + def check_prerequisites( self, resource_group_name: str, server_name: str, @@ -147,8 +219,7 @@ def trigger_ltr_pre_backup( content_type: str = "application/json", **kwargs: Any ) -> _models.LtrPreBackupResponse: - """PreBackup operation performs all the checks that are needed for the subsequent long term - retention backup operation to succeed. + """Performs all checks required for a long term retention backup operation to succeed. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -166,7 +237,7 @@ def trigger_ltr_pre_backup( """ @overload - def trigger_ltr_pre_backup( + def check_prerequisites( self, resource_group_name: str, server_name: str, @@ -175,8 +246,7 @@ def trigger_ltr_pre_backup( content_type: str = "application/json", **kwargs: Any ) -> _models.LtrPreBackupResponse: - """PreBackup operation performs all the checks that are needed for the subsequent long term - retention backup operation to succeed. + """Performs all checks required for a long term retention backup operation to succeed. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -194,15 +264,14 @@ def trigger_ltr_pre_backup( """ @distributed_trace - def trigger_ltr_pre_backup( + def check_prerequisites( self, resource_group_name: str, server_name: str, parameters: Union[_models.LtrPreBackupRequest, IO[bytes]], **kwargs: Any ) -> _models.LtrPreBackupResponse: - """PreBackup operation performs all the checks that are needed for the subsequent long term - retention backup operation to succeed. + """Performs all checks required for a long term retention backup operation to succeed. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -239,7 +308,7 @@ def trigger_ltr_pre_backup( else: _json = self._serialize.body(parameters, "LtrPreBackupRequest") - _request = build_trigger_ltr_pre_backup_request( + _request = build_check_prerequisites_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -261,7 +330,10 @@ def trigger_ltr_pre_backup( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -274,11 +346,11 @@ def trigger_ltr_pre_backup( return deserialized # type: ignore - def _start_ltr_backup_initial( + def _start_initial( self, resource_group_name: str, server_name: str, - parameters: Union[_models.LtrBackupRequest, IO[bytes]], + parameters: Union[_models.BackupsLongTermRetentionRequest, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -302,9 +374,9 @@ def _start_ltr_backup_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "LtrBackupRequest") + _json = self._serialize.body(parameters, "BackupsLongTermRetentionRequest") - _request = build_start_ltr_backup_request( + _request = build_start_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -331,7 +403,10 @@ def _start_ltr_backup_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -354,16 +429,16 @@ def _start_ltr_backup_initial( return deserialized # type: ignore @overload - def begin_start_ltr_backup( + def begin_start( self, resource_group_name: str, server_name: str, - parameters: _models.LtrBackupRequest, + parameters: _models.BackupsLongTermRetentionRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.LtrBackupResponse]: - """Start the Long Term Retention Backup operation. + ) -> LROPoller[_models.BackupsLongTermRetentionResponse]: + """Initiates a long term retention backup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -371,19 +446,19 @@ def begin_start_ltr_backup( :param server_name: The name of the server. Required. :type server_name: str :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.LtrBackupRequest + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either LtrBackupResponse or the result of - cls(response) + :return: An instance of LROPoller that returns either BackupsLongTermRetentionResponse or the + result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.LtrBackupResponse] + ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_start_ltr_backup( + def begin_start( self, resource_group_name: str, server_name: str, @@ -391,8 +466,8 @@ def begin_start_ltr_backup( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.LtrBackupResponse]: - """Start the Long Term Retention Backup operation. + ) -> LROPoller[_models.BackupsLongTermRetentionResponse]: + """Initiates a long term retention backup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -404,35 +479,36 @@ def begin_start_ltr_backup( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either LtrBackupResponse or the result of - cls(response) + :return: An instance of LROPoller that returns either BackupsLongTermRetentionResponse or the + result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.LtrBackupResponse] + ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionResponse] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_start_ltr_backup( + def begin_start( self, resource_group_name: str, server_name: str, - parameters: Union[_models.LtrBackupRequest, IO[bytes]], + parameters: Union[_models.BackupsLongTermRetentionRequest, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.LtrBackupResponse]: - """Start the Long Term Retention Backup operation. + ) -> LROPoller[_models.BackupsLongTermRetentionResponse]: + """Initiates a long term retention backup. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: Request body for operation. Is either a LtrBackupRequest type or a IO[bytes] - type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.LtrBackupRequest or IO[bytes] - :return: An instance of LROPoller that returns either LtrBackupResponse or the result of - cls(response) + :param parameters: Request body for operation. Is either a BackupsLongTermRetentionRequest type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionRequest + or IO[bytes] + :return: An instance of LROPoller that returns either BackupsLongTermRetentionResponse or the + result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.LtrBackupResponse] + ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionResponse] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -440,12 +516,12 @@ def begin_start_ltr_backup( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LtrBackupResponse] = kwargs.pop("cls", None) + cls: ClsType[_models.BackupsLongTermRetentionResponse] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._start_ltr_backup_initial( + raw_result = self._start_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -464,7 +540,7 @@ def get_long_running_output(pipeline_response): response = pipeline_response.http_response response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id")) - deserialized = self._deserialize("LtrBackupResponse", pipeline_response.http_response) + deserialized = self._deserialize("BackupsLongTermRetentionResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized @@ -478,12 +554,165 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.LtrBackupResponse].from_continuation_token( + return LROPoller[_models.BackupsLongTermRetentionResponse].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.LtrBackupResponse]( + return LROPoller[_models.BackupsLongTermRetentionResponse]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + + @distributed_trace + def get( + self, resource_group_name: str, server_name: str, backup_name: str, **kwargs: Any + ) -> _models.BackupsLongTermRetentionOperation: + """Gets the results of a long retention backup operation for a server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param backup_name: The name of the backup. Required. + :type backup_name: str + :return: BackupsLongTermRetentionOperation or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BackupsLongTermRetentionOperation] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + backup_name=backup_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("BackupsLongTermRetentionOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> ItemPaged["_models.BackupsLongTermRetentionOperation"]: + """Lists the results of the long term retention backup operations for a server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :return: An iterator like instance of either BackupsLongTermRetentionOperation or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.BackupsLongTermRetentionOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LtrServerBackupOperationList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_server_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LtrServerBackupOperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_location_based_capabilities_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_capabilities_by_location_operations.py similarity index 84% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_location_based_capabilities_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_capabilities_by_location_operations.py index ddad43cf6c69..bafa1f4b187e 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_location_based_capabilities_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_capabilities_by_location_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import PipelineClient @@ -30,17 +30,18 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_execute_request(location_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request(location_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,19 +65,19 @@ def build_execute_request(location_name: str, subscription_id: str, **kwargs: An return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class LocationBasedCapabilitiesOperations: +class CapabilitiesByLocationOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`location_based_capabilities` attribute. + :attr:`capabilities_by_location` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -86,22 +87,20 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def execute(self, location_name: str, **kwargs: Any) -> Iterable["_models.FlexibleServerCapability"]: - """Get capabilities at specified location in a given subscription. + def list(self, location_name: str, **kwargs: Any) -> ItemPaged["_models.Capability"]: + """Lists the capabilities available in a given location for a specific subscription. :param location_name: The name of the location. Required. :type location_name: str - :return: An iterator like instance of either FlexibleServerCapability or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.FlexibleServerCapability] + :return: An iterator like instance of either Capability or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.Capability] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapabilityList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -114,7 +113,7 @@ def execute(self, location_name: str, **kwargs: Any) -> Iterable["_models.Flexib def prepare_request(next_link=None): if not next_link: - _request = build_execute_request( + _request = build_list_request( location_name=location_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -141,7 +140,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("CapabilitiesListResult", pipeline_response) + deserialized = self._deserialize("CapabilityList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -158,7 +157,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_server_capabilities_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_capabilities_by_server_operations.py similarity index 87% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_server_capabilities_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_capabilities_by_server_operations.py index 25978c1f338d..8994ff217aec 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_server_capabilities_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_capabilities_by_server_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import PipelineClient @@ -31,7 +31,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -41,7 +42,7 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,19 +71,19 @@ def build_list_request(resource_group_name: str, server_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class ServerCapabilitiesOperations: +class CapabilitiesByServerOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`server_capabilities` attribute. + :attr:`capabilities_by_server` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -92,27 +93,23 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.FlexibleServerCapability"]: - """Get capabilities for a flexible server. + def list(self, resource_group_name: str, server_name: str, **kwargs: Any) -> ItemPaged["_models.Capability"]: + """Lists the capabilities available for a given server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either FlexibleServerCapability or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.FlexibleServerCapability] + :return: An iterator like instance of either Capability or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.Capability] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.CapabilitiesListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapabilityList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -153,7 +150,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("CapabilitiesListResult", pipeline_response) + deserialized = self._deserialize("CapabilityList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -170,7 +167,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_log_files_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_captured_logs_operations.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_log_files_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_captured_logs_operations.py index 4eebe695390c..b40474dc332f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_log_files_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_captured_logs_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import PipelineClient @@ -31,7 +31,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,7 +44,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,19 +73,19 @@ def build_list_by_server_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class LogFilesOperations: +class CapturedLogsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`log_files` attribute. + :attr:`captured_logs` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -94,23 +95,25 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterable["_models.LogFile"]: - """List all the server log files in a given server. + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> ItemPaged["_models.CapturedLog"]: + """Lists all captured logs for download in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either LogFile or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.LogFile] + :return: An iterator like instance of either CapturedLog or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.CapturedLog] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LogFileListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CapturedLogList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -151,7 +154,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("LogFileListResult", pipeline_response) + deserialized = self._deserialize("CapturedLogList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -168,7 +171,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_check_name_availability_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_check_name_availability_operations.py deleted file mode 100644 index 0a36441cd62f..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_check_name_availability_operations.py +++ /dev/null @@ -1,192 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import PostgreSQLManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_execute_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CheckNameAvailabilityOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`check_name_availability` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PostgreSQLManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def execute( - self, - name_availability_request: _models.CheckNameAvailabilityRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param name_availability_request: The required parameters for checking if resource name is - available. Required. - :type name_availability_request: - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def execute( - self, name_availability_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param name_availability_request: The required parameters for checking if resource name is - available. Required. - :type name_availability_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def execute( - self, name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param name_availability_request: The required parameters for checking if resource name is - available. Is either a CheckNameAvailabilityRequest type or a IO[bytes] type. Required. - :type name_availability_request: - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(name_availability_request, (IOBase, bytes)): - _content = name_availability_request - else: - _json = self._serialize.body(name_availability_request, "CheckNameAvailabilityRequest") - - _request = build_execute_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_check_name_availability_with_location_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_check_name_availability_with_location_operations.py deleted file mode 100644 index c800c8c2fb32..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_check_name_availability_with_location_operations.py +++ /dev/null @@ -1,211 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import PostgreSQLManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_execute_request(location_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class CheckNameAvailabilityWithLocationOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`check_name_availability_with_location` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PostgreSQLManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def execute( - self, - location_name: str, - name_availability_request: _models.CheckNameAvailabilityRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param location_name: The name of the location. Required. - :type location_name: str - :param name_availability_request: The required parameters for checking if resource name is - available. Required. - :type name_availability_request: - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def execute( - self, - location_name: str, - name_availability_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param location_name: The name of the location. Required. - :type location_name: str - :param name_availability_request: The required parameters for checking if resource name is - available. Required. - :type name_availability_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def execute( - self, - location_name: str, - name_availability_request: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], - **kwargs: Any - ) -> _models.NameAvailability: - """Check the availability of name for resource. - - :param location_name: The name of the location. Required. - :type location_name: str - :param name_availability_request: The required parameters for checking if resource name is - available. Is either a CheckNameAvailabilityRequest type or a IO[bytes] type. Required. - :type name_availability_request: - ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest or IO[bytes] - :return: NameAvailability or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailability - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NameAvailability] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(name_availability_request, (IOBase, bytes)): - _content = name_availability_request - else: - _json = self._serialize.body(name_availability_request, "CheckNameAvailabilityRequest") - - _request = build_execute_request( - location_name=location_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NameAvailability", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_configurations_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_configurations_operations.py index e50ae31d7fd5..0047d16a7655 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_configurations_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -36,7 +36,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -48,7 +49,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +101,7 @@ def build_get_request( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "configurationName": _SERIALIZER.url( - "configuration_name", configuration_name, "str", min_length=1, pattern=r"^[-\w\._]+$" + "configuration_name", configuration_name, "str", max_length=256, min_length=1, pattern=r"^[-\w\._]+$" ), } @@ -121,7 +122,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -139,7 +140,7 @@ def build_update_request( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "configurationName": _SERIALIZER.url( - "configuration_name", configuration_name, "str", min_length=1, pattern=r"^[-\w\._]+$" + "configuration_name", configuration_name, "str", max_length=256, min_length=1, pattern=r"^[-\w\._]+$" ), } @@ -162,7 +163,7 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +181,7 @@ def build_put_request( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "configurationName": _SERIALIZER.url( - "configuration_name", configuration_name, "str", min_length=1, pattern=r"^[-\w\._]+$" + "configuration_name", configuration_name, "str", max_length=256, min_length=1, pattern=r"^[-\w\._]+$" ), } @@ -209,7 +210,7 @@ class ConfigurationsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -221,8 +222,8 @@ def __init__(self, *args, **kwargs): @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.Configuration"]: - """List all the configurations in a given server. + ) -> ItemPaged["_models.Configuration"]: + """Lists all configurations (also known as server parameters) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -238,7 +239,7 @@ def list_by_server( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ConfigurationListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ConfigurationList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -279,7 +280,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationListResult", pipeline_response) + deserialized = self._deserialize("ConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -296,7 +297,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -307,14 +311,15 @@ def get_next(next_link=None): def get( self, resource_group_name: str, server_name: str, configuration_name: str, **kwargs: Any ) -> _models.Configuration: - """Gets information about a configuration of server. + """Gets information about a specific configuration (also known as server parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str :return: Configuration or the result of cls(response) :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Configuration @@ -354,7 +359,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Configuration", pipeline_response.http_response) @@ -417,18 +425,23 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -447,25 +460,26 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> LROPoller[None]: + """Updates the value assigned to a specific modifiable configuration (also known as server + parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Required. + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationForUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -479,25 +493,26 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> LROPoller[None]: + """Updates the value assigned to a specific modifiable configuration (also known as server + parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Required. + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -509,24 +524,25 @@ def begin_update( configuration_name: str, parameters: Union[_models.ConfigurationForUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> LROPoller[None]: + """Updates the value assigned to a specific modifiable configuration (also known as server + parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Is either a - ConfigurationForUpdate type or a IO[bytes] type. Required. + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Is either a ConfigurationForUpdate type or a + IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationForUpdate or IO[bytes] - :return: An instance of LROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -534,7 +550,7 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -554,11 +570,9 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -569,22 +583,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Configuration].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Configuration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _put_initial( self, resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO[bytes]], + parameters: Union[_models.ConfigurationForUpdate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -608,7 +620,7 @@ def _put_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "Configuration") + _json = self._serialize.body(parameters, "ConfigurationForUpdate") _request = build_put_request( resource_group_name=resource_group_name, @@ -632,18 +644,23 @@ def _put_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -658,29 +675,30 @@ def begin_put( resource_group_name: str, server_name: str, configuration_name: str, - parameters: _models.Configuration, + parameters: _models.ConfigurationForUpdate, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> LROPoller[None]: + """Updates, using Put verb, the value assigned to a specific modifiable configuration (also known + as server parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Configuration + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationForUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -694,25 +712,26 @@ def begin_put( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> LROPoller[None]: + """Updates, using Put verb, the value assigned to a specific modifiable configuration (also known + as server parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Required. + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -722,25 +741,27 @@ def begin_put( resource_group_name: str, server_name: str, configuration_name: str, - parameters: Union[_models.Configuration, IO[bytes]], + parameters: Union[_models.ConfigurationForUpdate, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Configuration]: - """Updates a configuration of a server. + ) -> LROPoller[None]: + """Updates, using Put verb, the value assigned to a specific modifiable configuration (also known + as server parameter) of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param configuration_name: The name of the server configuration. Required. + :param configuration_name: Name of the configuration (also known as server parameter). + Required. :type configuration_name: str - :param parameters: The required parameters for updating a server configuration. Is either a - Configuration type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Configuration or IO[bytes] - :return: An instance of LROPoller that returns either Configuration or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Configuration] + :param parameters: Parameters required to update the value of a specific modifiable + configuration (also known as server parameter). Is either a ConfigurationForUpdate type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ConfigurationForUpdate or + IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -748,7 +769,7 @@ def begin_put( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Configuration] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -768,27 +789,23 @@ def begin_put( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Configuration", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.Configuration].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Configuration]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_databases_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_databases_operations.py index b706f2735f2f..c96e4cd244ba 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_databases_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_databases_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -36,7 +36,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -48,7 +49,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +67,7 @@ def build_create_request( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "databaseName": _SERIALIZER.url( - "database_name", database_name, "str", min_length=1, pattern=r"^[a-zA-Z_][a-zA-Z0-9_]{0,30}$" + "database_name", database_name, "str", max_length=63, min_length=1, pattern=r"^[a-zA-Z_][\w\-]{0,62}$" ), } @@ -89,7 +90,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +107,7 @@ def build_delete_request( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "databaseName": _SERIALIZER.url( - "database_name", database_name, "str", min_length=1, pattern=r"^[a-zA-Z_][a-zA-Z0-9_]{0,30}$" + "database_name", database_name, "str", max_length=63, min_length=1, pattern=r"^[a-zA-Z_][\w\-]{0,62}$" ), } @@ -127,7 +128,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +145,7 @@ def build_get_request( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "databaseName": _SERIALIZER.url( - "database_name", database_name, "str", min_length=1, pattern=r"^[a-zA-Z_][a-zA-Z0-9_]{0,30}$" + "database_name", database_name, "str", max_length=63, min_length=1, pattern=r"^[a-zA-Z_][\w\-]{0,62}$" ), } @@ -165,7 +166,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -206,7 +207,7 @@ class DatabasesOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -268,18 +269,23 @@ def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -298,23 +304,24 @@ def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Database]: - """Creates a new database or updates an existing database. + ) -> LROPoller[None]: + """Creates a new database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param database_name: The name of the database. Required. + :param database_name: Name of the database (case-sensitive). Exact database names can be + retrieved by getting the list of all existing databases in a server. Required. :type database_name: str - :param parameters: The required parameters for creating or updating a database. Required. + :param parameters: Parameters required to create a new database. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Database :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Database or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Database] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -328,23 +335,24 @@ def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Database]: - """Creates a new database or updates an existing database. + ) -> LROPoller[None]: + """Creates a new database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param database_name: The name of the database. Required. + :param database_name: Name of the database (case-sensitive). Exact database names can be + retrieved by getting the list of all existing databases in a server. Required. :type database_name: str - :param parameters: The required parameters for creating or updating a database. Required. + :param parameters: Parameters required to create a new database. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Database or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Database] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -356,21 +364,22 @@ def begin_create( database_name: str, parameters: Union[_models.Database, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Database]: - """Creates a new database or updates an existing database. + ) -> LROPoller[None]: + """Creates a new database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param database_name: The name of the database. Required. + :param database_name: Name of the database (case-sensitive). Exact database names can be + retrieved by getting the list of all existing databases in a server. Required. :type database_name: str - :param parameters: The required parameters for creating or updating a database. Is either a - Database type or a IO[bytes] type. Required. + :param parameters: Parameters required to create a new database. Is either a Database type or a + IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Database or IO[bytes] - :return: An instance of LROPoller that returns either Database or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Database] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -378,7 +387,7 @@ def begin_create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Database] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -398,11 +407,9 @@ def begin_create( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Database", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -413,15 +420,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Database].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Database]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete_initial( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any @@ -459,18 +464,24 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -483,14 +494,15 @@ def _delete_initial( def begin_delete( self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes a database. + """Deletes an existing database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param database_name: The name of the database. Required. + :param database_name: Name of the database (case-sensitive). Exact database names can be + retrieved by getting the list of all existing databases in a server. Required. :type database_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] @@ -541,14 +553,15 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace def get(self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> _models.Database: - """Gets information about a database. + """Gets information about an existing database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param database_name: The name of the database. Required. + :param database_name: Name of the database (case-sensitive). Exact database names can be + retrieved by getting the list of all existing databases in a server. Required. :type database_name: str :return: Database or the result of cls(response) :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Database @@ -588,7 +601,10 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Database", pipeline_response.http_response) @@ -599,8 +615,10 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** return deserialized # type: ignore @distributed_trace - def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterable["_models.Database"]: - """List all the databases in a given server. + def list_by_server( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> ItemPaged["_models.Database"]: + """Lists all databases in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -615,7 +633,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.DatabaseList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -656,7 +674,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DatabaseListResult", pipeline_response) + deserialized = self._deserialize("DatabaseList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -673,7 +691,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_firewall_rules_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_firewall_rules_operations.py index b57b2b9db033..27a86635f7db 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_firewall_rules_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_firewall_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -36,7 +36,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -48,7 +49,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +67,12 @@ def build_create_or_update_request( "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "firewallRuleName": _SERIALIZER.url( - "firewall_rule_name", firewall_rule_name, "str", min_length=1, pattern=r"^[-\w\._]+$" + "firewall_rule_name", + firewall_rule_name, + "str", + max_length=80, + min_length=1, + pattern=r"^[a-zA-Z0-9][-_a-zA-Z0-9]{0,79}(? None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -268,18 +284,23 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -298,7 +319,7 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.FirewallRule]: + ) -> LROPoller[None]: """Creates a new firewall rule or updates an existing firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -306,17 +327,15 @@ def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param firewall_rule_name: The name of the server firewall rule. Required. + :param firewall_rule_name: Name of the firewall rule. Required. :type firewall_rule_name: str - :param parameters: The required parameters for creating or updating a firewall rule. Required. + :param parameters: Parameters required for creating or updating a firewall rule. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.FirewallRule :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either FirewallRule or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.FirewallRule] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -330,7 +349,7 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.FirewallRule]: + ) -> LROPoller[None]: """Creates a new firewall rule or updates an existing firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -338,17 +357,15 @@ def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param firewall_rule_name: The name of the server firewall rule. Required. + :param firewall_rule_name: Name of the firewall rule. Required. :type firewall_rule_name: str - :param parameters: The required parameters for creating or updating a firewall rule. Required. + :param parameters: Parameters required for creating or updating a firewall rule. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either FirewallRule or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.FirewallRule] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -360,7 +377,7 @@ def begin_create_or_update( firewall_rule_name: str, parameters: Union[_models.FirewallRule, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.FirewallRule]: + ) -> LROPoller[None]: """Creates a new firewall rule or updates an existing firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -368,15 +385,13 @@ def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param firewall_rule_name: The name of the server firewall rule. Required. + :param firewall_rule_name: Name of the firewall rule. Required. :type firewall_rule_name: str - :param parameters: The required parameters for creating or updating a firewall rule. Is either - a FirewallRule type or a IO[bytes] type. Required. + :param parameters: Parameters required for creating or updating a firewall rule. Is either a + FirewallRule type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.FirewallRule or IO[bytes] - :return: An instance of LROPoller that returns either FirewallRule or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.FirewallRule] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -384,7 +399,7 @@ def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FirewallRule] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -404,11 +419,9 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -419,15 +432,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.FirewallRule].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.FirewallRule]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete_initial( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any @@ -465,18 +476,24 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -489,14 +506,14 @@ def _delete_initial( def begin_delete( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes a PostgreSQL server firewall rule. + """Deletes an existing firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param firewall_rule_name: The name of the server firewall rule. Required. + :param firewall_rule_name: Name of the firewall rule. Required. :type firewall_rule_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] @@ -549,14 +566,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def get( self, resource_group_name: str, server_name: str, firewall_rule_name: str, **kwargs: Any ) -> _models.FirewallRule: - """List all the firewall rules in a given server. + """Gets information about a firewall rule in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param firewall_rule_name: The name of the server firewall rule. Required. + :param firewall_rule_name: Name of the firewall rule. Required. :type firewall_rule_name: str :return: FirewallRule or the result of cls(response) :rtype: ~azure.mgmt.postgresqlflexibleservers.models.FirewallRule @@ -596,7 +613,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("FirewallRule", pipeline_response.http_response) @@ -609,8 +629,8 @@ def get( @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.FirewallRule"]: - """List all the firewall rules in a given PostgreSQL server. + ) -> ItemPaged["_models.FirewallRule"]: + """Lists information about all firewall rules in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -625,7 +645,7 @@ def list_by_server( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FirewallRuleListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.FirewallRuleList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -666,7 +686,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("FirewallRuleListResult", pipeline_response) + deserialized = self._deserialize("FirewallRuleList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -683,7 +703,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_migrations_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_migrations_operations.py index e0a9f16b3393..71fb14f574bc 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_migrations_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_migrations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core import PipelineClient @@ -32,39 +32,35 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False def build_create_request( - subscription_id: str, resource_group_name: str, target_db_server_name: str, migration_name: str, **kwargs: Any + resource_group_name: str, server_name: str, migration_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}", ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", - subscription_id, - "str", - pattern=r"([a-z0-9]){8,8}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){12,12}", - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", pattern=r"^[-a-z0-9A-Z._()]+[^.]$" + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "targetDbServerName": _SERIALIZER.url( - "target_db_server_name", target_db_server_name, "str", pattern=r"([-a-z0-9]){3,63}" + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "migrationName": _SERIALIZER.url("migration_name", migration_name, "str", pattern=r"^[a-z][a-z0-9]*$"), } @@ -83,31 +79,26 @@ def build_create_request( def build_get_request( - subscription_id: str, resource_group_name: str, target_db_server_name: str, migration_name: str, **kwargs: Any + resource_group_name: str, server_name: str, migration_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}", ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", - subscription_id, - "str", - pattern=r"([a-z0-9]){8,8}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){12,12}", - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", pattern=r"^[-a-z0-9A-Z._()]+[^.]$" + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "targetDbServerName": _SERIALIZER.url( - "target_db_server_name", target_db_server_name, "str", pattern=r"([-a-z0-9]){3,63}" + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "migrationName": _SERIALIZER.url("migration_name", migration_name, "str", pattern=r"^[a-z][a-z0-9]*$"), } @@ -124,32 +115,27 @@ def build_get_request( def build_update_request( - subscription_id: str, resource_group_name: str, target_db_server_name: str, migration_name: str, **kwargs: Any + resource_group_name: str, server_name: str, migration_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}", ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", - subscription_id, - "str", - pattern=r"([a-z0-9]){8,8}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){12,12}", - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", pattern=r"^[-a-z0-9A-Z._()]+[^.]$" + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "targetDbServerName": _SERIALIZER.url( - "target_db_server_name", target_db_server_name, "str", pattern=r"([-a-z0-9]){3,63}" + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "migrationName": _SERIALIZER.url("migration_name", migration_name, "str", pattern=r"^[a-z][a-z0-9]*$"), } @@ -167,32 +153,27 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - subscription_id: str, resource_group_name: str, target_db_server_name: str, migration_name: str, **kwargs: Any +def build_cancel_request( + resource_group_name: str, server_name: str, migration_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations/{migrationName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations/{migrationName}", ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", - subscription_id, - "str", - pattern=r"([a-z0-9]){8,8}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){12,12}", - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", pattern=r"^[-a-z0-9A-Z._()]+[^.]$" + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "targetDbServerName": _SERIALIZER.url( - "target_db_server_name", target_db_server_name, "str", pattern=r"([-a-z0-9]){3,63}" + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), "migrationName": _SERIALIZER.url("migration_name", migration_name, "str", pattern=r"^[a-z][a-z0-9]*$"), } @@ -209,9 +190,9 @@ def build_delete_request( def build_list_by_target_server_request( - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, + subscription_id: str, *, migration_list_filter: Optional[Union[str, _models.MigrationListFilter]] = None, **kwargs: Any @@ -219,26 +200,21 @@ def build_list_by_target_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/migrations", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/migrations", ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", - subscription_id, - "str", - pattern=r"([a-z0-9]){8,8}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){12,12}", - ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", pattern=r"^[-a-z0-9A-Z._()]+[^.]$" + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "targetDbServerName": _SERIALIZER.url( - "target_db_server_name", target_db_server_name, "str", pattern=r"([-a-z0-9]){3,63}" + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" ), } @@ -255,6 +231,44 @@ def build_list_by_target_server_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_check_name_availability_request( + resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/checkMigrationNameAvailability", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class MigrationsOperations: """ .. warning:: @@ -267,7 +281,7 @@ class MigrationsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -279,92 +293,86 @@ def __init__(self, *args, **kwargs): @overload def create( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, - parameters: _models.MigrationResource, + parameters: _models.Migration, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Creates a new migration. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for creating a migration. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :param parameters: Parameters required for creating a migration. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Migration :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ @overload def create( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Creates a new migration. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for creating a migration. Required. + :param parameters: Parameters required for creating a migration. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def create( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, - parameters: Union[_models.MigrationResource, IO[bytes]], + parameters: Union[_models.Migration, IO[bytes]], **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Creates a new migration. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for creating a migration. Is either a - MigrationResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource or IO[bytes] - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :param parameters: Parameters required for creating a migration. Is either a Migration type or + a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Migration or IO[bytes] + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -380,7 +388,7 @@ def create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MigrationResource] = kwargs.pop("cls", None) + cls: ClsType[_models.Migration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -388,13 +396,13 @@ def create( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "MigrationResource") + _json = self._serialize.body(parameters, "Migration") _request = build_create_request( - subscription_id=subscription_id, resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, + server_name=server_name, migration_name=migration_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -413,10 +421,13 @@ def create( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) + deserialized = self._deserialize("Migration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,26 +435,18 @@ def create( return deserialized # type: ignore @distributed_trace - def get( - self, - subscription_id: str, - resource_group_name: str, - target_db_server_name: str, - migration_name: str, - **kwargs: Any - ) -> _models.MigrationResource: - """Gets details of a migration. + def get(self, resource_group_name: str, server_name: str, migration_name: str, **kwargs: Any) -> _models.Migration: + """Gets information about a migration. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -458,13 +461,13 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MigrationResource] = kwargs.pop("cls", None) + cls: ClsType[_models.Migration] = kwargs.pop("cls", None) _request = build_get_request( - subscription_id=subscription_id, resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, + server_name=server_name, migration_name=migration_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, @@ -480,10 +483,13 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) + deserialized = self._deserialize("Migration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -493,99 +499,93 @@ def get( @overload def update( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, parameters: _models.MigrationResourceForPatch, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for updating a migration. Required. + :param parameters: Parameters required to update an existing migration. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResourceForPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ @overload def update( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for updating a migration. Required. + :param parameters: Parameters required to update an existing migration. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace def update( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_name: str, parameters: Union[_models.MigrationResourceForPatch, IO[bytes]], **kwargs: Any - ) -> _models.MigrationResource: + ) -> _models.Migration: """Updates an existing migration. The request body can contain one to many of the mutable properties present in the migration definition. Certain property updates initiate migration state transitions. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :param parameters: The required parameters for updating a migration. Is either a + :param parameters: Parameters required to update an existing migration. Is either a MigrationResourceForPatch type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResourceForPatch or IO[bytes] - :return: MigrationResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationResource + :return: Migration or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -601,7 +601,7 @@ def update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MigrationResource] = kwargs.pop("cls", None) + cls: ClsType[_models.Migration] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -612,10 +612,10 @@ def update( _json = self._serialize.body(parameters, "MigrationResourceForPatch") _request = build_update_request( - subscription_id=subscription_id, resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, + server_name=server_name, migration_name=migration_name, + subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, @@ -634,10 +634,13 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("MigrationResource", pipeline_response.http_response) + deserialized = self._deserialize("Migration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -645,26 +648,20 @@ def update( return deserialized # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, - subscription_id: str, - resource_group_name: str, - target_db_server_name: str, - migration_name: str, - **kwargs: Any - ) -> None: - """Deletes a migration. + def cancel( + self, resource_group_name: str, server_name: str, migration_name: str, **kwargs: Any + ) -> Optional[_models.Migration]: + """Cancels an active migration. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_name: The name of the migration. Required. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_name: Name of migration. Required. :type migration_name: str - :return: None or the result of cls(response) - :rtype: None + :return: Migration or None or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.Migration or None :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -679,13 +676,13 @@ def delete( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.Migration]] = kwargs.pop("cls", None) - _request = build_delete_request( - subscription_id=subscription_id, + _request = build_cancel_request( resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, + server_name=server_name, migration_name=migration_name, + subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, params=_params, @@ -701,43 +698,50 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("Migration", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def list_by_target_server( self, - subscription_id: str, resource_group_name: str, - target_db_server_name: str, + server_name: str, migration_list_filter: Optional[Union[str, _models.MigrationListFilter]] = None, **kwargs: Any - ) -> Iterable["_models.MigrationResource"]: - """List all the migrations on a given target server. + ) -> ItemPaged["_models.Migration"]: + """Lists all migrations of a target flexible server. - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param migration_list_filter: Migration list filter. Retrieves either active migrations or all - migrations. Known values are: "Active" and "All". Default value is None. + :param server_name: The name of the server. Required. + :type server_name: str + :param migration_list_filter: Migration list filter. Indicates if the request should retrieve + only active migrations or all migrations. Defaults to Active. Known values are: "Active" and + "All". Default value is None. :type migration_list_filter: str or ~azure.mgmt.postgresqlflexibleservers.models.MigrationListFilter - :return: An iterator like instance of either MigrationResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.MigrationResource] + :return: An iterator like instance of either Migration or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.Migration] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MigrationResourceListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.MigrationList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -751,9 +755,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_list_by_target_server_request( - subscription_id=subscription_id, resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, + server_name=server_name, + subscription_id=self._config.subscription_id, migration_list_filter=migration_list_filter, api_version=api_version, headers=_headers, @@ -779,7 +783,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("MigrationResourceListResult", pipeline_response) + deserialized = self._deserialize("MigrationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -796,9 +800,155 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + + @overload + def check_name_availability( + self, + resource_group_name: str, + server_name: str, + parameters: _models.MigrationNameAvailability, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MigrationNameAvailability: + """Check the validity and availability of the given name, to assign it to a new migration. + + Checks if a proposed migration name is valid and available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param parameters: Parameters required to check if a migration name is valid and available. + Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MigrationNameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + resource_group_name: str, + server_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MigrationNameAvailability: + """Check the validity and availability of the given name, to assign it to a new migration. + + Checks if a proposed migration name is valid and available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param parameters: Parameters required to check if a migration name is valid and available. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MigrationNameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + server_name: str, + parameters: Union[_models.MigrationNameAvailability, IO[bytes]], + **kwargs: Any + ) -> _models.MigrationNameAvailability: + """Check the validity and availability of the given name, to assign it to a new migration. + + Checks if a proposed migration name is valid and available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param parameters: Parameters required to check if a migration name is valid and available. Is + either a MigrationNameAvailability type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability or + IO[bytes] + :return: MigrationNameAvailability or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailability + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MigrationNameAvailability] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "MigrationNameAvailability") + + _request = build_check_name_availability_request( + resource_group_name=resource_group_name, + server_name=server_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MigrationNameAvailability", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_name_availability_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_name_availability_operations.py new file mode 100644 index 000000000000..3c539f175333 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_name_availability_operations.py @@ -0,0 +1,348 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import PostgreSQLManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_check_globally_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_check_with_location_request(location_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/checkNameAvailability", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "locationName": _SERIALIZER.url("location_name", location_name, "str", min_length=1, pattern=r"^[-\w\._]+$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class NameAvailabilityOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s + :attr:`name_availability` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PostgreSQLManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def check_globally( + self, parameters: _models.CheckNameAvailabilityRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Checks the validity and availability of the given name, to assign it to a new server or to use + it as the base name of a new pair of virtual endpoints. + + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_globally( + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Checks the validity and availability of the given name, to assign it to a new server or to use + it as the base name of a new pair of virtual endpoints. + + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_globally( + self, parameters: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Checks the validity and availability of the given name, to assign it to a new server or to use + it as the base name of a new pair of virtual endpoints. + + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. Is + either a CheckNameAvailabilityRequest type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest or + IO[bytes] + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailabilityRequest") + + _request = build_check_globally_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NameAvailabilityModel", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def check_with_location( + self, + location_name: str, + parameters: _models.CheckNameAvailabilityRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Check the availability of name for resource. + + :param location_name: The name of the location. Required. + :type location_name: str + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_with_location( + self, location_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Check the availability of name for resource. + + :param location_name: The name of the location. Required. + :type location_name: str + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_with_location( + self, location_name: str, parameters: Union[_models.CheckNameAvailabilityRequest, IO[bytes]], **kwargs: Any + ) -> _models.NameAvailabilityModel: + """Check the availability of name for resource. + + :param location_name: The name of the location. Required. + :type location_name: str + :param parameters: Parameters required to check if a given name is valid and available to + assign it to a new server or to use it as the base name of a new pair of virtual endpoints. Is + either a CheckNameAvailabilityRequest type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.CheckNameAvailabilityRequest or + IO[bytes] + :return: NameAvailabilityModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.NameAvailabilityModel + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NameAvailabilityModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailabilityRequest") + + _request = build_check_with_location_request( + location_name=location_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NameAvailabilityModel", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_operations.py index e19bbfd736b0..373d35f9d8f3 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import PipelineClient @@ -30,7 +30,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -40,7 +41,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +68,7 @@ class Operations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -77,8 +78,8 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """Lists all of the available REST API operations. + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """Lists all available REST API operations. :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.Operation] @@ -88,7 +89,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -126,7 +127,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -143,7 +144,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_postgre_sql_management_client_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_postgre_sql_management_client_operations.py deleted file mode 100644 index 0c7294352319..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_postgre_sql_management_client_operations.py +++ /dev/null @@ -1,232 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import PostgreSQLManagementClientConfiguration -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_check_migration_name_availability_request( # pylint: disable=name-too-long - subscription_id: str, resource_group_name: str, target_db_server_name: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{targetDbServerName}/checkMigrationNameAvailability", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url( - "subscription_id", - subscription_id, - "str", - pattern=r"([a-z0-9]){8,8}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){4,4}[-]([a-z0-9]){12,12}", - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", pattern=r"^[-a-z0-9A-Z._()]+[^.]$" - ), - "targetDbServerName": _SERIALIZER.url( - "target_db_server_name", target_db_server_name, "str", pattern=r"([-a-z0-9]){3,63}" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class PostgreSQLManagementClientOperationsMixin( # pylint: disable=name-too-long - ClientMixinABC[PipelineClient, PostgreSQLManagementClientConfiguration] -): - - @overload - def check_migration_name_availability( - self, - subscription_id: str, - resource_group_name: str, - target_db_server_name: str, - parameters: _models.MigrationNameAvailabilityResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MigrationNameAvailabilityResource: - """Check migration name validity and availability. - - This method checks whether a proposed migration name is valid and available. - - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. - :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param parameters: The required parameters for checking if a migration name is available. - Required. - :type parameters: - ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MigrationNameAvailabilityResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_migration_name_availability( - self, - subscription_id: str, - resource_group_name: str, - target_db_server_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MigrationNameAvailabilityResource: - """Check migration name validity and availability. - - This method checks whether a proposed migration name is valid and available. - - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. - :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param parameters: The required parameters for checking if a migration name is available. - Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MigrationNameAvailabilityResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_migration_name_availability( - self, - subscription_id: str, - resource_group_name: str, - target_db_server_name: str, - parameters: Union[_models.MigrationNameAvailabilityResource, IO[bytes]], - **kwargs: Any - ) -> _models.MigrationNameAvailabilityResource: - """Check migration name validity and availability. - - This method checks whether a proposed migration name is valid and available. - - :param subscription_id: The subscription ID of the target database server. Required. - :type subscription_id: str - :param resource_group_name: The resource group name of the target database server. Required. - :type resource_group_name: str - :param target_db_server_name: The name of the target database server. Required. - :type target_db_server_name: str - :param parameters: The required parameters for checking if a migration name is available. Is - either a MigrationNameAvailabilityResource type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityResource or IO[bytes] - :return: MigrationNameAvailabilityResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.MigrationNameAvailabilityResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MigrationNameAvailabilityResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "MigrationNameAvailabilityResource") - - _request = build_check_migration_name_availability_request( - subscription_id=subscription_id, - resource_group_name=resource_group_name, - target_db_server_name=target_db_server_name, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MigrationNameAvailabilityResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_get_private_dns_zone_suffix_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_dns_zone_suffix_operations.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_get_private_dns_zone_suffix_operations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_dns_zone_suffix_operations.py index 88ff187bbead..ed941ede5165 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_get_private_dns_zone_suffix_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_dns_zone_suffix_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar from azure.core import PipelineClient from azure.core.exceptions import ( @@ -28,17 +28,18 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_execute_request(**kwargs: Any) -> HttpRequest: +def build_get_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,19 +54,19 @@ def build_execute_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class GetPrivateDnsZoneSuffixOperations: +class PrivateDnsZoneSuffixOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`get_private_dns_zone_suffix` attribute. + :attr:`private_dns_zone_suffix` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -75,8 +76,8 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def execute(self, **kwargs: Any) -> str: - """Get private DNS zone suffix in the cloud. + def get(self, **kwargs: Any) -> str: + """Gets the private DNS zone suffix. :return: str or the result of cls(response) :rtype: str @@ -96,7 +97,7 @@ def execute(self, **kwargs: Any) -> str: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[str] = kwargs.pop("cls", None) - _request = build_execute_request( + _request = build_get_request( api_version=api_version, headers=_headers, params=_params, @@ -112,7 +113,10 @@ def execute(self, **kwargs: Any) -> str: if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("str", pipeline_response.http_response) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_endpoint_connection_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_endpoint_connection_operations.py deleted file mode 100644 index 6574e009a48e..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_endpoint_connection_operations.py +++ /dev/null @@ -1,484 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import PostgreSQLManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_update_request( - resource_group_name: str, - server_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", - private_endpoint_connection_name, - "str", - pattern=r"^[a-zA-Z][a-zA-Z0-9-]*\.[a-fA-F0-9\-]+$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - server_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", - private_endpoint_connection_name, - "str", - pattern=r"^[a-zA-Z][a-zA-Z0-9-]*\.[a-fA-F0-9\-]+$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateEndpointConnectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`private_endpoint_connection` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PostgreSQLManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _update_initial( - self, - resource_group_name: str, - server_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "PrivateEndpointConnection") - - _request = build_update_request( - resource_group_name=resource_group_name, - server_name=server_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - server_name: str, - private_endpoint_connection_name: str, - parameters: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: The required parameters for updating private endpoint connection. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - server_name: str, - private_endpoint_connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: The required parameters for updating private endpoint connection. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - server_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: The required parameters for updating private endpoint connection. Is either - a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection or - IO[bytes] - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - server_name=server_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - server_name=server_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - server_name=server_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_endpoint_connections_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_endpoint_connections_operations.py index 6a62c51b7ce3..76cdf41515d7 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_endpoint_connections_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_endpoint_connections_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from io import IOBase +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -17,21 +18,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._configuration import PostgreSQLManagementClientConfiguration from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -47,7 +53,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,13 +88,106 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_update_request( + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", + private_endpoint_connection_name, + "str", + pattern=r"^[a-zA-Z][a-zA-Z0-9-]*\.[a-fA-F0-9\-]+$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", + private_endpoint_connection_name, + "str", + pattern=r"^[a-zA-Z][a-zA-Z0-9-]*\.[a-fA-F0-9\-]+$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + def build_list_by_server_request( resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +228,7 @@ class PrivateEndpointConnectionsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -189,7 +288,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) @@ -199,11 +301,341 @@ def get( return deserialized # type: ignore + def _update_initial( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "PrivateEndpointConnection") + + _request = build_update_request( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Approves or rejects a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters required to update a private endpoint connection. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Approves or rejects a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters required to update a private endpoint connection. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + server_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Approves or rejects a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Parameters required to update a private endpoint connection. Is either a + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.PrivateEndpointConnection or + IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, server_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + server_name=server_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnection"]: - """Gets all private endpoint connections on a server. + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """Lists all private endpoint connections on a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -220,7 +652,7 @@ def list_by_server( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateEndpointConnectionList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -261,7 +693,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -278,7 +710,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_link_resources_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_link_resources_operations.py index 8f9f59d5ea23..cf4cae725c9b 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_link_resources_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_private_link_resources_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import PipelineClient @@ -31,7 +31,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,7 +44,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +121,7 @@ class PrivateLinkResourcesOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -132,7 +133,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateLinkResource"]: + ) -> ItemPaged["_models.PrivateLinkResource"]: """Gets the private link resources for PostgreSQL server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -149,7 +150,7 @@ def list_by_server( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.PrivateLinkResourceList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -190,7 +191,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -207,7 +208,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -265,7 +269,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_quota_usages_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_quota_usages_operations.py index a212a0f117a2..a3a04a19802b 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_quota_usages_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_quota_usages_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import PipelineClient @@ -31,7 +31,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -41,7 +42,7 @@ def build_list_request(location_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +78,7 @@ class QuotaUsagesOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -87,7 +88,7 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.QuotaUsage"]: + def list(self, location_name: str, **kwargs: Any) -> ItemPaged["_models.QuotaUsage"]: """Get quota usages at specified location in a given subscription. :param location_name: The name of the location. Required. @@ -100,7 +101,7 @@ def list(self, location_name: str, **kwargs: Any) -> Iterable["_models.QuotaUsag _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.QuotaUsageList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -140,7 +141,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("QuotaUsagesListResult", pipeline_response) + deserialized = self._deserialize("QuotaUsageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -157,7 +158,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_replicas_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_replicas_operations.py index e2c223b7774d..e6b3749d43c7 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_replicas_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_replicas_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar import urllib.parse from azure.core import PipelineClient @@ -31,7 +31,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -43,7 +44,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +85,7 @@ class ReplicasOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -94,8 +95,8 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterable["_models.Server"]: - """List all the replicas for a given server. + def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: Any) -> ItemPaged["_models.Server"]: + """Lists all read replicas of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -110,7 +111,7 @@ def list_by_server(self, resource_group_name: str, server_name: str, **kwargs: A _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ServerList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -151,7 +152,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ServerListResult", pipeline_response) + deserialized = self._deserialize("ServerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -168,7 +169,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_server_threat_protection_settings_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_server_threat_protection_settings_operations.py index 75c598411531..b6b110d50c09 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_server_threat_protection_settings_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_server_threat_protection_settings_operations.py @@ -8,8 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -22,7 +21,6 @@ StreamConsumedError, map_error, ) -from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse @@ -36,87 +34,13 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_by_server_request( - resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - server_name: str, - threat_protection_name: Union[str, _models.ThreatProtectionName], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/advancedThreatProtectionSettings/{threatProtectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - "threatProtectionName": _SERIALIZER.url("threat_protection_name", threat_protection_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - def build_create_or_update_request( resource_group_name: str, server_name: str, @@ -127,7 +51,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -172,7 +96,7 @@ class ServerThreatProtectionSettingsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -181,164 +105,12 @@ def __init__(self, *args, **kwargs): self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_by_server( - self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.ServerThreatProtectionSettingsModel"]: - """Get a list of server's Threat Protection state. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :return: An iterator like instance of either ServerThreatProtectionSettingsModel or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerThreatProtectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_server_request( - resource_group_name=resource_group_name, - server_name=server_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ServerThreatProtectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, - resource_group_name: str, - server_name: str, - threat_protection_name: Union[str, _models.ThreatProtectionName], - **kwargs: Any - ) -> _models.ServerThreatProtectionSettingsModel: - """Get a server's Advanced Threat Protection settings. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param threat_protection_name: The name of the Threat Protection state. "Default" Required. - :type threat_protection_name: str or - ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName - :return: ServerThreatProtectionSettingsModel or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerThreatProtectionSettingsModel] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - server_name=server_name, - threat_protection_name=threat_protection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - def _create_or_update_initial( self, resource_group_name: str, server_name: str, threat_protection_name: Union[str, _models.ThreatProtectionName], - parameters: Union[_models.ServerThreatProtectionSettingsModel, IO[bytes]], + parameters: Union[_models.AdvancedThreatProtectionSettingsModel, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -362,7 +134,7 @@ def _create_or_update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "ServerThreatProtectionSettingsModel") + _json = self._serialize.body(parameters, "AdvancedThreatProtectionSettingsModel") _request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -386,18 +158,23 @@ def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -412,11 +189,11 @@ def begin_create_or_update( resource_group_name: str, server_name: str, threat_protection_name: Union[str, _models.ThreatProtectionName], - parameters: _models.ServerThreatProtectionSettingsModel, + parameters: _models.AdvancedThreatProtectionSettingsModel, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ServerThreatProtectionSettingsModel]: + ) -> LROPoller[None]: """Creates or updates a server's Advanced Threat Protection settings. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -424,19 +201,18 @@ def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :param threat_protection_name: Name of the advanced threat protection settings. "Default" + Required. :type threat_protection_name: str or ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName - :param parameters: The Advanced Threat Protection state for the flexible server. Required. + :param parameters: The Advanced Threat Protection state for the server. Required. :type parameters: - ~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel + ~azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsModel :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either ServerThreatProtectionSettingsModel or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -450,7 +226,7 @@ def begin_create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ServerThreatProtectionSettingsModel]: + ) -> LROPoller[None]: """Creates or updates a server's Advanced Threat Protection settings. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -458,18 +234,17 @@ def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :param threat_protection_name: Name of the advanced threat protection settings. "Default" + Required. :type threat_protection_name: str or ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName - :param parameters: The Advanced Threat Protection state for the flexible server. Required. + :param parameters: The Advanced Threat Protection state for the server. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either ServerThreatProtectionSettingsModel or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -479,9 +254,9 @@ def begin_create_or_update( resource_group_name: str, server_name: str, threat_protection_name: Union[str, _models.ThreatProtectionName], - parameters: Union[_models.ServerThreatProtectionSettingsModel, IO[bytes]], + parameters: Union[_models.AdvancedThreatProtectionSettingsModel, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.ServerThreatProtectionSettingsModel]: + ) -> LROPoller[None]: """Creates or updates a server's Advanced Threat Protection settings. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -489,17 +264,16 @@ def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param threat_protection_name: The name of the Threat Protection state. "Default" Required. + :param threat_protection_name: Name of the advanced threat protection settings. "Default" + Required. :type threat_protection_name: str or ~azure.mgmt.postgresqlflexibleservers.models.ThreatProtectionName - :param parameters: The Advanced Threat Protection state for the flexible server. Is either a - ServerThreatProtectionSettingsModel type or a IO[bytes] type. Required. + :param parameters: The Advanced Threat Protection state for the server. Is either a + AdvancedThreatProtectionSettingsModel type or a IO[bytes] type. Required. :type parameters: - ~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel or IO[bytes] - :return: An instance of LROPoller that returns either ServerThreatProtectionSettingsModel or - the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.ServerThreatProtectionSettingsModel] + ~azure.mgmt.postgresqlflexibleservers.models.AdvancedThreatProtectionSettingsModel or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -507,7 +281,7 @@ def begin_create_or_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServerThreatProtectionSettingsModel] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -527,11 +301,9 @@ def begin_create_or_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ServerThreatProtectionSettingsModel", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -542,12 +314,10 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ServerThreatProtectionSettingsModel].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ServerThreatProtectionSettingsModel]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_servers_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_servers_operations.py index 8c32d2d76982..0a98e0846e81 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_servers_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_servers_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -36,19 +36,20 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_create_request( +def build_create_or_update_request( resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -86,7 +87,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,7 +125,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +158,7 @@ def build_get_request(resource_group_name: str, server_name: str, subscription_i _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +191,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,11 +217,11 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +249,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -284,7 +285,7 @@ def build_start_request(resource_group_name: str, server_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -317,7 +318,7 @@ def build_stop_request(resource_group_name: str, server_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -358,7 +359,7 @@ class ServersOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -367,7 +368,7 @@ def __init__(self, *args, **kwargs): self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def _create_initial( + def _create_or_update_initial( self, resource_group_name: str, server_name: str, parameters: Union[_models.Server, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -393,7 +394,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "Server") - _request = build_create_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, server_name=server_name, subscription_id=self._config.subscription_id, @@ -414,18 +415,23 @@ def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -435,7 +441,7 @@ def _create_initial( return deserialized # type: ignore @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -443,7 +449,7 @@ def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Server]: + ) -> LROPoller[None]: """Creates a new server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -451,18 +457,19 @@ def begin_create( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for creating or updating a server. Required. + :param parameters: Parameters required to create a new server or to update an existing server. + Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Server :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Server or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create( + def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -470,7 +477,7 @@ def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Server]: + ) -> LROPoller[None]: """Creates a new server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -478,20 +485,21 @@ def begin_create( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for creating or updating a server. Required. + :param parameters: Parameters required to create a new server or to update an existing server. + Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Server or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create( + def begin_create_or_update( self, resource_group_name: str, server_name: str, parameters: Union[_models.Server, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Server]: + ) -> LROPoller[None]: """Creates a new server. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -499,11 +507,11 @@ def begin_create( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for creating or updating a server. Is either a - Server type or a IO[bytes] type. Required. + :param parameters: Parameters required to create a new server or to update an existing server. + Is either a Server type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.Server or IO[bytes] - :return: An instance of LROPoller that returns either Server or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -511,12 +519,12 @@ def begin_create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Server] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, server_name=server_name, parameters=parameters, @@ -530,11 +538,9 @@ def begin_create( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -545,21 +551,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Server].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Server]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _update_initial( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerForUpdate, IO[bytes]], + parameters: Union[_models.ServerForPatch, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -583,7 +587,7 @@ def _update_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "ServerForUpdate") + _json = self._serialize.body(parameters, "ServerForPatch") _request = build_update_request( resource_group_name=resource_group_name, @@ -606,18 +610,23 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -631,26 +640,26 @@ def begin_update( self, resource_group_name: str, server_name: str, - parameters: _models.ServerForUpdate, + parameters: _models.ServerForPatch, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Server]: - """Updates an existing server. The request body can contain one to many of the properties present - in the normal server definition. + ) -> LROPoller[None]: + """Updates an existing server. The request body can contain one or multiple of the properties + present in the normal server definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for updating a server. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ServerForUpdate + :param parameters: Parameters required to update a server. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ServerForPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Server or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -663,22 +672,22 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.Server]: - """Updates an existing server. The request body can contain one to many of the properties present - in the normal server definition. + ) -> LROPoller[None]: + """Updates an existing server. The request body can contain one or multiple of the properties + present in the normal server definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for updating a server. Required. + :param parameters: Parameters required to update a server. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either Server or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -687,22 +696,22 @@ def begin_update( self, resource_group_name: str, server_name: str, - parameters: Union[_models.ServerForUpdate, IO[bytes]], + parameters: Union[_models.ServerForPatch, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Server]: - """Updates an existing server. The request body can contain one to many of the properties present - in the normal server definition. + ) -> LROPoller[None]: + """Updates an existing server. The request body can contain one or multiple of the properties + present in the normal server definition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The required parameters for updating a server. Is either a ServerForUpdate - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ServerForUpdate or IO[bytes] - :return: An instance of LROPoller that returns either Server or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.Server] + :param parameters: Parameters required to update a server. Is either a ServerForPatch type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.ServerForPatch or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -710,7 +719,7 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Server] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -729,11 +738,9 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Server", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -744,15 +751,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.Server].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.Server]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { @@ -787,18 +792,24 @@ def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -809,7 +820,7 @@ def _delete_initial(self, resource_group_name: str, server_name: str, **kwargs: @distributed_trace def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a server. + """Deletes or drops an existing server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -864,7 +875,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _models.Server: - """Gets information about a server. + """Gets information about an existing server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -908,7 +919,10 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Server", pipeline_response.http_response) @@ -919,8 +933,8 @@ def get(self, resource_group_name: str, server_name: str, **kwargs: Any) -> _mod return deserialized # type: ignore @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Server"]: - """List all the servers in a given resource group. + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Server"]: + """Lists all servers in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -933,7 +947,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ServerList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -973,7 +987,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ServerListResult", pipeline_response) + deserialized = self._deserialize("ServerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -990,7 +1004,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -998,8 +1015,8 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Server"]: - """List all the servers in a given subscription. + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.Server"]: + """Lists all servers in a subscription. :return: An iterator like instance of either Server or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.Server] @@ -1009,7 +1026,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Server"]: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ServerList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1022,7 +1039,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Server"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -1048,7 +1065,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("ServerListResult", pipeline_response) + deserialized = self._deserialize("ServerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1065,7 +1082,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1092,9 +1112,10 @@ def _restart_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if parameters else None _json = None _content = None if isinstance(parameters, (IOBase, bytes)): @@ -1126,18 +1147,23 @@ def _restart_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -1156,14 +1182,14 @@ def begin_restart( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Restarts a server. + """Restarts PostgreSQL database engine in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The parameters for restarting a server. Default value is None. + :param parameters: Parameters to restart a server. Default value is None. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.RestartParameter :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -1183,14 +1209,14 @@ def begin_restart( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[None]: - """Restarts a server. + """Restarts PostgreSQL database engine in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The parameters for restarting a server. Default value is None. + :param parameters: Parameters to restart a server. Default value is None. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -1208,15 +1234,15 @@ def begin_restart( parameters: Optional[Union[_models.RestartParameter, IO[bytes]]] = None, **kwargs: Any ) -> LROPoller[None]: - """Restarts a server. + """Restarts PostgreSQL database engine in a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The parameters for restarting a server. Is either a RestartParameter type or - a IO[bytes] type. Default value is None. + :param parameters: Parameters to restart a server. Is either a RestartParameter type or a + IO[bytes] type. Default value is None. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.RestartParameter or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] @@ -1227,6 +1253,7 @@ def begin_restart( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if parameters else None cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1300,18 +1327,23 @@ def _start_initial(self, resource_group_name: str, server_name: str, **kwargs: A response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -1322,7 +1354,7 @@ def _start_initial(self, resource_group_name: str, server_name: str, **kwargs: A @distributed_trace def begin_start(self, resource_group_name: str, server_name: str, **kwargs: Any) -> LROPoller[None]: - """Starts a server. + """Starts a stopped server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1408,18 +1440,23 @@ def _stop_initial(self, resource_group_name: str, server_name: str, **kwargs: An response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_configuration_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_configuration_operations.py deleted file mode 100644 index 4b7192d097d1..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_configuration_operations.py +++ /dev/null @@ -1,1081 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import PostgreSQLManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_enable_request( - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/enable", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - "tuningOption": _SERIALIZER.url("tuning_option", tuning_option, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_disable_request( - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/disable", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - "tuningOption": _SERIALIZER.url("tuning_option", tuning_option, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_session_request( - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/startSession", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - "tuningOption": _SERIALIZER.url("tuning_option", tuning_option, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_session_request( - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/stopSession", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - "tuningOption": _SERIALIZER.url("tuning_option", tuning_option, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_sessions_request( - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/sessions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - "tuningOption": _SERIALIZER.url("tuning_option", tuning_option, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_session_details_request( - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - subscription_id: str, - *, - session_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/sessionDetails", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - "tuningOption": _SERIALIZER.url("tuning_option", tuning_option, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _params["sessionId"] = _SERIALIZER.query("session_id", session_id, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class TuningConfigurationOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`tuning_configuration` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PostgreSQLManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _enable_initial( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_enable_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_enable( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> LROPoller[None]: - """Enables the config tuning. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enable_initial( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _disable_initial( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_disable_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_disable( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> LROPoller[None]: - """Disables the config tuning. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._disable_initial( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_session_initial( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - config_tuning_request: Union[_models.ConfigTuningRequestParameter, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(config_tuning_request, (IOBase, bytes)): - _content = config_tuning_request - else: - _json = self._serialize.body(config_tuning_request, "ConfigTuningRequestParameter") - - _request = build_start_session_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_start_session( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - config_tuning_request: _models.ConfigTuningRequestParameter, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Starts up the config tuning session. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :param config_tuning_request: The parameters for tuning request. Required. - :type config_tuning_request: - ~azure.mgmt.postgresqlflexibleservers.models.ConfigTuningRequestParameter - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_start_session( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - config_tuning_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Starts up the config tuning session. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :param config_tuning_request: The parameters for tuning request. Required. - :type config_tuning_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_start_session( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - config_tuning_request: Union[_models.ConfigTuningRequestParameter, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Starts up the config tuning session. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :param config_tuning_request: The parameters for tuning request. Is either a - ConfigTuningRequestParameter type or a IO[bytes] type. Required. - :type config_tuning_request: - ~azure.mgmt.postgresqlflexibleservers.models.ConfigTuningRequestParameter or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_session_initial( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - config_tuning_request=config_tuning_request, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _stop_session_initial( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_session_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_stop_session( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> LROPoller[None]: - """Stops the config tuning session. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_session_initial( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_sessions( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - **kwargs: Any - ) -> Iterable["_models.SessionResource"]: - """Gets up the config tuning session status. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :return: An iterator like instance of either SessionResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.SessionResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SessionsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_sessions_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SessionsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_session_details( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - session_id: str, - **kwargs: Any - ) -> Iterable["_models.SessionDetailsResource"]: - """Gets the session details of a config tuning session. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :param session_id: Guid of the objectId for the session. Required. - :type session_id: str - :return: An iterator like instance of either SessionDetailsResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.SessionDetailsResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SessionDetailsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_session_details_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - session_id=session_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("SessionDetailsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_index_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_index_operations.py deleted file mode 100644 index c366dacac826..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_index_operations.py +++ /dev/null @@ -1,203 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import PostgreSQLManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_recommendations_request( - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - subscription_id: str, - *, - recommendation_type: Optional[Union[str, _models.RecommendationType]] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/recommendations", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "serverName": _SERIALIZER.url( - "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" - ), - "tuningOption": _SERIALIZER.url("tuning_option", tuning_option, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if recommendation_type is not None: - _params["recommendationType"] = _SERIALIZER.query("recommendation_type", recommendation_type, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class TuningIndexOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.postgresqlflexibleservers.PostgreSQLManagementClient`'s - :attr:`tuning_index` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: PostgreSQLManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_recommendations( - self, - resource_group_name: str, - server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], - recommendation_type: Optional[Union[str, _models.RecommendationType]] = None, - **kwargs: Any - ) -> Iterable["_models.IndexRecommendationResource"]: - """Retrieve the list of available tuning index recommendations. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param server_name: The name of the server. Required. - :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :param recommendation_type: Recommendations list filter. Retrieves recommendations based on - type. Known values are: "CreateIndex" and "DropIndex". Default value is None. - :type recommendation_type: str or - ~azure.mgmt.postgresqlflexibleservers.models.RecommendationType - :return: An iterator like instance of either IndexRecommendationResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.IndexRecommendationResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.IndexRecommendationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_recommendations_request( - resource_group_name=resource_group_name, - server_name=server_name, - tuning_option=tuning_option, - subscription_id=self._config.subscription_id, - recommendation_type=recommendation_type, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("IndexRecommendationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_options_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_options_operations.py index cddd1ff88906..22e04d492c07 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_options_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_tuning_options_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Optional, TypeVar, Union import urllib.parse from azure.core import PipelineClient @@ -31,7 +31,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -40,14 +41,14 @@ def build_get_request( resource_group_name: str, server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], + tuning_option: Union[str, _models.TuningOptionParameterEnum], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,13 +78,57 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_list_recommendations_request( + resource_group_name: str, + server_name: str, + tuning_option: Union[str, _models.TuningOptionParameterEnum], + subscription_id: str, + *, + recommendation_type: Optional[Union[str, _models.RecommendationTypeParameterEnum]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}/tuningOptions/{tuningOption}/recommendations", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "serverName": _SERIALIZER.url( + "server_name", server_name, "str", max_length=63, min_length=3, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*" + ), + "tuningOption": _SERIALIZER.url("tuning_option", tuning_option, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if recommendation_type is not None: + _params["recommendationType"] = _SERIALIZER.query("recommendation_type", recommendation_type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_list_by_server_request( resource_group_name: str, server_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +169,7 @@ class TuningOptionsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -138,21 +183,22 @@ def get( self, resource_group_name: str, server_name: str, - tuning_option: Union[str, _models.TuningOptionEnum], + tuning_option: Union[str, _models.TuningOptionParameterEnum], **kwargs: Any - ) -> _models.TuningOptionsResource: - """Retrieve the tuning option on a server. + ) -> _models.TuningOptions: + """Gets the tuning options of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param tuning_option: The name of the tuning option. Known values are: "index" and - "configuration". Required. - :type tuning_option: str or ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionEnum - :return: TuningOptionsResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionsResource + :param tuning_option: The name of the tuning option. Known values are: "index" and "table". + Required. + :type tuning_option: str or + ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionParameterEnum + :return: TuningOptions or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.TuningOptions :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -167,7 +213,7 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.TuningOptionsResource] = kwargs.pop("cls", None) + cls: ClsType[_models.TuningOptions] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -189,38 +235,145 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TuningOptionsResource", pipeline_response.http_response) + deserialized = self._deserialize("TuningOptions", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + @distributed_trace + def list_recommendations( + self, + resource_group_name: str, + server_name: str, + tuning_option: Union[str, _models.TuningOptionParameterEnum], + recommendation_type: Optional[Union[str, _models.RecommendationTypeParameterEnum]] = None, + **kwargs: Any + ) -> ItemPaged["_models.ObjectRecommendation"]: + """Lists available object recommendations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :param tuning_option: The name of the tuning option. Known values are: "index" and "table". + Required. + :type tuning_option: str or + ~azure.mgmt.postgresqlflexibleservers.models.TuningOptionParameterEnum + :param recommendation_type: Recommendations list filter. Retrieves recommendations based on + type. Known values are: "CreateIndex", "DropIndex", "ReIndex", and "AnalyzeTable". Default + value is None. + :type recommendation_type: str or + ~azure.mgmt.postgresqlflexibleservers.models.RecommendationTypeParameterEnum + :return: An iterator like instance of either ObjectRecommendation or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.ObjectRecommendation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ObjectRecommendationList] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_recommendations_request( + resource_group_name=resource_group_name, + server_name=server_name, + tuning_option=tuning_option, + subscription_id=self._config.subscription_id, + recommendation_type=recommendation_type, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ObjectRecommendationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.TuningOptionsResource"]: - """Retrieve the list of available tuning options. + ) -> ItemPaged["_models.TuningOptions"]: + """Lists the tuning options of a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either TuningOptionsResource or the result of - cls(response) + :return: An iterator like instance of either TuningOptions or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.TuningOptionsResource] + ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.TuningOptions] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.TuningOptionsListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.TuningOptionsList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -261,7 +414,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("TuningOptionsListResult", pipeline_response) + deserialized = self._deserialize("TuningOptionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -278,7 +431,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_virtual_endpoints_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_virtual_endpoints_operations.py index fa07a231e843..51191b1c26fc 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_virtual_endpoints_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_virtual_endpoints_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -36,7 +36,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -48,7 +49,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -94,7 +95,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -140,7 +141,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +184,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -226,7 +227,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -267,7 +268,7 @@ class VirtualEndpointsOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -281,7 +282,7 @@ def _create_initial( resource_group_name: str, server_name: str, virtual_endpoint_name: str, - parameters: Union[_models.VirtualEndpointResource, IO[bytes]], + parameters: Union[_models.VirtualEndpoint, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -305,7 +306,7 @@ def _create_initial( if isinstance(parameters, (IOBase, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "VirtualEndpointResource") + _json = self._serialize.body(parameters, "VirtualEndpoint") _request = build_create_request( resource_group_name=resource_group_name, @@ -329,18 +330,23 @@ def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -355,30 +361,28 @@ def begin_create( resource_group_name: str, server_name: str, virtual_endpoint_name: str, - parameters: _models.VirtualEndpointResource, + parameters: _models.VirtualEndpoint, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualEndpointResource]: - """Creates a new virtual endpoint for PostgreSQL flexible server. + ) -> LROPoller[None]: + """Creates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for creating or updating virtual endpoints. + :param parameters: Parameters required to create or update a pair of virtual endpoints. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -392,26 +396,24 @@ def begin_create( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualEndpointResource]: - """Creates a new virtual endpoint for PostgreSQL flexible server. + ) -> LROPoller[None]: + """Creates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for creating or updating virtual endpoints. + :param parameters: Parameters required to create or update a pair of virtual endpoints. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -421,26 +423,23 @@ def begin_create( resource_group_name: str, server_name: str, virtual_endpoint_name: str, - parameters: Union[_models.VirtualEndpointResource, IO[bytes]], + parameters: Union[_models.VirtualEndpoint, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.VirtualEndpointResource]: - """Creates a new virtual endpoint for PostgreSQL flexible server. + ) -> LROPoller[None]: + """Creates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for creating or updating virtual endpoints. Is - either a VirtualEndpointResource type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource or - IO[bytes] - :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :param parameters: Parameters required to create or update a pair of virtual endpoints. Is + either a VirtualEndpoint type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -448,7 +447,7 @@ def begin_create( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualEndpointResource] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -468,11 +467,9 @@ def begin_create( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -483,15 +480,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualEndpointResource].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualEndpointResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _update_initial( self, @@ -546,18 +541,23 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -576,26 +576,23 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualEndpointResource]: - """Updates an existing virtual endpoint. The request body can contain one to many of the - properties present in the normal virtual endpoint definition. + ) -> LROPoller[None]: + """Updates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for updating a server. Required. + :param parameters: Parameters required to update a pair of virtual endpoints. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResourceForPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -609,26 +606,23 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.VirtualEndpointResource]: - """Updates an existing virtual endpoint. The request body can contain one to many of the - properties present in the normal virtual endpoint definition. + ) -> LROPoller[None]: + """Updates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for updating a server. Required. + :param parameters: Parameters required to update a pair of virtual endpoints. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -640,25 +634,22 @@ def begin_update( virtual_endpoint_name: str, parameters: Union[_models.VirtualEndpointResourceForPatch, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.VirtualEndpointResource]: - """Updates an existing virtual endpoint. The request body can contain one to many of the - properties present in the normal virtual endpoint definition. + ) -> LROPoller[None]: + """Updates a pair of virtual endpoints for a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :param parameters: The required parameters for updating a server. Is either a + :param parameters: Parameters required to update a pair of virtual endpoints. Is either a VirtualEndpointResourceForPatch type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResourceForPatch or IO[bytes] - :return: An instance of LROPoller that returns either VirtualEndpointResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -666,7 +657,7 @@ def begin_update( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualEndpointResource] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -686,11 +677,9 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -701,15 +690,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.VirtualEndpointResource].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.VirtualEndpointResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete_initial( self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any @@ -753,12 +740,18 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -771,14 +764,14 @@ def _delete_initial( def begin_delete( self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes a virtual endpoint. + """Deletes a pair of virtual endpoints. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] @@ -830,18 +823,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace def get( self, resource_group_name: str, server_name: str, virtual_endpoint_name: str, **kwargs: Any - ) -> _models.VirtualEndpointResource: - """Gets information about a virtual endpoint. + ) -> _models.VirtualEndpoint: + """Gets information about a pair of virtual endpoints. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param virtual_endpoint_name: The name of the virtual endpoint. Required. + :param virtual_endpoint_name: Base name of the virtual endpoints. Required. :type virtual_endpoint_name: str - :return: VirtualEndpointResource or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource + :return: VirtualEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -856,7 +849,7 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VirtualEndpointResource] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualEndpoint] = kwargs.pop("cls", None) _request = build_get_request( resource_group_name=resource_group_name, @@ -878,10 +871,13 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualEndpointResource", pipeline_response.http_response) + deserialized = self._deserialize("VirtualEndpoint", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -891,25 +887,24 @@ def get( @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any - ) -> Iterable["_models.VirtualEndpointResource"]: - """List all the servers in a given resource group. + ) -> ItemPaged["_models.VirtualEndpoint"]: + """Lists pair of virtual endpoints associated to a server. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :return: An iterator like instance of either VirtualEndpointResource or the result of - cls(response) + :return: An iterator like instance of either VirtualEndpoint or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpointResource] + ~azure.core.paging.ItemPaged[~azure.mgmt.postgresqlflexibleservers.models.VirtualEndpoint] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.VirtualEndpointsListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualEndpointsList] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -950,7 +945,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualEndpointsListResult", pipeline_response) + deserialized = self._deserialize("VirtualEndpointsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -967,7 +962,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_virtual_network_subnet_usage_operations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_virtual_network_subnet_usage_operations.py index 2b43746c30ad..579bcdff7286 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_virtual_network_subnet_usage_operations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/azure/mgmt/postgresqlflexibleservers/operations/_virtual_network_subnet_usage_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -30,17 +30,18 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_execute_request(location_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_list_request(location_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -79,7 +80,7 @@ class VirtualNetworkSubnetUsageOperations: models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: PostgreSQLManagementClientConfiguration = ( @@ -89,15 +90,15 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload - def execute( + def list( self, location_name: str, parameters: _models.VirtualNetworkSubnetUsageParameter, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.VirtualNetworkSubnetUsageResult: - """Get virtual network subnet usage for a given vNet resource id. + ) -> _models.VirtualNetworkSubnetUsageModel: + """Lists the virtual network subnet usage for a given virtual network. :param location_name: The name of the location. Required. :type location_name: str @@ -107,16 +108,16 @@ def execute( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: VirtualNetworkSubnetUsageResult or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageResult + :return: VirtualNetworkSubnetUsageModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageModel :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def execute( + def list( self, location_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.VirtualNetworkSubnetUsageResult: - """Get virtual network subnet usage for a given vNet resource id. + ) -> _models.VirtualNetworkSubnetUsageModel: + """Lists the virtual network subnet usage for a given virtual network. :param location_name: The name of the location. Required. :type location_name: str @@ -125,19 +126,19 @@ def execute( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: VirtualNetworkSubnetUsageResult or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageResult + :return: VirtualNetworkSubnetUsageModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageModel :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def execute( + def list( self, location_name: str, parameters: Union[_models.VirtualNetworkSubnetUsageParameter, IO[bytes]], **kwargs: Any - ) -> _models.VirtualNetworkSubnetUsageResult: - """Get virtual network subnet usage for a given vNet resource id. + ) -> _models.VirtualNetworkSubnetUsageModel: + """Lists the virtual network subnet usage for a given virtual network. :param location_name: The name of the location. Required. :type location_name: str @@ -145,8 +146,8 @@ def execute( VirtualNetworkSubnetUsageParameter type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageParameter or IO[bytes] - :return: VirtualNetworkSubnetUsageResult or the result of cls(response) - :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageResult + :return: VirtualNetworkSubnetUsageModel or the result of cls(response) + :rtype: ~azure.mgmt.postgresqlflexibleservers.models.VirtualNetworkSubnetUsageModel :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -162,7 +163,7 @@ def execute( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.VirtualNetworkSubnetUsageResult] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualNetworkSubnetUsageModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -172,7 +173,7 @@ def execute( else: _json = self._serialize.body(parameters, "VirtualNetworkSubnetUsageParameter") - _request = build_execute_request( + _request = build_list_request( location_name=location_name, subscription_id=self._config.subscription_id, api_version=api_version, @@ -193,10 +194,13 @@ def execute( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetworkSubnetUsageResult", pipeline_response.http_response) + deserialized = self._deserialize("VirtualNetworkSubnetUsageModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrator_add.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_add.py similarity index 82% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrator_add.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_add.py index 5a4be3dd7f1a..f61b78ad6939 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrator_add.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_add.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python administrator_add.py + python administrators_microsoft_entra_add.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,21 +31,20 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.administrators.begin_create( - resource_group_name="testrg", - server_name="testserver", + client.administrators_microsoft_entra.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", object_id="oooooooo-oooo-oooo-oooo-oooooooooooo", parameters={ "properties": { - "principalName": "testuser1@microsoft.com", + "principalName": "exampleuser@contoso.com", "principalType": "User", "tenantId": "tttttttt-tttt-tttt-tttt-tttttttttttt", } }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/AdministratorAdd.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraAdd.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrator_delete.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_delete.py similarity index 83% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrator_delete.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_delete.py index 5e3356afaf39..6a149b984824 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrator_delete.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_delete.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python administrator_delete.py + python administrators_microsoft_entra_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,13 +31,13 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - client.administrators.begin_delete( - resource_group_name="testrg", - server_name="testserver", + client.administrators_microsoft_entra.begin_delete( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", object_id="oooooooo-oooo-oooo-oooo-oooooooooooo", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/AdministratorDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraDelete.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrator_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_get.py similarity index 83% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrator_get.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_get.py index 4e4c67cf79e3..6f100dc2b1fc 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrator_get.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_get.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python administrator_get.py + python administrators_microsoft_entra_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,14 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.administrators.get( - resource_group_name="testrg", - server_name="pgtestsvc1", + response = client.administrators_microsoft_entra.get( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", object_id="oooooooo-oooo-oooo-oooo-oooooooooooo", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/AdministratorGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_list_by_server.py new file mode 100644 index 000000000000..73672157411b --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_microsoft_entra_list_by_server.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python administrators_microsoft_entra_list_by_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.administrators_microsoft_entra.list_by_server( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdministratorsMicrosoftEntraListByServer.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_create_or_update.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_create_or_update.py similarity index 76% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_create_or_update.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_create_or_update.py index 47f6c39e6bde..298bb97560fa 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_create_or_update.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_create_or_update.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_threat_protection_settings_create_or_update.py + python advanced_threat_protection_settings_create_or_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,18 +28,17 @@ def main(): client = PostgreSQLManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.server_threat_protection_settings.begin_create_or_update( - resource_group_name="threatprotection-4799", - server_name="threatprotection-6440", + client.server_threat_protection_settings.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", threat_protection_name="Default", parameters={"properties": {"state": "Enabled"}}, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerThreatProtectionSettingsCreateOrUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_get.py new file mode 100644 index 000000000000..a9a69c05de74 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python advanced_threat_protection_settings_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.advanced_threat_protection_settings.get( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + threat_protection_name="Default", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_list_by_server.py new file mode 100644 index 000000000000..898e38ccc926 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/advanced_threat_protection_settings_list_by_server.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python advanced_threat_protection_settings_list_by_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.advanced_threat_protection_settings.list_by_server( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/AdvancedThreatProtectionSettingsListByServer.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_create.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_create.py similarity index 80% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_create.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_create.py index b1a8d3cffd21..7bf4a1b42646 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_create.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_create.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python backup_create.py + python backups_automatic_and_on_demand_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,14 +31,13 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.backups.begin_create( - resource_group_name="TestGroup", - server_name="postgresqltestserver", - backup_name="backup_20250303T160516", + client.backups_automatic_and_on_demand.begin_create( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + backup_name="ondemandbackup-20250601T183022", ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/BackupCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandCreate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_delete.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_delete.py similarity index 80% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_delete.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_delete.py index c3b3746f040e..642f23835d4d 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_delete.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_delete.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python backup_delete.py + python backups_automatic_and_on_demand_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,13 +31,13 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - client.backups.begin_delete( - resource_group_name="TestGroup", - server_name="testserver", - backup_name="backup_20250303T160516", + client.backups_automatic_and_on_demand.begin_delete( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + backup_name="ondemandbackup-20250601T183022", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/BackupDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandDelete.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_get.py new file mode 100644 index 000000000000..5d5998014c19 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python backups_automatic_and_on_demand_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.backups_automatic_and_on_demand.get( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + backup_name="backup_638830782181266873", + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandGet.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_list_by_server.py new file mode 100644 index 000000000000..6070a3e2bbaf --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_automatic_and_on_demand_list_by_server.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python backups_automatic_and_on_demand_list_by_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.backups_automatic_and_on_demand.list_by_server( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsAutomaticAndOnDemandListByServer.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/check_name_availability_location_based.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_check_prerequisites.py similarity index 78% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/check_name_availability_location_based.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_check_prerequisites.py index 0a367ece551b..1d2261aedf24 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/check_name_availability_location_based.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_check_prerequisites.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python check_name_availability_location_based.py + python backups_long_term_retention_check_prerequisites.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,13 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.check_name_availability_with_location.execute( - location_name="westus", - name_availability_request={"name": "name1", "type": "Microsoft.DBforPostgreSQL/flexibleServers"}, + response = client.backups_long_term_retention.check_prerequisites( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={"backupSettings": {"backupName": "exampleltrbackup"}}, ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/CheckNameAvailabilityLocationBased.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionCheckPrerequisites.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_get.py similarity index 81% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_get.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_get.py index 3830199f6a0d..e35dbc60f149 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_get.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_get.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python backup_get.py + python backups_long_term_retention_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,14 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.backups.get( - resource_group_name="TestGroup", - server_name="postgresqltestserver", - backup_name="daily_20250303T160516", + response = client.backups_long_term_retention.get( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + backup_name="exampleltrbackup", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/BackupGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_list_by_server.py new file mode 100644 index 000000000000..775982b2a272 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_list_by_server.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python backups_long_term_retention_list_by_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.backups_long_term_retention.list_by_server( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionListByServer.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_start.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_start.py new file mode 100644 index 000000000000..233e446047b4 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backups_long_term_retention_start.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python backups_long_term_retention_start.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.backups_long_term_retention.begin_start( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={"backupSettings": {"backupName": "exampleltrbackup"}, "targetDetails": {"sasUriList": ["sasuri"]}}, + ).result() + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/BackupsLongTermRetentionStart.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/capabilities_by_location.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/capabilities_by_location_list.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/capabilities_by_location.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/capabilities_by_location_list.py index 224fab6620a9..99577c1ce8c9 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/capabilities_by_location.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/capabilities_by_location_list.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python capabilities_by_location.py + python capabilities_by_location_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,13 +31,13 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.location_based_capabilities.execute( + response = client.capabilities_by_location.list( location_name="eastus", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/CapabilitiesByLocation.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByLocationList.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/capabilities_by_server_list.py similarity index 84% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_list_by_server.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/capabilities_by_server_list.py index 78ed085656d4..69e093fbb70f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/administrators_list_by_server.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/capabilities_by_server_list.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python administrators_list_by_server.py + python capabilities_by_server_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,14 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.administrators.list_by_server( - resource_group_name="testrg", - server_name="pgtestsvc1", + response = client.capabilities_by_server.list( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/AdministratorsListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapabilitiesByServerList.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/captured_logs_list_by_server.py similarity index 84% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_list_by_server.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/captured_logs_list_by_server.py index c5013f2f2174..e5f23df09266 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/backup_list_by_server.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/captured_logs_list_by_server.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python backup_list_by_server.py + python captured_logs_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,14 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.backups.list_by_server( - resource_group_name="TestGroup", - server_name="postgresqltestserver", + response = client.captured_logs.list_by_server( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/BackupListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/CapturedLogsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/check_migration_name_availability.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/check_migration_name_availability.py deleted file mode 100644 index 25cc3a235b1e..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/check_migration_name_availability.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python check_migration_name_availability.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.check_migration_name_availability( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - parameters={"name": "name1", "type": "Microsoft.DBforPostgreSQL/flexibleServers/migrations"}, - ) - print(response) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/CheckMigrationNameAvailability.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configuration_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_get.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configuration_get.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_get.py index 60eaed62b9ee..6e870aa890bf 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configuration_get.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_get.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python configuration_get.py + python configurations_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,13 +32,13 @@ def main(): ) response = client.configurations.get( - resource_group_name="testrg", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", configuration_name="array_nulls", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ConfigurationGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configuration_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_list_by_server.py similarity index 87% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configuration_list_by_server.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_list_by_server.py index f1937f0bba34..2cbb5d31fee8 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configuration_list_by_server.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_list_by_server.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python configuration_list_by_server.py + python configurations_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,13 +32,13 @@ def main(): ) response = client.configurations.list_by_server( - resource_group_name="testrg", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ConfigurationListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configuration_update.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_update.py similarity index 85% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configuration_update.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_update.py index 2283141dd171..47cdead14d02 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configuration_update.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_update.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python configuration_update.py + python configurations_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,15 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.configurations.begin_update( - resource_group_name="testrg", - server_name="testserver", + client.configurations.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", configuration_name="constraint_exclusion", parameters={"properties": {"source": "user-override", "value": "on"}}, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ConfigurationUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_update_using_put.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_update_using_put.py new file mode 100644 index 000000000000..5eab004856f4 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/configurations_update_using_put.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python configurations_update_using_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.configurations.begin_put( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + configuration_name="constraint_exclusion", + parameters={"properties": {"source": "user-override", "value": "on"}}, + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ConfigurationsUpdateUsingPut.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/database_create.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_create.py similarity index 84% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/database_create.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_create.py index 37171be5c6a0..20067d4cdb99 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/database_create.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_create.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python database_create.py + python databases_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,15 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.databases.begin_create( - resource_group_name="TestGroup", - server_name="testserver", - database_name="db1", + client.databases.begin_create( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + database_name="exampledatabase", parameters={"properties": {"charset": "utf8", "collation": "en_US.utf8"}}, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/DatabaseCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesCreate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/database_delete.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_delete.py similarity index 86% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/database_delete.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_delete.py index a40497ceb77e..66352b0b605f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/database_delete.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_delete.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python database_delete.py + python databases_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,12 +32,12 @@ def main(): ) client.databases.begin_delete( - resource_group_name="TestGroup", - server_name="testserver", - database_name="db1", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + database_name="exampledatabase", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/DatabaseDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesDelete.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/database_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_get.py similarity index 86% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/database_get.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_get.py index a9e1ed5bc25c..209e77955731 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/database_get.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_get.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python database_get.py + python databases_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,13 +32,13 @@ def main(): ) response = client.databases.get( - resource_group_name="TestGroup", - server_name="testserver", - database_name="db1", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + database_name="exampledatabase", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/DatabaseGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_list_by_server.py index 2163f3cc09dd..3a10a16fa7e8 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_list_by_server.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/databases_list_by_server.py @@ -32,13 +32,13 @@ def main(): ) response = client.databases.list_by_server( - resource_group_name="TestGroup", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/DatabasesListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/DatabasesListByServer.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_create.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_create_or_update.py similarity index 82% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_create.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_create_or_update.py index 4bfbadfc6828..f7bbfce75602 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_create.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_create_or_update.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python firewall_rule_create.py + python firewall_rules_create_or_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,15 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.firewall_rules.begin_create_or_update( - resource_group_name="testrg", - server_name="testserver", - firewall_rule_name="rule1", + client.firewall_rules.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + firewall_rule_name="examplefirewallrule", parameters={"properties": {"endIpAddress": "255.255.255.255", "startIpAddress": "0.0.0.0"}}, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/FirewallRuleCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_delete.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_delete.py similarity index 85% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_delete.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_delete.py index f2e6b8fa9f7a..6496bfe7e7b5 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_delete.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_delete.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python firewall_rule_delete.py + python firewall_rules_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,12 +32,12 @@ def main(): ) client.firewall_rules.begin_delete( - resource_group_name="testrg", - server_name="testserver", - firewall_rule_name="rule1", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + firewall_rule_name="examplefirewallrule", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/FirewallRuleDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesDelete.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_get.py similarity index 85% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_get.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_get.py index 211215425cf4..ca2fa3763cfa 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_get.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_get.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python firewall_rule_get.py + python firewall_rules_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,13 +32,13 @@ def main(): ) response = client.firewall_rules.get( - resource_group_name="testrg", - server_name="testserver", - firewall_rule_name="rule1", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + firewall_rule_name="examplefirewallrule", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/FirewallRuleGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_list_by_server.py similarity index 87% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_list_by_server.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_list_by_server.py index dd216ce94043..05c85d1584f9 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rule_list_by_server.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/firewall_rules_list_by_server.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python firewall_rule_list_by_server.py + python firewall_rules_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,13 +32,13 @@ def main(): ) response = client.firewall_rules.list_by_server( - resource_group_name="testrg", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/FirewallRuleListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/FirewallRulesListByServer.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/log_files_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/log_files_list_by_server.py deleted file mode 100644 index 2ee50ce198af..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/log_files_list_by_server.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python log_files_list_by_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.log_files.list_by_server( - resource_group_name="testrg", - server_name="postgresqltestsvc1", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/LogFilesListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_backup.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_backup.py deleted file mode 100644 index a1fa3f7a83bb..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_backup.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python long_term_retention_backup.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.flexible_server.begin_start_ltr_backup( - resource_group_name="rgLongTermRetention", - server_name="pgsqlltrtestserver", - parameters={"backupSettings": {"backupName": "backup1"}, "targetDetails": {"sasUriList": ["sasuri"]}}, - ).result() - print(response) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/LongTermRetentionBackup.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_operation_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_operation_get.py deleted file mode 100644 index 8ebb104ec64a..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_operation_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python long_term_retention_operation_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.ltr_backup_operations.get( - resource_group_name="rgLongTermRetention", - server_name="pgsqlltrtestserver", - backup_name="backup1", - ) - print(response) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/LongTermRetentionOperationGet.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_operation_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_operation_list_by_server.py deleted file mode 100644 index a65b7ab2dcaa..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_operation_list_by_server.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python long_term_retention_operation_list_by_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.ltr_backup_operations.list_by_server( - resource_group_name="rgLongTermRetention", - server_name="pgsqlltrtestserver", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/LongTermRetentionOperationListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_pre_backup.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_pre_backup.py deleted file mode 100644 index 6c32a2f8d9d5..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/long_term_retention_pre_backup.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python long_term_retention_pre_backup.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.flexible_server.trigger_ltr_pre_backup( - resource_group_name="rgLongTermRetention", - server_name="pgsqlltrtestserver", - parameters={"backupSettings": {"backupName": "backup1"}}, - ) - print(response) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/LongTermRetentionPreBackup.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_cancel.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_cancel.py index 4aba1bf5dd43..1f983268ca3e 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_cancel.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_cancel.py @@ -31,16 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.migrations.update( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", - parameters={"properties": {"cancel": "True"}}, + response = client.migrations.cancel( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Cancel.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCancel.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_check_name_availability.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_check_name_availability.py new file mode 100644 index 000000000000..29587d0e5356 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_check_name_availability.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python migrations_check_name_availability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.migrations.check_name_availability( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={"name": "examplemigration", "type": "Microsoft.DBforPostgreSQL/flexibleServers/migrations"}, + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCheckNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create.py index cea83948c706..80dc440cb1e2 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create.py @@ -32,26 +32,28 @@ def main(): ) response = client.migrations.create( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", parameters={ - "location": "westus", + "location": "eastus", "properties": { - "dbsToMigrate": ["db1", "db2", "db3", "db4"], + "dbsToMigrate": ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], "migrationMode": "Offline", "overwriteDbsInTarget": "True", "secretParameters": { - "adminCredentials": {"sourceServerPassword": "xxxxxxxx", "targetServerPassword": "xxxxxxxx"} + "adminCredentials": { + "sourceServerPassword": "examplesourcepassword", + "targetServerPassword": "exampletargetpassword", + } }, - "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource", + "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", }, }, ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Create.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_other_source_types_validate_migrate.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_other_source_types_validate_migrate.py index 18ac38be7e8e..e5a5cba654c9 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_other_source_types_validate_migrate.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_other_source_types_validate_migrate.py @@ -32,21 +32,23 @@ def main(): ) response = client.migrations.create( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", parameters={ - "location": "westus", + "location": "eastus", "properties": { - "dbsToMigrate": ["db1", "db2", "db3", "db4"], + "dbsToMigrate": ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], "migrationMode": "Offline", "migrationOption": "ValidateAndMigrate", "overwriteDbsInTarget": "True", "secretParameters": { - "adminCredentials": {"sourceServerPassword": "xxxxxxxx", "targetServerPassword": "xxxxxxxx"} + "adminCredentials": { + "sourceServerPassword": "examplesourcepassword", + "targetServerPassword": "exampletargetpassword", + } }, - "sourceDbServerResourceId": "testsource:5432@pguser", + "sourceDbServerResourceId": "examplesource:5432@exampleuser", "sourceType": "OnPremises", "sslMode": "Prefer", }, @@ -55,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Create_Other_SourceTypes_Validate_Migrate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateOtherSourceTypesValidateMigrate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_validate_only.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_validate_only.py index 96c90f14eb7a..3f9d19f3025f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_validate_only.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_validate_only.py @@ -32,27 +32,29 @@ def main(): ) response = client.migrations.create( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", parameters={ - "location": "westus", + "location": "eastus", "properties": { - "dbsToMigrate": ["db1", "db2", "db3", "db4"], + "dbsToMigrate": ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], "migrationMode": "Offline", "migrationOption": "Validate", "overwriteDbsInTarget": "True", "secretParameters": { - "adminCredentials": {"sourceServerPassword": "xxxxxxxx", "targetServerPassword": "xxxxxxxx"} + "adminCredentials": { + "sourceServerPassword": "examplesourcepassword", + "targetServerPassword": "exampletargetpassword", + } }, - "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource", + "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", }, }, ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Create_Validate_Only.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateValidateOnly.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_fully_qualified_domain_name.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_fully_qualified_domain_name.py index eff12c085219..c9809b4f2b2a 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_fully_qualified_domain_name.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_fully_qualified_domain_name.py @@ -32,28 +32,27 @@ def main(): ) response = client.migrations.create( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", parameters={ - "location": "westus", + "location": "eastus", "properties": { - "dbsToMigrate": ["db1", "db2", "db3", "db4"], + "dbsToMigrate": ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], "migrationMode": "Offline", "overwriteDbsInTarget": "True", "secretParameters": { "adminCredentials": {"sourceServerPassword": "xxxxxxxx", "targetServerPassword": "xxxxxxxx"} }, - "sourceDbServerFullyQualifiedDomainName": "testsourcefqdn.example.com", - "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource", - "targetDbServerFullyQualifiedDomainName": "test-target-fqdn.example.com", + "sourceDbServerFullyQualifiedDomainName": "examplesource.contoso.com", + "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", + "targetDbServerFullyQualifiedDomainName": "exampletarget.contoso.com", }, }, ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Create_With_FullyQualifiedDomainName.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithFullyQualifiedDomainName.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_other_users.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_other_users.py index 8c9b28c1513d..2f4802064a3a 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_other_users.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_other_users.py @@ -32,27 +32,29 @@ def main(): ) response = client.migrations.create( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", parameters={ - "location": "westus", + "location": "eastus", "properties": { - "dbsToMigrate": ["db1", "db2", "db3", "db4"], + "dbsToMigrate": ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], "migrationMode": "Offline", "secretParameters": { - "adminCredentials": {"sourceServerPassword": "xxxxxxxx", "targetServerPassword": "xxxxxxxx"}, - "sourceServerUsername": "newadmin@testsource", + "adminCredentials": { + "sourceServerPassword": "examplesourcepassword", + "targetServerPassword": "exampletargetpassword", + }, + "sourceServerUsername": "newadmin@examplesource", "targetServerUsername": "targetadmin", }, - "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource", + "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", }, }, ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Create_With_Other_Users.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithOtherUsers.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_private_endpoint_servers.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_private_endpoint_servers.py index 2b3e29f2a7a2..0b2748185b7c 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_private_endpoint_servers.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_private_endpoint_servers.py @@ -32,27 +32,29 @@ def main(): ) response = client.migrations.create( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", parameters={ - "location": "westus", + "location": "eastus", "properties": { - "dbsToMigrate": ["db1", "db2", "db3", "db4"], - "migrationInstanceResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/flexibleServers/testsourcemigration", + "dbsToMigrate": ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], + "migrationInstanceResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/flexibleServers/examplesourcemigration", "migrationMode": "Offline", "overwriteDbsInTarget": "True", "secretParameters": { - "adminCredentials": {"sourceServerPassword": "xxxxxxxx", "targetServerPassword": "xxxxxxxx"} + "adminCredentials": { + "sourceServerPassword": "examplesourcepassword", + "targetServerPassword": "exampletargetpassword", + } }, - "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource", + "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", }, }, ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Create_With_PrivateEndpoint_Servers.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithPrivateEndpointServers.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_roles.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_roles.py index 27748cc86c9b..003ed4ac9be4 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_roles.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_create_with_roles.py @@ -32,27 +32,29 @@ def main(): ) response = client.migrations.create( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", parameters={ - "location": "westus", + "location": "eastus", "properties": { - "dbsToMigrate": ["db1", "db2", "db3", "db4"], + "dbsToMigrate": ["exampledatabase1", "exampledatabase2", "exampledatabase3", "exampledatabase4"], "migrateRoles": "True", "migrationMode": "Offline", "overwriteDbsInTarget": "True", "secretParameters": { - "adminCredentials": {"sourceServerPassword": "xxxxxxxx", "targetServerPassword": "xxxxxxxx"} + "adminCredentials": { + "sourceServerPassword": "examplesourcepassword", + "targetServerPassword": "exampletargetpassword", + } }, - "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource", + "sourceDbServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBForPostgreSql/servers/examplesource", }, }, ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Create_With_Roles.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsCreateWithRoles.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_delete.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_delete.py deleted file mode 100644 index 2181b50b793c..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_delete.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python migrations_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - client.migrations.delete( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", - ) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get.py index db4f6cd6c75c..58580c2e9972 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get.py @@ -32,14 +32,13 @@ def main(): ) response = client.migrations.get( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Get.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_and_migration.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_and_migration.py index f3e140a9eb6f..250b96f0d3c4 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_and_migration.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_and_migration.py @@ -32,14 +32,13 @@ def main(): ) response = client.migrations.get( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigrationwithsuccessfulvalidationandmigration", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_GetMigrationWithSuccessfulValidationAndMigration.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationAndMigration.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_but_migration_failure.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_but_migration_failure.py index 5f655d753a8b..d0cac45f1de2 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_but_migration_failure.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_but_migration_failure.py @@ -32,14 +32,13 @@ def main(): ) response = client.migrations.get( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigrationwithsuccessfulvalidationbutmigrationfailure", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_GetMigrationWithSuccessfulValidationButMigrationFailure.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationButMigrationFailure.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_only.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_only.py index fb43cd1d35f4..c57af79c430a 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_only.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_successful_validation_only.py @@ -32,14 +32,13 @@ def main(): ) response = client.migrations.get( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigrationwithsuccessfulvalidationonly", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_GetMigrationWithSuccessfulValidationOnly.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithSuccessfulValidationOnly.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_validation_failures.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_validation_failures.py index 269a720fb7fe..61e8c563aa9c 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_validation_failures.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_get_migration_with_validation_failures.py @@ -32,14 +32,13 @@ def main(): ) response = client.migrations.get( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigrationwithvalidationfailure", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_GetMigrationWithValidationFailures.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsGetMigrationWithValidationFailures.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_list_by_target_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_list_by_target_server.py index b5f9d6e9db90..f1eeff92d304 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_list_by_target_server.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_list_by_target_server.py @@ -32,14 +32,13 @@ def main(): ) response = client.migrations.list_by_target_server( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_ListByTargetServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsListByTargetServer.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_update.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_update.py index 2d13c2db22f7..78e550e32228 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_update.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/migrations_update.py @@ -32,15 +32,14 @@ def main(): ) response = client.migrations.update( - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - resource_group_name="testrg", - target_db_server_name="testtarget", - migration_name="testmigration", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + migration_name="examplemigration", parameters={"properties": {"setupLogicalReplicationOnSourceDbIfNeeded": "True"}}, ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Migrations_Update.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/MigrationsUpdate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/check_name_availability.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/name_availability_check_globally.py similarity index 83% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/check_name_availability.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/name_availability_check_globally.py index a76ecc94565f..cdfbf80d435e 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/check_name_availability.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/name_availability_check_globally.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python check_name_availability.py + python name_availability_check_globally.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,12 +31,12 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.check_name_availability.execute( - name_availability_request={"name": "name1", "type": "Microsoft.DBforPostgreSQL/flexibleServers"}, + response = client.name_availability.check_globally( + parameters={"name": "exampleserver", "type": "Microsoft.DBforPostgreSQL/flexibleServers"}, ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/CheckNameAvailability.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckGlobally.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/name_availability_check_with_location.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/name_availability_check_with_location.py new file mode 100644 index 000000000000..e2f6b11b2edf --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/name_availability_check_with_location.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python name_availability_check_with_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.name_availability.check_with_location( + location_name="eastus", + parameters={"name": "exampleserver", "type": "Microsoft.DBforPostgreSQL/flexibleServers"}, + ) + print(response) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/NameAvailabilityCheckWithLocation.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/operation_list.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/operations_list.py similarity index 93% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/operation_list.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/operations_list.py index 8d653e8b195c..c9e8fdbc0879 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/operation_list.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/operations_list.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python operation_list.py + python operations_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/OperationList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/get_private_dns_zone_suffix.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_dns_zone_suffix_get.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/get_private_dns_zone_suffix.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_dns_zone_suffix_get.py index edbad31cbd9a..9f08b88f229a 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/get_private_dns_zone_suffix.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_dns_zone_suffix_get.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python get_private_dns_zone_suffix.py + python private_dns_zone_suffix_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,10 +31,10 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.get_private_dns_zone_suffix.execute() + response = client.private_dns_zone_suffix.get() print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/GetPrivateDnsZoneSuffix.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateDnsZoneSuffixGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_delete.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_delete.py similarity index 84% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_delete.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_delete.py index fc09a5ade9d2..4e92a8923e86 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_delete.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_delete.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python private_endpoint_connection_delete.py + python private_endpoint_connections_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,13 +31,13 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - client.private_endpoint_connection.begin_delete( - resource_group_name="Default", - server_name="test-svr", + client.private_endpoint_connections.begin_delete( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", private_endpoint_connection_name="private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/PrivateEndpointConnectionDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsDelete.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_get.py similarity index 87% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_get.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_get.py index 9dc52d334d41..9f163e935799 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_get.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_get.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python private_endpoint_connection_get.py + python private_endpoint_connections_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,13 +32,13 @@ def main(): ) response = client.private_endpoint_connections.get( - resource_group_name="Default", - server_name="test-svr", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", private_endpoint_connection_name="private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/PrivateEndpointConnectionGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_list.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_list.py similarity index 87% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_list.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_list.py index 59cc71a219be..125bda75470c 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_list.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_list.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python private_endpoint_connection_list.py + python private_endpoint_connections_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,13 +32,13 @@ def main(): ) response = client.private_endpoint_connections.list_by_server( - resource_group_name="Default", - server_name="test-svr", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/PrivateEndpointConnectionList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsList.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_update.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_update.py similarity index 85% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_update.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_update.py index 25975fc0e570..479b3a5528d1 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connection_update.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_endpoint_connections_update.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python private_endpoint_connection_update.py + python private_endpoint_connections_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,9 +31,9 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.private_endpoint_connection.begin_update( - resource_group_name="Default", - server_name="test-svr", + client.private_endpoint_connections.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", private_endpoint_connection_name="private-endpoint-connection-name.1fa229cd-bf3f-47f0-8c49-afb36723997e", parameters={ "properties": { @@ -44,9 +44,8 @@ def main(): } }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/PrivateEndpointConnectionUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateEndpointConnectionsUpdate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_link_resources_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_link_resources_get.py index a0420c681e2d..b7c1952cba76 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_link_resources_get.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_link_resources_get.py @@ -32,13 +32,13 @@ def main(): ) response = client.private_link_resources.get( - resource_group_name="Default", - server_name="test-svr", - group_name="plr", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + group_name="exampleprivatelink", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/PrivateLinkResourcesGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_link_resources_list.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_link_resources_list.py index f160ff14fb08..7988575817b8 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_link_resources_list.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/private_link_resources_list.py @@ -32,13 +32,13 @@ def main(): ) response = client.private_link_resources.list_by_server( - resource_group_name="Default", - server_name="test-svr", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/PrivateLinkResourcesList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/PrivateLinkResourcesList.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_forced_standalone_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_forced_standalone_server.py deleted file mode 100644 index 0c471de45413..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_forced_standalone_server.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python promote_replica_as_forced_standalone_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.begin_update( - resource_group_name="testResourceGroup", - server_name="pgtestsvc4-replica", - parameters={"properties": {"replica": {"promoteMode": "standalone", "promoteOption": "forced"}}}, - ).result() - print(response) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/PromoteReplicaAsForcedStandaloneServer.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_forced_switchover.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_forced_switchover.py deleted file mode 100644 index 638ead85932e..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_forced_switchover.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python promote_replica_as_forced_switchover.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.begin_update( - resource_group_name="testResourceGroup", - server_name="pgtestsvc4-replica", - parameters={"properties": {"replica": {"promoteMode": "switchover", "promoteOption": "forced"}}}, - ).result() - print(response) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/PromoteReplicaAsForcedSwitchover.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_planned_standalone_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_planned_standalone_server.py deleted file mode 100644 index 2e370f9add54..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_planned_standalone_server.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python promote_replica_as_planned_standalone_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.begin_update( - resource_group_name="testResourceGroup", - server_name="pgtestsvc4-replica", - parameters={"properties": {"replica": {"promoteMode": "standalone", "promoteOption": "planned"}}}, - ).result() - print(response) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/PromoteReplicaAsPlannedStandaloneServer.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_planned_switchover.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_planned_switchover.py deleted file mode 100644 index 22126c711c2b..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/promote_replica_as_planned_switchover.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python promote_replica_as_planned_switchover.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.servers.begin_update( - resource_group_name="testResourceGroup", - server_name="pgtestsvc4-replica", - parameters={"properties": {"replica": {"promoteMode": "switchover", "promoteOption": "planned"}}}, - ).result() - print(response) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/PromoteReplicaAsPlannedSwitchover.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/quota_usages_for_flexible_servers.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/quota_usages_for_flexible_servers.py index d9cffcb1aed8..a6a5bc71ad8f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/quota_usages_for_flexible_servers.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/quota_usages_for_flexible_servers.py @@ -32,12 +32,12 @@ def main(): ) response = client.quota_usages.list( - location_name="westus", + location_name="eastus", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/QuotaUsagesForFlexibleServers.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/QuotaUsagesForFlexibleServers.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/replicas_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/replicas_list_by_server.py index d07fdc08b6cb..5f5512f16ff6 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/replicas_list_by_server.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/replicas_list_by_server.py @@ -32,13 +32,13 @@ def main(): ) response = client.replicas.list_by_server( - resource_group_name="testrg", - server_name="sourcepgservername", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ReplicasListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ReplicasListByServer.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_capabilities.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_capabilities.py deleted file mode 100644 index 997cdc27d75a..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_capabilities.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python server_capabilities.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.server_capabilities.list( - resource_group_name="testrg", - server_name="pgtestsvc4", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerCapabilities.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_get.py deleted file mode 100644 index 654940a884a5..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python server_threat_protection_settings_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", - ) - - response = client.server_threat_protection_settings.get( - resource_group_name="threatprotection-6852", - server_name="threatprotection-2080", - threat_protection_name="Default", - ) - print(response) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerThreatProtectionSettingsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_list_by_server.py deleted file mode 100644 index a908628eb689..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_threat_protection_settings_list_by_server.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python server_threat_protection_settings_list_by_server.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", - ) - - response = client.server_threat_protection_settings.list_by_server( - resource_group_name="threatprotection-6852", - server_name="threatprotection-2080", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerThreatProtectionSettingsListByServer.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/cluster_create.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_cluster_create.py similarity index 80% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/cluster_create.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_cluster_create.py index 9bb6068c97a2..5c4556a09bf7 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/cluster_create.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_cluster_create.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python cluster_create.py + python servers_cluster_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,16 +31,16 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_create( - resource_group_name="testrg", - server_name="pgtestcluster", + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ - "location": "westus", + "location": "eastus", "properties": { - "administratorLogin": "login", - "administratorLoginPassword": "Password1", + "administratorLogin": "examplelogin", + "administratorLoginPassword": "examplepassword", "backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"}, - "cluster": {"clusterSize": 2}, + "cluster": {"clusterSize": 2, "defaultDatabaseName": "clusterdb"}, "createMode": "Create", "highAvailability": {"mode": "Disabled"}, "network": {"publicNetworkAccess": "Disabled"}, @@ -50,9 +50,8 @@ def main(): "sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"}, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ClusterCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersClusterCreate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_geo_restore_with_data_encryption_enabled.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_geo_restore_with_data_encryption_enabled.py new file mode 100644 index 000000000000..eebe49547803 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_geo_restore_with_data_encryption_enabled.py @@ -0,0 +1,64 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python servers_create_geo_restore_with_data_encryption_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}, + }, + }, + "location": "eastus", + "properties": { + "createMode": "GeoRestore", + "dataEncryption": { + "geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", + "geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + "primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + "type": "AzureKeyVault", + }, + "pointInTimeUTC": "2025-06-01T18:35:22.123456Z", + "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", + }, + }, + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabled.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_geo_restore_with_data_encryption_enabled.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_geo_restore_with_data_encryption_enabled_auto_update.py similarity index 61% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_geo_restore_with_data_encryption_enabled.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_geo_restore_with_data_encryption_enabled_auto_update.py index 7b830722fcdd..d9c2a7acb632 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_geo_restore_with_data_encryption_enabled.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_geo_restore_with_data_encryption_enabled_auto_update.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_create_geo_restore_with_data_encryption_enabled.py + python servers_create_geo_restore_with_data_encryption_enabled_auto_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,35 +31,34 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_create( - resource_group_name="testrg", - server_name="pgtestsvc5geo", + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ "identity": { "type": "UserAssigned", "userAssignedIdentities": { - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity": {}, - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}, }, }, "location": "eastus", "properties": { "createMode": "GeoRestore", "dataEncryption": { - "geoBackupKeyURI": "https://test-geo-kv.vault.azure.net/keys/test-key1/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", - "geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity", - "primaryKeyURI": "https://test-kv.vault.azure.net/keys/test-key1/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + "geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", + "geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + "primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", "type": "AzureKeyVault", }, - "pointInTimeUTC": "2021-06-27T00:04:59.4078005+00:00", - "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername", + "pointInTimeUTC": "2025-06-01T18:35:22.123456Z", + "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", }, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerCreateGeoRestoreWithDataEncryptionEnabled.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateGeoRestoreWithDataEncryptionEnabledAutoUpdate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_in_microsoft_owned_virtual_network_with_zone_redundant_high_availability.py similarity index 68% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_in_microsoft_owned_virtual_network_with_zone_redundant_high_availability.py index f6cb72e98384..fa87b427f89f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_in_microsoft_owned_virtual_network_with_zone_redundant_high_availability.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_create.py + python servers_create_in_microsoft_owned_virtual_network_with_zone_redundant_high_availability.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,32 +31,28 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_create( - resource_group_name="testrg", - server_name="testpgflex", + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ "location": "eastus", "properties": { - "administratorLogin": "login", - "administratorLoginPassword": "Password1", + "administratorLogin": "exampleadministratorlogin", + "administratorLoginPassword": "examplepassword", "availabilityZone": "1", "backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Enabled"}, "createMode": "Create", "highAvailability": {"mode": "ZoneRedundant"}, - "network": { - "delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-subnet", - "privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/testpgflex.private.postgres.database", - }, + "network": {"publicNetworkAccess": "Enabled"}, "storage": {"autoGrow": "Disabled", "storageSizeGB": 512, "tier": "P20"}, - "version": "16", + "version": "17", }, "sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"}, - "tags": {"VNetServer": "1"}, + "tags": {"InCustomerVnet": "false", "InMicrosoftVnet": "true"}, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInMicrosoftOwnedVirtualNetworkWithZoneRedundantHighAvailability.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_in_your_own_virtual_network_with_same_zone_high_availability.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_in_your_own_virtual_network_with_same_zone_high_availability.py new file mode 100644 index 000000000000..26e30d4fb0ed --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_in_your_own_virtual_network_with_same_zone_high_availability.py @@ -0,0 +1,61 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python servers_create_in_your_own_virtual_network_with_same_zone_high_availability.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={ + "location": "eastus", + "properties": { + "administratorLogin": "exampleadministratorlogin", + "administratorLoginPassword": "examplepassword", + "availabilityZone": "1", + "backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Enabled"}, + "createMode": "Create", + "highAvailability": {"mode": "SameZone"}, + "network": { + "delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", + "privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.private.postgres.database", + }, + "storage": {"autoGrow": "Disabled", "storageSizeGB": 512, "tier": "P20"}, + "version": "17", + }, + "sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"}, + "tags": {"InCustomerVnet": "true", "InMicrosoftVnet": "false"}, + }, + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateInYourOwnVirtualNetworkWithSameZoneHighAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_point_in_time_restore.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_point_in_time_restore.py similarity index 75% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_point_in_time_restore.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_point_in_time_restore.py index 9e29bbfea74a..301f36e31d22 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_point_in_time_restore.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_point_in_time_restore.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_create_point_in_time_restore.py + python servers_create_point_in_time_restore.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,21 +31,20 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_create( - resource_group_name="testrg", - server_name="pgtestsvc5", + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ - "location": "westus", + "location": "eastus", "properties": { "createMode": "PointInTimeRestore", - "pointInTimeUTC": "2021-06-27T00:04:59.4078005+00:00", - "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername", + "pointInTimeUTC": "2025-06-01T18:35:22.123456Z", + "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", }, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerCreatePointInTimeRestore.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreatePointInTimeRestore.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_replica.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_replica.py similarity index 69% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_replica.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_replica.py index 9389fbee2e44..7ed83a4de1b7 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_replica.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_replica.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_create_replica.py + python servers_create_replica.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,34 +31,33 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_create( - resource_group_name="testrg", - server_name="pgtestsvc5rep", + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ "identity": { "type": "UserAssigned", "userAssignedIdentities": { - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {} + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {} }, }, - "location": "westus", + "location": "eastus", "properties": { "createMode": "Replica", "dataEncryption": { "geoBackupKeyURI": "", "geoBackupUserAssignedIdentityId": "", - "primaryKeyURI": "https://test-kv.vault.azure.net/keys/test-key1/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + "primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", "type": "AzureKeyVault", }, - "pointInTimeUTC": "2021-06-27T00:04:59.4078005+00:00", - "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername", + "pointInTimeUTC": "2025-06-01T18:35:22.123456Z", + "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/examplesourceserver", }, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerCreateReplica.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReplica.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_revive_dropped.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_revive_dropped.py similarity index 76% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_revive_dropped.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_revive_dropped.py index 34409a0a2911..be23c2a8a45b 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_revive_dropped.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_revive_dropped.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_create_revive_dropped.py + python servers_create_revive_dropped.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,21 +31,20 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_create( - resource_group_name="testrg", - server_name="pgtestsvc5-rev", + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ - "location": "westus", + "location": "eastus", "properties": { "createMode": "ReviveDropped", - "pointInTimeUTC": "2023-04-27T00:04:59.4078005+00:00", - "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5", + "pointInTimeUTC": "2025-06-01T18:30:22.123456Z", + "sourceServerResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.DBforPostgreSQL/flexibleServers/exampledeletedserver", }, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerCreateReviveDropped.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateReviveDropped.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_with_data_encryption_enabled.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_with_data_encryption_enabled.py new file mode 100644 index 000000000000..b8a2dae033c0 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_with_data_encryption_enabled.py @@ -0,0 +1,73 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python servers_create_with_data_encryption_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {} + }, + }, + "location": "eastus", + "properties": { + "administratorLogin": "exampleadministratorlogin", + "administratorLoginPassword": "examplepassword", + "availabilityZone": "1", + "backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"}, + "createMode": "Create", + "dataEncryption": { + "geoBackupKeyURI": "", + "geoBackupUserAssignedIdentityId": "", + "primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + "type": "AzureKeyVault", + }, + "highAvailability": {"mode": "ZoneRedundant"}, + "network": { + "delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", + "privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", + }, + "storage": {"autoGrow": "Disabled", "storageSizeGB": 512, "tier": "P20"}, + "version": "17", + }, + "sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"}, + }, + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabled.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_with_data_encryption_enabled.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_with_data_encryption_enabled_auto_update.py similarity index 67% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_with_data_encryption_enabled.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_with_data_encryption_enabled_auto_update.py index 3f83d11bec11..466d1d3dae5d 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_with_data_encryption_enabled.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_with_data_encryption_enabled_auto_update.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_create_with_data_encryption_enabled.py + python servers_create_with_data_encryption_enabled_auto_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,44 +31,43 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_create( - resource_group_name="testrg", - server_name="pgtestsvc4", + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ "identity": { "type": "UserAssigned", "userAssignedIdentities": { - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {} + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {} }, }, - "location": "westus", + "location": "eastus", "properties": { - "administratorLogin": "login", - "administratorLoginPassword": "Password1", + "administratorLogin": "exampleadministratorlogin", + "administratorLoginPassword": "examplepassword", "availabilityZone": "1", "backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"}, "createMode": "Create", "dataEncryption": { "geoBackupKeyURI": "", "geoBackupUserAssignedIdentityId": "", - "primaryKeyURI": "https://test-kv.vault.azure.net/keys/test-key1/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + "primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", "type": "AzureKeyVault", }, "highAvailability": {"mode": "ZoneRedundant"}, "network": { - "delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet", - "privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com", + "delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", + "privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", }, "storage": {"autoGrow": "Disabled", "storageSizeGB": 512, "tier": "P20"}, - "version": "16", + "version": "17", }, "sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"}, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerCreateWithDataEncryptionEnabled.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithDataEncryptionEnabledAutoUpdate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_with_microsoft_entra_enabled.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_with_microsoft_entra_enabled_in_your_own_virtual_network_without_high_availability.py similarity index 69% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_with_microsoft_entra_enabled.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_with_microsoft_entra_enabled_in_your_own_virtual_network_without_high_availability.py index 124559a23440..0967c2519be3 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_create_with_microsoft_entra_enabled.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_create_with_microsoft_entra_enabled_in_your_own_virtual_network_without_high_availability.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_create_with_microsoft_entra_enabled.py + python servers_create_with_microsoft_entra_enabled_in_your_own_virtual_network_without_high_availability.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,14 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_create( - resource_group_name="testrg", - server_name="pgtestsvc4", + client.servers.begin_create_or_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ - "location": "westus", + "location": "eastus", "properties": { - "administratorLogin": "login", - "administratorLoginPassword": "Password1", + "administratorLogin": "exampleadministratorlogin", + "administratorLoginPassword": "examplepassword", "authConfig": { "activeDirectoryAuth": "Enabled", "passwordAuth": "Enabled", @@ -48,21 +48,19 @@ def main(): "backup": {"backupRetentionDays": 7, "geoRedundantBackup": "Disabled"}, "createMode": "Create", "dataEncryption": {"type": "SystemManaged"}, - "highAvailability": {"mode": "ZoneRedundant"}, + "highAvailability": {"mode": "Disabled"}, "network": { - "delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet", - "privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com", + "delegatedSubnetResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork/subnets/examplesubnet", + "privateDnsZoneArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/exampleresourcegroup/providers/Microsoft.Network/privateDnsZones/exampleprivatednszone.postgres.database.azure.com", }, "storage": {"autoGrow": "Disabled", "storageSizeGB": 512, "tier": "P20"}, - "version": "16", + "version": "17", }, "sku": {"name": "Standard_D4ds_v5", "tier": "GeneralPurpose"}, - "tags": {"ElasticServer": "1"}, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerCreateWithMicrosoftEntraEnabled.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersCreateWithMicrosoftEntraEnabledInYourOwnVirtualNetworkWithoutHighAvailability.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_delete.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_delete.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_delete.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_delete.py index b6c62bd9a094..314da8f255bc 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_delete.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_delete.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_delete.py + python servers_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,11 +32,11 @@ def main(): ) client.servers.begin_delete( - resource_group_name="testrg", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersDelete.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_get.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_get.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_get.py index 518c9287812b..99405e02eb5c 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_get.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_get.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_get.py + python servers_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,12 +32,12 @@ def main(): ) response = client.servers.get( - resource_group_name="testrg", - server_name="testpgflex", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_get_with_private_endpoints.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_get_with_private_endpoints.py similarity index 86% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_get_with_private_endpoints.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_get_with_private_endpoints.py index f63812cf763c..6be543730108 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_get_with_private_endpoints.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_get_with_private_endpoints.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_get_with_private_endpoints.py + python servers_get_with_private_endpoints.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,12 +32,12 @@ def main(): ) response = client.servers.get( - resource_group_name="testrg", - server_name="pgtestsvc2", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerGetWithPrivateEndpoints.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGetWithPrivateEndpoints.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_get_with_vnet.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_get_with_vnet.py similarity index 87% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_get_with_vnet.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_get_with_vnet.py index 20704f4673b4..7c8fc723622a 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_get_with_vnet.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_get_with_vnet.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_get_with_vnet.py + python servers_get_with_vnet.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,12 +32,12 @@ def main(): ) response = client.servers.get( - resource_group_name="testrg", - server_name="testpgflex", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerGetWithVnet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersGetWithVnet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_list_by_resource_group.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_list_by_resource_group.py similarity index 89% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_list_by_resource_group.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_list_by_resource_group.py index e479e4ecace9..ce5630db3bb3 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_list_by_resource_group.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_list_by_resource_group.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_list_by_resource_group.py + python servers_list_by_resource_group.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,12 +32,12 @@ def main(): ) response = client.servers.list_by_resource_group( - resource_group_name="testrgn", + resource_group_name="exampleresourcegroup", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerListByResourceGroup.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_list.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_list_by_subscription.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_list.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_list_by_subscription.py index 3ab924bf2e47..32b264319a9e 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_list.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_list_by_subscription.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_list.py + python servers_list_by_subscription.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,11 +31,11 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.list() + response = client.servers.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerList.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_forced_standalone_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_forced_standalone_server.py new file mode 100644 index 000000000000..22a64acf6931 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_forced_standalone_server.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python servers_promote_replica_as_forced_standalone_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.servers.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={"properties": {"replica": {"promoteMode": "Standalone", "promoteOption": "Forced"}}}, + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedStandaloneServer.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_forced_switchover.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_forced_switchover.py new file mode 100644 index 000000000000..46faa939022f --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_forced_switchover.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python servers_promote_replica_as_forced_switchover.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.servers.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={"properties": {"replica": {"promoteMode": "Switchover", "promoteOption": "Forced"}}}, + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsForcedSwitchover.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_planned_standalone_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_planned_standalone_server.py new file mode 100644 index 000000000000..19604d326cca --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_planned_standalone_server.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python servers_promote_replica_as_planned_standalone_server.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.servers.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={"properties": {"replica": {"promoteMode": "Standalone", "promoteOption": "Planned"}}}, + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedStandaloneServer.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_planned_switchover.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_planned_switchover.py new file mode 100644 index 000000000000..96632e5fa607 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_promote_replica_as_planned_switchover.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python servers_promote_replica_as_planned_switchover.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.servers.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={"properties": {"replica": {"promoteMode": "Switchover", "promoteOption": "Planned"}}}, + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersPromoteReplicaAsPlannedSwitchover.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_restart.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_restart.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_restart.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_restart.py index 509dbedbefea..9b1f4343d022 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_restart.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_restart.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_restart.py + python servers_restart.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,11 +32,11 @@ def main(): ) client.servers.begin_restart( - resource_group_name="testrg", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerRestart.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersRestart.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_restart_with_failover.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_restart_with_failover.py similarity index 86% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_restart_with_failover.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_restart_with_failover.py index b581326de4aa..a0bc7155ec92 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_restart_with_failover.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_restart_with_failover.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_restart_with_failover.py + python servers_restart_with_failover.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,11 +32,11 @@ def main(): ) client.servers.begin_restart( - resource_group_name="testrg", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerRestartWithFailover.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersRestartWithFailover.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_start.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_start.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_start.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_start.py index d47ddc2a6ebc..77508ed36c74 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_start.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_start.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_start.py + python servers_start.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,11 +32,11 @@ def main(): ) client.servers.begin_start( - resource_group_name="testrg", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerStart.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStart.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_stop.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_stop.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_stop.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_stop.py index 9b0ba12c989d..61466c14968f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_stop.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_stop.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_stop.py + python servers_stop.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,11 +32,11 @@ def main(): ) client.servers.begin_stop( - resource_group_name="testrg", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerStop.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersStop.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update.py similarity index 85% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update.py index a9e2fb0dc481..d88ea37b888f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_update.py + python servers_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,12 +31,12 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_update( - resource_group_name="TestGroup", - server_name="pgtestsvc4", + client.servers.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ "properties": { - "administratorLoginPassword": "newpassword", + "administratorLoginPassword": "examplenewpassword", "backup": {"backupRetentionDays": 20}, "createMode": "Update", "storage": {"autoGrow": "Enabled", "storageSizeGB": 1024, "tier": "P30"}, @@ -44,9 +44,8 @@ def main(): "sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"}, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_customer_maintenance_window.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_custom_maintenance_window.py similarity index 84% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_customer_maintenance_window.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_custom_maintenance_window.py index 0a2ec1e98fac..a008164b3f5c 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_customer_maintenance_window.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_custom_maintenance_window.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_update_with_customer_maintenance_window.py + python servers_update_with_custom_maintenance_window.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,9 +31,9 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_update( - resource_group_name="testrg", - server_name="pgtestsvc4", + client.servers.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ "properties": { "createMode": "Update", @@ -41,9 +41,8 @@ def main(): } }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithCustomMaintenanceWindow.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_data_encryption_enabled.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_data_encryption_enabled.py new file mode 100644 index 000000000000..172909564c15 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_data_encryption_enabled.py @@ -0,0 +1,64 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python servers_update_with_data_encryption_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.servers.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}, + }, + }, + "properties": { + "administratorLoginPassword": "examplenewpassword", + "backup": {"backupRetentionDays": 20}, + "createMode": "Update", + "dataEncryption": { + "geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", + "geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + "primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", + "type": "AzureKeyVault", + }, + }, + "sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"}, + }, + ).result() + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabled.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_data_encryption_enabled.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_data_encryption_enabled_auto_update.py similarity index 64% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_data_encryption_enabled.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_data_encryption_enabled_auto_update.py index 0474e82cc1e6..54d8834178c7 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_data_encryption_enabled.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_data_encryption_enabled_auto_update.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_update_with_data_encryption_enabled.py + python servers_update_with_data_encryption_enabled_auto_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,35 +31,34 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_update( - resource_group_name="TestGroup", - server_name="pgtestsvc4", + client.servers.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ "identity": { "type": "UserAssigned", "userAssignedIdentities": { - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity": {}, - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity": {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity": {}, + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity": {}, }, }, "properties": { - "administratorLoginPassword": "newpassword", + "administratorLoginPassword": "examplenewpassword", "backup": {"backupRetentionDays": 20}, "createMode": "Update", "dataEncryption": { - "geoBackupKeyURI": "https://test-geo-kv.vault.azure.net/keys/test-key1/yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", - "geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity", - "primaryKeyURI": "https://test-kv.vault.azure.net/keys/test-key1/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity", + "geoBackupKeyURI": "https://examplegeoredundantkeyvault.vault.azure.net/keys/examplekey", + "geoBackupUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/examplegeoredundantidentity", + "primaryKeyURI": "https://exampleprimarykeyvault.vault.azure.net/keys/examplekey", + "primaryUserAssignedIdentityId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/exampleprimaryidentity", "type": "AzureKeyVault", }, }, "sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"}, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerUpdateWithDataEncryptionEnabled.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithDataEncryptionEnabledAutoUpdate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_major_version_upgrade.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_major_version_upgrade.py similarity index 82% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_major_version_upgrade.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_major_version_upgrade.py index 7d1595283a39..e790186c4434 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_major_version_upgrade.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_major_version_upgrade.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_update_with_major_version_upgrade.py + python servers_update_with_major_version_upgrade.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,14 +31,13 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_update( - resource_group_name="testrg", - server_name="pgtestsvc4", - parameters={"properties": {"createMode": "Update", "version": "16"}}, + client.servers.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + parameters={"properties": {"createMode": "Update", "version": "17"}}, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerUpdateWithMajorVersionUpgrade.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMajorVersionUpgrade.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_microsoft_entra_enabled.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_microsoft_entra_enabled.py similarity index 84% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_microsoft_entra_enabled.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_microsoft_entra_enabled.py index 1c179ddf88e7..7e8cdb025d4c 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/server_update_with_microsoft_entra_enabled.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/servers_update_with_microsoft_entra_enabled.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python server_update_with_microsoft_entra_enabled.py + python servers_update_with_microsoft_entra_enabled.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,12 +31,12 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.servers.begin_update( - resource_group_name="TestGroup", - server_name="pgtestsvc4", + client.servers.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", parameters={ "properties": { - "administratorLoginPassword": "newpassword", + "administratorLoginPassword": "examplenewpassword", "authConfig": { "activeDirectoryAuth": "Enabled", "passwordAuth": "Enabled", @@ -49,9 +49,8 @@ def main(): "sku": {"name": "Standard_D8s_v3", "tier": "GeneralPurpose"}, }, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/ServerUpdateWithMicrosoftEntraEnabled.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/ServersUpdateWithMicrosoftEntraEnabled.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_disable.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_disable.py deleted file mode 100644 index c48405f162a3..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_disable.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python tuning_configuration_disable.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - client.tuning_configuration.begin_disable( - resource_group_name="testrg", - server_name="testserver", - tuning_option="configuration", - ).result() - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/TuningConfiguration_Disable.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_enable.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_enable.py deleted file mode 100644 index b63f17cb30ac..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_enable.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python tuning_configuration_enable.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - client.tuning_configuration.begin_enable( - resource_group_name="testrg", - server_name="testserver", - tuning_option="configuration", - ).result() - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/TuningConfiguration_Enable.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_list_session_details.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_list_session_details.py deleted file mode 100644 index 18b405cb7884..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_list_session_details.py +++ /dev/null @@ -1,46 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python tuning_configuration_list_session_details.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.tuning_configuration.list_session_details( - resource_group_name="testrg", - server_name="testserver", - tuning_option="configuration", - session_id="oooooooo-oooo-oooo-oooo-oooooooooooo", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/TuningConfiguration_ListSessionDetails.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_list_sessions.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_list_sessions.py deleted file mode 100644 index 07d243eaa146..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_list_sessions.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python tuning_configuration_list_sessions.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - response = client.tuning_configuration.list_sessions( - resource_group_name="testrg", - server_name="testserver", - tuning_option="configuration", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/TuningConfiguration_ListSessions.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_start_session.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_start_session.py deleted file mode 100644 index ee88562ba021..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_start_session.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python tuning_configuration_start_session.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - client.tuning_configuration.begin_start_session( - resource_group_name="testrg", - server_name="testserver", - tuning_option="configuration", - config_tuning_request={"allowServerRestarts": False, "targetImprovementMetric": "targetImprovementMetric"}, - ).result() - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/TuningConfiguration_StartSession.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_stop_session.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_stop_session.py deleted file mode 100644 index 19665616f5a0..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_configuration_stop_session.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-postgresqlflexibleservers -# USAGE - python tuning_configuration_stop_session.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = PostgreSQLManagementClient( - credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", - ) - - client.tuning_configuration.begin_stop_session( - resource_group_name="testrg", - server_name="testserver", - tuning_option="configuration", - ).result() - - -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/TuningConfiguration_StopSession.json -if __name__ == "__main__": - main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_get_tuning_option.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_get.py similarity index 88% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_get_tuning_option.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_get.py index 189d6d9f01c6..109800ebccde 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_get_tuning_option.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_get.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python tuning_get_tuning_option.py + python tuning_options_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,13 +32,13 @@ def main(): ) response = client.tuning_options.get( - resource_group_name="testrg", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", tuning_option="index", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Tuning_GetTuningOption.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_list_tuning_options.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_by_server.py similarity index 87% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_list_tuning_options.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_by_server.py index 97e348387cf2..38a55a75db55 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_list_tuning_options.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_by_server.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python tuning_list_tuning_options.py + python tuning_options_list_by_server.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -32,13 +32,13 @@ def main(): ) response = client.tuning_options.list_by_server( - resource_group_name="testrg", - server_name="testserver", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/Tuning_ListTuningOptions.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_index_get_filtered_recommendations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_index_recommendations.py similarity index 83% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_index_get_filtered_recommendations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_index_recommendations.py index a2fc38267221..480ea0ee27e2 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_index_get_filtered_recommendations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_index_recommendations.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python tuning_index_get_filtered_recommendations.py + python tuning_options_list_index_recommendations.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,15 +31,15 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.tuning_index.list_recommendations( - resource_group_name="testrg", - server_name="pgtestrecs", + response = client.tuning_options.list_recommendations( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", tuning_option="index", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/TuningIndex_GetFilteredRecommendations.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendations.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_index_get_recommendations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_index_recommendations_filtered_for_create_index.py similarity index 81% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_index_get_recommendations.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_index_recommendations_filtered_for_create_index.py index 43d0b4414001..587cb9303c09 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_index_get_recommendations.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_index_recommendations_filtered_for_create_index.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python tuning_index_get_recommendations.py + python tuning_options_list_index_recommendations_filtered_for_create_index.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,15 +31,15 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.tuning_index.list_recommendations( - resource_group_name="testrg", - server_name="pgtestsvc4", + response = client.tuning_options.list_recommendations( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", tuning_option="index", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/TuningIndex_GetRecommendations.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListIndexRecommendationsFilteredForCreateIndex.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_table_recommendations.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_table_recommendations.py new file mode 100644 index 000000000000..667bdd7a1968 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_table_recommendations.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python tuning_options_list_table_recommendations.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.tuning_options.list_recommendations( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + tuning_option="table", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendations.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_table_recommendations_filtered_for_analyze_table.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_table_recommendations_filtered_for_analyze_table.py new file mode 100644 index 000000000000..f95ea42794b5 --- /dev/null +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/tuning_options_list_table_recommendations_filtered_for_analyze_table.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.postgresqlflexibleservers import PostgreSQLManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-postgresqlflexibleservers +# USAGE + python tuning_options_list_table_recommendations_filtered_for_analyze_table.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = PostgreSQLManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.tuning_options.list_recommendations( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + tuning_option="table", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/TuningOptionsListTableRecommendationsFilteredForAnalyzeTable.json +if __name__ == "__main__": + main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_create.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_create.py index 722a943548bb..526a5ffa5f1f 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_create.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_create.py @@ -31,15 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.virtual_endpoints.begin_create( - resource_group_name="testrg", - server_name="pgtestsvc4", - virtual_endpoint_name="pgVirtualEndpoint1", - parameters={"properties": {"endpointType": "ReadWrite", "members": ["testPrimary1"]}}, + client.virtual_endpoints.begin_create( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + virtual_endpoint_name="examplebasename", + parameters={"properties": {"endpointType": "ReadWrite", "members": ["exampleprimaryserver"]}}, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/VirtualEndpointCreate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointCreate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_delete.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_delete.py index 2502bb36f20e..e69f4873faca 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_delete.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_delete.py @@ -32,12 +32,12 @@ def main(): ) client.virtual_endpoints.begin_delete( - resource_group_name="testrg", - server_name="pgtestsvc4", - virtual_endpoint_name="pgVirtualEndpoint1", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + virtual_endpoint_name="examplebasename", ).result() -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/VirtualEndpointDelete.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointDelete.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_update.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_update.py index 47d7ee35a18b..b024ad8d50bb 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_update.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoint_update.py @@ -31,15 +31,14 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.virtual_endpoints.begin_update( - resource_group_name="testrg", - server_name="pgtestsvc4", - virtual_endpoint_name="pgVirtualEndpoint1", - parameters={"properties": {"endpointType": "ReadWrite", "members": ["testReplica1"]}}, + client.virtual_endpoints.begin_update( + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + virtual_endpoint_name="examplebasename", + parameters={"properties": {"endpointType": "ReadWrite", "members": ["exampleprimaryserver"]}}, ).result() - print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/VirtualEndpointUpdate.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointUpdate.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoints_get.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoints_get.py index 4f9990b69289..6a4b5028e06a 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoints_get.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoints_get.py @@ -32,13 +32,13 @@ def main(): ) response = client.virtual_endpoints.get( - resource_group_name="testrg", - server_name="pgtestsvc4", - virtual_endpoint_name="pgVirtualEndpoint1", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", + virtual_endpoint_name="examplebasename", ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/VirtualEndpointsGet.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsGet.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoints_list_by_server.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoints_list_by_server.py index 7e754079f03a..450a28d1a13a 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoints_list_by_server.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_endpoints_list_by_server.py @@ -32,13 +32,13 @@ def main(): ) response = client.virtual_endpoints.list_by_server( - resource_group_name="testrg", - server_name="pgtestsvc4", + resource_group_name="exampleresourcegroup", + server_name="exampleserver", ) for item in response: print(item) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/VirtualEndpointsListByServer.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualEndpointsListByServer.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_network_subnet_usage.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_network_subnet_usage_list.py similarity index 80% rename from sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_network_subnet_usage.py rename to sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_network_subnet_usage_list.py index aa691caf47cb..0bf8b3127c5b 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_network_subnet_usage.py +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/generated_samples/virtual_network_subnet_usage_list.py @@ -16,7 +16,7 @@ pip install azure-identity pip install azure-mgmt-postgresqlflexibleservers # USAGE - python virtual_network_subnet_usage.py + python virtual_network_subnet_usage_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -31,15 +31,15 @@ def main(): subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", ) - response = client.virtual_network_subnet_usage.execute( - location_name="westus", + response = client.virtual_network_subnet_usage.list( + location_name="eastus", parameters={ - "virtualNetworkArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet" + "virtualNetworkArmResourceId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/exampleresourcegroup/providers/Microsoft.Network/virtualNetworks/examplevirtualnetwork" }, ) print(response) -# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2025-01-01-preview/examples/VirtualNetworkSubnetUsage.json +# x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2025-08-01/examples/VirtualNetworkSubnetUsageList.json if __name__ == "__main__": main() diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/pyproject.toml b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/pyproject.toml index 540da07d41af..19810f1f6b18 100644 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/pyproject.toml +++ b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/pyproject.toml @@ -1,6 +1,88 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-postgresqlflexibleservers" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Postgresqlflexibleservers Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">=3.9" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "msrest>=0.7.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.postgresqlflexibleservers._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-postgresqlflexibleservers" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Postgresqlflexibleservers Management" +package_doc_id = "" +is_stable = true +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" +title = "PostgreSQLManagementClient" diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/sdk_packaging.toml b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/sdk_packaging.toml deleted file mode 100644 index 30c6442fcd25..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/sdk_packaging.toml +++ /dev/null @@ -1,12 +0,0 @@ -[packaging] -package_name = "azure-mgmt-postgresqlflexibleservers" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Postgresqlflexibleservers Management" -package_doc_id = "" -is_stable = false -is_arm = true -need_msrestazure = false -need_azuremgmtcore = true -sample_link = "" -exclude_folders = "" -title = "PostgreSQLManagementClient" diff --git a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/setup.py b/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/setup.py deleted file mode 100644 index e34745e79465..000000000000 --- a/sdk/postgresqlflexibleservers/azure-mgmt-postgresqlflexibleservers/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-postgresqlflexibleservers" -PACKAGE_PPRINT_NAME = "Postgresqlflexibleservers Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "typing-extensions>=4.6.0", - "azure-common>=1.1", - "azure-mgmt-core>=1.5.0", - ], - python_requires=">=3.9", -)