From c0003f939b975255e4f663384f6c5f14fe2dab30 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 16 Feb 2023 01:08:39 +0000 Subject: [PATCH] CodeGen from PR 22292 in Azure/azure-rest-api-specs Merge 40deb8c800b47317969bcedbeb6ace78397e1107 into d2088a7409d1ed25b8cdcadd18c6789c7504bdf2 --- sdk/sql/azure-mgmt-sql/_meta.json | 6 +- .../azure/mgmt/sql/_sql_management_client.py | 81 +- .../azure-mgmt-sql/azure/mgmt/sql/_version.py | 2 +- .../mgmt/sql/aio/_sql_management_client.py | 81 +- .../azure/mgmt/sql/aio/operations/__init__.py | 28 +- ...hort_term_retention_policies_operations.py | 8 +- .../_data_masking_policies_operations.py | 4 +- .../_data_masking_rules_operations.py | 2 +- ...d_threat_protection_settings_operations.py | 4 +- .../_database_advisors_operations.py | 2 +- .../_database_automatic_tuning_operations.py | 4 +- ...abase_blob_auditing_policies_operations.py | 4 +- ...tabase_encryption_protectors_operations.py | 332 +++++++ .../_database_extensions_operations.py | 4 +- ...database_recommended_actions_operations.py | 4 +- ...base_security_alert_policies_operations.py | 4 +- ...ability_assessment_baselines_operations.py | 4 +- ...ty_assessment_rule_baselines_operations.py | 4 +- ...ty_assessment_rule_baselines_operations.py | 4 +- ...se_vulnerability_assessments_operations.py | 3 +- .../aio/operations/_databases_operations.py | 140 +-- ...tributed_availability_groups_operations.py | 8 +- .../operations/_elastic_pools_operations.py | 7 +- .../_encryption_protectors_operations.py | 4 +- ...abase_blob_auditing_policies_operations.py | 4 +- ...erver_blob_auditing_policies_operations.py | 4 +- .../operations/_failover_groups_operations.py | 6 +- .../operations/_firewall_rules_operations.py | 4 +- .../_geo_backup_policies_operations.py | 2 +- .../_instance_failover_groups_operations.py | 4 +- .../operations/_instance_pools_operations.py | 8 +- .../_ipv6_firewall_rules_operations.py | 2 +- .../aio/operations/_job_agents_operations.py | 7 +- .../operations/_job_credentials_operations.py | 4 +- .../aio/operations/_job_steps_operations.py | 2 +- .../_job_target_groups_operations.py | 4 +- .../sql/aio/operations/_jobs_operations.py | 2 +- .../_ledger_digest_uploads_operations.py | 2 +- ..._long_term_retention_backups_operations.py | 12 +- ...long_term_retention_policies_operations.py | 4 +- .../_maintenance_windows_operations.py | 2 +- ...hort_term_retention_policies_operations.py | 8 +- ...d_threat_protection_settings_operations.py | 4 +- ...commended_sensitivity_labels_operations.py | 3 +- ...base_security_alert_policies_operations.py | 4 +- ..._database_sensitivity_labels_operations.py | 6 +- ..._transparent_data_encryption_operations.py | 4 +- ...ty_assessment_rule_baselines_operations.py | 4 +- ...se_vulnerability_assessments_operations.py | 3 +- .../_managed_databases_operations.py | 20 +- ...aged_instance_administrators_operations.py | 4 +- ...d_threat_protection_settings_operations.py | 4 +- ...zure_ad_only_authentications_operations.py | 3 +- .../_managed_instance_dtcs_operations.py | 4 +- ...stance_encryption_protectors_operations.py | 4 +- .../_managed_instance_keys_operations.py | 4 +- ...long_term_retention_policies_operations.py | 4 +- ...private_endpoint_connections_operations.py | 3 +- ...ed_instance_tde_certificates_operations.py | 4 +- ...ce_vulnerability_assessments_operations.py | 3 +- .../_managed_instances_operations.py | 570 +++++++++--- ...anaged_ledger_digest_uploads_operations.py | 627 ++++++++++++++ ...hort_term_retention_policies_operations.py | 8 +- .../_managed_server_dns_aliases_operations.py | 4 +- ...rver_security_alert_policies_operations.py | 4 +- .../_outbound_firewall_rules_operations.py | 2 +- ...private_endpoint_connections_operations.py | 2 +- ...commended_sensitivity_labels_operations.py | 3 +- .../_recoverable_databases_operations.py | 153 ++-- ...restorable_dropped_databases_operations.py | 23 +- .../operations/_restore_points_operations.py | 2 +- .../_sensitivity_labels_operations.py | 6 +- ...d_threat_protection_settings_operations.py | 4 +- .../operations/_server_advisors_operations.py | 2 +- .../_server_automatic_tuning_operations.py | 4 +- ...rver_azure_ad_administrators_operations.py | 2 +- ...zure_ad_only_authentications_operations.py | 3 +- ...erver_blob_auditing_policies_operations.py | 4 +- .../_server_communication_links_operations.py | 2 +- ...server_configuration_options_operations.py | 463 ++++++++++ .../_server_connection_policies_operations.py | 2 +- ...erver_dev_ops_audit_settings_operations.py | 4 +- .../_server_dns_aliases_operations.py | 2 +- .../aio/operations/_server_keys_operations.py | 2 +- ...rver_security_alert_policies_operations.py | 4 +- .../_server_trust_certificates_operations.py | 4 +- .../_server_trust_groups_operations.py | 4 +- ...er_vulnerability_assessments_operations.py | 3 +- .../sql/aio/operations/_servers_operations.py | 471 ++++++---- .../aio/operations/_sql_agent_operations.py | 2 +- ...ability_assessment_baselines_operations.py | 4 +- ...ity_assessment_rule_baseline_operations.py | 4 +- ...ability_assessments_settings_operations.py | 3 +- ...p_managed_instance_schedules_operations.py | 448 ++++++++++ .../aio/operations/_sync_agents_operations.py | 2 +- .../aio/operations/_sync_groups_operations.py | 4 +- .../operations/_sync_members_operations.py | 8 +- .../_tde_certificates_operations.py | 4 +- ...transparent_data_encryptions_operations.py | 411 +++++---- .../_virtual_clusters_operations.py | 4 +- .../_virtual_network_rules_operations.py | 4 +- .../_workload_classifiers_operations.py | 4 +- .../operations/_workload_groups_operations.py | 4 +- .../azure/mgmt/sql/models/__init__.py | 42 + .../azure/mgmt/sql/models/_models_py3.py | 812 ++++++++++++++++-- .../models/_sql_management_client_enums.py | 59 +- .../azure/mgmt/sql/operations/__init__.py | 28 +- ...hort_term_retention_policies_operations.py | 8 +- .../_data_masking_policies_operations.py | 4 +- .../_data_masking_rules_operations.py | 2 +- ...d_threat_protection_settings_operations.py | 4 +- .../_database_advisors_operations.py | 2 +- .../_database_automatic_tuning_operations.py | 4 +- ...abase_blob_auditing_policies_operations.py | 4 +- ...tabase_encryption_protectors_operations.py | 403 +++++++++ .../_database_extensions_operations.py | 4 +- ...database_recommended_actions_operations.py | 4 +- ...base_security_alert_policies_operations.py | 4 +- ...ability_assessment_baselines_operations.py | 4 +- ...ty_assessment_rule_baselines_operations.py | 4 +- ...ty_assessment_rule_baselines_operations.py | 4 +- ...se_vulnerability_assessments_operations.py | 3 +- .../sql/operations/_databases_operations.py | 210 +++-- ...tributed_availability_groups_operations.py | 8 +- .../operations/_elastic_pools_operations.py | 7 +- .../_encryption_protectors_operations.py | 4 +- ...abase_blob_auditing_policies_operations.py | 4 +- ...erver_blob_auditing_policies_operations.py | 4 +- .../operations/_failover_groups_operations.py | 6 +- .../operations/_firewall_rules_operations.py | 4 +- .../_geo_backup_policies_operations.py | 2 +- .../_instance_failover_groups_operations.py | 4 +- .../operations/_instance_pools_operations.py | 8 +- .../_ipv6_firewall_rules_operations.py | 2 +- .../sql/operations/_job_agents_operations.py | 7 +- .../operations/_job_credentials_operations.py | 4 +- .../sql/operations/_job_steps_operations.py | 2 +- .../_job_target_groups_operations.py | 4 +- .../mgmt/sql/operations/_jobs_operations.py | 2 +- .../_ledger_digest_uploads_operations.py | 2 +- ..._long_term_retention_backups_operations.py | 12 +- ...long_term_retention_policies_operations.py | 4 +- .../_maintenance_windows_operations.py | 2 +- ...hort_term_retention_policies_operations.py | 8 +- ...d_threat_protection_settings_operations.py | 4 +- ...commended_sensitivity_labels_operations.py | 3 +- ...base_security_alert_policies_operations.py | 4 +- ..._database_sensitivity_labels_operations.py | 6 +- ..._transparent_data_encryption_operations.py | 4 +- ...ty_assessment_rule_baselines_operations.py | 4 +- ...se_vulnerability_assessments_operations.py | 3 +- .../_managed_databases_operations.py | 20 +- ...aged_instance_administrators_operations.py | 4 +- ...d_threat_protection_settings_operations.py | 4 +- ...zure_ad_only_authentications_operations.py | 3 +- .../_managed_instance_dtcs_operations.py | 4 +- ...stance_encryption_protectors_operations.py | 4 +- .../_managed_instance_keys_operations.py | 4 +- ...long_term_retention_policies_operations.py | 4 +- ...private_endpoint_connections_operations.py | 3 +- ...ed_instance_tde_certificates_operations.py | 4 +- ...ce_vulnerability_assessments_operations.py | 3 +- .../_managed_instances_operations.py | 791 ++++++++++++----- ...anaged_ledger_digest_uploads_operations.py | 780 +++++++++++++++++ ...hort_term_retention_policies_operations.py | 8 +- .../_managed_server_dns_aliases_operations.py | 4 +- ...rver_security_alert_policies_operations.py | 4 +- .../_outbound_firewall_rules_operations.py | 2 +- ...private_endpoint_connections_operations.py | 2 +- ...commended_sensitivity_labels_operations.py | 3 +- .../_recoverable_databases_operations.py | 190 ++-- ...restorable_dropped_databases_operations.py | 44 +- .../operations/_restore_points_operations.py | 2 +- .../_sensitivity_labels_operations.py | 6 +- ...d_threat_protection_settings_operations.py | 4 +- .../operations/_server_advisors_operations.py | 2 +- .../_server_automatic_tuning_operations.py | 4 +- ...rver_azure_ad_administrators_operations.py | 2 +- ...zure_ad_only_authentications_operations.py | 3 +- ...erver_blob_auditing_policies_operations.py | 4 +- .../_server_communication_links_operations.py | 2 +- ...server_configuration_options_operations.py | 576 +++++++++++++ .../_server_connection_policies_operations.py | 2 +- ...erver_dev_ops_audit_settings_operations.py | 4 +- .../_server_dns_aliases_operations.py | 2 +- .../sql/operations/_server_keys_operations.py | 2 +- ...rver_security_alert_policies_operations.py | 4 +- .../_server_trust_certificates_operations.py | 4 +- .../_server_trust_groups_operations.py | 4 +- ...er_vulnerability_assessments_operations.py | 3 +- .../sql/operations/_servers_operations.py | 597 ++++++++----- .../sql/operations/_sql_agent_operations.py | 2 +- ...ability_assessment_baselines_operations.py | 4 +- ...ity_assessment_rule_baseline_operations.py | 4 +- ...ability_assessments_settings_operations.py | 3 +- ...p_managed_instance_schedules_operations.py | 588 +++++++++++++ .../sql/operations/_sync_agents_operations.py | 2 +- .../sql/operations/_sync_groups_operations.py | 4 +- .../operations/_sync_members_operations.py | 8 +- .../_tde_certificates_operations.py | 4 +- ...transparent_data_encryptions_operations.py | 458 ++++++---- .../_virtual_clusters_operations.py | 4 +- .../_virtual_network_rules_operations.py | 4 +- .../_workload_classifiers_operations.py | 4 +- .../operations/_workload_groups_operations.py | 4 +- ...name_availability_server_already_exists.py | 2 +- ...heck_name_availability_server_available.py | 2 +- .../check_name_availability_server_invalid.py | 2 +- ...se_configured_backup_storage_redundancy.py | 2 +- .../create_database_copy_mode.py | 2 +- .../create_database_default_enclave.py | 2 +- .../create_database_default_mode.py | 2 +- ...mode_with_keys_and_encryption_protector.py | 62 ++ .../create_database_ledger.py | 2 +- ...eate_database_maintenance_configuration.py | 2 +- .../generated_samples/create_database_min.py | 2 +- .../create_database_named_replica.py | 2 +- .../create_database_pitr_mode.py | 2 +- .../create_database_secondary_mode.py | 2 +- .../create_database_standby_mode.py | 2 +- .../create_database_vbs_enclave.py | 2 +- .../create_database_with_availability_zone.py | 52 ++ ...ate_dw_database_cross_subscription_pitr.py | 2 +- ...dw_database_cross_subscription_recovery.py | 2 +- ..._dw_database_cross_subscription_restore.py | 2 +- ...ate_vcore_database_by_service_objective.py | 2 +- ...ate_vcore_database_by_sku_name_capacity.py | 2 +- ...atabase_encryption_protector_revalidate.py | 43 + .../database_encryption_protector_revert.py | 43 + .../generated_samples/delete_database.py | 2 +- .../generated_samples/export_database.py | 2 +- .../export_database_with_network_isolation.py | 2 +- .../generated_samples/failover_database.py | 2 +- .../failover_managed_instance.py | 2 +- .../get_database_with_availability_zone.py | 42 + .../get_restorable_dropped_database.py | 2 +- ...ropped_database_with_expand_equals_keys.py | 42 + .../generated_samples/get_vcore_database.py | 2 +- .../get_vcore_database_default_enclave.py | 2 +- .../get_vcore_database_vbs_enclave.py | 2 +- ..._vcore_database_with_expand_equals_keys.py | 42 + .../generated_samples/import_database.py | 2 +- .../import_database_with_network_isolation.py | 2 +- .../generated_samples/import_new_database.py | 2 +- ...ort_new_database_with_network_isolation.py | 2 +- .../list_databases_by_elastic_pool.py | 2 +- ...etwork_dependencies_by_managed_instance.py | 42 + ..._restorable_dropped_databases_by_server.py | 2 +- .../list_vcore_databases_by_server.py | 2 +- ..._vcore_databases_enclave_type_by_server.py | 2 +- ..._vcore_inaccessible_databases_by_server.py | 2 +- .../managed_instance_create_max.py | 2 +- .../managed_instance_create_min.py | 2 +- .../managed_instance_delete.py | 2 +- .../generated_samples/managed_instance_get.py | 2 +- ...e_get_with_expand_equals_administrators.py | 2 +- .../managed_instance_list.py | 2 +- .../managed_instance_list_by_instance_pool.py | 2 +- ..._pool_with_expand_equals_administrators.py | 2 +- ...managed_instance_list_by_resource_group.py | 2 +- ...group_with_expand_equals_administrators.py | 2 +- ..._list_with_expand_equals_administrators.py | 2 +- ...stance_remove_maintenance_configuration.py | 2 +- .../managed_instance_top_queries_list.py | 2 +- .../managed_instance_top_queries_list_max.py | 2 +- .../managed_instance_top_queries_list_min.py | 2 +- .../managed_instance_update_max.py | 2 +- .../managed_instance_update_min.py | 2 +- .../managed_ledger_digest_uploads_disable.py | 43 + .../managed_ledger_digest_uploads_enable.py | 44 + .../managed_ledger_digest_uploads_get.py | 43 + .../managed_ledger_digest_uploads_list.py | 43 + .../patch_database_default_enclave.py | 2 +- .../patch_database_vbs_enclave.py | 2 +- .../generated_samples/patch_vcore_database.py | 2 +- ...tabase_assign_maintenance_configuration.py | 2 +- ...atabase_reset_maintenance_configuration.py | 2 +- ...base_with_keys_and_encryption_protector.py | 59 ++ .../generated_samples/pause_database.py | 2 +- .../recoverable_database_get.py | 2 +- ...le_database_get_with_expand_equals_keys.py | 42 + .../recoverable_database_list.py | 2 +- .../refresh_external_governance_status.py | 41 + .../generated_samples/rename_database.py | 2 +- .../generated_samples/resume_database.py | 2 +- .../server_configuration_option_get.py | 42 + .../server_configuration_option_list.py | 42 + .../server_configuration_option_update.py | 43 + .../generated_samples/server_create.py | 2 +- .../generated_samples/server_delete.py | 2 +- .../generated_samples/server_get.py | 2 +- ...r_get_with_expand_equals_administrators.py | 2 +- .../generated_samples/server_list.py | 2 +- .../server_list_by_resource_group.py | 2 +- ...group_with_expand_equals_administrators.py | 2 +- ..._list_with_expand_equals_administrators.py | 2 +- .../generated_samples/server_update.py | 2 +- .../start_managed_instance.py | 41 + ..._instance_schedule_create_or_update_max.py | 52 ++ ..._instance_schedule_create_or_update_min.py | 50 ++ ...t_stop_managed_instance_schedule_delete.py | 42 + ...tart_stop_managed_instance_schedule_get.py | 42 + ...art_stop_managed_instance_schedule_list.py | 42 + .../stop_managed_instance.py | 41 + .../transparent_data_encryption_get.py | 2 +- .../transparent_data_encryption_list.py | 2 +- .../transparent_data_encryption_update.py | 6 +- ...se_hyperscale_migration_perform_cutover.py | 53 ++ ...yperscale_migration_with_manual_cutover.py | 54 ++ .../upgrade_data_warehouse.py | 2 +- 310 files changed, 9610 insertions(+), 1919 deletions(-) create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_encryption_protectors_operations.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_ledger_digest_uploads_operations.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_configuration_options_operations.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_start_stop_managed_instance_schedules_operations.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_encryption_protectors_operations.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_ledger_digest_uploads_operations.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_configuration_options_operations.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_start_stop_managed_instance_schedules_operations.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_mode_with_keys_and_encryption_protector.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/create_database_with_availability_zone.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/database_encryption_protector_revalidate.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/database_encryption_protector_revert.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/get_database_with_availability_zone.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/get_restorable_dropped_database_with_expand_equals_keys.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_with_expand_equals_keys.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/list_outbound_network_dependencies_by_managed_instance.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_disable.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_enable.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_get.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_list.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_with_keys_and_encryption_protector.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_get_with_expand_equals_keys.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/refresh_external_governance_status.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_get.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_list.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_update.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/start_managed_instance.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_create_or_update_max.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_create_or_update_min.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_delete.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_get.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_list.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/stop_managed_instance.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/update_database_hyperscale_migration_perform_cutover.py create mode 100644 sdk/sql/azure-mgmt-sql/generated_samples/update_database_hyperscale_migration_with_manual_cutover.py diff --git a/sdk/sql/azure-mgmt-sql/_meta.json b/sdk/sql/azure-mgmt-sql/_meta.json index edbee1d22b4b..1d69da7385b9 100644 --- a/sdk/sql/azure-mgmt-sql/_meta.json +++ b/sdk/sql/azure-mgmt-sql/_meta.json @@ -1,11 +1,11 @@ { - "commit": "78ec1b99699a4bf44869bd13f1b0ed7d92a99c27", + "commit": "e7669dfc1c01498d9328a8f9817af4e68153dc69", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.16", + "@autorest/python@6.4.0", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/sql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/sql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/sql/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py index d06e503abe01..58a7c5802ded 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_sql_management_client.py @@ -26,6 +26,7 @@ DatabaseAutomaticTuningOperations, DatabaseBlobAuditingPoliciesOperations, DatabaseColumnsOperations, + DatabaseEncryptionProtectorsOperations, DatabaseExtensionsOperations, DatabaseOperationsOperations, DatabaseRecommendedActionsOperations, @@ -104,6 +105,7 @@ ManagedInstanceTdeCertificatesOperations, ManagedInstanceVulnerabilityAssessmentsOperations, ManagedInstancesOperations, + ManagedLedgerDigestUploadsOperations, ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations, ManagedServerDnsAliasesOperations, ManagedServerSecurityAlertPoliciesOperations, @@ -126,6 +128,7 @@ ServerAzureADOnlyAuthenticationsOperations, ServerBlobAuditingPoliciesOperations, ServerCommunicationLinksOperations, + ServerConfigurationOptionsOperations, ServerConnectionPoliciesOperations, ServerDevOpsAuditSettingsOperations, ServerDnsAliasesOperations, @@ -148,6 +151,7 @@ SqlVulnerabilityAssessmentScansOperations, SqlVulnerabilityAssessmentsOperations, SqlVulnerabilityAssessmentsSettingsOperations, + StartStopManagedInstanceSchedulesOperations, SubscriptionUsagesOperations, SynapseLinkWorkspacesOperations, SyncAgentsOperations, @@ -173,8 +177,6 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. - :ivar recoverable_databases: RecoverableDatabasesOperations operations - :vartype recoverable_databases: azure.mgmt.sql.operations.RecoverableDatabasesOperations :ivar data_masking_policies: DataMaskingPoliciesOperations operations :vartype data_masking_policies: azure.mgmt.sql.operations.DataMaskingPoliciesOperations :ivar data_masking_rules: DataMaskingRulesOperations operations @@ -405,9 +407,6 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword :vartype workload_classifiers: azure.mgmt.sql.operations.WorkloadClassifiersOperations :ivar workload_groups: WorkloadGroupsOperations operations :vartype workload_groups: azure.mgmt.sql.operations.WorkloadGroupsOperations - :ivar transparent_data_encryptions: TransparentDataEncryptionsOperations operations - :vartype transparent_data_encryptions: - azure.mgmt.sql.operations.TransparentDataEncryptionsOperations :ivar backup_short_term_retention_policies: BackupShortTermRetentionPoliciesOperations operations :vartype backup_short_term_retention_policies: @@ -422,8 +421,6 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword :vartype ledger_digest_uploads: azure.mgmt.sql.operations.LedgerDigestUploadsOperations :ivar outbound_firewall_rules: OutboundFirewallRulesOperations operations :vartype outbound_firewall_rules: azure.mgmt.sql.operations.OutboundFirewallRulesOperations - :ivar servers: ServersOperations operations - :vartype servers: azure.mgmt.sql.operations.ServersOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.sql.operations.UsagesOperations :ivar long_term_retention_backups: LongTermRetentionBackupsOperations operations @@ -433,11 +430,6 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword LongTermRetentionManagedInstanceBackupsOperations operations :vartype long_term_retention_managed_instance_backups: azure.mgmt.sql.operations.LongTermRetentionManagedInstanceBackupsOperations - :ivar managed_instances: ManagedInstancesOperations operations - :vartype managed_instances: azure.mgmt.sql.operations.ManagedInstancesOperations - :ivar restorable_dropped_databases: RestorableDroppedDatabasesOperations operations - :vartype restorable_dropped_databases: - azure.mgmt.sql.operations.RestorableDroppedDatabasesOperations :ivar restorable_dropped_managed_databases: RestorableDroppedManagedDatabasesOperations operations :vartype restorable_dropped_managed_databases: @@ -576,6 +568,31 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword azure.mgmt.sql.operations.ManagedDatabaseRestoreDetailsOperations :ivar managed_databases: ManagedDatabasesOperations operations :vartype managed_databases: azure.mgmt.sql.operations.ManagedDatabasesOperations + :ivar database_encryption_protectors: DatabaseEncryptionProtectorsOperations operations + :vartype database_encryption_protectors: + azure.mgmt.sql.operations.DatabaseEncryptionProtectorsOperations + :ivar managed_instances: ManagedInstancesOperations operations + :vartype managed_instances: azure.mgmt.sql.operations.ManagedInstancesOperations + :ivar managed_ledger_digest_uploads: ManagedLedgerDigestUploadsOperations operations + :vartype managed_ledger_digest_uploads: + azure.mgmt.sql.operations.ManagedLedgerDigestUploadsOperations + :ivar recoverable_databases: RecoverableDatabasesOperations operations + :vartype recoverable_databases: azure.mgmt.sql.operations.RecoverableDatabasesOperations + :ivar restorable_dropped_databases: RestorableDroppedDatabasesOperations operations + :vartype restorable_dropped_databases: + azure.mgmt.sql.operations.RestorableDroppedDatabasesOperations + :ivar server_configuration_options: ServerConfigurationOptionsOperations operations + :vartype server_configuration_options: + azure.mgmt.sql.operations.ServerConfigurationOptionsOperations + :ivar servers: ServersOperations operations + :vartype servers: azure.mgmt.sql.operations.ServersOperations + :ivar start_stop_managed_instance_schedules: StartStopManagedInstanceSchedulesOperations + operations + :vartype start_stop_managed_instance_schedules: + azure.mgmt.sql.operations.StartStopManagedInstanceSchedulesOperations + :ivar transparent_data_encryptions: TransparentDataEncryptionsOperations operations + :vartype transparent_data_encryptions: + azure.mgmt.sql.operations.TransparentDataEncryptionsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID that identifies an Azure subscription. Required. @@ -602,9 +619,6 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.recoverable_databases = RecoverableDatabasesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.data_masking_policies = DataMaskingPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -826,9 +840,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.workload_groups = WorkloadGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.transparent_data_encryptions = TransparentDataEncryptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.backup_short_term_retention_policies = BackupShortTermRetentionPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -845,7 +856,6 @@ def __init__( self.outbound_firewall_rules = OutboundFirewallRulesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.long_term_retention_backups = LongTermRetentionBackupsOperations( self._client, self._config, self._serialize, self._deserialize @@ -853,12 +863,6 @@ def __init__( self.long_term_retention_managed_instance_backups = LongTermRetentionManagedInstanceBackupsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_instances = ManagedInstancesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.restorable_dropped_managed_databases = RestorableDroppedManagedDatabasesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -993,6 +997,31 @@ def __init__( self.managed_databases = ManagedDatabasesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.database_encryption_protectors = DatabaseEncryptionProtectorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_instances = ManagedInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_ledger_digest_uploads = ManagedLedgerDigestUploadsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.recoverable_databases = RecoverableDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.server_configuration_options = ServerConfigurationOptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.start_stop_managed_instance_schedules = StartStopManagedInstanceSchedulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.transparent_data_encryptions = TransparentDataEncryptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -1023,5 +1052,5 @@ def __enter__(self) -> "SqlManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_version.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_version.py index 1aaefa4d8bd7..c78e629b6f08 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_version.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0b7" +VERSION = "0.9.0" diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/_sql_management_client.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/_sql_management_client.py index 0357cb116c3c..4a40410591cd 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/_sql_management_client.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/_sql_management_client.py @@ -26,6 +26,7 @@ DatabaseAutomaticTuningOperations, DatabaseBlobAuditingPoliciesOperations, DatabaseColumnsOperations, + DatabaseEncryptionProtectorsOperations, DatabaseExtensionsOperations, DatabaseOperationsOperations, DatabaseRecommendedActionsOperations, @@ -104,6 +105,7 @@ ManagedInstanceTdeCertificatesOperations, ManagedInstanceVulnerabilityAssessmentsOperations, ManagedInstancesOperations, + ManagedLedgerDigestUploadsOperations, ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations, ManagedServerDnsAliasesOperations, ManagedServerSecurityAlertPoliciesOperations, @@ -126,6 +128,7 @@ ServerAzureADOnlyAuthenticationsOperations, ServerBlobAuditingPoliciesOperations, ServerCommunicationLinksOperations, + ServerConfigurationOptionsOperations, ServerConnectionPoliciesOperations, ServerDevOpsAuditSettingsOperations, ServerDnsAliasesOperations, @@ -148,6 +151,7 @@ SqlVulnerabilityAssessmentScansOperations, SqlVulnerabilityAssessmentsOperations, SqlVulnerabilityAssessmentsSettingsOperations, + StartStopManagedInstanceSchedulesOperations, SubscriptionUsagesOperations, SynapseLinkWorkspacesOperations, SyncAgentsOperations, @@ -173,8 +177,6 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases. - :ivar recoverable_databases: RecoverableDatabasesOperations operations - :vartype recoverable_databases: azure.mgmt.sql.aio.operations.RecoverableDatabasesOperations :ivar data_masking_policies: DataMaskingPoliciesOperations operations :vartype data_masking_policies: azure.mgmt.sql.aio.operations.DataMaskingPoliciesOperations :ivar data_masking_rules: DataMaskingRulesOperations operations @@ -409,9 +411,6 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword :vartype workload_classifiers: azure.mgmt.sql.aio.operations.WorkloadClassifiersOperations :ivar workload_groups: WorkloadGroupsOperations operations :vartype workload_groups: azure.mgmt.sql.aio.operations.WorkloadGroupsOperations - :ivar transparent_data_encryptions: TransparentDataEncryptionsOperations operations - :vartype transparent_data_encryptions: - azure.mgmt.sql.aio.operations.TransparentDataEncryptionsOperations :ivar backup_short_term_retention_policies: BackupShortTermRetentionPoliciesOperations operations :vartype backup_short_term_retention_policies: @@ -426,8 +425,6 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword :vartype ledger_digest_uploads: azure.mgmt.sql.aio.operations.LedgerDigestUploadsOperations :ivar outbound_firewall_rules: OutboundFirewallRulesOperations operations :vartype outbound_firewall_rules: azure.mgmt.sql.aio.operations.OutboundFirewallRulesOperations - :ivar servers: ServersOperations operations - :vartype servers: azure.mgmt.sql.aio.operations.ServersOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.sql.aio.operations.UsagesOperations :ivar long_term_retention_backups: LongTermRetentionBackupsOperations operations @@ -437,11 +434,6 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword LongTermRetentionManagedInstanceBackupsOperations operations :vartype long_term_retention_managed_instance_backups: azure.mgmt.sql.aio.operations.LongTermRetentionManagedInstanceBackupsOperations - :ivar managed_instances: ManagedInstancesOperations operations - :vartype managed_instances: azure.mgmt.sql.aio.operations.ManagedInstancesOperations - :ivar restorable_dropped_databases: RestorableDroppedDatabasesOperations operations - :vartype restorable_dropped_databases: - azure.mgmt.sql.aio.operations.RestorableDroppedDatabasesOperations :ivar restorable_dropped_managed_databases: RestorableDroppedManagedDatabasesOperations operations :vartype restorable_dropped_managed_databases: @@ -582,6 +574,31 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword azure.mgmt.sql.aio.operations.ManagedDatabaseRestoreDetailsOperations :ivar managed_databases: ManagedDatabasesOperations operations :vartype managed_databases: azure.mgmt.sql.aio.operations.ManagedDatabasesOperations + :ivar database_encryption_protectors: DatabaseEncryptionProtectorsOperations operations + :vartype database_encryption_protectors: + azure.mgmt.sql.aio.operations.DatabaseEncryptionProtectorsOperations + :ivar managed_instances: ManagedInstancesOperations operations + :vartype managed_instances: azure.mgmt.sql.aio.operations.ManagedInstancesOperations + :ivar managed_ledger_digest_uploads: ManagedLedgerDigestUploadsOperations operations + :vartype managed_ledger_digest_uploads: + azure.mgmt.sql.aio.operations.ManagedLedgerDigestUploadsOperations + :ivar recoverable_databases: RecoverableDatabasesOperations operations + :vartype recoverable_databases: azure.mgmt.sql.aio.operations.RecoverableDatabasesOperations + :ivar restorable_dropped_databases: RestorableDroppedDatabasesOperations operations + :vartype restorable_dropped_databases: + azure.mgmt.sql.aio.operations.RestorableDroppedDatabasesOperations + :ivar server_configuration_options: ServerConfigurationOptionsOperations operations + :vartype server_configuration_options: + azure.mgmt.sql.aio.operations.ServerConfigurationOptionsOperations + :ivar servers: ServersOperations operations + :vartype servers: azure.mgmt.sql.aio.operations.ServersOperations + :ivar start_stop_managed_instance_schedules: StartStopManagedInstanceSchedulesOperations + operations + :vartype start_stop_managed_instance_schedules: + azure.mgmt.sql.aio.operations.StartStopManagedInstanceSchedulesOperations + :ivar transparent_data_encryptions: TransparentDataEncryptionsOperations operations + :vartype transparent_data_encryptions: + azure.mgmt.sql.aio.operations.TransparentDataEncryptionsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID that identifies an Azure subscription. Required. @@ -608,9 +625,6 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.recoverable_databases = RecoverableDatabasesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.data_masking_policies = DataMaskingPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -832,9 +846,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.workload_groups = WorkloadGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.transparent_data_encryptions = TransparentDataEncryptionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.backup_short_term_retention_policies = BackupShortTermRetentionPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -851,7 +862,6 @@ def __init__( self.outbound_firewall_rules = OutboundFirewallRulesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.long_term_retention_backups = LongTermRetentionBackupsOperations( self._client, self._config, self._serialize, self._deserialize @@ -859,12 +869,6 @@ def __init__( self.long_term_retention_managed_instance_backups = LongTermRetentionManagedInstanceBackupsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_instances = ManagedInstancesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.restorable_dropped_managed_databases = RestorableDroppedManagedDatabasesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -999,6 +1003,31 @@ def __init__( self.managed_databases = ManagedDatabasesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.database_encryption_protectors = DatabaseEncryptionProtectorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_instances = ManagedInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_ledger_digest_uploads = ManagedLedgerDigestUploadsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.recoverable_databases = RecoverableDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.restorable_dropped_databases = RestorableDroppedDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.server_configuration_options = ServerConfigurationOptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.servers = ServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.start_stop_managed_instance_schedules = StartStopManagedInstanceSchedulesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.transparent_data_encryptions = TransparentDataEncryptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -1029,5 +1058,5 @@ async def __aenter__(self) -> "SqlManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/__init__.py index f4c14a4eade9..93aefa270e1a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/__init__.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._recoverable_databases_operations import RecoverableDatabasesOperations from ._data_masking_policies_operations import DataMaskingPoliciesOperations from ._data_masking_rules_operations import DataMaskingRulesOperations from ._geo_backup_policies_operations import GeoBackupPoliciesOperations @@ -110,19 +109,15 @@ from ._virtual_network_rules_operations import VirtualNetworkRulesOperations from ._workload_classifiers_operations import WorkloadClassifiersOperations from ._workload_groups_operations import WorkloadGroupsOperations -from ._transparent_data_encryptions_operations import TransparentDataEncryptionsOperations from ._backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations from ._database_extensions_operations import DatabaseExtensionsOperations from ._database_operations_operations import DatabaseOperationsOperations from ._database_usages_operations import DatabaseUsagesOperations from ._ledger_digest_uploads_operations import LedgerDigestUploadsOperations from ._outbound_firewall_rules_operations import OutboundFirewallRulesOperations -from ._servers_operations import ServersOperations from ._usages_operations import UsagesOperations from ._long_term_retention_backups_operations import LongTermRetentionBackupsOperations from ._long_term_retention_managed_instance_backups_operations import LongTermRetentionManagedInstanceBackupsOperations -from ._managed_instances_operations import ManagedInstancesOperations -from ._restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from ._restorable_dropped_managed_databases_operations import RestorableDroppedManagedDatabasesOperations from ._server_connection_policies_operations import ServerConnectionPoliciesOperations from ._distributed_availability_groups_operations import DistributedAvailabilityGroupsOperations @@ -181,13 +176,21 @@ from ._instance_failover_groups_operations import InstanceFailoverGroupsOperations from ._managed_database_restore_details_operations import ManagedDatabaseRestoreDetailsOperations from ._managed_databases_operations import ManagedDatabasesOperations +from ._database_encryption_protectors_operations import DatabaseEncryptionProtectorsOperations +from ._managed_instances_operations import ManagedInstancesOperations +from ._managed_ledger_digest_uploads_operations import ManagedLedgerDigestUploadsOperations +from ._recoverable_databases_operations import RecoverableDatabasesOperations +from ._restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations +from ._server_configuration_options_operations import ServerConfigurationOptionsOperations +from ._servers_operations import ServersOperations +from ._start_stop_managed_instance_schedules_operations import StartStopManagedInstanceSchedulesOperations +from ._transparent_data_encryptions_operations import TransparentDataEncryptionsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "RecoverableDatabasesOperations", "DataMaskingPoliciesOperations", "DataMaskingRulesOperations", "GeoBackupPoliciesOperations", @@ -277,19 +280,15 @@ "VirtualNetworkRulesOperations", "WorkloadClassifiersOperations", "WorkloadGroupsOperations", - "TransparentDataEncryptionsOperations", "BackupShortTermRetentionPoliciesOperations", "DatabaseExtensionsOperations", "DatabaseOperationsOperations", "DatabaseUsagesOperations", "LedgerDigestUploadsOperations", "OutboundFirewallRulesOperations", - "ServersOperations", "UsagesOperations", "LongTermRetentionBackupsOperations", "LongTermRetentionManagedInstanceBackupsOperations", - "ManagedInstancesOperations", - "RestorableDroppedDatabasesOperations", "RestorableDroppedManagedDatabasesOperations", "ServerConnectionPoliciesOperations", "DistributedAvailabilityGroupsOperations", @@ -332,6 +331,15 @@ "InstanceFailoverGroupsOperations", "ManagedDatabaseRestoreDetailsOperations", "ManagedDatabasesOperations", + "DatabaseEncryptionProtectorsOperations", + "ManagedInstancesOperations", + "ManagedLedgerDigestUploadsOperations", + "RecoverableDatabasesOperations", + "RestorableDroppedDatabasesOperations", + "ServerConfigurationOptionsOperations", + "ServersOperations", + "StartStopManagedInstanceSchedulesOperations", + "TransparentDataEncryptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_backup_short_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_backup_short_term_retention_policies_operations.py index 84c7536e6327..c2594b3b5cdf 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_backup_short_term_retention_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_backup_short_term_retention_policies_operations.py @@ -321,8 +321,8 @@ async def begin_create_or_update( :type database_name: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + BackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.BackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -574,8 +574,8 @@ async def begin_update( :type database_name: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + BackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.BackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_data_masking_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_data_masking_policies_operations.py index 794f0634584f..5e462d18ae1e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_data_masking_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_data_masking_policies_operations.py @@ -143,8 +143,8 @@ async def create_or_update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Parameters for creating or updating a data masking policy. Is either a model - type or a IO type. Required. + :param parameters: Parameters for creating or updating a data masking policy. Is either a + DataMaskingPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DataMaskingPolicy or IO :keyword data_masking_policy_name: The name of the database for which the data masking rule applies. Default value is "Default". Note that overriding this default value may result in diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_data_masking_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_data_masking_rules_operations.py index c760c8c07dee..50cf3081d0aa 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_data_masking_rules_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_data_masking_rules_operations.py @@ -157,7 +157,7 @@ async def create_or_update( :param data_masking_rule_name: The name of the data masking rule. Required. :type data_masking_rule_name: str :param parameters: The required parameters for creating or updating a data masking rule. Is - either a model type or a IO type. Required. + either a DataMaskingRule type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DataMaskingRule or IO :keyword data_masking_policy_name: The name of the database for which the data masking rule applies. Default value is "Default". Note that overriding this default value may result in diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_advanced_threat_protection_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_advanced_threat_protection_settings_operations.py index 19ff93a116e3..673ae7e7b5b2 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_advanced_threat_protection_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_advanced_threat_protection_settings_operations.py @@ -320,8 +320,8 @@ async def create_or_update( "Default" Required. :type advanced_threat_protection_name: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionName - :param parameters: The database Advanced Threat Protection state. Is either a model type or a - IO type. Required. + :param parameters: The database Advanced Threat Protection state. Is either a + DatabaseAdvancedThreatProtection type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseAdvancedThreatProtection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_advisors_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_advisors_operations.py index d50a1e2bdaca..c73e1557a288 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_advisors_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_advisors_operations.py @@ -295,7 +295,7 @@ async def update( :type database_name: str :param advisor_name: The name of the Database Advisor. Required. :type advisor_name: str - :param parameters: The requested advisor resource state. Is either a model type or a IO type. + :param parameters: The requested advisor resource state. Is either a Advisor type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.Advisor or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_automatic_tuning_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_automatic_tuning_operations.py index 85f86315a1d6..8018463fedfd 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_automatic_tuning_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_automatic_tuning_operations.py @@ -203,8 +203,8 @@ async def update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The requested automatic tuning resource state. Is either a model type or a - IO type. Required. + :param parameters: The requested automatic tuning resource state. Is either a + DatabaseAutomaticTuning type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseAutomaticTuning or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_blob_auditing_policies_operations.py index 80b4a994d2be..fbcf9c3a4cba 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_blob_auditing_policies_operations.py @@ -306,8 +306,8 @@ async def create_or_update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The database blob auditing policy. Is either a model type or a IO type. - Required. + :param parameters: The database blob auditing policy. Is either a DatabaseBlobAuditingPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseBlobAuditingPolicy or IO :keyword blob_auditing_policy_name: The name of the blob auditing policy. Default value is "default". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_encryption_protectors_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_encryption_protectors_operations.py new file mode 100644 index 000000000000..357bb7f51ce3 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_encryption_protectors_operations.py @@ -0,0 +1,332 @@ +# pylint: disable=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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import 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 ..._vendor import _convert_request +from ...operations._database_encryption_protectors_operations import build_revalidate_request, build_revert_request + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DatabaseEncryptionProtectorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.aio.SqlManagementClient`'s + :attr:`database_encryption_protectors` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _revalidate_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + server_name: str, + database_name: str, + encryption_protector_name: Union[str, _models.EncryptionProtectorName], + **kwargs: Any + ) -> None: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_revalidate_request( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + encryption_protector_name=encryption_protector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._revalidate_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _revalidate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revalidate" + } + + @distributed_trace_async + async def begin_revalidate( + self, + resource_group_name: str, + server_name: str, + database_name: str, + encryption_protector_name: Union[str, _models.EncryptionProtectorName], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Revalidates an existing encryption protector for a particular database. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. 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. + :type database_name: str + :param encryption_protector_name: The name of the encryption protector to be updated. "current" + Required. + :type encryption_protector_name: str or ~azure.mgmt.sql.models.EncryptionProtectorName + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + 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._revalidate_initial( # type: ignore + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + encryption_protector_name=encryption_protector_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_revalidate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revalidate" + } + + async def _revert_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + server_name: str, + database_name: str, + encryption_protector_name: Union[str, _models.EncryptionProtectorName], + **kwargs: Any + ) -> None: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_revert_request( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + encryption_protector_name=encryption_protector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._revert_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _revert_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revert" + } + + @distributed_trace_async + async def begin_revert( + self, + resource_group_name: str, + server_name: str, + database_name: str, + encryption_protector_name: Union[str, _models.EncryptionProtectorName], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reverts an existing encryption protector for a particular database. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. 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. + :type database_name: str + :param encryption_protector_name: The name of the encryption protector to be updated. "current" + Required. + :type encryption_protector_name: str or ~azure.mgmt.sql.models.EncryptionProtectorName + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + 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._revert_initial( # type: ignore + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + encryption_protector_name=encryption_protector_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revert" + } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_extensions_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_extensions_operations.py index 4dcadbb5eb61..c42c21f98ca5 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_extensions_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_extensions_operations.py @@ -311,8 +311,8 @@ async def begin_create_or_update( :type database_name: str :param extension_name: Required. :type extension_name: str - :param parameters: The database import request parameters. Is either a model type or a IO type. - Required. + :param parameters: The database import request parameters. Is either a DatabaseExtensions type + or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseExtensions or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_recommended_actions_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_recommended_actions_operations.py index e6b06562b1b1..907c888f875c 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_recommended_actions_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_recommended_actions_operations.py @@ -308,8 +308,8 @@ async def update( :type advisor_name: str :param recommended_action_name: The name of Database Recommended Action. Required. :type recommended_action_name: str - :param parameters: The requested recommended action resource state. Is either a model type or a - IO type. Required. + :param parameters: The requested recommended action resource state. Is either a + RecommendedAction type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.RecommendedAction or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_security_alert_policies_operations.py index 76d77c1f4ae4..b9da96d67965 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_security_alert_policies_operations.py @@ -230,8 +230,8 @@ async def create_or_update( :type database_name: str :param security_alert_policy_name: The name of the security alert policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName - :param parameters: The database security alert policy. Is either a model type or a IO type. - Required. + :param parameters: The database security alert policy. Is either a DatabaseSecurityAlertPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseSecurityAlertPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_sql_vulnerability_assessment_baselines_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_sql_vulnerability_assessment_baselines_operations.py index 60f64db0bd1a..11e5dedb9666 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_sql_vulnerability_assessment_baselines_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_sql_vulnerability_assessment_baselines_operations.py @@ -341,8 +341,8 @@ async def create_or_update( :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName :param baseline_name: "default" Required. :type baseline_name: str or ~azure.mgmt.sql.models.BaselineName - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_sql_vulnerability_assessment_rule_baselines_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_sql_vulnerability_assessment_rule_baselines_operations.py index 9eef3f965243..3bd7b09e62be 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_sql_vulnerability_assessment_rule_baselines_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_sql_vulnerability_assessment_rule_baselines_operations.py @@ -358,8 +358,8 @@ async def create_or_update( :type baseline_name: str or ~azure.mgmt.sql.models.BaselineName :param rule_id: The vulnerability assessment rule ID. Required. :type rule_id: str - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_vulnerability_assessment_rule_baselines_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_vulnerability_assessment_rule_baselines_operations.py index 89adc592ca6a..60bc365f599a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_vulnerability_assessment_rule_baselines_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_vulnerability_assessment_rule_baselines_operations.py @@ -266,8 +266,8 @@ async def create_or_update( baseline on a database level rule and master for server level rule). Known values are: "master" and "default". Required. :type baseline_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseVulnerabilityAssessmentRuleBaseline type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaseline or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_vulnerability_assessments_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_vulnerability_assessments_operations.py index f317a7c33e2c..98ac081b42f9 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_vulnerability_assessments_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_database_vulnerability_assessments_operations.py @@ -235,7 +235,8 @@ async def create_or_update( :param vulnerability_assessment_name: The name of the vulnerability assessment. "default" Required. :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName - :param parameters: The requested resource. Is either a model type or a IO type. Required. + :param parameters: The requested resource. Is either a DatabaseVulnerabilityAssessment type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_databases_operations.py index e499327871f2..cc2fc3e9c19d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_databases_operations.py @@ -265,8 +265,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) @@ -330,7 +330,13 @@ async def get_next(next_link=None): @distributed_trace_async async def get( - self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any + self, + resource_group_name: str, + server_name: str, + database_name: str, + expand: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any ) -> _models.Database: """Gets a database. @@ -341,6 +347,11 @@ async def get( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str + :param expand: The child resources to include in the response. Default value is None. + :type expand: str + :param filter: An OData filter expression that filters elements in the collection. Default + value is None. + :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Database or the result of cls(response) :rtype: ~azure.mgmt.sql.models.Database @@ -357,8 +368,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.Database] = kwargs.pop("cls", None) @@ -367,6 +378,8 @@ async def get( server_name=server_name, database_name=database_name, subscription_id=self._config.subscription_id, + expand=expand, + filter=filter, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -415,8 +428,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) @@ -567,8 +580,8 @@ async def begin_create_or_update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The requested database resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested database resource state. Is either a Database type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.Database or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -589,8 +602,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Database] = kwargs.pop("cls", None) @@ -619,7 +632,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -651,8 +667,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -714,8 +730,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -739,7 +755,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -776,8 +794,8 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) @@ -925,8 +943,8 @@ async def begin_update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The requested database resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested database resource state. Is either a DatabaseUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -947,8 +965,8 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Database] = kwargs.pop("cls", None) @@ -977,7 +995,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -1014,8 +1034,8 @@ async def _export_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ImportExportOperationResult]] = kwargs.pop("cls", None) @@ -1163,8 +1183,8 @@ async def begin_export( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The database export request parameters. Is either a model type or a IO type. - Required. + :param parameters: The database export request parameters. Is either a ExportDatabaseDefinition + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ExportDatabaseDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1185,8 +1205,8 @@ async def begin_export( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ImportExportOperationResult] = kwargs.pop("cls", None) @@ -1252,8 +1272,8 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1324,8 +1344,8 @@ async def begin_failover( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1387,8 +1407,8 @@ async def _import_method_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ImportExportOperationResult]] = kwargs.pop("cls", None) @@ -1536,8 +1556,8 @@ async def begin_import_method( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The database import request parameters. Is either a model type or a IO type. - Required. + :param parameters: The database import request parameters. Is either a + ImportExistingDatabaseDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ImportExistingDatabaseDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1558,8 +1578,8 @@ async def begin_import_method( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ImportExportOperationResult] = kwargs.pop("cls", None) @@ -1686,8 +1706,8 @@ async def rename( # pylint: disable=inconsistent-return-statements :type server_name: str :param database_name: The name of the database to rename. Required. :type database_name: str - :param parameters: The resource move definition for renaming this database. Is either a model - type or a IO type. Required. + :param parameters: The resource move definition for renaming this database. Is either a + ResourceMoveDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ResourceMoveDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1708,8 +1728,8 @@ async def rename( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1769,8 +1789,8 @@ async def _pause_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) @@ -1839,8 +1859,8 @@ async def begin_pause( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.Database] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1898,8 +1918,8 @@ async def _resume_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) @@ -1968,8 +1988,8 @@ async def begin_resume( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.Database] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -2027,8 +2047,8 @@ async def _upgrade_data_warehouse_initial( # pylint: disable=inconsistent-retur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2090,8 +2110,8 @@ async def begin_upgrade_data_warehouse( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -2154,8 +2174,8 @@ def list_by_elastic_pool( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) @@ -2236,8 +2256,8 @@ def list_inaccessible_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py index 37fadfa572c8..0064fc1db2b4 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py @@ -391,8 +391,8 @@ async def begin_create_or_update( :type managed_instance_name: str :param distributed_availability_group_name: The distributed availability group name. Required. :type distributed_availability_group_name: str - :param parameters: The distributed availability group info. Is either a model type or a IO - type. Required. + :param parameters: The distributed availability group info. Is either a + DistributedAvailabilityGroup type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -757,8 +757,8 @@ async def begin_update( :type managed_instance_name: str :param distributed_availability_group_name: The distributed availability group name. Required. :type distributed_availability_group_name: str - :param parameters: The distributed availability group info. Is either a model type or a IO - type. Required. + :param parameters: The distributed availability group info. Is either a + DistributedAvailabilityGroup type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_elastic_pools_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_elastic_pools_operations.py index 69d3e8512e43..4c087013d7e4 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_elastic_pools_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_elastic_pools_operations.py @@ -559,7 +559,8 @@ async def begin_create_or_update( :type server_name: str :param elastic_pool_name: The name of the elastic pool. Required. :type elastic_pool_name: str - :param parameters: The elastic pool parameters. Is either a model type or a IO type. Required. + :param parameters: The elastic pool parameters. Is either a ElasticPool type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.ElasticPool or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -916,8 +917,8 @@ async def begin_update( :type server_name: str :param elastic_pool_name: The name of the elastic pool. Required. :type elastic_pool_name: str - :param parameters: The elastic pool update parameters. Is either a model type or a IO type. - Required. + :param parameters: The elastic pool update parameters. Is either a ElasticPoolUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.ElasticPoolUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_encryption_protectors_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_encryption_protectors_operations.py index 3815694d765e..3f987874cbad 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_encryption_protectors_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_encryption_protectors_operations.py @@ -389,8 +389,8 @@ async def begin_create_or_update( :param encryption_protector_name: The name of the encryption protector to be updated. "current" Required. :type encryption_protector_name: str or ~azure.mgmt.sql.models.EncryptionProtectorName - :param parameters: The requested encryption protector resource state. Is either a model type or - a IO type. Required. + :param parameters: The requested encryption protector resource state. Is either a + EncryptionProtector type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.EncryptionProtector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_extended_database_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_extended_database_blob_auditing_policies_operations.py index ed0238bb5dce..bf1048277408 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_extended_database_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_extended_database_blob_auditing_policies_operations.py @@ -306,8 +306,8 @@ async def create_or_update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The extended database blob auditing policy. Is either a model type or a IO - type. Required. + :param parameters: The extended database blob auditing policy. Is either a + ExtendedDatabaseBlobAuditingPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy or IO :keyword blob_auditing_policy_name: The name of the blob auditing policy. Default value is "default". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_extended_server_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_extended_server_blob_auditing_policies_operations.py index ffc1f5be5907..076b739e1c12 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_extended_server_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_extended_server_blob_auditing_policies_operations.py @@ -383,8 +383,8 @@ 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 parameters: Properties of extended blob auditing policy. Is either a model type or a IO - type. Required. + :param parameters: Properties of extended blob auditing policy. Is either a + ExtendedServerBlobAuditingPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy or IO :keyword blob_auditing_policy_name: The name of the blob auditing policy. Default value is "default". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_failover_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_failover_groups_operations.py index b22fd56062e7..db2a7e8a0739 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_failover_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_failover_groups_operations.py @@ -306,7 +306,7 @@ async def begin_create_or_update( :type server_name: str :param failover_group_name: The name of the failover group. Required. :type failover_group_name: str - :param parameters: The failover group parameters. Is either a model type or a IO type. + :param parameters: The failover group parameters. Is either a FailoverGroup type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.FailoverGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -664,8 +664,8 @@ async def begin_update( :type server_name: str :param failover_group_name: The name of the failover group. Required. :type failover_group_name: str - :param parameters: The failover group parameters. Is either a model type or a IO type. - Required. + :param parameters: The failover group parameters. Is either a FailoverGroupUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.FailoverGroupUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_firewall_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_firewall_rules_operations.py index 9d901ef0200f..ef3e26578a43 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_firewall_rules_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_firewall_rules_operations.py @@ -212,7 +212,7 @@ async def create_or_update( :param firewall_rule_name: The 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 model type or a IO type. Required. + a FirewallRule type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.FirewallRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -500,7 +500,7 @@ async def replace( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a FirewallRuleList type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.FirewallRuleList or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_geo_backup_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_geo_backup_policies_operations.py index 8862cbec721f..8d08d5d90db6 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_geo_backup_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_geo_backup_policies_operations.py @@ -153,7 +153,7 @@ async def create_or_update( :param geo_backup_policy_name: The name of the geo backup policy. "Default" Required. :type geo_backup_policy_name: str or ~azure.mgmt.sql.models.GeoBackupPolicyName :param parameters: The required parameters for creating or updating the geo backup policy. Is - either a model type or a IO type. Required. + either a GeoBackupPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.GeoBackupPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_instance_failover_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_instance_failover_groups_operations.py index f928416c08d8..b079d71d2b7d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_instance_failover_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_instance_failover_groups_operations.py @@ -387,8 +387,8 @@ async def begin_create_or_update( :type location_name: str :param failover_group_name: The name of the failover group. Required. :type failover_group_name: str - :param parameters: The failover group parameters. Is either a model type or a IO type. - Required. + :param parameters: The failover group parameters. Is either a InstanceFailoverGroup type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.InstanceFailoverGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_instance_pools_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_instance_pools_operations.py index 46f45b9936e4..9dac541ff39e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_instance_pools_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_instance_pools_operations.py @@ -289,8 +289,8 @@ async def begin_create_or_update( :type resource_group_name: str :param instance_pool_name: The name of the instance pool to be created or updated. Required. :type instance_pool_name: str - :param parameters: The requested instance pool resource state. Is either a model type or a IO - type. Required. + :param parameters: The requested instance pool resource state. Is either a InstancePool type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.InstancePool or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -631,8 +631,8 @@ async def begin_update( :type resource_group_name: str :param instance_pool_name: The name of the instance pool to be updated. Required. :type instance_pool_name: str - :param parameters: The requested instance pool resource state. Is either a model type or a IO - type. Required. + :param parameters: The requested instance pool resource state. Is either a InstancePoolUpdate + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.InstancePoolUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ipv6_firewall_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ipv6_firewall_rules_operations.py index 907fb57d8fa2..ee13bf686b69 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ipv6_firewall_rules_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ipv6_firewall_rules_operations.py @@ -294,7 +294,7 @@ async def create_or_update( :param firewall_rule_name: The name of the firewall rule. Required. :type firewall_rule_name: str :param parameters: The required parameters for creating or updating an IPv6 firewall rule. Is - either a model type or a IO type. Required. + either a IPv6FirewallRule type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.IPv6FirewallRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_agents_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_agents_operations.py index 320cc090ea29..3868c4bd6689 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_agents_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_agents_operations.py @@ -385,8 +385,8 @@ async def begin_create_or_update( :type server_name: str :param job_agent_name: The name of the job agent to be created or updated. Required. :type job_agent_name: str - :param parameters: The requested job agent resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested job agent resource state. Is either a JobAgent type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.JobAgent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -743,7 +743,8 @@ async def begin_update( :type server_name: str :param job_agent_name: The name of the job agent to be updated. Required. :type job_agent_name: str - :param parameters: The update to the job agent. Is either a model type or a IO type. Required. + :param parameters: The update to the job agent. Is either a JobAgentUpdate type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.JobAgentUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_credentials_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_credentials_operations.py index 846bd8d77d1d..139bf9a8bff4 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_credentials_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_credentials_operations.py @@ -306,8 +306,8 @@ async def create_or_update( :type job_agent_name: str :param credential_name: The name of the credential. Required. :type credential_name: str - :param parameters: The requested job credential state. Is either a model type or a IO type. - Required. + :param parameters: The requested job credential state. Is either a JobCredential type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.JobCredential or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_steps_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_steps_operations.py index 38fc6fc14f90..787bd8767c61 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_steps_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_steps_operations.py @@ -509,7 +509,7 @@ async def create_or_update( :type job_name: str :param step_name: The name of the job step. Required. :type step_name: str - :param parameters: The requested state of the job step. Is either a model type or a IO type. + :param parameters: The requested state of the job step. Is either a JobStep type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.JobStep or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_target_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_target_groups_operations.py index 58e9eefd8bdb..cba7bf08c521 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_target_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_job_target_groups_operations.py @@ -306,8 +306,8 @@ async def create_or_update( :type job_agent_name: str :param target_group_name: The name of the target group. Required. :type target_group_name: str - :param parameters: The requested state of the target group. Is either a model type or a IO - type. Required. + :param parameters: The requested state of the target group. Is either a JobTargetGroup type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.JobTargetGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_jobs_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_jobs_operations.py index 71dcffe3d287..e871e4e2047c 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_jobs_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_jobs_operations.py @@ -306,7 +306,7 @@ async def create_or_update( :type job_agent_name: str :param job_name: The name of the job to get. Required. :type job_name: str - :param parameters: The requested job state. Is either a model type or a IO type. Required. + :param parameters: The requested job state. Is either a Job type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.Job or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ledger_digest_uploads_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ledger_digest_uploads_operations.py index fb668b19bef2..b3b47e824ef4 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ledger_digest_uploads_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ledger_digest_uploads_operations.py @@ -322,7 +322,7 @@ async def begin_create_or_update( :type database_name: str :param ledger_digest_uploads: "current" Required. :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.LedgerDigestUploadsName - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a LedgerDigestUploads type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.LedgerDigestUploads or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_long_term_retention_backups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_long_term_retention_backups_operations.py index b55da768e4fa..a87a00489e89 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_long_term_retention_backups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_long_term_retention_backups_operations.py @@ -253,7 +253,7 @@ async def begin_copy( :param backup_name: The backup name. Required. :type backup_name: str :param parameters: The parameters needed for long term retention copy request. Is either a - model type or a IO type. Required. + CopyLongTermRetentionBackupParameters type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.CopyLongTermRetentionBackupParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -502,8 +502,8 @@ async def begin_update( :type long_term_retention_database_name: str :param backup_name: The backup name. Required. :type backup_name: str - :param parameters: The requested backup resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested backup resource state. Is either a + UpdateLongTermRetentionBackupParameters type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.UpdateLongTermRetentionBackupParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1257,7 +1257,7 @@ async def begin_copy_by_resource_group( :param backup_name: The backup name. Required. :type backup_name: str :param parameters: The parameters needed for long term retention copy request. Is either a - model type or a IO type. Required. + CopyLongTermRetentionBackupParameters type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.CopyLongTermRetentionBackupParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1521,8 +1521,8 @@ async def begin_update_by_resource_group( :type long_term_retention_database_name: str :param backup_name: The backup name. Required. :type backup_name: str - :param parameters: The requested backup resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested backup resource state. Is either a + UpdateLongTermRetentionBackupParameters type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.UpdateLongTermRetentionBackupParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_long_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_long_term_retention_policies_operations.py index 05c02c3a42b2..4f635689f977 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_long_term_retention_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_long_term_retention_policies_operations.py @@ -318,8 +318,8 @@ async def begin_create_or_update( :type database_name: str :param policy_name: The policy name. Should always be Default. "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.LongTermRetentionPolicyName - :param parameters: The long term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The long term retention policy info. Is either a LongTermRetentionPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.LongTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_maintenance_windows_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_maintenance_windows_operations.py index 62beff697cd4..82529db6cecd 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_maintenance_windows_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_maintenance_windows_operations.py @@ -220,7 +220,7 @@ async def create_or_update( # pylint: disable=inconsistent-return-statements :type database_name: str :param maintenance_window_name: Maintenance window name. Required. :type maintenance_window_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a MaintenanceWindows type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.MaintenanceWindows or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_backup_short_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_backup_short_term_retention_policies_operations.py index 8821b224a806..074ed9d664f3 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_backup_short_term_retention_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_backup_short_term_retention_policies_operations.py @@ -321,8 +321,8 @@ async def begin_create_or_update( :type database_name: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ManagedShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + ManagedBackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -574,8 +574,8 @@ async def begin_update( :type database_name: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ManagedShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + ManagedBackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_advanced_threat_protection_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_advanced_threat_protection_settings_operations.py index 15f8c5470e20..6ecc1ba0d9a4 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_advanced_threat_protection_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_advanced_threat_protection_settings_operations.py @@ -320,8 +320,8 @@ async def create_or_update( "Default" Required. :type advanced_threat_protection_name: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionName - :param parameters: The managed database Advanced Threat Protection state. Is either a model - type or a IO type. Required. + :param parameters: The managed database Advanced Threat Protection state. Is either a + ManagedDatabaseAdvancedThreatProtection type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_recommended_sensitivity_labels_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_recommended_sensitivity_labels_operations.py index 2e09603b32a1..2d3e3cd085c8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_recommended_sensitivity_labels_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_recommended_sensitivity_labels_operations.py @@ -135,7 +135,8 @@ async def update( # pylint: disable=inconsistent-return-statements :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a RecommendedSensitivityLabelUpdateList type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdateList or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_security_alert_policies_operations.py index 933f5e68e316..cf8e0281cdff 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_security_alert_policies_operations.py @@ -230,8 +230,8 @@ async def create_or_update( :type database_name: str :param security_alert_policy_name: The name of the security alert policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName - :param parameters: The database security alert policy. Is either a model type or a IO type. - Required. + :param parameters: The database security alert policy. Is either a + ManagedDatabaseSecurityAlertPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseSecurityAlertPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_sensitivity_labels_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_sensitivity_labels_operations.py index 9f159dca7d08..67647676ca12 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_sensitivity_labels_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_sensitivity_labels_operations.py @@ -268,8 +268,8 @@ async def create_or_update( :type table_name: str :param column_name: The name of the column. Required. :type column_name: str - :param parameters: The column sensitivity label resource. Is either a model type or a IO type. - Required. + :param parameters: The column sensitivity label resource. Is either a SensitivityLabel type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SensitivityLabel or IO :keyword sensitivity_label_source: The source of the sensitivity label. Default value is "current". Note that overriding this default value may result in unsupported behavior. @@ -790,7 +790,7 @@ async def update( # pylint: disable=inconsistent-return-statements :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a SensitivityLabelUpdateList type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SensitivityLabelUpdateList or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_transparent_data_encryption_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_transparent_data_encryption_operations.py index 6a77e5b47902..bfefb6fc0010 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_transparent_data_encryption_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_transparent_data_encryption_operations.py @@ -230,8 +230,8 @@ async def create_or_update( :type database_name: str :param tde_name: The name of the transparent data encryption configuration. "current" Required. :type tde_name: str or ~azure.mgmt.sql.models.TransparentDataEncryptionName - :param parameters: The database transparent data encryption. Is either a model type or a IO - type. Required. + :param parameters: The database transparent data encryption. Is either a + ManagedTransparentDataEncryption type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedTransparentDataEncryption or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_vulnerability_assessment_rule_baselines_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_vulnerability_assessment_rule_baselines_operations.py index 810305078cdb..c273939a6a94 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_vulnerability_assessment_rule_baselines_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_vulnerability_assessment_rule_baselines_operations.py @@ -266,8 +266,8 @@ async def create_or_update( baseline on a database level rule and master for server level rule). Known values are: "master" and "default". Required. :type baseline_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseVulnerabilityAssessmentRuleBaseline type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaseline or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_vulnerability_assessments_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_vulnerability_assessments_operations.py index 662af85265ac..d7fc00043e5d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_vulnerability_assessments_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_vulnerability_assessments_operations.py @@ -235,7 +235,8 @@ async def create_or_update( :param vulnerability_assessment_name: The name of the vulnerability assessment. "default" Required. :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName - :param parameters: The requested resource. Is either a model type or a IO type. Required. + :param parameters: The requested resource. Is either a DatabaseVulnerabilityAssessment type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_databases_operations.py index cf11f1768b96..d144162e0a54 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_databases_operations.py @@ -390,8 +390,8 @@ async def begin_create_or_update( :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The requested database resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested database resource state. Is either a ManagedDatabase type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabase or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -748,8 +748,8 @@ async def begin_update( :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The requested database resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested database resource state. Is either a ManagedDatabaseUpdate + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -978,8 +978,8 @@ async def begin_cancel_move( :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Parameters of the cancel managed database move operation. Is either a model - type or a IO type. Required. + :param parameters: Parameters of the cancel managed database move operation. Is either a + ManagedDatabaseMoveDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseMoveDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1206,7 +1206,7 @@ async def begin_complete_move( :param database_name: The name of the database. Required. :type database_name: str :param parameters: Parameters of the complete managed database move operation. Is either a - model type or a IO type. Required. + ManagedDatabaseMoveDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseMoveDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1435,7 +1435,7 @@ async def begin_complete_restore( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The definition for completing the restore of this managed database. Is - either a model type or a IO type. Required. + either a CompleteDatabaseRestoreDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.CompleteDatabaseRestoreDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1661,8 +1661,8 @@ async def begin_start_move( :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Parameters of the start managed database move operation. Is either a model - type or a IO type. Required. + :param parameters: Parameters of the start managed database move operation. Is either a + ManagedDatabaseStartMoveDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseStartMoveDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_administrators_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_administrators_operations.py index 1f1f7ed8645c..0870483fff5a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_administrators_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_administrators_operations.py @@ -390,8 +390,8 @@ async def begin_create_or_update( :type managed_instance_name: str :param administrator_name: "ActiveDirectory" Required. :type administrator_name: str or ~azure.mgmt.sql.models.AdministratorName - :param parameters: The requested administrator parameters. Is either a model type or a IO type. - Required. + :param parameters: The requested administrator parameters. Is either a + ManagedInstanceAdministrator type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceAdministrator or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_advanced_threat_protection_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_advanced_threat_protection_settings_operations.py index 784e962e0311..827815a36f1e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_advanced_threat_protection_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_advanced_threat_protection_settings_operations.py @@ -396,8 +396,8 @@ async def begin_create_or_update( "Default" Required. :type advanced_threat_protection_name: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionName - :param parameters: The managed instance Advanced Threat Protection state. Is either a model - type or a IO type. Required. + :param parameters: The managed instance Advanced Threat Protection state. Is either a + ManagedInstanceAdvancedThreatProtection type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_azure_ad_only_authentications_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_azure_ad_only_authentications_operations.py index f212cdf88b7b..5ddadc84f8b3 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_azure_ad_only_authentications_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_azure_ad_only_authentications_operations.py @@ -319,7 +319,8 @@ async def begin_create_or_update( "Default" Required. :type authentication_name: str or ~azure.mgmt.sql.models.AuthenticationName :param parameters: The required parameters for creating or updating an Active Directory only - authentication property. Is either a model type or a IO type. Required. + authentication property. Is either a ManagedInstanceAzureADOnlyAuthentication type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceAzureADOnlyAuthentication or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_dtcs_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_dtcs_operations.py index 7286d8b75e5d..30a535722c59 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_dtcs_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_dtcs_operations.py @@ -378,8 +378,8 @@ async def begin_create_or_update( :type managed_instance_name: str :param dtc_name: The name of the managed instance DTC. "current" Required. :type dtc_name: str or ~azure.mgmt.sql.models.DtcName - :param parameters: Managed instance DTC settings. Is either a model type or a IO type. - Required. + :param parameters: Managed instance DTC settings. Is either a ManagedInstanceDtc type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceDtc or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_encryption_protectors_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_encryption_protectors_operations.py index b7080b2d1d83..d498c44e9276 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_encryption_protectors_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_encryption_protectors_operations.py @@ -522,8 +522,8 @@ async def begin_create_or_update( :param encryption_protector_name: The name of the encryption protector to be updated. "current" Required. :type encryption_protector_name: str or ~azure.mgmt.sql.models.EncryptionProtectorName - :param parameters: The requested encryption protector resource state. Is either a model type or - a IO type. Required. + :param parameters: The requested encryption protector resource state. Is either a + ManagedInstanceEncryptionProtector type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceEncryptionProtector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_keys_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_keys_operations.py index b54f878f5008..bbf9211792f7 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_keys_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_keys_operations.py @@ -391,8 +391,8 @@ async def begin_create_or_update( :param key_name: The name of the managed instance key to be operated on (updated or created). Required. :type key_name: str - :param parameters: The requested managed instance key resource state. Is either a model type or - a IO type. Required. + :param parameters: The requested managed instance key resource state. Is either a + ManagedInstanceKey type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceKey or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_long_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_long_term_retention_policies_operations.py index 104e75c29024..835422b67cf5 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_long_term_retention_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_long_term_retention_policies_operations.py @@ -320,8 +320,8 @@ async def begin_create_or_update( :type database_name: str :param policy_name: The policy name. Should always be Default. "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicyName - :param parameters: The long term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The long term retention policy info. Is either a + ManagedInstanceLongTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_private_endpoint_connections_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_private_endpoint_connections_operations.py index 03beb7cd5617..7092f2cd5356 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_private_endpoint_connections_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_private_endpoint_connections_operations.py @@ -302,7 +302,8 @@ async def begin_create_or_update( :type managed_instance_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a ManagedInstancePrivateEndpointConnection type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstancePrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_tde_certificates_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_tde_certificates_operations.py index cce3b8fe088c..ca2abd59a9c8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_tde_certificates_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_tde_certificates_operations.py @@ -206,8 +206,8 @@ async def begin_create( :type resource_group_name: str :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param parameters: The requested TDE certificate to be created or updated. Is either a model - type or a IO type. Required. + :param parameters: The requested TDE certificate to be created or updated. Is either a + TdeCertificate type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.TdeCertificate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_vulnerability_assessments_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_vulnerability_assessments_operations.py index b81f57346b44..11c961d72b01 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_vulnerability_assessments_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_vulnerability_assessments_operations.py @@ -228,7 +228,8 @@ async def create_or_update( :param vulnerability_assessment_name: The name of the vulnerability assessment. "default" Required. :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName - :param parameters: The requested resource. Is either a model type or a IO type. Required. + :param parameters: The requested resource. Is either a ManagedInstanceVulnerabilityAssessment + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceVulnerabilityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instances_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instances_operations.py index 2b9134ef891b..a8d71a77bebc 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instances_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instances_operations.py @@ -38,7 +38,10 @@ build_list_by_instance_pool_request, build_list_by_managed_instance_request, build_list_by_resource_group_request, + build_list_outbound_network_dependencies_by_managed_instance_request, build_list_request, + build_start_request, + build_stop_request, build_update_request, ) @@ -70,16 +73,9 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_instance_pool( - self, resource_group_name: str, instance_pool_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.ManagedInstance"]: - """Gets a list of all managed instances in an instance pool. + def list(self, expand: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ManagedInstance"]: + """Gets a list of all managed instances in the subscription. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param instance_pool_name: The instance pool name. Required. - :type instance_pool_name: str :param expand: The child resources to include in the response. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -90,8 +86,8 @@ def list_by_instance_pool( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.ManagedInstanceListResult] = kwargs.pop("cls", None) @@ -106,13 +102,11 @@ def list_by_instance_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_instance_pool_request( - resource_group_name=resource_group_name, - instance_pool_name=instance_pool_name, + request = build_list_request( subscription_id=self._config.subscription_id, expand=expand, api_version=api_version, - template_url=self.list_by_instance_pool.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -149,14 +143,19 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_instance_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances" - } + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances"} @distributed_trace - def list(self, expand: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.ManagedInstance"]: - """Gets a list of all managed instances in the subscription. + def list_by_instance_pool( + self, resource_group_name: str, instance_pool_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ManagedInstance"]: + """Gets a list of all managed instances in an instance pool. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param instance_pool_name: The instance pool name. Required. + :type instance_pool_name: str :param expand: The child resources to include in the response. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -167,8 +166,8 @@ def list(self, expand: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.ManagedInstanceListResult] = kwargs.pop("cls", None) @@ -183,11 +182,13 @@ def list(self, expand: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m def prepare_request(next_link=None): if not next_link: - request = build_list_request( + request = build_list_by_instance_pool_request( + resource_group_name=resource_group_name, + instance_pool_name=instance_pool_name, subscription_id=self._config.subscription_id, expand=expand, api_version=api_version, - template_url=self.list.metadata["url"], + template_url=self.list_by_instance_pool.metadata["url"], headers=_headers, params=_params, ) @@ -224,7 +225,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances"} + list_by_instance_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances" + } @distributed_trace def list_by_resource_group( @@ -245,8 +248,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.ManagedInstanceListResult] = kwargs.pop("cls", None) @@ -336,8 +339,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.ManagedInstance] = kwargs.pop("cls", None) @@ -393,8 +396,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ManagedInstance]] = kwargs.pop("cls", None) @@ -535,8 +538,8 @@ async def begin_create_or_update( :type resource_group_name: str :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param parameters: The requested managed instance resource state. Is either a model type or a - IO type. Required. + :param parameters: The requested managed instance resource state. Is either a ManagedInstance + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -557,8 +560,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ManagedInstance] = kwargs.pop("cls", None) @@ -618,8 +621,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -678,8 +681,8 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -738,8 +741,8 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ManagedInstance]] = kwargs.pop("cls", None) @@ -877,8 +880,8 @@ async def begin_update( :type resource_group_name: str :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param parameters: The requested managed instance resource state. Is either a model type or a - IO type. Required. + :param parameters: The requested managed instance resource state. Is either a + ManagedInstanceUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -899,8 +902,8 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ManagedInstance] = kwargs.pop("cls", None) @@ -946,58 +949,160 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}" } - @distributed_trace - def list_by_managed_instance( + async def _failover_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, managed_instance_name: str, - number_of_queries: Optional[int] = None, - databases: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - interval: Optional[Union[str, _models.QueryTimeGrainType]] = None, - aggregation_function: Optional[Union[str, _models.AggregationFunctionType]] = None, - observation_metric: Optional[Union[str, _models.MetricType]] = None, + replica_type: Optional[Union[str, _models.ReplicaType]] = None, **kwargs: Any - ) -> AsyncIterable["_models.TopQueries"]: - """Get top resource consuming queries of a managed instance. + ) -> None: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_failover_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + subscription_id=self._config.subscription_id, + replica_type=replica_type, + api_version=api_version, + template_url=self._failover_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover" + } + + @distributed_trace_async + async def begin_failover( + self, + resource_group_name: str, + managed_instance_name: str, + replica_type: Optional[Union[str, _models.ReplicaType]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Failovers a managed instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance to failover. Required. + :type managed_instance_name: str + :param replica_type: The type of replica to be failed over. Known values are: "Primary" and + "ReadableSecondary". Default value is None. + :type replica_type: str or ~azure.mgmt.sql.models.ReplicaType + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + 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._failover_initial( # type: ignore + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + replica_type=replica_type, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover" + } + + @distributed_trace + def list_outbound_network_dependencies_by_managed_instance( + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.OutboundEnvironmentEndpoint"]: + """Gets the collection of outbound network dependencies for the given managed instance. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param number_of_queries: How many 'top queries' to return. Default is 5. Default value is - None. - :type number_of_queries: int - :param databases: Comma separated list of databases to be included into search. All DB's are - included if this parameter is not specified. Default value is None. - :type databases: str - :param start_time: Start time for observed period. Default value is None. - :type start_time: str - :param end_time: End time for observed period. Default value is None. - :type end_time: str - :param interval: The time step to be used to summarize the metric values. Default value is - PT1H. Known values are: "PT1H" and "P1D". Default value is None. - :type interval: str or ~azure.mgmt.sql.models.QueryTimeGrainType - :param aggregation_function: Aggregation function to be used, default value is 'sum'. Known - values are: "avg", "min", "max", "stdev", and "sum". Default value is None. - :type aggregation_function: str or ~azure.mgmt.sql.models.AggregationFunctionType - :param observation_metric: Metric to be used for ranking top queries. Default is 'cpu'. Known - values are: "cpu", "io", "logIo", "duration", and "dtu". Default value is None. - :type observation_metric: str or ~azure.mgmt.sql.models.MetricType :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TopQueries or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.TopQueries] + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.OutboundEnvironmentEndpoint] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) - cls: ClsType[_models.TopQueriesListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.OutboundEnvironmentEndpointCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1010,19 +1115,12 @@ def list_by_managed_instance( def prepare_request(next_link=None): if not next_link: - request = build_list_by_managed_instance_request( + request = build_list_outbound_network_dependencies_by_managed_instance_request( resource_group_name=resource_group_name, managed_instance_name=managed_instance_name, subscription_id=self._config.subscription_id, - number_of_queries=number_of_queries, - databases=databases, - start_time=start_time, - end_time=end_time, - interval=interval, - aggregation_function=aggregation_function, - observation_metric=observation_metric, api_version=api_version, - template_url=self.list_by_managed_instance.metadata["url"], + template_url=self.list_outbound_network_dependencies_by_managed_instance.metadata["url"], headers=_headers, params=_params, ) @@ -1037,7 +1135,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize("TopQueriesListResult", pipeline_response) + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1059,16 +1157,12 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_managed_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries" + list_outbound_network_dependencies_by_managed_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/outboundNetworkDependenciesEndpoints" } - async def _failover_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - managed_instance_name: str, - replica_type: Optional[Union[str, _models.ReplicaType]] = None, - **kwargs: Any + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1081,18 +1175,17 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_failover_request( + request = build_start_request( resource_group_name=resource_group_name, managed_instance_name=managed_instance_name, subscription_id=self._config.subscription_id, - replica_type=replica_type, api_version=api_version, - template_url=self._failover_initial.metadata["url"], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1105,35 +1198,28 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _failover_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover" + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/start" } @distributed_trace_async - async def begin_failover( - self, - resource_group_name: str, - managed_instance_name: str, - replica_type: Optional[Union[str, _models.ReplicaType]] = None, - **kwargs: Any + async def begin_start( + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Failovers a managed instance. + """Starts the managed instance. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param managed_instance_name: The name of the managed instance to failover. Required. + :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param replica_type: The type of replica to be failed over. Known values are: "Primary" and - "ReadableSecondary". Default value is None. - :type replica_type: str or ~azure.mgmt.sql.models.ReplicaType :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1149,18 +1235,17 @@ async def begin_failover( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) 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._failover_initial( # type: ignore + raw_result = await self._start_initial( # type: ignore resource_group_name=resource_group_name, managed_instance_name=managed_instance_name, - replica_type=replica_type, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1174,7 +1259,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -1188,6 +1275,241 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_failover.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover" + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/start" + } + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any + ) -> None: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/stop" + } + + @distributed_trace_async + async def begin_stop( + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stops the managed instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + 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_initial( # type: ignore + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/stop" + } + + @distributed_trace + def list_by_managed_instance( + self, + resource_group_name: str, + managed_instance_name: str, + number_of_queries: Optional[int] = None, + databases: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + interval: Optional[Union[str, _models.QueryTimeGrainType]] = None, + aggregation_function: Optional[Union[str, _models.AggregationFunctionType]] = None, + observation_metric: Optional[Union[str, _models.MetricType]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.TopQueries"]: + """Get top resource consuming queries of a managed instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param number_of_queries: How many 'top queries' to return. Default is 5. Default value is + None. + :type number_of_queries: int + :param databases: Comma separated list of databases to be included into search. All DB's are + included if this parameter is not specified. Default value is None. + :type databases: str + :param start_time: Start time for observed period. Default value is None. + :type start_time: str + :param end_time: End time for observed period. Default value is None. + :type end_time: str + :param interval: The time step to be used to summarize the metric values. Default value is + PT1H. Known values are: "PT1H" and "P1D". Default value is None. + :type interval: str or ~azure.mgmt.sql.models.QueryTimeGrainType + :param aggregation_function: Aggregation function to be used, default value is 'sum'. Known + values are: "avg", "min", "max", "stdev", and "sum". Default value is None. + :type aggregation_function: str or ~azure.mgmt.sql.models.AggregationFunctionType + :param observation_metric: Metric to be used for ranking top queries. Default is 'cpu'. Known + values are: "cpu", "io", "logIo", "duration", and "dtu". Default value is None. + :type observation_metric: str or ~azure.mgmt.sql.models.MetricType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopQueries or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.TopQueries] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.TopQueriesListResult] = kwargs.pop("cls", None) + + error_map = { + 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_managed_instance_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + subscription_id=self._config.subscription_id, + number_of_queries=number_of_queries, + databases=databases, + start_time=start_time, + end_time=end_time, + interval=interval, + aggregation_function=aggregation_function, + observation_metric=observation_metric, + api_version=api_version, + template_url=self.list_by_managed_instance.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TopQueriesListResult", 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) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_managed_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries" } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_ledger_digest_uploads_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_ledger_digest_uploads_operations.py new file mode 100644 index 000000000000..4134e09fd3aa --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_ledger_digest_uploads_operations.py @@ -0,0 +1,627 @@ +# pylint: disable=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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +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.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import 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 ..._vendor import _convert_request +from ...operations._managed_ledger_digest_uploads_operations import ( + build_create_or_update_request, + build_disable_request, + build_get_request, + build_list_by_database_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedLedgerDigestUploadsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.aio.SqlManagementClient`'s + :attr:`managed_ledger_digest_uploads` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_database( + self, resource_group_name: str, managed_instance_name: str, database_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ManagedLedgerDigestUploads"]: + """Gets all ledger digest upload settings on a database. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedLedgerDigestUploads or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.ManagedLedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ManagedLedgerDigestUploadsListResult] = kwargs.pop("cls", None) + + error_map = { + 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_database_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_database.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedLedgerDigestUploadsListResult", 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) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + **kwargs: Any + ) -> _models.ManagedLedgerDigestUploads: + """Gets the current ledger digest upload configuration for a database. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :param ledger_digest_uploads: "current" Required. + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedLedgerDigestUploads or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ManagedLedgerDigestUploads + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ManagedLedgerDigestUploads] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedLedgerDigestUploads", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + parameters: Union[_models.ManagedLedgerDigestUploads, IO], + **kwargs: Any + ) -> Optional[_models.ManagedLedgerDigestUploads]: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ManagedLedgerDigestUploads]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedLedgerDigestUploads") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ManagedLedgerDigestUploads", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + parameters: _models.ManagedLedgerDigestUploads, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedLedgerDigestUploads]: + """Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :param ledger_digest_uploads: The name of the Ledger Digest Upload Configurations. "current" + Required. + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsName + :param parameters: The Ledger Digest Storage Endpoint. Required. + :type parameters: ~azure.mgmt.sql.models.ManagedLedgerDigestUploads + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedLedgerDigestUploads or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.ManagedLedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedLedgerDigestUploads]: + """Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :param ledger_digest_uploads: The name of the Ledger Digest Upload Configurations. "current" + Required. + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsName + :param parameters: The Ledger Digest Storage Endpoint. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedLedgerDigestUploads or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.ManagedLedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + parameters: Union[_models.ManagedLedgerDigestUploads, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedLedgerDigestUploads]: + """Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :param ledger_digest_uploads: The name of the Ledger Digest Upload Configurations. "current" + Required. + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsName + :param parameters: The Ledger Digest Storage Endpoint. Is either a ManagedLedgerDigestUploads + type or a IO type. Required. + :type parameters: ~azure.mgmt.sql.models.ManagedLedgerDigestUploads or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedLedgerDigestUploads or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.ManagedLedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedLedgerDigestUploads] = 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_or_update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedLedgerDigestUploads", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}" + } + + async def _disable_initial( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + **kwargs: Any + ) -> Optional[_models.ManagedLedgerDigestUploads]: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[Optional[_models.ManagedLedgerDigestUploads]] = kwargs.pop("cls", None) + + request = build_disable_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._disable_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ManagedLedgerDigestUploads", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _disable_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable" + } + + @distributed_trace_async + async def begin_disable( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedLedgerDigestUploads]: + """Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :param ledger_digest_uploads: "current" Required. + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsName + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedLedgerDigestUploads or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.ManagedLedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ManagedLedgerDigestUploads] = 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, + managed_instance_name=managed_instance_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedLedgerDigestUploads", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable" + } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py index 1e84dd1eb5f5..fc0aeb519583 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py @@ -321,8 +321,8 @@ async def begin_create_or_update( :type restorable_dropped_database_id: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ManagedShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + ManagedBackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -574,8 +574,8 @@ async def begin_update( :type restorable_dropped_database_id: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ManagedShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + ManagedBackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_dns_aliases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_dns_aliases_operations.py index ad68bc6a244a..6e4663f1f101 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_dns_aliases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_dns_aliases_operations.py @@ -386,7 +386,7 @@ async def begin_create_or_update( :type managed_instance_name: str :param dns_alias_name: Required. :type dns_alias_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a ManagedServerDnsAliasCreation type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedServerDnsAliasCreation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -743,7 +743,7 @@ async def begin_acquire( :type managed_instance_name: str :param dns_alias_name: Required. :type dns_alias_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a ManagedServerDnsAliasAcquisition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedServerDnsAliasAcquisition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_security_alert_policies_operations.py index 50f88fe86ee0..b0d9adacf260 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_security_alert_policies_operations.py @@ -305,8 +305,8 @@ async def begin_create_or_update( :type managed_instance_name: str :param security_alert_policy_name: The name of the security alert policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName - :param parameters: The managed server security alert policy. Is either a model type or a IO - type. Required. + :param parameters: The managed server security alert policy. Is either a + ManagedServerSecurityAlertPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_outbound_firewall_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_outbound_firewall_rules_operations.py index 30e5a93163a3..78e628ccfeba 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_outbound_firewall_rules_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_outbound_firewall_rules_operations.py @@ -303,7 +303,7 @@ async def begin_create_or_update( :type server_name: str :param outbound_rule_fqdn: Required. :type outbound_rule_fqdn: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a OutboundFirewallRule type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.OutboundFirewallRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_private_endpoint_connections_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_private_endpoint_connections_operations.py index 01f56af1af32..be3de73b41c5 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_private_endpoint_connections_operations.py @@ -300,7 +300,7 @@ async def begin_create_or_update( :type server_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_recommended_sensitivity_labels_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_recommended_sensitivity_labels_operations.py index bb79255a7e0c..a9f2f4222153 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_recommended_sensitivity_labels_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_recommended_sensitivity_labels_operations.py @@ -135,7 +135,8 @@ async def update( # pylint: disable=inconsistent-return-statements :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a RecommendedSensitivityLabelUpdateList type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdateList or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_recoverable_databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_recoverable_databases_operations.py index 7934fcefa532..ca0f9d1b61ac 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_recoverable_databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_recoverable_databases_operations.py @@ -57,72 +57,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = 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, database_name: str, **kwargs: Any - ) -> _models.RecoverableDatabase: - """Gets a recoverable database, which is a resource representing a database's geo backup. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. 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. - :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoverableDatabase or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.RecoverableDatabase - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2014-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2014-04-01")) - cls: ClsType[_models.RecoverableDatabase] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - server_name=server_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecoverableDatabase", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}" - } - @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any @@ -142,7 +76,9 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2014-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2014-04-01")) + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) cls: ClsType[_models.RecoverableDatabaseListResult] = kwargs.pop("cls", None) error_map = { @@ -180,7 +116,7 @@ async def extract_data(pipeline_response): list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) @@ -201,3 +137,84 @@ async def get_next(next_link=None): list_by_server.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases" } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + server_name: str, + database_name: str, + expand: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> _models.RecoverableDatabase: + """Gets a recoverable database. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. 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. + :type database_name: str + :param expand: The child resources to include in the response. Default value is None. + :type expand: str + :param filter: An OData filter expression that filters elements in the collection. Default + value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecoverableDatabase or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.RecoverableDatabase + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.RecoverableDatabase] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + expand=expand, + filter=filter, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RecoverableDatabase", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}" + } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_restorable_dropped_databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_restorable_dropped_databases_operations.py index b241be3a50aa..c6eba11ac152 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_restorable_dropped_databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_restorable_dropped_databases_operations.py @@ -78,8 +78,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.RestorableDroppedDatabaseListResult] = kwargs.pop("cls", None) @@ -142,7 +142,13 @@ async def get_next(next_link=None): @distributed_trace_async async def get( - self, resource_group_name: str, server_name: str, restorable_dropped_database_id: str, **kwargs: Any + self, + resource_group_name: str, + server_name: str, + restorable_dropped_database_id: str, + expand: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any ) -> _models.RestorableDroppedDatabase: """Gets a restorable dropped database. @@ -153,6 +159,11 @@ async def get( :type server_name: str :param restorable_dropped_database_id: Required. :type restorable_dropped_database_id: str + :param expand: The child resources to include in the response. Default value is None. + :type expand: str + :param filter: An OData filter expression that filters elements in the collection. Default + value is None. + :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RestorableDroppedDatabase or the result of cls(response) :rtype: ~azure.mgmt.sql.models.RestorableDroppedDatabase @@ -169,8 +180,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.RestorableDroppedDatabase] = kwargs.pop("cls", None) @@ -179,6 +190,8 @@ async def get( server_name=server_name, restorable_dropped_database_id=restorable_dropped_database_id, subscription_id=self._config.subscription_id, + expand=expand, + filter=filter, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_restore_points_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_restore_points_operations.py index 1f50ed913d10..187cb9d6c657 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_restore_points_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_restore_points_operations.py @@ -320,7 +320,7 @@ async def begin_create( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The definition for creating the restore point of this database. Is either a - model type or a IO type. Required. + CreateDatabaseRestorePointDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.CreateDatabaseRestorePointDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sensitivity_labels_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sensitivity_labels_operations.py index 3dcaaa3d1cf9..f57669494d67 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sensitivity_labels_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sensitivity_labels_operations.py @@ -247,7 +247,7 @@ async def update( # pylint: disable=inconsistent-return-statements :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a SensitivityLabelUpdateList type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SensitivityLabelUpdateList or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -790,8 +790,8 @@ async def create_or_update( :type table_name: str :param column_name: The name of the column. Required. :type column_name: str - :param parameters: The column sensitivity label resource. Is either a model type or a IO type. - Required. + :param parameters: The column sensitivity label resource. Is either a SensitivityLabel type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SensitivityLabel or IO :keyword sensitivity_label_source: The source of the sensitivity label. Default value is "current". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_advanced_threat_protection_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_advanced_threat_protection_settings_operations.py index a5ae92a999ce..e4dd023b2fe9 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_advanced_threat_protection_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_advanced_threat_protection_settings_operations.py @@ -396,8 +396,8 @@ async def begin_create_or_update( "Default" Required. :type advanced_threat_protection_name: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionName - :param parameters: The server Advanced Threat Protection state. Is either a model type or a IO - type. Required. + :param parameters: The server Advanced Threat Protection state. Is either a + ServerAdvancedThreatProtection type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerAdvancedThreatProtection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_advisors_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_advisors_operations.py index bce34f83de0f..1d7185be11b8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_advisors_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_advisors_operations.py @@ -275,7 +275,7 @@ async def update( :type server_name: str :param advisor_name: The name of the Server Advisor. Required. :type advisor_name: str - :param parameters: The requested advisor resource state. Is either a model type or a IO type. + :param parameters: The requested advisor resource state. Is either a Advisor type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.Advisor or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_automatic_tuning_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_automatic_tuning_operations.py index 1cc3909b3f46..3e5553aff485 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_automatic_tuning_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_automatic_tuning_operations.py @@ -189,8 +189,8 @@ async def update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The requested automatic tuning resource state. Is either a model type or a - IO type. Required. + :param parameters: The requested automatic tuning resource state. Is either a + ServerAutomaticTuning type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerAutomaticTuning or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_azure_ad_administrators_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_azure_ad_administrators_operations.py index c123c4083dfe..e038a07630cc 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_azure_ad_administrators_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_azure_ad_administrators_operations.py @@ -312,7 +312,7 @@ async def begin_create_or_update( Required. :type administrator_name: str or ~azure.mgmt.sql.models.AdministratorName :param parameters: The requested Azure Active Directory administrator Resource state. Is either - a model type or a IO type. Required. + a ServerAzureADAdministrator type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerAzureADAdministrator or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_azure_ad_only_authentications_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_azure_ad_only_authentications_operations.py index 21d9e1376e45..e48681daee4d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_azure_ad_only_authentications_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_azure_ad_only_authentications_operations.py @@ -319,7 +319,8 @@ async def begin_create_or_update( "Default" Required. :type authentication_name: str or ~azure.mgmt.sql.models.AuthenticationName :param parameters: The required parameters for creating or updating an Active Directory only - authentication property. Is either a model type or a IO type. Required. + authentication property. Is either a ServerAzureADOnlyAuthentication type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.ServerAzureADOnlyAuthentication or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_blob_auditing_policies_operations.py index 10d37d5da1e4..0d6b7b82b6db 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_blob_auditing_policies_operations.py @@ -379,8 +379,8 @@ 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 parameters: Properties of blob auditing policy. Is either a model type or a IO type. - Required. + :param parameters: Properties of blob auditing policy. Is either a ServerBlobAuditingPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerBlobAuditingPolicy or IO :keyword blob_auditing_policy_name: The name of the blob auditing policy. Default value is "default". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_communication_links_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_communication_links_operations.py index 2f4ed7ad5cf8..cd6fbd627008 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_communication_links_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_communication_links_operations.py @@ -359,7 +359,7 @@ async def begin_create_or_update( :param communication_link_name: The name of the server communication link. Required. :type communication_link_name: str :param parameters: The required parameters for creating a server communication link. Is either - a model type or a IO type. Required. + a ServerCommunicationLink type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerCommunicationLink or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_configuration_options_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_configuration_options_operations.py new file mode 100644 index 000000000000..a83bbd30fc49 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_configuration_options_operations.py @@ -0,0 +1,463 @@ +# pylint: disable=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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +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.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import 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 ..._vendor import _convert_request +from ...operations._server_configuration_options_operations import ( + build_create_or_update_request, + build_get_request, + build_list_by_managed_instance_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServerConfigurationOptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.aio.SqlManagementClient`'s + :attr:`server_configuration_options` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_managed_instance( + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ServerConfigurationOption"]: + """Gets a list of managed instance server configuration options. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServerConfigurationOption or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.ServerConfigurationOption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ServerConfigurationOptionListResult] = kwargs.pop("cls", None) + + error_map = { + 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_managed_instance_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_managed_instance.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServerConfigurationOptionListResult", 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) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_managed_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + **kwargs: Any + ) -> _models.ServerConfigurationOption: + """Gets managed instance server configuration option. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param server_configuration_option_name: The name of the server configuration option. + "allowPolybaseExport" Required. + :type server_configuration_option_name: str or + ~azure.mgmt.sql.models.ServerConfigurationOptionName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerConfigurationOption or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ServerConfigurationOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ServerConfigurationOption] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + server_configuration_option_name=server_configuration_option_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServerConfigurationOption", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + parameters: Union[_models.ServerConfigurationOption, IO], + **kwargs: Any + ) -> _models.ServerConfigurationOption: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerConfigurationOption] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ServerConfigurationOption") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + server_configuration_option_name=server_configuration_option_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServerConfigurationOption", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + parameters: _models.ServerConfigurationOption, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerConfigurationOption]: + """Updates managed instance server configuration option. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param server_configuration_option_name: The name of the server configuration option. + "allowPolybaseExport" Required. + :type server_configuration_option_name: str or + ~azure.mgmt.sql.models.ServerConfigurationOptionName + :param parameters: Server configuration option parameters. Required. + :type parameters: ~azure.mgmt.sql.models.ServerConfigurationOption + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerConfigurationOption or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.ServerConfigurationOption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerConfigurationOption]: + """Updates managed instance server configuration option. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param server_configuration_option_name: The name of the server configuration option. + "allowPolybaseExport" Required. + :type server_configuration_option_name: str or + ~azure.mgmt.sql.models.ServerConfigurationOptionName + :param parameters: Server configuration option parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerConfigurationOption or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.ServerConfigurationOption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + parameters: Union[_models.ServerConfigurationOption, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerConfigurationOption]: + """Updates managed instance server configuration option. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param server_configuration_option_name: The name of the server configuration option. + "allowPolybaseExport" Required. + :type server_configuration_option_name: str or + ~azure.mgmt.sql.models.ServerConfigurationOptionName + :param parameters: Server configuration option parameters. Is either a + ServerConfigurationOption type or a IO type. Required. + :type parameters: ~azure.mgmt.sql.models.ServerConfigurationOption or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerConfigurationOption or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.ServerConfigurationOption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerConfigurationOption] = 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_or_update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + server_configuration_option_name=server_configuration_option_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerConfigurationOption", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}" + } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_connection_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_connection_policies_operations.py index 2ef67fabb1d8..ca8e3c38b056 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_connection_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_connection_policies_operations.py @@ -304,7 +304,7 @@ async def begin_create_or_update( :param connection_policy_name: The name of the connection policy. "default" Required. :type connection_policy_name: str or ~azure.mgmt.sql.models.ConnectionPolicyName :param parameters: The required parameters for updating a server connection policy. Is either a - model type or a IO type. Required. + ServerConnectionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerConnectionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_dev_ops_audit_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_dev_ops_audit_settings_operations.py index f31474761b72..e9642bf9ad9b 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_dev_ops_audit_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_dev_ops_audit_settings_operations.py @@ -386,8 +386,8 @@ async def begin_create_or_update( :type server_name: str :param dev_ops_auditing_settings_name: "Default" Required. :type dev_ops_auditing_settings_name: str or ~azure.mgmt.sql.models.DevOpsAuditingSettingsName - :param parameters: Properties of DevOps audit settings. Is either a model type or a IO type. - Required. + :param parameters: Properties of DevOps audit settings. Is either a + ServerDevOpsAuditingSettings type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerDevOpsAuditingSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_dns_aliases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_dns_aliases_operations.py index a8af9ea5617c..cece4835cf7b 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_dns_aliases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_dns_aliases_operations.py @@ -634,7 +634,7 @@ async def begin_acquire( :type server_name: str :param dns_alias_name: The name of the server dns alias. Required. :type dns_alias_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a ServerDnsAliasAcquisition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerDnsAliasAcquisition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_keys_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_keys_operations.py index bb3904fc77ac..e10949b1ffe6 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_keys_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_keys_operations.py @@ -391,7 +391,7 @@ async def begin_create_or_update( https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, then the server key name should be formatted as: YourVaultName_YourKeyName_YourKeyVersion. Required. :type key_name: str - :param parameters: The requested server key resource state. Is either a model type or a IO + :param parameters: The requested server key resource state. Is either a ServerKey type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerKey or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_security_alert_policies_operations.py index a7068dcc9f48..aeaf4c48ac2e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_security_alert_policies_operations.py @@ -303,8 +303,8 @@ async def begin_create_or_update( :type server_name: str :param security_alert_policy_name: The name of the threat detection policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName - :param parameters: The server security alert policy. Is either a model type or a IO type. - Required. + :param parameters: The server security alert policy. Is either a ServerSecurityAlertPolicy type + or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_certificates_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_certificates_operations.py index 9b15295a4f77..20fa133726a2 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_certificates_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_certificates_operations.py @@ -386,8 +386,8 @@ async def begin_create_or_update( :type managed_instance_name: str :param certificate_name: Name of of the certificate to upload. Required. :type certificate_name: str - :param parameters: The server trust certificate info. Is either a model type or a IO type. - Required. + :param parameters: The server trust certificate info. Is either a ServerTrustCertificate type + or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerTrustCertificate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_groups_operations.py index 81145dc0ed7f..c6ff8695711d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_groups_operations.py @@ -304,8 +304,8 @@ async def begin_create_or_update( :type location_name: str :param server_trust_group_name: The name of the server trust group. Required. :type server_trust_group_name: str - :param parameters: The server trust group parameters. Is either a model type or a IO type. - Required. + :param parameters: The server trust group parameters. Is either a ServerTrustGroup type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.ServerTrustGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_vulnerability_assessments_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_vulnerability_assessments_operations.py index 8b9189ff450c..2ba9230fcfae 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_vulnerability_assessments_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_vulnerability_assessments_operations.py @@ -228,7 +228,8 @@ async def create_or_update( :param vulnerability_assessment_name: The name of the vulnerability assessment. "default" Required. :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName - :param parameters: The requested resource. Is either a model type or a IO type. Required. + :param parameters: The requested resource. Is either a ServerVulnerabilityAssessment type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerVulnerabilityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_servers_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_servers_operations.py index 017ae2ebb3a8..55fe5392b791 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_servers_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_servers_operations.py @@ -38,6 +38,7 @@ build_import_database_request, build_list_by_resource_group_request, build_list_request, + build_refresh_status_request, build_update_request, ) @@ -68,6 +69,189 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def check_name_availability( + self, parameters: _models.CheckNameAvailabilityRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Determines whether a resource can be created with the specified name. + + :param parameters: The name availability request parameters. Required. + :type parameters: ~azure.mgmt.sql.models.CheckNameAvailabilityRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Determines whether a resource can be created with the specified name. + + :param parameters: The name availability request parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, parameters: Union[_models.CheckNameAvailabilityRequest, IO], **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Determines whether a resource can be created with the specified name. + + :param parameters: The name availability request parameters. Is either a + CheckNameAvailabilityRequest type or a IO type. Required. + :type parameters: ~azure.mgmt.sql.models.CheckNameAvailabilityRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailabilityRequest") + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability" + } + + @distributed_trace + def list(self, expand: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Server"]: + """Gets a list of all servers in the subscription. + + :param expand: The child resources to include in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Server or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.Server] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) + + error_map = { + 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_request( + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServerListResult", 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) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers"} + @distributed_trace def list_by_resource_group( self, resource_group_name: str, expand: Optional[str] = None, **kwargs: Any @@ -87,8 +271,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) @@ -178,8 +362,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.Server] = kwargs.pop("cls", None) @@ -231,8 +415,8 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) @@ -369,7 +553,7 @@ 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 parameters: The requested server resource state. Is either a model type or a IO type. + :param parameters: The requested server resource state. Is either a Server type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.Server or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -391,8 +575,8 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Server] = kwargs.pop("cls", None) @@ -452,8 +636,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -510,8 +694,8 @@ async def begin_delete(self, resource_group_name: str, server_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -566,8 +750,8 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) @@ -701,8 +885,8 @@ async def begin_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The requested server resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested server resource state. Is either a ServerUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.ServerUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -723,8 +907,8 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Server] = kwargs.pop("cls", None) @@ -770,79 +954,6 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}" } - @distributed_trace - def list(self, expand: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Server"]: - """Gets a list of all servers in the subscription. - - :param expand: The child resources to include in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Server or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.Server] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) - cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - - error_map = { - 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_request( - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ServerListResult", 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) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers"} - async def _import_database_initial( self, resource_group_name: str, @@ -861,8 +972,8 @@ async def _import_database_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ImportExportOperationResult]] = kwargs.pop("cls", None) @@ -1000,8 +1111,8 @@ async def begin_import_database( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The database import request parameters. Is either a model type or a IO type. - Required. + :param parameters: The database import request parameters. Is either a + ImportNewDatabaseDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ImportNewDatabaseDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1022,8 +1133,8 @@ async def begin_import_database( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ImportExportOperationResult] = kwargs.pop("cls", None) @@ -1069,57 +1180,9 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import" } - @overload - async def check_name_availability( - self, parameters: _models.CheckNameAvailabilityRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Determines whether a resource can be created with the specified name. - - :param parameters: The name availability request parameters. Required. - :type parameters: ~azure.mgmt.sql.models.CheckNameAvailabilityRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Determines whether a resource can be created with the specified name. - - :param parameters: The name availability request parameters. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, parameters: Union[_models.CheckNameAvailabilityRequest, IO], **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Determines whether a resource can be created with the specified name. - - :param parameters: The name availability request parameters. Is either a model type or a IO - type. Required. - :type parameters: ~azure.mgmt.sql.models.CheckNameAvailabilityRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ + async def _refresh_status_initial( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> Optional[_models.RefreshExternalGovernanceStatusOperationResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1128,30 +1191,20 @@ async def check_name_availability( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CheckNameAvailabilityRequest") + cls: ClsType[Optional[_models.RefreshExternalGovernanceStatusOperationResult]] = kwargs.pop("cls", None) - request = build_check_name_availability_request( + request = build_refresh_status_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, - template_url=self.check_name_availability.metadata["url"], + template_url=self._refresh_status_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1164,17 +1217,93 @@ async def check_name_availability( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("RefreshExternalGovernanceStatusOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability" + _refresh_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/refreshExternalGovernanceStatus" + } + + @distributed_trace_async + async def begin_refresh_status( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.RefreshExternalGovernanceStatusOperationResult]: + """Refresh external governance enablement status. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + RefreshExternalGovernanceStatusOperationResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.RefreshExternalGovernanceStatusOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.RefreshExternalGovernanceStatusOperationResult] = 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._refresh_status_initial( + resource_group_name=resource_group_name, + server_name=server_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RefreshExternalGovernanceStatusOperationResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_refresh_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/refreshExternalGovernanceStatus" } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_agent_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_agent_operations.py index 2069ecac3e81..28e6bd350603 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_agent_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_agent_operations.py @@ -191,7 +191,7 @@ async def create_or_update( :type resource_group_name: str :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a SqlAgentConfiguration type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SqlAgentConfiguration or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessment_baselines_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessment_baselines_operations.py index 0bb34bfef106..5a6f722160a3 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessment_baselines_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessment_baselines_operations.py @@ -154,8 +154,8 @@ async def create_or_update( :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName :param baseline_name: "default" Required. :type baseline_name: str or ~azure.mgmt.sql.models.BaselineName - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput or IO :keyword system_database_name: The vulnerability assessment system database name. Default value diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessment_rule_baseline_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessment_rule_baseline_operations.py index a55a03ba8d57..265d13137d1f 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessment_rule_baseline_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessment_rule_baseline_operations.py @@ -360,8 +360,8 @@ async def create_or_update( :type baseline_name: str or ~azure.mgmt.sql.models.BaselineName :param rule_id: The vulnerability assessment rule ID. Required. :type rule_id: str - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput or IO :keyword system_database_name: The vulnerability assessment system database name. Default value diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessments_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessments_settings_operations.py index 5e55adb6c080..63ff9f3a53e4 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessments_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sql_vulnerability_assessments_settings_operations.py @@ -301,7 +301,8 @@ async def create_or_update( :param vulnerability_assessment_name: The name of the SQL Vulnerability Assessment. "default" Required. :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName - :param parameters: The requested resource. Is either a model type or a IO type. Required. + :param parameters: The requested resource. Is either a SqlVulnerabilityAssessment type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.SqlVulnerabilityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_start_stop_managed_instance_schedules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_start_stop_managed_instance_schedules_operations.py new file mode 100644 index 000000000000..effd5b463f47 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_start_stop_managed_instance_schedules_operations.py @@ -0,0 +1,448 @@ +# pylint: disable=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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload + +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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import 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 ... import models as _models +from ..._vendor import _convert_request +from ...operations._start_stop_managed_instance_schedules_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_instance_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class StartStopManagedInstanceSchedulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.aio.SqlManagementClient`'s + :attr:`start_stop_managed_instance_schedules` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_instance( + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.StartStopManagedInstanceSchedule"]: + """Lists the managed instance's Start/Stop schedules. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StartStopManagedInstanceSchedule or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.StartStopManagedInstanceSchedule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.StartStopManagedInstanceScheduleListResult] = kwargs.pop("cls", None) + + error_map = { + 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_instance_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_instance.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StartStopManagedInstanceScheduleListResult", 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) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + **kwargs: Any + ) -> _models.StartStopManagedInstanceSchedule: + """Gets the managed instance's Start/Stop schedule. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param start_stop_schedule_name: Name of the managed instance Start/Stop schedule. "default" + Required. + :type start_stop_schedule_name: str or ~azure.mgmt.sql.models.StartStopScheduleName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StartStopManagedInstanceSchedule or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.StartStopManagedInstanceSchedule] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + start_stop_schedule_name=start_stop_schedule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("StartStopManagedInstanceSchedule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + parameters: _models.StartStopManagedInstanceSchedule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StartStopManagedInstanceSchedule: + """Creates or updates the managed instance's Start/Stop schedule. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param start_stop_schedule_name: Name of the managed instance Start/Stop schedule. "default" + Required. + :type start_stop_schedule_name: str or ~azure.mgmt.sql.models.StartStopScheduleName + :param parameters: The requested managed instance Start/Stop schedule. Required. + :type parameters: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StartStopManagedInstanceSchedule or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StartStopManagedInstanceSchedule: + """Creates or updates the managed instance's Start/Stop schedule. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param start_stop_schedule_name: Name of the managed instance Start/Stop schedule. "default" + Required. + :type start_stop_schedule_name: str or ~azure.mgmt.sql.models.StartStopScheduleName + :param parameters: The requested managed instance Start/Stop schedule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StartStopManagedInstanceSchedule or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + parameters: Union[_models.StartStopManagedInstanceSchedule, IO], + **kwargs: Any + ) -> _models.StartStopManagedInstanceSchedule: + """Creates or updates the managed instance's Start/Stop schedule. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param start_stop_schedule_name: Name of the managed instance Start/Stop schedule. "default" + Required. + :type start_stop_schedule_name: str or ~azure.mgmt.sql.models.StartStopScheduleName + :param parameters: The requested managed instance Start/Stop schedule. Is either a + StartStopManagedInstanceSchedule type or a IO type. Required. + :type parameters: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StartStopManagedInstanceSchedule or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StartStopManagedInstanceSchedule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StartStopManagedInstanceSchedule") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + start_stop_schedule_name=start_stop_schedule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("StartStopManagedInstanceSchedule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("StartStopManagedInstanceSchedule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + **kwargs: Any + ) -> None: + """Deletes the managed instance's Start/Stop schedule. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param start_stop_schedule_name: Name of the managed instance Start/Stop schedule. "default" + Required. + :type start_stop_schedule_name: str or ~azure.mgmt.sql.models.StartStopScheduleName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + start_stop_schedule_name=start_stop_schedule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}" + } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_agents_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_agents_operations.py index 33e34f578688..3764c49bd507 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_agents_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_agents_operations.py @@ -305,7 +305,7 @@ async def begin_create_or_update( :type server_name: str :param sync_agent_name: The name of the sync agent. Required. :type sync_agent_name: str - :param parameters: The requested sync agent resource state. Is either a model type or a IO + :param parameters: The requested sync agent resource state. Is either a SyncAgent type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SyncAgent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_groups_operations.py index 1e7d07fd311b..df32b38e5e6e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_groups_operations.py @@ -861,7 +861,7 @@ async def begin_create_or_update( :type database_name: str :param sync_group_name: The name of the sync group. Required. :type sync_group_name: str - :param parameters: The requested sync group resource state. Is either a model type or a IO + :param parameters: The requested sync group resource state. Is either a SyncGroup type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SyncGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1235,7 +1235,7 @@ async def begin_update( :type database_name: str :param sync_group_name: The name of the sync group. Required. :type sync_group_name: str - :param parameters: The requested sync group resource state. Is either a model type or a IO + :param parameters: The requested sync group resource state. Is either a SyncGroup type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SyncGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_members_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_members_operations.py index 81bf04aa8585..29c76749a1e7 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_members_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_members_operations.py @@ -344,8 +344,8 @@ async def begin_create_or_update( :type sync_group_name: str :param sync_member_name: The name of the sync member. Required. :type sync_member_name: str - :param parameters: The requested sync member resource state. Is either a model type or a IO - type. Required. + :param parameters: The requested sync member resource state. Is either a SyncMember type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.SyncMember or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -750,8 +750,8 @@ async def begin_update( :type sync_group_name: str :param sync_member_name: The name of the sync member. Required. :type sync_member_name: str - :param parameters: The requested sync member resource state. Is either a model type or a IO - type. Required. + :param parameters: The requested sync member resource state. Is either a SyncMember type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.SyncMember or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_tde_certificates_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_tde_certificates_operations.py index 5950ddbaad09..5f72ea0c02e0 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_tde_certificates_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_tde_certificates_operations.py @@ -198,8 +198,8 @@ 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 requested TDE certificate to be created or updated. Is either a model - type or a IO type. Required. + :param parameters: The requested TDE certificate to be created or updated. Is either a + TdeCertificate type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.TdeCertificate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_transparent_data_encryptions_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_transparent_data_encryptions_operations.py index 6d12c29fb4c3..4c70860a8771 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_transparent_data_encryptions_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_transparent_data_encryptions_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -20,11 +20,13 @@ ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import 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 ..._vendor import _convert_request @@ -61,6 +63,93 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list_by_database( + self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any + ) -> AsyncIterable["_models.LogicalDatabaseTransparentDataEncryption"]: + """Gets a list of the logical database's transparent data encryption. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. 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 logical database for which the transparent data + encryption is defined. Required. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogicalDatabaseTransparentDataEncryption or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.LogicalDatabaseTransparentDataEncryptionListResult] = kwargs.pop("cls", None) + + error_map = { + 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_database_request( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_database.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryptionListResult", 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) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption" + } + @distributed_trace_async async def get( self, @@ -98,8 +187,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.LogicalDatabaseTransparentDataEncryption] = kwargs.pop("cls", None) @@ -138,8 +227,85 @@ async def get( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}" } + async def _create_or_update_initial( + self, + resource_group_name: str, + server_name: str, + database_name: str, + tde_name: Union[str, _models.TransparentDataEncryptionName], + parameters: Union[_models.LogicalDatabaseTransparentDataEncryption, IO], + **kwargs: Any + ) -> Optional[_models.LogicalDatabaseTransparentDataEncryption]: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.LogicalDatabaseTransparentDataEncryption]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "LogicalDatabaseTransparentDataEncryption") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + tde_name=tde_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryption", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryption", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}" + } + @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -149,7 +315,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.LogicalDatabaseTransparentDataEncryption]: + ) -> AsyncLROPoller[_models.LogicalDatabaseTransparentDataEncryption]: """Updates a logical database's transparent data encryption configuration. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -168,13 +334,22 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogicalDatabaseTransparentDataEncryption or None or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption or None + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + LogicalDatabaseTransparentDataEncryption or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -184,7 +359,7 @@ async def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.LogicalDatabaseTransparentDataEncryption]: + ) -> AsyncLROPoller[_models.LogicalDatabaseTransparentDataEncryption]: """Updates a logical database's transparent data encryption configuration. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -203,13 +378,22 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogicalDatabaseTransparentDataEncryption or None or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption or None + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + LogicalDatabaseTransparentDataEncryption or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -217,7 +401,7 @@ async def create_or_update( tde_name: Union[str, _models.TransparentDataEncryptionName], parameters: Union[_models.LogicalDatabaseTransparentDataEncryption, IO], **kwargs: Any - ) -> Optional[_models.LogicalDatabaseTransparentDataEncryption]: + ) -> AsyncLROPoller[_models.LogicalDatabaseTransparentDataEncryption]: """Updates a logical database's transparent data encryption configuration. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -230,168 +414,77 @@ async def create_or_update( :type database_name: str :param tde_name: The name of the transparent data encryption configuration. "current" Required. :type tde_name: str or ~azure.mgmt.sql.models.TransparentDataEncryptionName - :param parameters: The database transparent data encryption. Is either a model type or a IO - type. Required. + :param parameters: The database transparent data encryption. Is either a + LogicalDatabaseTransparentDataEncryption type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogicalDatabaseTransparentDataEncryption or None or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption or None + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + LogicalDatabaseTransparentDataEncryption or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.LogicalDatabaseTransparentDataEncryption]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LogicalDatabaseTransparentDataEncryption") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - server_name=server_name, - database_name=database_name, - tde_name=tde_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryption", pipeline_response) + cls: ClsType[_models.LogicalDatabaseTransparentDataEncryption] = 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_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + tde_name=tde_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - if response.status_code == 201: + def get_long_running_output(pipeline_response): deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryption", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}" - } - - @distributed_trace - def list_by_database( - self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> AsyncIterable["_models.LogicalDatabaseTransparentDataEncryption"]: - """Gets a list of the logical database's transparent data encryption. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. 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 logical database for which the transparent data - encryption is defined. Required. - :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LogicalDatabaseTransparentDataEncryption or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) - cls: ClsType[_models.LogicalDatabaseTransparentDataEncryptionListResult] = kwargs.pop("cls", None) - - error_map = { - 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_database_request( - resource_group_name=resource_group_name, - server_name=server_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_database.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryptionListResult", 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) + return cls(pipeline_response, deserialized, {}) + return deserialized - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - list_by_database.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption" + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}" } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_virtual_clusters_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_virtual_clusters_operations.py index 322ed6a33f48..13a1b4d37926 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_virtual_clusters_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_virtual_clusters_operations.py @@ -550,8 +550,8 @@ async def begin_update( :type resource_group_name: str :param virtual_cluster_name: The name of the virtual cluster. Required. :type virtual_cluster_name: str - :param parameters: The requested virtual cluster resource state. Is either a model type or a IO - type. Required. + :param parameters: The requested virtual cluster resource state. Is either a + VirtualClusterUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.VirtualClusterUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_virtual_network_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_virtual_network_rules_operations.py index 932007621a74..c318d50e9612 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_virtual_network_rules_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_virtual_network_rules_operations.py @@ -303,8 +303,8 @@ async def begin_create_or_update( :type server_name: str :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str - :param parameters: The requested virtual Network Rule Resource state. Is either a model type or - a IO type. Required. + :param parameters: The requested virtual Network Rule Resource state. Is either a + VirtualNetworkRule type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.VirtualNetworkRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_workload_classifiers_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_workload_classifiers_operations.py index 356d2366dc48..0b40281dc3bb 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_workload_classifiers_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_workload_classifiers_operations.py @@ -344,8 +344,8 @@ async def begin_create_or_update( :param workload_classifier_name: The name of the workload classifier to create/update. Required. :type workload_classifier_name: str - :param parameters: The properties of the workload classifier. Is either a model type or a IO - type. Required. + :param parameters: The properties of the workload classifier. Is either a WorkloadClassifier + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.WorkloadClassifier or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_workload_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_workload_groups_operations.py index a41f1f694d4a..59ebd9a2fcb0 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_workload_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_workload_groups_operations.py @@ -317,8 +317,8 @@ async def begin_create_or_update( :type database_name: str :param workload_group_name: The name of the workload group. Required. :type workload_group_name: str - :param parameters: The requested workload group state. Is either a model type or a IO type. - Required. + :param parameters: The requested workload group state. Is either a WorkloadGroup type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.WorkloadGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index c92a1749a5e5..2a17373ff534 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -37,6 +37,7 @@ from ._models_py3 import DatabaseColumnListResult from ._models_py3 import DatabaseExtensions from ._models_py3 import DatabaseIdentity +from ._models_py3 import DatabaseKey from ._models_py3 import DatabaseListResult from ._models_py3 import DatabaseOperation from ._models_py3 import DatabaseOperationListResult @@ -84,6 +85,8 @@ from ._models_py3 import EncryptionProtectorListResult from ._models_py3 import EndpointCertificate from ._models_py3 import EndpointCertificateListResult +from ._models_py3 import EndpointDependency +from ._models_py3 import EndpointDetail from ._models_py3 import ExportDatabaseDefinition from ._models_py3 import ExtendedDatabaseBlobAuditingPolicy from ._models_py3 import ExtendedDatabaseBlobAuditingPolicyListResult @@ -216,6 +219,8 @@ from ._models_py3 import ManagedInstanceVersionCapability from ._models_py3 import ManagedInstanceVulnerabilityAssessment from ._models_py3 import ManagedInstanceVulnerabilityAssessmentListResult +from ._models_py3 import ManagedLedgerDigestUploads +from ._models_py3 import ManagedLedgerDigestUploadsListResult from ._models_py3 import ManagedServerDnsAlias from ._models_py3 import ManagedServerDnsAliasAcquisition from ._models_py3 import ManagedServerDnsAliasCreation @@ -240,6 +245,8 @@ from ._models_py3 import OperationDisplay from ._models_py3 import OperationImpact from ._models_py3 import OperationListResult +from ._models_py3 import OutboundEnvironmentEndpoint +from ._models_py3 import OutboundEnvironmentEndpointCollection from ._models_py3 import OutboundFirewallRule from ._models_py3 import OutboundFirewallRuleListResult from ._models_py3 import PartnerInfo @@ -274,6 +281,7 @@ from ._models_py3 import RecoverableDatabaseListResult from ._models_py3 import RecoverableManagedDatabase from ._models_py3 import RecoverableManagedDatabaseListResult +from ._models_py3 import RefreshExternalGovernanceStatusOperationResult from ._models_py3 import Remediation from ._models_py3 import ReplicationLink from ._models_py3 import ReplicationLinkListResult @@ -288,6 +296,7 @@ from ._models_py3 import RestorePoint from ._models_py3 import RestorePointListResult from ._models_py3 import SQLVulnerabilityAssessmentScanListResult +from ._models_py3 import ScheduleItem from ._models_py3 import SecurityEvent from ._models_py3 import SecurityEventCollection from ._models_py3 import SecurityEventSqlInjectionAdditionalProperties @@ -305,6 +314,8 @@ from ._models_py3 import ServerBlobAuditingPolicyListResult from ._models_py3 import ServerCommunicationLink from ._models_py3 import ServerCommunicationLinkListResult +from ._models_py3 import ServerConfigurationOption +from ._models_py3 import ServerConfigurationOptionListResult from ._models_py3 import ServerConnectionPolicy from ._models_py3 import ServerConnectionPolicyListResult from ._models_py3 import ServerDevOpsAuditSettingsListResult @@ -344,6 +355,8 @@ from ._models_py3 import SqlVulnerabilityAssessmentScanRecord from ._models_py3 import SqlVulnerabilityAssessmentScanRecordListResult from ._models_py3 import SqlVulnerabilityAssessmentScanResults +from ._models_py3 import StartStopManagedInstanceSchedule +from ._models_py3 import StartStopManagedInstanceScheduleListResult from ._models_py3 import StorageCapability from ._models_py3 import SubscriptionUsage from ._models_py3 import SubscriptionUsageListResult @@ -415,6 +428,7 @@ from ._sql_management_client_enums import AutomaticTuningOptionModeDesired from ._sql_management_client_enums import AutomaticTuningServerMode from ._sql_management_client_enums import AutomaticTuningServerReason +from ._sql_management_client_enums import AvailabilityZoneType from ._sql_management_client_enums import BackupStorageRedundancy from ._sql_management_client_enums import BaselineName from ._sql_management_client_enums import BlobAuditingPolicyState @@ -432,6 +446,7 @@ from ._sql_management_client_enums import DataMaskingState from ._sql_management_client_enums import DataWarehouseUserActivityName from ._sql_management_client_enums import DatabaseIdentityType +from ._sql_management_client_enums import DatabaseKeyType from ._sql_management_client_enums import DatabaseLicenseType from ._sql_management_client_enums import DatabaseReadScale from ._sql_management_client_enums import DatabaseState @@ -443,6 +458,7 @@ from ._sql_management_client_enums import ElasticPoolLicenseType from ._sql_management_client_enums import ElasticPoolState from ._sql_management_client_enums import EncryptionProtectorName +from ._sql_management_client_enums import ExternalGovernanceStatus from ._sql_management_client_enums import FailoverGroupReplicationRole from ._sql_management_client_enums import GeoBackupPolicyName from ._sql_management_client_enums import GeoBackupPolicyState @@ -470,6 +486,8 @@ from ._sql_management_client_enums import ManagedInstanceLongTermRetentionPolicyName from ._sql_management_client_enums import ManagedInstancePropertiesProvisioningState from ._sql_management_client_enums import ManagedInstanceProxyOverride +from ._sql_management_client_enums import ManagedLedgerDigestUploadsName +from ._sql_management_client_enums import ManagedLedgerDigestUploadsState from ._sql_management_client_enums import ManagedServerCreateMode from ._sql_management_client_enums import ManagedShortTermRetentionPolicyName from ._sql_management_client_enums import ManagementOperationState @@ -514,9 +532,11 @@ from ._sql_management_client_enums import SensitivityLabelRank from ._sql_management_client_enums import SensitivityLabelSource from ._sql_management_client_enums import SensitivityLabelUpdateKind +from ._sql_management_client_enums import ServerConfigurationOptionName from ._sql_management_client_enums import ServerConnectionType from ._sql_management_client_enums import ServerKeyType from ._sql_management_client_enums import ServerNetworkAccessFlag +from ._sql_management_client_enums import ServerPublicNetworkAccessFlag from ._sql_management_client_enums import ServerTrustGroupPropertiesTrustScopesItem from ._sql_management_client_enums import ServerWorkspaceFeature from ._sql_management_client_enums import ServiceObjectiveName @@ -525,6 +545,7 @@ from ._sql_management_client_enums import SqlAgentConfigurationPropertiesState from ._sql_management_client_enums import SqlVulnerabilityAssessmentName from ._sql_management_client_enums import SqlVulnerabilityAssessmentState +from ._sql_management_client_enums import StartStopScheduleName from ._sql_management_client_enums import StorageCapabilityStorageAccountType from ._sql_management_client_enums import StorageKeyType from ._sql_management_client_enums import SyncAgentState @@ -582,6 +603,7 @@ "DatabaseColumnListResult", "DatabaseExtensions", "DatabaseIdentity", + "DatabaseKey", "DatabaseListResult", "DatabaseOperation", "DatabaseOperationListResult", @@ -629,6 +651,8 @@ "EncryptionProtectorListResult", "EndpointCertificate", "EndpointCertificateListResult", + "EndpointDependency", + "EndpointDetail", "ExportDatabaseDefinition", "ExtendedDatabaseBlobAuditingPolicy", "ExtendedDatabaseBlobAuditingPolicyListResult", @@ -761,6 +785,8 @@ "ManagedInstanceVersionCapability", "ManagedInstanceVulnerabilityAssessment", "ManagedInstanceVulnerabilityAssessmentListResult", + "ManagedLedgerDigestUploads", + "ManagedLedgerDigestUploadsListResult", "ManagedServerDnsAlias", "ManagedServerDnsAliasAcquisition", "ManagedServerDnsAliasCreation", @@ -785,6 +811,8 @@ "OperationDisplay", "OperationImpact", "OperationListResult", + "OutboundEnvironmentEndpoint", + "OutboundEnvironmentEndpointCollection", "OutboundFirewallRule", "OutboundFirewallRuleListResult", "PartnerInfo", @@ -819,6 +847,7 @@ "RecoverableDatabaseListResult", "RecoverableManagedDatabase", "RecoverableManagedDatabaseListResult", + "RefreshExternalGovernanceStatusOperationResult", "Remediation", "ReplicationLink", "ReplicationLinkListResult", @@ -833,6 +862,7 @@ "RestorePoint", "RestorePointListResult", "SQLVulnerabilityAssessmentScanListResult", + "ScheduleItem", "SecurityEvent", "SecurityEventCollection", "SecurityEventSqlInjectionAdditionalProperties", @@ -850,6 +880,8 @@ "ServerBlobAuditingPolicyListResult", "ServerCommunicationLink", "ServerCommunicationLinkListResult", + "ServerConfigurationOption", + "ServerConfigurationOptionListResult", "ServerConnectionPolicy", "ServerConnectionPolicyListResult", "ServerDevOpsAuditSettingsListResult", @@ -889,6 +921,8 @@ "SqlVulnerabilityAssessmentScanRecord", "SqlVulnerabilityAssessmentScanRecordListResult", "SqlVulnerabilityAssessmentScanResults", + "StartStopManagedInstanceSchedule", + "StartStopManagedInstanceScheduleListResult", "StorageCapability", "SubscriptionUsage", "SubscriptionUsageListResult", @@ -959,6 +993,7 @@ "AutomaticTuningOptionModeDesired", "AutomaticTuningServerMode", "AutomaticTuningServerReason", + "AvailabilityZoneType", "BackupStorageRedundancy", "BaselineName", "BlobAuditingPolicyState", @@ -976,6 +1011,7 @@ "DataMaskingState", "DataWarehouseUserActivityName", "DatabaseIdentityType", + "DatabaseKeyType", "DatabaseLicenseType", "DatabaseReadScale", "DatabaseState", @@ -987,6 +1023,7 @@ "ElasticPoolLicenseType", "ElasticPoolState", "EncryptionProtectorName", + "ExternalGovernanceStatus", "FailoverGroupReplicationRole", "GeoBackupPolicyName", "GeoBackupPolicyState", @@ -1014,6 +1051,8 @@ "ManagedInstanceLongTermRetentionPolicyName", "ManagedInstancePropertiesProvisioningState", "ManagedInstanceProxyOverride", + "ManagedLedgerDigestUploadsName", + "ManagedLedgerDigestUploadsState", "ManagedServerCreateMode", "ManagedShortTermRetentionPolicyName", "ManagementOperationState", @@ -1058,9 +1097,11 @@ "SensitivityLabelRank", "SensitivityLabelSource", "SensitivityLabelUpdateKind", + "ServerConfigurationOptionName", "ServerConnectionType", "ServerKeyType", "ServerNetworkAccessFlag", + "ServerPublicNetworkAccessFlag", "ServerTrustGroupPropertiesTrustScopesItem", "ServerWorkspaceFeature", "ServiceObjectiveName", @@ -1069,6 +1110,7 @@ "SqlAgentConfigurationPropertiesState", "SqlVulnerabilityAssessmentName", "SqlVulnerabilityAssessmentState", + "StartStopScheduleName", "StorageCapabilityStorageAccountType", "StorageKeyType", "SyncAgentState", diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py index b9bd3817a7a6..308cbcc0bad1 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py @@ -965,6 +965,11 @@ class Database(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype is_infra_encryption_enabled: bool :ivar federated_client_id: The Client id used for cross tenant per database CMK scenario. :vartype federated_client_id: str + :ivar keys: The resource ids of the user assigned identities to use. + :vartype keys: dict[str, ~azure.mgmt.sql.models.DatabaseKey] + :ivar encryption_protector: The azure key vault URI of the database if it's configured with per + Database Customer Managed Keys. + :vartype encryption_protector: str :ivar preferred_enclave_type: Type of enclave requested on the database i.e. Default or VBS enclaves. Known values are: "Default" and "VBS". :vartype preferred_enclave_type: str or ~azure.mgmt.sql.models.AlwaysEncryptedEnclaveType @@ -992,6 +997,33 @@ class Database(TrackedResource): # pylint: disable=too-many-instance-attributes For more details about “x-ms-authorization-auxiliary” header see https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. :vartype source_resource_id: str + :ivar manual_cutover: Whether or not customer controlled manual cutover needs to be done during + Update Database operation to Hyperscale tier. + + This property is only applicable when scaling database from Business Critical/General + Purpose/Premium/Standard tier to Hyperscale tier. + + When manualCutover is specified, the scaling operation will wait for user input to trigger + cutover to Hyperscale database. + + To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in + Waiting state. + :vartype manual_cutover: bool + :ivar perform_cutover: To trigger customer controlled manual cutover during the wait state + while Scaling operation is in progress. + + This property parameter is only applicable for scaling operations that are initiated along + with 'manualCutover' parameter. + + This property is only applicable when scaling database from Business Critical/General + Purpose/Premium/Standard tier to Hyperscale tier is already in progress. + + When performCutover is specified, the scaling operation will trigger cutover and perform + role-change to Hyperscale database. + :vartype perform_cutover: bool + :ivar availability_zone: Specifies the availability zone the database is pinned to. Known + values are: "NoPreference", "1", "2", and "3". + :vartype availability_zone: str or ~azure.mgmt.sql.models.AvailabilityZoneType """ _validation = { @@ -1068,8 +1100,13 @@ class Database(TrackedResource): # pylint: disable=too-many-instance-attributes "is_ledger_on": {"key": "properties.isLedgerOn", "type": "bool"}, "is_infra_encryption_enabled": {"key": "properties.isInfraEncryptionEnabled", "type": "bool"}, "federated_client_id": {"key": "properties.federatedClientId", "type": "str"}, + "keys": {"key": "properties.keys", "type": "{DatabaseKey}"}, + "encryption_protector": {"key": "properties.encryptionProtector", "type": "str"}, "preferred_enclave_type": {"key": "properties.preferredEnclaveType", "type": "str"}, "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"}, + "manual_cutover": {"key": "properties.manualCutover", "type": "bool"}, + "perform_cutover": {"key": "properties.performCutover", "type": "bool"}, + "availability_zone": {"key": "properties.availabilityZone", "type": "str"}, } def __init__( # pylint: disable=too-many-locals @@ -1103,8 +1140,13 @@ def __init__( # pylint: disable=too-many-locals maintenance_configuration_id: Optional[str] = None, is_ledger_on: Optional[bool] = None, federated_client_id: Optional[str] = None, + keys: Optional[Dict[str, "_models.DatabaseKey"]] = None, + encryption_protector: Optional[str] = None, preferred_enclave_type: Optional[Union[str, "_models.AlwaysEncryptedEnclaveType"]] = None, source_resource_id: Optional[str] = None, + manual_cutover: Optional[bool] = None, + perform_cutover: Optional[bool] = None, + availability_zone: Optional[Union[str, "_models.AvailabilityZoneType"]] = None, **kwargs: Any ) -> None: """ @@ -1233,6 +1275,11 @@ def __init__( # pylint: disable=too-many-locals :paramtype is_ledger_on: bool :keyword federated_client_id: The Client id used for cross tenant per database CMK scenario. :paramtype federated_client_id: str + :keyword keys: The resource ids of the user assigned identities to use. + :paramtype keys: dict[str, ~azure.mgmt.sql.models.DatabaseKey] + :keyword encryption_protector: The azure key vault URI of the database if it's configured with + per Database Customer Managed Keys. + :paramtype encryption_protector: str :keyword preferred_enclave_type: Type of enclave requested on the database i.e. Default or VBS enclaves. Known values are: "Default" and "VBS". :paramtype preferred_enclave_type: str or ~azure.mgmt.sql.models.AlwaysEncryptedEnclaveType @@ -1260,6 +1307,33 @@ def __init__( # pylint: disable=too-many-locals For more details about “x-ms-authorization-auxiliary” header see https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. :paramtype source_resource_id: str + :keyword manual_cutover: Whether or not customer controlled manual cutover needs to be done + during Update Database operation to Hyperscale tier. + + This property is only applicable when scaling database from Business Critical/General + Purpose/Premium/Standard tier to Hyperscale tier. + + When manualCutover is specified, the scaling operation will wait for user input to trigger + cutover to Hyperscale database. + + To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in + Waiting state. + :paramtype manual_cutover: bool + :keyword perform_cutover: To trigger customer controlled manual cutover during the wait state + while Scaling operation is in progress. + + This property parameter is only applicable for scaling operations that are initiated along + with 'manualCutover' parameter. + + This property is only applicable when scaling database from Business Critical/General + Purpose/Premium/Standard tier to Hyperscale tier is already in progress. + + When performCutover is specified, the scaling operation will trigger cutover and perform + role-change to Hyperscale database. + :paramtype perform_cutover: bool + :keyword availability_zone: Specifies the availability zone the database is pinned to. Known + values are: "NoPreference", "1", "2", and "3". + :paramtype availability_zone: str or ~azure.mgmt.sql.models.AvailabilityZoneType """ super().__init__(location=location, tags=tags, **kwargs) self.sku = sku @@ -1304,8 +1378,13 @@ def __init__( # pylint: disable=too-many-locals self.is_ledger_on = is_ledger_on self.is_infra_encryption_enabled = None self.federated_client_id = federated_client_id + self.keys = keys + self.encryption_protector = encryption_protector self.preferred_enclave_type = preferred_enclave_type self.source_resource_id = source_resource_id + self.manual_cutover = manual_cutover + self.perform_cutover = perform_cutover + self.availability_zone = availability_zone class DatabaseAdvancedThreatProtection(ProxyResource): @@ -2004,6 +2083,44 @@ def __init__( self.user_assigned_identities = user_assigned_identities +class DatabaseKey(_serialization.Model): + """Database level key used for encryption at rest. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The database key type. Only supported value is 'AzureKeyVault'. "AzureKeyVault" + :vartype type: str or ~azure.mgmt.sql.models.DatabaseKeyType + :ivar thumbprint: Thumbprint of the database key. + :vartype thumbprint: str + :ivar creation_date: The database key creation date. + :vartype creation_date: ~datetime.datetime + :ivar subregion: Subregion of the server key. + :vartype subregion: str + """ + + _validation = { + "type": {"readonly": True}, + "thumbprint": {"readonly": True}, + "creation_date": {"readonly": True}, + "subregion": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "thumbprint": {"key": "thumbprint", "type": "str"}, + "creation_date": {"key": "creationDate", "type": "iso-8601"}, + "subregion": {"key": "subregion", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.thumbprint = None + self.creation_date = None + self.subregion = None + + class DatabaseListResult(_serialization.Model): """A list of databases. @@ -2825,9 +2942,38 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance :vartype is_infra_encryption_enabled: bool :ivar federated_client_id: The Client id used for cross tenant per database CMK scenario. :vartype federated_client_id: str + :ivar keys: The resource ids of the user assigned identities to use. + :vartype keys: dict[str, ~azure.mgmt.sql.models.DatabaseKey] + :ivar encryption_protector: The azure key vault URI of the database if it's configured with per + Database Customer Managed Keys. + :vartype encryption_protector: str :ivar preferred_enclave_type: Type of enclave requested on the database i.e. Default or VBS enclaves. Known values are: "Default" and "VBS". :vartype preferred_enclave_type: str or ~azure.mgmt.sql.models.AlwaysEncryptedEnclaveType + :ivar manual_cutover: Whether or not customer controlled manual cutover needs to be done during + Update Database operation to Hyperscale tier. + + This property is only applicable when scaling database from Business Critical/General + Purpose/Premium/Standard tier to Hyperscale tier. + + When manualCutover is specified, the scaling operation will wait for user input to trigger + cutover to Hyperscale database. + + To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in + Waiting state. + :vartype manual_cutover: bool + :ivar perform_cutover: To trigger customer controlled manual cutover during the wait state + while Scaling operation is in progress. + + This property parameter is only applicable for scaling operations that are initiated along + with 'manualCutover' parameter. + + This property is only applicable when scaling database from Business Critical/General + Purpose/Premium/Standard tier to Hyperscale tier is already in progress. + + When performCutover is specified, the scaling operation will trigger cutover and perform + role-change to Hyperscale database. + :vartype perform_cutover: bool """ _validation = { @@ -2892,7 +3038,11 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance "is_ledger_on": {"key": "properties.isLedgerOn", "type": "bool"}, "is_infra_encryption_enabled": {"key": "properties.isInfraEncryptionEnabled", "type": "bool"}, "federated_client_id": {"key": "properties.federatedClientId", "type": "str"}, + "keys": {"key": "properties.keys", "type": "{DatabaseKey}"}, + "encryption_protector": {"key": "properties.encryptionProtector", "type": "str"}, "preferred_enclave_type": {"key": "properties.preferredEnclaveType", "type": "str"}, + "manual_cutover": {"key": "properties.manualCutover", "type": "bool"}, + "perform_cutover": {"key": "properties.performCutover", "type": "bool"}, } def __init__( # pylint: disable=too-many-locals @@ -2925,7 +3075,11 @@ def __init__( # pylint: disable=too-many-locals maintenance_configuration_id: Optional[str] = None, is_ledger_on: Optional[bool] = None, federated_client_id: Optional[str] = None, + keys: Optional[Dict[str, "_models.DatabaseKey"]] = None, + encryption_protector: Optional[str] = None, preferred_enclave_type: Optional[Union[str, "_models.AlwaysEncryptedEnclaveType"]] = None, + manual_cutover: Optional[bool] = None, + perform_cutover: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -3037,9 +3191,38 @@ def __init__( # pylint: disable=too-many-locals :paramtype is_ledger_on: bool :keyword federated_client_id: The Client id used for cross tenant per database CMK scenario. :paramtype federated_client_id: str + :keyword keys: The resource ids of the user assigned identities to use. + :paramtype keys: dict[str, ~azure.mgmt.sql.models.DatabaseKey] + :keyword encryption_protector: The azure key vault URI of the database if it's configured with + per Database Customer Managed Keys. + :paramtype encryption_protector: str :keyword preferred_enclave_type: Type of enclave requested on the database i.e. Default or VBS enclaves. Known values are: "Default" and "VBS". :paramtype preferred_enclave_type: str or ~azure.mgmt.sql.models.AlwaysEncryptedEnclaveType + :keyword manual_cutover: Whether or not customer controlled manual cutover needs to be done + during Update Database operation to Hyperscale tier. + + This property is only applicable when scaling database from Business Critical/General + Purpose/Premium/Standard tier to Hyperscale tier. + + When manualCutover is specified, the scaling operation will wait for user input to trigger + cutover to Hyperscale database. + + To trigger cutover, please provide 'performCutover' parameter when the Scaling operation is in + Waiting state. + :paramtype manual_cutover: bool + :keyword perform_cutover: To trigger customer controlled manual cutover during the wait state + while Scaling operation is in progress. + + This property parameter is only applicable for scaling operations that are initiated along + with 'manualCutover' parameter. + + This property is only applicable when scaling database from Business Critical/General + Purpose/Premium/Standard tier to Hyperscale tier is already in progress. + + When performCutover is specified, the scaling operation will trigger cutover and perform + role-change to Hyperscale database. + :paramtype perform_cutover: bool """ super().__init__(**kwargs) self.sku = sku @@ -3083,7 +3266,11 @@ def __init__( # pylint: disable=too-many-locals self.is_ledger_on = is_ledger_on self.is_infra_encryption_enabled = None self.federated_client_id = federated_client_id + self.keys = keys + self.encryption_protector = encryption_protector self.preferred_enclave_type = preferred_enclave_type + self.manual_cutover = manual_cutover + self.perform_cutover = perform_cutover class DatabaseUsage(ProxyResource): @@ -5103,6 +5290,59 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None +class EndpointDependency(_serialization.Model): + """A domain name that the managed instance service needs to communicate with, along with + additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar domain_name: The domain name of the dependency. + :vartype domain_name: str + :ivar endpoint_details: The IP Addresses and Ports used when connecting to DomainName. + :vartype endpoint_details: list[~azure.mgmt.sql.models.EndpointDetail] + """ + + _validation = { + "domain_name": {"readonly": True}, + "endpoint_details": {"readonly": True}, + } + + _attribute_map = { + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[EndpointDetail]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.domain_name = None + self.endpoint_details = None + + +class EndpointDetail(_serialization.Model): + """A domain name that the managed instance service needs to communicate with, along with + additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar port: The port an endpoint is connected to. + :vartype port: int + """ + + _validation = { + "port": {"readonly": True}, + } + + _attribute_map = { + "port": {"key": "port", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.port = None + + class ExportDatabaseDefinition(_serialization.Model): """Contains the information necessary to perform export database operation. @@ -10322,8 +10562,8 @@ class ManagedInstance(TrackedResource): # pylint: disable=too-many-instance-att :vartype tags: dict[str, str] :ivar identity: The Azure Active Directory identity of the managed instance. :vartype identity: ~azure.mgmt.sql.models.ResourceIdentity - :ivar sku: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, - BC_Gen5. + :ivar sku: Managed instance SKU. Allowed values for sku.name: GP_Gen5, GP_G8IM, GP_G8IH, + BC_Gen5, BC_G8IM, BC_G8IH. :vartype sku: ~azure.mgmt.sql.models.Sku :ivar provisioning_state: Known values are: "Creating", "Deleting", "Updating", "Unknown", "Succeeded", "Failed", "Accepted", "Created", "Deleted", "Unrecognized", "Running", "Canceled", @@ -10356,8 +10596,9 @@ class ManagedInstance(TrackedResource): # pylint: disable=too-many-instance-att :vartype license_type: str or ~azure.mgmt.sql.models.ManagedInstanceLicenseType :ivar v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. :vartype v_cores: int - :ivar storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 8192. - Increments of 32 GB allowed only. + :ivar storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 16384. + Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and + number of vCores. :vartype storage_size_in_gb: int :ivar collation: Collation of the managed instance. :vartype collation: str @@ -10414,7 +10655,9 @@ class ManagedInstance(TrackedResource): # pylint: disable=too-many-instance-att :vartype primary_user_assigned_identity_id: str :ivar key_id: A CMK URI of the key to use for encryption. :vartype key_id: str - :ivar administrators: The Azure Active Directory administrator of the server. + :ivar administrators: The Azure Active Directory administrator of the instance. This can only + be used at instance create time. If used for instance update, it will be ignored or it will + result in an error. For updates individual APIs will need to be used. :vartype administrators: ~azure.mgmt.sql.models.ManagedInstanceExternalAdministrator :ivar service_principal: The managed instance's service principal. :vartype service_principal: ~azure.mgmt.sql.models.ServicePrincipal @@ -10514,8 +10757,8 @@ def __init__( # pylint: disable=too-many-locals :paramtype tags: dict[str, str] :keyword identity: The Azure Active Directory identity of the managed instance. :paramtype identity: ~azure.mgmt.sql.models.ResourceIdentity - :keyword sku: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, - BC_Gen5. + :keyword sku: Managed instance SKU. Allowed values for sku.name: GP_Gen5, GP_G8IM, GP_G8IH, + BC_Gen5, BC_G8IM, BC_G8IH. :paramtype sku: ~azure.mgmt.sql.models.Sku :keyword managed_instance_create_mode: Specifies the mode of database creation. @@ -10539,8 +10782,9 @@ def __init__( # pylint: disable=too-many-locals :paramtype license_type: str or ~azure.mgmt.sql.models.ManagedInstanceLicenseType :keyword v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. :paramtype v_cores: int - :keyword storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 8192. - Increments of 32 GB allowed only. + :keyword storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 16384. + Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and + number of vCores. :paramtype storage_size_in_gb: int :keyword collation: Collation of the managed instance. :paramtype collation: str @@ -10587,7 +10831,9 @@ def __init__( # pylint: disable=too-many-locals :paramtype primary_user_assigned_identity_id: str :keyword key_id: A CMK URI of the key to use for encryption. :paramtype key_id: str - :keyword administrators: The Azure Active Directory administrator of the server. + :keyword administrators: The Azure Active Directory administrator of the instance. This can + only be used at instance create time. If used for instance update, it will be ignored or it + will result in an error. For updates individual APIs will need to be used. :paramtype administrators: ~azure.mgmt.sql.models.ManagedInstanceExternalAdministrator :keyword service_principal: The managed instance's service principal. :paramtype service_principal: ~azure.mgmt.sql.models.ServicePrincipal @@ -12339,8 +12585,9 @@ class ManagedInstanceUpdate(_serialization.Model): # pylint: disable=too-many-i :vartype license_type: str or ~azure.mgmt.sql.models.ManagedInstanceLicenseType :ivar v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. :vartype v_cores: int - :ivar storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 8192. - Increments of 32 GB allowed only. + :ivar storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 16384. + Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and + number of vCores. :vartype storage_size_in_gb: int :ivar collation: Collation of the managed instance. :vartype collation: str @@ -12397,7 +12644,9 @@ class ManagedInstanceUpdate(_serialization.Model): # pylint: disable=too-many-i :vartype primary_user_assigned_identity_id: str :ivar key_id: A CMK URI of the key to use for encryption. :vartype key_id: str - :ivar administrators: The Azure Active Directory administrator of the server. + :ivar administrators: The Azure Active Directory administrator of the instance. This can only + be used at instance create time. If used for instance update, it will be ignored or it will + result in an error. For updates individual APIs will need to be used. :vartype administrators: ~azure.mgmt.sql.models.ManagedInstanceExternalAdministrator :ivar service_principal: The managed instance's service principal. :vartype service_principal: ~azure.mgmt.sql.models.ServicePrincipal @@ -12510,8 +12759,9 @@ def __init__( # pylint: disable=too-many-locals :paramtype license_type: str or ~azure.mgmt.sql.models.ManagedInstanceLicenseType :keyword v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. :paramtype v_cores: int - :keyword storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 8192. - Increments of 32 GB allowed only. + :keyword storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum value: 16384. + Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and + number of vCores. :paramtype storage_size_in_gb: int :keyword collation: Collation of the managed instance. :paramtype collation: str @@ -12558,7 +12808,9 @@ def __init__( # pylint: disable=too-many-locals :paramtype primary_user_assigned_identity_id: str :keyword key_id: A CMK URI of the key to use for encryption. :paramtype key_id: str - :keyword administrators: The Azure Active Directory administrator of the server. + :keyword administrators: The Azure Active Directory administrator of the instance. This can + only be used at instance create time. If used for instance update, it will be ignored or it + will result in an error. For updates individual APIs will need to be used. :paramtype administrators: ~azure.mgmt.sql.models.ManagedInstanceExternalAdministrator :keyword service_principal: The managed instance's service principal. :paramtype service_principal: ~azure.mgmt.sql.models.ServicePrincipal @@ -12830,6 +13082,79 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None +class ManagedLedgerDigestUploads(ProxyResource): + """Azure SQL Database ledger digest upload settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar digest_storage_endpoint: The digest storage endpoint, which must be either an Azure blob + storage endpoint or an URI for Azure Confidential Ledger. + :vartype digest_storage_endpoint: str + :ivar state: Specifies the state of ledger digest upload. Known values are: "Enabled" and + "Disabled". + :vartype state: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "digest_storage_endpoint": {"key": "properties.digestStorageEndpoint", "type": "str"}, + "state": {"key": "properties.state", "type": "str"}, + } + + def __init__(self, *, digest_storage_endpoint: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword digest_storage_endpoint: The digest storage endpoint, which must be either an Azure + blob storage endpoint or an URI for Azure Confidential Ledger. + :paramtype digest_storage_endpoint: str + """ + super().__init__(**kwargs) + self.digest_storage_endpoint = digest_storage_endpoint + self.state = None + + +class ManagedLedgerDigestUploadsListResult(_serialization.Model): + """A list of ledger digest upload 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.sql.models.ManagedLedgerDigestUploads] + :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": "[ManagedLedgerDigestUploads]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + class ManagedServerDnsAlias(ProxyResource): """A managed server DNS alias. @@ -13727,6 +14052,65 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None +class OutboundEnvironmentEndpoint(_serialization.Model): + """An endpoint that the managed instance service requires outbound network access to. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar category: The type of service accessed by the managed instance service, e.g., Azure + Storage, Azure Active Directory, etc. + :vartype category: str + :ivar endpoints: The endpoints that the managed instance service communicates with in order to + function correctly. + :vartype endpoints: list[~azure.mgmt.sql.models.EndpointDependency] + """ + + _validation = { + "category": {"readonly": True}, + "endpoints": {"readonly": True}, + } + + _attribute_map = { + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[EndpointDependency]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.category = None + self.endpoints = None + + +class OutboundEnvironmentEndpointCollection(_serialization.Model): + """A collection of endpoints that the managed instance service requires outbound network access + to. + + 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.sql.models.OutboundEnvironmentEndpoint] + :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": "[OutboundEnvironmentEndpoint]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + class OutboundFirewallRule(ProxyResource): """An Azure SQL DB Server Outbound Firewall Rule. @@ -13985,6 +14369,8 @@ class PrivateEndpointConnectionProperties(_serialization.Model): :ivar private_endpoint: Private endpoint which the connection belongs to. :vartype private_endpoint: ~azure.mgmt.sql.models.PrivateEndpointProperty + :ivar group_ids: Group IDs. + :vartype group_ids: list[str] :ivar private_link_service_connection_state: Connection state of the private endpoint connection. :vartype private_link_service_connection_state: @@ -13995,11 +14381,13 @@ class PrivateEndpointConnectionProperties(_serialization.Model): """ _validation = { + "group_ids": {"readonly": True}, "provisioning_state": {"readonly": True}, } _attribute_map = { "private_endpoint": {"key": "privateEndpoint", "type": "PrivateEndpointProperty"}, + "group_ids": {"key": "groupIds", "type": "[str]"}, "private_link_service_connection_state": { "key": "privateLinkServiceConnectionState", "type": "PrivateLinkServiceConnectionStateProperty", @@ -14024,6 +14412,7 @@ def __init__( """ super().__init__(**kwargs) self.private_endpoint = private_endpoint + self.group_ids = None self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None @@ -14985,7 +15374,7 @@ def __init__( class RecoverableDatabase(ProxyResource): - """A recoverable database. + """A recoverable database resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -15001,9 +15390,10 @@ class RecoverableDatabase(ProxyResource): :vartype service_level_objective: str :ivar elastic_pool_name: The elastic pool name of the database. :vartype elastic_pool_name: str - :ivar last_available_backup_date: The last available backup date of the database (ISO8601 - format). + :ivar last_available_backup_date: The last available backup date. :vartype last_available_backup_date: ~datetime.datetime + :ivar keys: The resource ids of the user assigned identities to use. + :vartype keys: dict[str, ~azure.mgmt.sql.models.DatabaseKey] """ _validation = { @@ -15024,41 +15414,48 @@ class RecoverableDatabase(ProxyResource): "service_level_objective": {"key": "properties.serviceLevelObjective", "type": "str"}, "elastic_pool_name": {"key": "properties.elasticPoolName", "type": "str"}, "last_available_backup_date": {"key": "properties.lastAvailableBackupDate", "type": "iso-8601"}, + "keys": {"key": "properties.keys", "type": "{DatabaseKey}"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, keys: Optional[Dict[str, "_models.DatabaseKey"]] = None, **kwargs: Any) -> None: + """ + :keyword keys: The resource ids of the user assigned identities to use. + :paramtype keys: dict[str, ~azure.mgmt.sql.models.DatabaseKey] + """ super().__init__(**kwargs) self.edition = None self.service_level_objective = None self.elastic_pool_name = None self.last_available_backup_date = None + self.keys = keys class RecoverableDatabaseListResult(_serialization.Model): - """The response to a list recoverable databases request. + """A list of recoverable databases. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: A list of recoverable databases. Required. + :ivar value: Array of results. :vartype value: list[~azure.mgmt.sql.models.RecoverableDatabase] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str """ _validation = { - "value": {"required": True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { "value": {"key": "value", "type": "[RecoverableDatabase]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.RecoverableDatabase"], **kwargs: Any) -> None: - """ - :keyword value: A list of recoverable databases. Required. - :paramtype value: list[~azure.mgmt.sql.models.RecoverableDatabase] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.value = value + self.value = None + self.next_link = None class RecoverableManagedDatabase(ProxyResource): @@ -15124,6 +15521,66 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None +class RefreshExternalGovernanceStatusOperationResult(ProxyResource): + """An RefreshExternalGovernanceStatus operation result resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar request_id: Request Id. + :vartype request_id: str + :ivar request_type: Request type. + :vartype request_type: str + :ivar queued_time: Queued time. + :vartype queued_time: str + :ivar server_name: Server name. + :vartype server_name: str + :ivar status: Operation status. + :vartype status: str + :ivar error_message: Error message. + :vartype error_message: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "request_id": {"readonly": True}, + "request_type": {"readonly": True}, + "queued_time": {"readonly": True}, + "server_name": {"readonly": True}, + "status": {"readonly": True}, + "error_message": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "request_id": {"key": "properties.requestId", "type": "str"}, + "request_type": {"key": "properties.requestType", "type": "str"}, + "queued_time": {"key": "properties.queuedTime", "type": "str"}, + "server_name": {"key": "properties.serverName", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "error_message": {"key": "properties.errorMessage", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.request_id = None + self.request_type = None + self.queued_time = None + self.server_name = None + self.status = None + self.error_message = None + + class Remediation(_serialization.Model): """SQL Vulnerability Assessment remediation Details. @@ -15386,6 +15843,8 @@ class RestorableDroppedDatabase(ProxyResource): # pylint: disable=too-many-inst :ivar backup_storage_redundancy: The storage account type used to store backups for this database. Known values are: "Geo", "Local", "Zone", and "GeoZone". :vartype backup_storage_redundancy: str or ~azure.mgmt.sql.models.BackupStorageRedundancy + :ivar keys: The resource ids of the user assigned identities to use. + :vartype keys: dict[str, ~azure.mgmt.sql.models.DatabaseKey] """ _validation = { @@ -15413,6 +15872,7 @@ class RestorableDroppedDatabase(ProxyResource): # pylint: disable=too-many-inst "deletion_date": {"key": "properties.deletionDate", "type": "iso-8601"}, "earliest_restore_date": {"key": "properties.earliestRestoreDate", "type": "iso-8601"}, "backup_storage_redundancy": {"key": "properties.backupStorageRedundancy", "type": "str"}, + "keys": {"key": "properties.keys", "type": "{DatabaseKey}"}, } def __init__( @@ -15421,6 +15881,7 @@ def __init__( sku: Optional["_models.Sku"] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + keys: Optional[Dict[str, "_models.DatabaseKey"]] = None, **kwargs: Any ) -> None: """ @@ -15430,6 +15891,8 @@ def __init__( :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword keys: The resource ids of the user assigned identities to use. + :paramtype keys: dict[str, ~azure.mgmt.sql.models.DatabaseKey] """ super().__init__(**kwargs) self.sku = sku @@ -15441,6 +15904,7 @@ def __init__( self.deletion_date = None self.earliest_restore_date = None self.backup_storage_redundancy = None + self.keys = keys class RestorableDroppedDatabaseListResult(_serialization.Model): @@ -15647,6 +16111,65 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None +class ScheduleItem(_serialization.Model): + """Schedule info describing when the server should be started or stopped. + + All required parameters must be populated in order to send to Azure. + + :ivar start_day: Start day. Required. Known values are: "Sunday", "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", and "Saturday". + :vartype start_day: str or ~azure.mgmt.sql.models.DayOfWeek + :ivar start_time: Start time. Required. + :vartype start_time: str + :ivar stop_day: Stop day. Required. Known values are: "Sunday", "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", and "Saturday". + :vartype stop_day: str or ~azure.mgmt.sql.models.DayOfWeek + :ivar stop_time: Stop time. Required. + :vartype stop_time: str + """ + + _validation = { + "start_day": {"required": True}, + "start_time": {"required": True}, + "stop_day": {"required": True}, + "stop_time": {"required": True}, + } + + _attribute_map = { + "start_day": {"key": "startDay", "type": "str"}, + "start_time": {"key": "startTime", "type": "str"}, + "stop_day": {"key": "stopDay", "type": "str"}, + "stop_time": {"key": "stopTime", "type": "str"}, + } + + def __init__( + self, + *, + start_day: Union[str, "_models.DayOfWeek"], + start_time: str, + stop_day: Union[str, "_models.DayOfWeek"], + stop_time: str, + **kwargs: Any + ) -> None: + """ + :keyword start_day: Start day. Required. Known values are: "Sunday", "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", and "Saturday". + :paramtype start_day: str or ~azure.mgmt.sql.models.DayOfWeek + :keyword start_time: Start time. Required. + :paramtype start_time: str + :keyword stop_day: Stop day. Required. Known values are: "Sunday", "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", and "Saturday". + :paramtype stop_day: str or ~azure.mgmt.sql.models.DayOfWeek + :keyword stop_time: Stop time. Required. + :paramtype stop_time: str + """ + super().__init__(**kwargs) + self.start_day = start_day + self.start_time = start_time + self.stop_day = stop_day + self.stop_time = stop_time + + class SecurityEvent(ProxyResource): # pylint: disable=too-many-instance-attributes """A security event. @@ -16095,9 +16618,9 @@ class Server(TrackedResource): # pylint: disable=too-many-instance-attributes :ivar minimal_tls_version: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. :vartype minimal_tls_version: str :ivar public_network_access: Whether or not public endpoint access is allowed for this server. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are: - "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag + Value is optional but if passed in, must be 'Enabled' or 'Disabled' or 'SecuredByPerimeter'. + Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype public_network_access: str or ~azure.mgmt.sql.models.ServerPublicNetworkAccessFlag :ivar workspace_feature: Whether or not existing server has a workspace created and if it allows connection from workspace. Known values are: "Connected" and "Disconnected". :vartype workspace_feature: str or ~azure.mgmt.sql.models.ServerWorkspaceFeature @@ -16108,13 +16631,18 @@ class Server(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype federated_client_id: str :ivar key_id: A CMK URI of the key to use for encryption. :vartype key_id: str - :ivar administrators: The Azure Active Directory identity of the server. + :ivar administrators: The Azure Active Directory administrator of the server. This can only be + used at server create time. If used for server update, it will be ignored or it will result in + an error. For updates individual APIs will need to be used. :vartype administrators: ~azure.mgmt.sql.models.ServerExternalAdministrator :ivar restrict_outbound_network_access: Whether or not to restrict outbound network access for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are: "Enabled" and "Disabled". :vartype restrict_outbound_network_access: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag + :ivar external_governance_status: Status of external governance. Known values are: "Enabled" + and "Disabled". + :vartype external_governance_status: str or ~azure.mgmt.sql.models.ExternalGovernanceStatus """ _validation = { @@ -16127,6 +16655,7 @@ class Server(TrackedResource): # pylint: disable=too-many-instance-attributes "fully_qualified_domain_name": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, "workspace_feature": {"readonly": True}, + "external_governance_status": {"readonly": True}, } _attribute_map = { @@ -16154,6 +16683,7 @@ class Server(TrackedResource): # pylint: disable=too-many-instance-attributes "key_id": {"key": "properties.keyId", "type": "str"}, "administrators": {"key": "properties.administrators", "type": "ServerExternalAdministrator"}, "restrict_outbound_network_access": {"key": "properties.restrictOutboundNetworkAccess", "type": "str"}, + "external_governance_status": {"key": "properties.externalGovernanceStatus", "type": "str"}, } def __init__( @@ -16166,7 +16696,7 @@ def __init__( administrator_login_password: Optional[str] = None, version: Optional[str] = None, minimal_tls_version: Optional[str] = None, - public_network_access: Optional[Union[str, "_models.ServerNetworkAccessFlag"]] = None, + public_network_access: Optional[Union[str, "_models.ServerPublicNetworkAccessFlag"]] = None, primary_user_assigned_identity_id: Optional[str] = None, federated_client_id: Optional[str] = None, key_id: Optional[str] = None, @@ -16192,9 +16722,9 @@ def __init__( :keyword minimal_tls_version: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. :paramtype minimal_tls_version: str :keyword public_network_access: Whether or not public endpoint access is allowed for this - server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are: - "Enabled" and "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag + server. Value is optional but if passed in, must be 'Enabled' or 'Disabled' or + 'SecuredByPerimeter'. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + :paramtype public_network_access: str or ~azure.mgmt.sql.models.ServerPublicNetworkAccessFlag :keyword primary_user_assigned_identity_id: The resource id of a user assigned identity to be used by default. :paramtype primary_user_assigned_identity_id: str @@ -16202,7 +16732,9 @@ def __init__( :paramtype federated_client_id: str :keyword key_id: A CMK URI of the key to use for encryption. :paramtype key_id: str - :keyword administrators: The Azure Active Directory identity of the server. + :keyword administrators: The Azure Active Directory administrator of the server. This can only + be used at server create time. If used for server update, it will be ignored or it will result + in an error. For updates individual APIs will need to be used. :paramtype administrators: ~azure.mgmt.sql.models.ServerExternalAdministrator :keyword restrict_outbound_network_access: Whether or not to restrict outbound network access for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known @@ -16227,6 +16759,7 @@ def __init__( self.key_id = key_id self.administrators = administrators self.restrict_outbound_network_access = restrict_outbound_network_access + self.external_governance_status = None class ServerAdvancedThreatProtection(ProxyResource): @@ -16895,6 +17428,77 @@ def __init__(self, *, value: Optional[List["_models.ServerCommunicationLink"]] = self.value = value +class ServerConfigurationOption(ProxyResource): + """A server configuration option. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar server_configuration_option_value: Value of the server configuration option. + :vartype server_configuration_option_value: int + :ivar provisioning_state: Provisioning state of server configuration option. Known values are: + "Created", "InProgress", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.sql.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "server_configuration_option_value": {"key": "properties.serverConfigurationOptionValue", "type": "int"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__(self, *, server_configuration_option_value: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword server_configuration_option_value: Value of the server configuration option. + :paramtype server_configuration_option_value: int + """ + super().__init__(**kwargs) + self.server_configuration_option_value = server_configuration_option_value + self.provisioning_state = None + + +class ServerConfigurationOptionListResult(_serialization.Model): + """A list of server configuration options. + + 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.sql.models.ServerConfigurationOption] + :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": "[ServerConfigurationOption]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + class ServerConnectionPolicy(ProxyResource): """A server connection policy. @@ -17904,9 +18508,9 @@ class ServerUpdate(_serialization.Model): # pylint: disable=too-many-instance-a :ivar minimal_tls_version: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. :vartype minimal_tls_version: str :ivar public_network_access: Whether or not public endpoint access is allowed for this server. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are: - "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag + Value is optional but if passed in, must be 'Enabled' or 'Disabled' or 'SecuredByPerimeter'. + Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype public_network_access: str or ~azure.mgmt.sql.models.ServerPublicNetworkAccessFlag :ivar workspace_feature: Whether or not existing server has a workspace created and if it allows connection from workspace. Known values are: "Connected" and "Disconnected". :vartype workspace_feature: str or ~azure.mgmt.sql.models.ServerWorkspaceFeature @@ -17917,13 +18521,18 @@ class ServerUpdate(_serialization.Model): # pylint: disable=too-many-instance-a :vartype federated_client_id: str :ivar key_id: A CMK URI of the key to use for encryption. :vartype key_id: str - :ivar administrators: The Azure Active Directory identity of the server. + :ivar administrators: The Azure Active Directory administrator of the server. This can only be + used at server create time. If used for server update, it will be ignored or it will result in + an error. For updates individual APIs will need to be used. :vartype administrators: ~azure.mgmt.sql.models.ServerExternalAdministrator :ivar restrict_outbound_network_access: Whether or not to restrict outbound network access for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are: "Enabled" and "Disabled". :vartype restrict_outbound_network_access: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag + :ivar external_governance_status: Status of external governance. Known values are: "Enabled" + and "Disabled". + :vartype external_governance_status: str or ~azure.mgmt.sql.models.ExternalGovernanceStatus """ _validation = { @@ -17931,6 +18540,7 @@ class ServerUpdate(_serialization.Model): # pylint: disable=too-many-instance-a "fully_qualified_domain_name": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, "workspace_feature": {"readonly": True}, + "external_governance_status": {"readonly": True}, } _attribute_map = { @@ -17953,6 +18563,7 @@ class ServerUpdate(_serialization.Model): # pylint: disable=too-many-instance-a "key_id": {"key": "properties.keyId", "type": "str"}, "administrators": {"key": "properties.administrators", "type": "ServerExternalAdministrator"}, "restrict_outbound_network_access": {"key": "properties.restrictOutboundNetworkAccess", "type": "str"}, + "external_governance_status": {"key": "properties.externalGovernanceStatus", "type": "str"}, } def __init__( @@ -17964,7 +18575,7 @@ def __init__( administrator_login_password: Optional[str] = None, version: Optional[str] = None, minimal_tls_version: Optional[str] = None, - public_network_access: Optional[Union[str, "_models.ServerNetworkAccessFlag"]] = None, + public_network_access: Optional[Union[str, "_models.ServerPublicNetworkAccessFlag"]] = None, primary_user_assigned_identity_id: Optional[str] = None, federated_client_id: Optional[str] = None, key_id: Optional[str] = None, @@ -17988,9 +18599,9 @@ def __init__( :keyword minimal_tls_version: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. :paramtype minimal_tls_version: str :keyword public_network_access: Whether or not public endpoint access is allowed for this - server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known values are: - "Enabled" and "Disabled". - :paramtype public_network_access: str or ~azure.mgmt.sql.models.ServerNetworkAccessFlag + server. Value is optional but if passed in, must be 'Enabled' or 'Disabled' or + 'SecuredByPerimeter'. Known values are: "Enabled", "Disabled", and "SecuredByPerimeter". + :paramtype public_network_access: str or ~azure.mgmt.sql.models.ServerPublicNetworkAccessFlag :keyword primary_user_assigned_identity_id: The resource id of a user assigned identity to be used by default. :paramtype primary_user_assigned_identity_id: str @@ -17998,7 +18609,9 @@ def __init__( :paramtype federated_client_id: str :keyword key_id: A CMK URI of the key to use for encryption. :paramtype key_id: str - :keyword administrators: The Azure Active Directory identity of the server. + :keyword administrators: The Azure Active Directory administrator of the server. This can only + be used at server create time. If used for server update, it will be ignored or it will result + in an error. For updates individual APIs will need to be used. :paramtype administrators: ~azure.mgmt.sql.models.ServerExternalAdministrator :keyword restrict_outbound_network_access: Whether or not to restrict outbound network access for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Known @@ -18023,6 +18636,7 @@ def __init__( self.key_id = key_id self.administrators = administrators self.restrict_outbound_network_access = restrict_outbound_network_access + self.external_governance_status = None class ServerUsage(_serialization.Model): @@ -18973,6 +19587,106 @@ def __init__(self, **kwargs: Any) -> None: self.rule_metadata = None +class StartStopManagedInstanceSchedule(ProxyResource): + """Managed instance's Start/Stop schedule. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: System data of the scheduled resource. + :vartype system_data: ~azure.mgmt.sql.models.SystemData + :ivar description: The description of the schedule. + :vartype description: str + :ivar time_zone_id: The time zone of the schedule. + :vartype time_zone_id: str + :ivar schedule_list: Schedule list. + :vartype schedule_list: list[~azure.mgmt.sql.models.ScheduleItem] + :ivar next_run_action: Next action to be executed (Start or Stop). + :vartype next_run_action: str + :ivar next_execution_time: Timestamp when the next action will be executed in the corresponding + schedule time zone. + :vartype next_execution_time: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "next_run_action": {"readonly": True}, + "next_execution_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"}, + "description": {"key": "properties.description", "type": "str"}, + "time_zone_id": {"key": "properties.timeZoneId", "type": "str"}, + "schedule_list": {"key": "properties.scheduleList", "type": "[ScheduleItem]"}, + "next_run_action": {"key": "properties.nextRunAction", "type": "str"}, + "next_execution_time": {"key": "properties.nextExecutionTime", "type": "str"}, + } + + def __init__( + self, + *, + description: str = "", + time_zone_id: str = "UTC", + schedule_list: Optional[List["_models.ScheduleItem"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: The description of the schedule. + :paramtype description: str + :keyword time_zone_id: The time zone of the schedule. + :paramtype time_zone_id: str + :keyword schedule_list: Schedule list. + :paramtype schedule_list: list[~azure.mgmt.sql.models.ScheduleItem] + """ + super().__init__(**kwargs) + self.system_data = None + self.description = description + self.time_zone_id = time_zone_id + self.schedule_list = schedule_list + self.next_run_action = None + self.next_execution_time = None + + +class StartStopManagedInstanceScheduleListResult(_serialization.Model): + """Managed instance's Start/Stop schedule list result. + + 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.sql.models.StartStopManagedInstanceSchedule] + :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": "[StartStopManagedInstanceSchedule]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + class StorageCapability(_serialization.Model): """The storage account type capability. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_sql_management_client_enums.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_sql_management_client_enums.py index 51d4b85095ad..2670cd53f424 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_sql_management_client_enums.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_sql_management_client_enums.py @@ -148,6 +148,15 @@ class AutomaticTuningServerReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): AUTO_CONFIGURED = "AutoConfigured" +class AvailabilityZoneType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the availability zone the database is pinned to.""" + + NO_PREFERENCE = "NoPreference" + ONE = "1" + TWO = "2" + THREE = "3" + + class BackupStorageRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The storage redundancy type of the copied backup.""" @@ -312,6 +321,12 @@ class DatabaseIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED = "UserAssigned" +class DatabaseKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The database key type. Only supported value is 'AzureKeyVault'.""" + + AZURE_KEY_VAULT = "AzureKeyVault" + + class DatabaseLicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to apply for this database. ``LicenseIncluded`` if you need a license, or ``BasePrice`` if you have a license and are eligible for the Azure Hybrid Benefit. @@ -466,6 +481,13 @@ class EncryptionProtectorName(str, Enum, metaclass=CaseInsensitiveEnumMeta): CURRENT = "current" +class ExternalGovernanceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of external governance.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class FailoverGroupReplicationRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Local replication role of the failover group instance.""" @@ -711,6 +733,19 @@ class ManagedInstanceProxyOverride(str, Enum, metaclass=CaseInsensitiveEnumMeta) DEFAULT = "Default" +class ManagedLedgerDigestUploadsName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ManagedLedgerDigestUploadsName.""" + + CURRENT = "current" + + +class ManagedLedgerDigestUploadsState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the state of ledger digest upload.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class ManagedServerCreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the mode of database creation. @@ -1087,6 +1122,12 @@ class SensitivityLabelUpdateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): REMOVE = "remove" +class ServerConfigurationOptionName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ServerConfigurationOptionName.""" + + ALLOW_POLYBASE_EXPORT = "allowPolybaseExport" + + class ServerConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The server connection type.""" @@ -1103,7 +1144,7 @@ class ServerKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ServerNetworkAccessFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether or not public endpoint access is allowed for this server. Value is optional but if + """Whether or not to restrict outbound network access for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. """ @@ -1111,6 +1152,16 @@ class ServerNetworkAccessFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" +class ServerPublicNetworkAccessFlag(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether or not public endpoint access is allowed for this server. Value is optional but if + passed in, must be 'Enabled' or 'Disabled' or 'SecuredByPerimeter'. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + SECURED_BY_PERIMETER = "SecuredByPerimeter" + + class ServerTrustGroupPropertiesTrustScopesItem(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ServerTrustGroupPropertiesTrustScopesItem.""" @@ -1238,6 +1289,12 @@ class SqlVulnerabilityAssessmentState(str, Enum, metaclass=CaseInsensitiveEnumMe DISABLED = "Disabled" +class StartStopScheduleName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """StartStopScheduleName.""" + + DEFAULT = "default" + + class StorageCapabilityStorageAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The storage account type for the database's backups.""" diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index f4c14a4eade9..93aefa270e1a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._recoverable_databases_operations import RecoverableDatabasesOperations from ._data_masking_policies_operations import DataMaskingPoliciesOperations from ._data_masking_rules_operations import DataMaskingRulesOperations from ._geo_backup_policies_operations import GeoBackupPoliciesOperations @@ -110,19 +109,15 @@ from ._virtual_network_rules_operations import VirtualNetworkRulesOperations from ._workload_classifiers_operations import WorkloadClassifiersOperations from ._workload_groups_operations import WorkloadGroupsOperations -from ._transparent_data_encryptions_operations import TransparentDataEncryptionsOperations from ._backup_short_term_retention_policies_operations import BackupShortTermRetentionPoliciesOperations from ._database_extensions_operations import DatabaseExtensionsOperations from ._database_operations_operations import DatabaseOperationsOperations from ._database_usages_operations import DatabaseUsagesOperations from ._ledger_digest_uploads_operations import LedgerDigestUploadsOperations from ._outbound_firewall_rules_operations import OutboundFirewallRulesOperations -from ._servers_operations import ServersOperations from ._usages_operations import UsagesOperations from ._long_term_retention_backups_operations import LongTermRetentionBackupsOperations from ._long_term_retention_managed_instance_backups_operations import LongTermRetentionManagedInstanceBackupsOperations -from ._managed_instances_operations import ManagedInstancesOperations -from ._restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from ._restorable_dropped_managed_databases_operations import RestorableDroppedManagedDatabasesOperations from ._server_connection_policies_operations import ServerConnectionPoliciesOperations from ._distributed_availability_groups_operations import DistributedAvailabilityGroupsOperations @@ -181,13 +176,21 @@ from ._instance_failover_groups_operations import InstanceFailoverGroupsOperations from ._managed_database_restore_details_operations import ManagedDatabaseRestoreDetailsOperations from ._managed_databases_operations import ManagedDatabasesOperations +from ._database_encryption_protectors_operations import DatabaseEncryptionProtectorsOperations +from ._managed_instances_operations import ManagedInstancesOperations +from ._managed_ledger_digest_uploads_operations import ManagedLedgerDigestUploadsOperations +from ._recoverable_databases_operations import RecoverableDatabasesOperations +from ._restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations +from ._server_configuration_options_operations import ServerConfigurationOptionsOperations +from ._servers_operations import ServersOperations +from ._start_stop_managed_instance_schedules_operations import StartStopManagedInstanceSchedulesOperations +from ._transparent_data_encryptions_operations import TransparentDataEncryptionsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "RecoverableDatabasesOperations", "DataMaskingPoliciesOperations", "DataMaskingRulesOperations", "GeoBackupPoliciesOperations", @@ -277,19 +280,15 @@ "VirtualNetworkRulesOperations", "WorkloadClassifiersOperations", "WorkloadGroupsOperations", - "TransparentDataEncryptionsOperations", "BackupShortTermRetentionPoliciesOperations", "DatabaseExtensionsOperations", "DatabaseOperationsOperations", "DatabaseUsagesOperations", "LedgerDigestUploadsOperations", "OutboundFirewallRulesOperations", - "ServersOperations", "UsagesOperations", "LongTermRetentionBackupsOperations", "LongTermRetentionManagedInstanceBackupsOperations", - "ManagedInstancesOperations", - "RestorableDroppedDatabasesOperations", "RestorableDroppedManagedDatabasesOperations", "ServerConnectionPoliciesOperations", "DistributedAvailabilityGroupsOperations", @@ -332,6 +331,15 @@ "InstanceFailoverGroupsOperations", "ManagedDatabaseRestoreDetailsOperations", "ManagedDatabasesOperations", + "DatabaseEncryptionProtectorsOperations", + "ManagedInstancesOperations", + "ManagedLedgerDigestUploadsOperations", + "RecoverableDatabasesOperations", + "RestorableDroppedDatabasesOperations", + "ServerConfigurationOptionsOperations", + "ServersOperations", + "StartStopManagedInstanceSchedulesOperations", + "TransparentDataEncryptionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_backup_short_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_backup_short_term_retention_policies_operations.py index 8d987ea3500a..15cd1ad601a1 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_backup_short_term_retention_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_backup_short_term_retention_policies_operations.py @@ -476,8 +476,8 @@ def begin_create_or_update( :type database_name: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + BackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.BackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -726,8 +726,8 @@ def begin_update( :type database_name: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + BackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.BackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_data_masking_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_data_masking_policies_operations.py index 9ff8c50cfbac..f3e9df29d653 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_data_masking_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_data_masking_policies_operations.py @@ -217,8 +217,8 @@ def create_or_update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Parameters for creating or updating a data masking policy. Is either a model - type or a IO type. Required. + :param parameters: Parameters for creating or updating a data masking policy. Is either a + DataMaskingPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DataMaskingPolicy or IO :keyword data_masking_policy_name: The name of the database for which the data masking rule applies. Default value is "Default". Note that overriding this default value may result in diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_data_masking_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_data_masking_rules_operations.py index ca7d113e7f79..7fb5a7e980af 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_data_masking_rules_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_data_masking_rules_operations.py @@ -236,7 +236,7 @@ def create_or_update( :param data_masking_rule_name: The name of the data masking rule. Required. :type data_masking_rule_name: str :param parameters: The required parameters for creating or updating a data masking rule. Is - either a model type or a IO type. Required. + either a DataMaskingRule type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DataMaskingRule or IO :keyword data_masking_policy_name: The name of the database for which the data masking rule applies. Default value is "Default". Note that overriding this default value may result in diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_advanced_threat_protection_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_advanced_threat_protection_settings_operations.py index 50f456a9f69b..5b1f0548c282 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_advanced_threat_protection_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_advanced_threat_protection_settings_operations.py @@ -438,8 +438,8 @@ def create_or_update( "Default" Required. :type advanced_threat_protection_name: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionName - :param parameters: The database Advanced Threat Protection state. Is either a model type or a - IO type. Required. + :param parameters: The database Advanced Threat Protection state. Is either a + DatabaseAdvancedThreatProtection type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseAdvancedThreatProtection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_advisors_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_advisors_operations.py index 75e9b3eb2b53..432ff85af11b 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_advisors_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_advisors_operations.py @@ -419,7 +419,7 @@ def update( :type database_name: str :param advisor_name: The name of the Database Advisor. Required. :type advisor_name: str - :param parameters: The requested advisor resource state. Is either a model type or a IO type. + :param parameters: The requested advisor resource state. Is either a Advisor type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.Advisor or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_automatic_tuning_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_automatic_tuning_operations.py index 7426d1aeb267..f537ed0e15ea 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_automatic_tuning_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_automatic_tuning_operations.py @@ -277,8 +277,8 @@ def update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The requested automatic tuning resource state. Is either a model type or a - IO type. Required. + :param parameters: The requested automatic tuning resource state. Is either a + DatabaseAutomaticTuning type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseAutomaticTuning or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_blob_auditing_policies_operations.py index 21268097feb5..7bfd1a53bb6f 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_blob_auditing_policies_operations.py @@ -412,8 +412,8 @@ def create_or_update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The database blob auditing policy. Is either a model type or a IO type. - Required. + :param parameters: The database blob auditing policy. Is either a DatabaseBlobAuditingPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseBlobAuditingPolicy or IO :keyword blob_auditing_policy_name: The name of the blob auditing policy. Default value is "default". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_encryption_protectors_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_encryption_protectors_operations.py new file mode 100644 index 000000000000..ee8f2a338e97 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_encryption_protectors_operations.py @@ -0,0 +1,403 @@ +# pylint: disable=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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_revalidate_request( + resource_group_name: str, + server_name: str, + database_name: str, + encryption_protector_name: Union[str, _models.EncryptionProtectorName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revalidate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serverName": _SERIALIZER.url("server_name", server_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + "encryptionProtectorName": _SERIALIZER.url("encryption_protector_name", encryption_protector_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_revert_request( + resource_group_name: str, + server_name: str, + database_name: str, + encryption_protector_name: Union[str, _models.EncryptionProtectorName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revert", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serverName": _SERIALIZER.url("server_name", server_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + "encryptionProtectorName": _SERIALIZER.url("encryption_protector_name", encryption_protector_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +class DatabaseEncryptionProtectorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.SqlManagementClient`'s + :attr:`database_encryption_protectors` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _revalidate_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + server_name: str, + database_name: str, + encryption_protector_name: Union[str, _models.EncryptionProtectorName], + **kwargs: Any + ) -> None: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_revalidate_request( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + encryption_protector_name=encryption_protector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._revalidate_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _revalidate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revalidate" + } + + @distributed_trace + def begin_revalidate( + self, + resource_group_name: str, + server_name: str, + database_name: str, + encryption_protector_name: Union[str, _models.EncryptionProtectorName], + **kwargs: Any + ) -> LROPoller[None]: + """Revalidates an existing encryption protector for a particular database. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. 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. + :type database_name: str + :param encryption_protector_name: The name of the encryption protector to be updated. "current" + Required. + :type encryption_protector_name: str or ~azure.mgmt.sql.models.EncryptionProtectorName + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + 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._revalidate_initial( # type: ignore + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + encryption_protector_name=encryption_protector_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_revalidate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revalidate" + } + + def _revert_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + server_name: str, + database_name: str, + encryption_protector_name: Union[str, _models.EncryptionProtectorName], + **kwargs: Any + ) -> None: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_revert_request( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + encryption_protector_name=encryption_protector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._revert_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _revert_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revert" + } + + @distributed_trace + def begin_revert( + self, + resource_group_name: str, + server_name: str, + database_name: str, + encryption_protector_name: Union[str, _models.EncryptionProtectorName], + **kwargs: Any + ) -> LROPoller[None]: + """Reverts an existing encryption protector for a particular database. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. 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. + :type database_name: str + :param encryption_protector_name: The name of the encryption protector to be updated. "current" + Required. + :type encryption_protector_name: str or ~azure.mgmt.sql.models.EncryptionProtectorName + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + 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._revert_initial( # type: ignore + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + encryption_protector_name=encryption_protector_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_revert.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/encryptionProtector/{encryptionProtectorName}/revert" + } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_extensions_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_extensions_operations.py index a6995987fa5c..140e26bf8991 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_extensions_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_extensions_operations.py @@ -420,8 +420,8 @@ def begin_create_or_update( :type database_name: str :param extension_name: Required. :type extension_name: str - :param parameters: The database import request parameters. Is either a model type or a IO type. - Required. + :param parameters: The database import request parameters. Is either a DatabaseExtensions type + or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseExtensions or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_recommended_actions_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_recommended_actions_operations.py index 54f4d3bcb8c5..873f5efc8ec7 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_recommended_actions_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_recommended_actions_operations.py @@ -434,8 +434,8 @@ def update( :type advisor_name: str :param recommended_action_name: The name of Database Recommended Action. Required. :type recommended_action_name: str - :param parameters: The requested recommended action resource state. Is either a model type or a - IO type. Required. + :param parameters: The requested recommended action resource state. Is either a + RecommendedAction type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.RecommendedAction or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_security_alert_policies_operations.py index a2c944af9b17..9a8975389ca7 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_security_alert_policies_operations.py @@ -345,8 +345,8 @@ def create_or_update( :type database_name: str :param security_alert_policy_name: The name of the security alert policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName - :param parameters: The database security alert policy. Is either a model type or a IO type. - Required. + :param parameters: The database security alert policy. Is either a DatabaseSecurityAlertPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseSecurityAlertPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_sql_vulnerability_assessment_baselines_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_sql_vulnerability_assessment_baselines_operations.py index 94aaf2799d03..6fa8dcc4b8e3 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_sql_vulnerability_assessment_baselines_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_sql_vulnerability_assessment_baselines_operations.py @@ -472,8 +472,8 @@ def create_or_update( :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName :param baseline_name: "default" Required. :type baseline_name: str or ~azure.mgmt.sql.models.BaselineName - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_sql_vulnerability_assessment_rule_baselines_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_sql_vulnerability_assessment_rule_baselines_operations.py index 4e0dca1ad673..60bed0944c0c 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_sql_vulnerability_assessment_rule_baselines_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_sql_vulnerability_assessment_rule_baselines_operations.py @@ -534,8 +534,8 @@ def create_or_update( :type baseline_name: str or ~azure.mgmt.sql.models.BaselineName :param rule_id: The vulnerability assessment rule ID. Required. :type rule_id: str - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_vulnerability_assessment_rule_baselines_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_vulnerability_assessment_rule_baselines_operations.py index 3f0deded38ff..ffb95f9e0b01 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_vulnerability_assessment_rule_baselines_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_vulnerability_assessment_rule_baselines_operations.py @@ -400,8 +400,8 @@ def create_or_update( baseline on a database level rule and master for server level rule). Known values are: "master" and "default". Required. :type baseline_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseVulnerabilityAssessmentRuleBaseline type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaseline or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_vulnerability_assessments_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_vulnerability_assessments_operations.py index bfb80bd0f206..8661b25eca51 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_vulnerability_assessments_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_database_vulnerability_assessments_operations.py @@ -389,7 +389,8 @@ def create_or_update( :param vulnerability_assessment_name: The name of the vulnerability assessment. "default" Required. :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName - :param parameters: The requested resource. Is either a model type or a IO type. Required. + :param parameters: The requested resource. Is either a DatabaseVulnerabilityAssessment type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_databases_operations.py index 337c5aac4e48..d2c618d4f512 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_databases_operations.py @@ -113,8 +113,8 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -143,13 +143,20 @@ def build_list_by_server_request( def build_get_request( - resource_group_name: str, server_name: str, database_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + server_name: str, + database_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -168,6 +175,10 @@ def build_get_request( _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -182,8 +193,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -218,8 +229,8 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) # Construct URL _url = kwargs.pop( @@ -247,8 +258,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -284,8 +295,8 @@ def build_export_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -326,8 +337,8 @@ def build_failover_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) # Construct URL _url = kwargs.pop( @@ -357,8 +368,8 @@ def build_import_method_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -394,8 +405,8 @@ def build_rename_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL @@ -428,8 +439,8 @@ def build_pause_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -462,8 +473,8 @@ def build_resume_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -495,8 +506,8 @@ def build_upgrade_data_warehouse_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) # Construct URL _url = kwargs.pop( @@ -524,8 +535,8 @@ def build_list_by_elastic_pool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -558,8 +569,8 @@ def build_list_inaccessible_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -793,8 +804,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) @@ -857,7 +868,15 @@ def get_next(next_link=None): } @distributed_trace - def get(self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> _models.Database: + def get( + self, + resource_group_name: str, + server_name: str, + database_name: str, + expand: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> _models.Database: """Gets a database. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -867,6 +886,11 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** :type server_name: str :param database_name: The name of the database. Required. :type database_name: str + :param expand: The child resources to include in the response. Default value is None. + :type expand: str + :param filter: An OData filter expression that filters elements in the collection. Default + value is None. + :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Database or the result of cls(response) :rtype: ~azure.mgmt.sql.models.Database @@ -883,8 +907,8 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.Database] = kwargs.pop("cls", None) @@ -893,6 +917,8 @@ def get(self, resource_group_name: str, server_name: str, database_name: str, ** server_name=server_name, database_name=database_name, subscription_id=self._config.subscription_id, + expand=expand, + filter=filter, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -941,8 +967,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) @@ -1091,8 +1117,8 @@ def begin_create_or_update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The requested database resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested database resource state. Is either a Database type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.Database or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1112,8 +1138,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Database] = kwargs.pop("cls", None) @@ -1142,7 +1168,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -1174,8 +1202,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1237,8 +1265,8 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1262,7 +1290,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -1299,8 +1329,8 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) @@ -1446,8 +1476,8 @@ def begin_update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The requested database resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested database resource state. Is either a DatabaseUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1467,8 +1497,8 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Database] = kwargs.pop("cls", None) @@ -1497,7 +1527,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -1534,8 +1566,8 @@ def _export_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ImportExportOperationResult]] = kwargs.pop("cls", None) @@ -1683,8 +1715,8 @@ def begin_export( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The database export request parameters. Is either a model type or a IO type. - Required. + :param parameters: The database export request parameters. Is either a ExportDatabaseDefinition + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ExportDatabaseDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1705,8 +1737,8 @@ def begin_export( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ImportExportOperationResult] = kwargs.pop("cls", None) @@ -1772,8 +1804,8 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1844,8 +1876,8 @@ def begin_failover( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1907,8 +1939,8 @@ def _import_method_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ImportExportOperationResult]] = kwargs.pop("cls", None) @@ -2056,8 +2088,8 @@ def begin_import_method( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The database import request parameters. Is either a model type or a IO type. - Required. + :param parameters: The database import request parameters. Is either a + ImportExistingDatabaseDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ImportExistingDatabaseDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2078,8 +2110,8 @@ def begin_import_method( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ImportExportOperationResult] = kwargs.pop("cls", None) @@ -2206,8 +2238,8 @@ def rename( # pylint: disable=inconsistent-return-statements :type server_name: str :param database_name: The name of the database to rename. Required. :type database_name: str - :param parameters: The resource move definition for renaming this database. Is either a model - type or a IO type. Required. + :param parameters: The resource move definition for renaming this database. Is either a + ResourceMoveDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ResourceMoveDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2228,8 +2260,8 @@ def rename( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2289,8 +2321,8 @@ def _pause_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) @@ -2358,8 +2390,8 @@ def begin_pause( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.Database] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2417,8 +2449,8 @@ def _resume_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[Optional[_models.Database]] = kwargs.pop("cls", None) @@ -2486,8 +2518,8 @@ def begin_resume( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.Database] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2545,8 +2577,8 @@ def _upgrade_data_warehouse_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2608,8 +2640,8 @@ def begin_upgrade_data_warehouse( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -2672,8 +2704,8 @@ def list_by_elastic_pool( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) @@ -2754,8 +2786,8 @@ def list_inaccessible_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.DatabaseListResult] = kwargs.pop("cls", None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py index 3b4180e0856e..4d847d0de716 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py @@ -579,8 +579,8 @@ def begin_create_or_update( :type managed_instance_name: str :param distributed_availability_group_name: The distributed availability group name. Required. :type distributed_availability_group_name: str - :param parameters: The distributed availability group info. Is either a model type or a IO - type. Required. + :param parameters: The distributed availability group info. Is either a + DistributedAvailabilityGroup type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -945,8 +945,8 @@ def begin_update( :type managed_instance_name: str :param distributed_availability_group_name: The distributed availability group name. Required. :type distributed_availability_group_name: str - :param parameters: The distributed availability group info. Is either a model type or a IO - type. Required. + :param parameters: The distributed availability group info. Is either a + DistributedAvailabilityGroup type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_elastic_pools_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_elastic_pools_operations.py index a2f25992f42a..e48bab34b4fd 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_elastic_pools_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_elastic_pools_operations.py @@ -822,7 +822,8 @@ def begin_create_or_update( :type server_name: str :param elastic_pool_name: The name of the elastic pool. Required. :type elastic_pool_name: str - :param parameters: The elastic pool parameters. Is either a model type or a IO type. Required. + :param parameters: The elastic pool parameters. Is either a ElasticPool type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.ElasticPool or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1179,8 +1180,8 @@ def begin_update( :type server_name: str :param elastic_pool_name: The name of the elastic pool. Required. :type elastic_pool_name: str - :param parameters: The elastic pool update parameters. Is either a model type or a IO type. - Required. + :param parameters: The elastic pool update parameters. Is either a ElasticPoolUpdate type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.ElasticPoolUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_encryption_protectors_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_encryption_protectors_operations.py index eeb136ca442f..68cfc3993991 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_encryption_protectors_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_encryption_protectors_operations.py @@ -530,8 +530,8 @@ def begin_create_or_update( :param encryption_protector_name: The name of the encryption protector to be updated. "current" Required. :type encryption_protector_name: str or ~azure.mgmt.sql.models.EncryptionProtectorName - :param parameters: The requested encryption protector resource state. Is either a model type or - a IO type. Required. + :param parameters: The requested encryption protector resource state. Is either a + EncryptionProtector type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.EncryptionProtector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py index 8d8555a8ec03..e655a17ba7df 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py @@ -412,8 +412,8 @@ def create_or_update( :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The extended database blob auditing policy. Is either a model type or a IO - type. Required. + :param parameters: The extended database blob auditing policy. Is either a + ExtendedDatabaseBlobAuditingPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy or IO :keyword blob_auditing_policy_name: The name of the blob auditing policy. Default value is "default". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py index 88acc4982b42..62a806b6ad6a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py @@ -482,8 +482,8 @@ def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: Properties of extended blob auditing policy. Is either a model type or a IO - type. Required. + :param parameters: Properties of extended blob auditing policy. Is either a + ExtendedServerBlobAuditingPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy or IO :keyword blob_auditing_policy_name: The name of the blob auditing policy. Default value is "default". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_failover_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_failover_groups_operations.py index 901eade427a9..547c57ffb721 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_failover_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_failover_groups_operations.py @@ -537,7 +537,7 @@ def begin_create_or_update( :type server_name: str :param failover_group_name: The name of the failover group. Required. :type failover_group_name: str - :param parameters: The failover group parameters. Is either a model type or a IO type. + :param parameters: The failover group parameters. Is either a FailoverGroup type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.FailoverGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -895,8 +895,8 @@ def begin_update( :type server_name: str :param failover_group_name: The name of the failover group. Required. :type failover_group_name: str - :param parameters: The failover group parameters. Is either a model type or a IO type. - Required. + :param parameters: The failover group parameters. Is either a FailoverGroupUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.FailoverGroupUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_firewall_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_firewall_rules_operations.py index 81e938a70ff0..2a4a78d2a627 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_firewall_rules_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_firewall_rules_operations.py @@ -376,7 +376,7 @@ def create_or_update( :param firewall_rule_name: The 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 model type or a IO type. Required. + a FirewallRule type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.FirewallRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -664,7 +664,7 @@ def replace( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a FirewallRuleList type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.FirewallRuleList or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_geo_backup_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_geo_backup_policies_operations.py index 19b94ce7c395..7ec08a82a430 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_geo_backup_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_geo_backup_policies_operations.py @@ -262,7 +262,7 @@ def create_or_update( :param geo_backup_policy_name: The name of the geo backup policy. "Default" Required. :type geo_backup_policy_name: str or ~azure.mgmt.sql.models.GeoBackupPolicyName :param parameters: The required parameters for creating or updating the geo backup policy. Is - either a model type or a IO type. Required. + either a GeoBackupPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.GeoBackupPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_instance_failover_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_instance_failover_groups_operations.py index 319ec81c8098..e4f9dac5e413 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_instance_failover_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_instance_failover_groups_operations.py @@ -582,8 +582,8 @@ def begin_create_or_update( :type location_name: str :param failover_group_name: The name of the failover group. Required. :type failover_group_name: str - :param parameters: The failover group parameters. Is either a model type or a IO type. - Required. + :param parameters: The failover group parameters. Is either a InstanceFailoverGroup type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.InstanceFailoverGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_instance_pools_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_instance_pools_operations.py index c4c056da58cf..752694f43b07 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_instance_pools_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_instance_pools_operations.py @@ -472,8 +472,8 @@ def begin_create_or_update( :type resource_group_name: str :param instance_pool_name: The name of the instance pool to be created or updated. Required. :type instance_pool_name: str - :param parameters: The requested instance pool resource state. Is either a model type or a IO - type. Required. + :param parameters: The requested instance pool resource state. Is either a InstancePool type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.InstancePool or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -812,8 +812,8 @@ def begin_update( :type resource_group_name: str :param instance_pool_name: The name of the instance pool to be updated. Required. :type instance_pool_name: str - :param parameters: The requested instance pool resource state. Is either a model type or a IO - type. Required. + :param parameters: The requested instance pool resource state. Is either a InstancePoolUpdate + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.InstancePoolUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ipv6_firewall_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ipv6_firewall_rules_operations.py index bb63c2e917b7..4b2863b10f3d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ipv6_firewall_rules_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ipv6_firewall_rules_operations.py @@ -423,7 +423,7 @@ def create_or_update( :param firewall_rule_name: The name of the firewall rule. Required. :type firewall_rule_name: str :param parameters: The required parameters for creating or updating an IPv6 firewall rule. Is - either a model type or a IO type. Required. + either a IPv6FirewallRule type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.IPv6FirewallRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_agents_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_agents_operations.py index 17327a6b7565..793bea7911b7 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_agents_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_agents_operations.py @@ -544,8 +544,8 @@ def begin_create_or_update( :type server_name: str :param job_agent_name: The name of the job agent to be created or updated. Required. :type job_agent_name: str - :param parameters: The requested job agent resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested job agent resource state. Is either a JobAgent type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.JobAgent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -899,7 +899,8 @@ def begin_update( :type server_name: str :param job_agent_name: The name of the job agent to be updated. Required. :type job_agent_name: str - :param parameters: The update to the job agent. Is either a model type or a IO type. Required. + :param parameters: The update to the job agent. Is either a JobAgentUpdate type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.JobAgentUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_credentials_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_credentials_operations.py index 0812108c5519..a39835bb35e8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_credentials_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_credentials_operations.py @@ -454,8 +454,8 @@ def create_or_update( :type job_agent_name: str :param credential_name: The name of the credential. Required. :type credential_name: str - :param parameters: The requested job credential state. Is either a model type or a IO type. - Required. + :param parameters: The requested job credential state. Is either a JobCredential type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.JobCredential or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_steps_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_steps_operations.py index b8a40b11ea9c..7065c955d139 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_steps_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_steps_operations.py @@ -748,7 +748,7 @@ def create_or_update( :type job_name: str :param step_name: The name of the job step. Required. :type step_name: str - :param parameters: The requested state of the job step. Is either a model type or a IO type. + :param parameters: The requested state of the job step. Is either a JobStep type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.JobStep or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_target_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_target_groups_operations.py index 0a7fdf3aad8d..05fe6f2d600e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_target_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_target_groups_operations.py @@ -454,8 +454,8 @@ def create_or_update( :type job_agent_name: str :param target_group_name: The name of the target group. Required. :type target_group_name: str - :param parameters: The requested state of the target group. Is either a model type or a IO - type. Required. + :param parameters: The requested state of the target group. Is either a JobTargetGroup type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.JobTargetGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_jobs_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_jobs_operations.py index 99d03fa290f5..1400907acc9f 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_jobs_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_jobs_operations.py @@ -439,7 +439,7 @@ def create_or_update( :type job_agent_name: str :param job_name: The name of the job to get. Required. :type job_name: str - :param parameters: The requested job state. Is either a model type or a IO type. Required. + :param parameters: The requested job state. Is either a Job type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.Job or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ledger_digest_uploads_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ledger_digest_uploads_operations.py index 9adee65cf750..631eb9155fd9 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ledger_digest_uploads_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ledger_digest_uploads_operations.py @@ -476,7 +476,7 @@ def begin_create_or_update( :type database_name: str :param ledger_digest_uploads: "current" Required. :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.LedgerDigestUploadsName - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a LedgerDigestUploads type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.LedgerDigestUploads or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_backups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_backups_operations.py index 407854d3d188..420a5e9d3bee 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_backups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_backups_operations.py @@ -888,7 +888,7 @@ def begin_copy( :param backup_name: The backup name. Required. :type backup_name: str :param parameters: The parameters needed for long term retention copy request. Is either a - model type or a IO type. Required. + CopyLongTermRetentionBackupParameters type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.CopyLongTermRetentionBackupParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1137,8 +1137,8 @@ def begin_update( :type long_term_retention_database_name: str :param backup_name: The backup name. Required. :type backup_name: str - :param parameters: The requested backup resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested backup resource state. Is either a + UpdateLongTermRetentionBackupParameters type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.UpdateLongTermRetentionBackupParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1892,7 +1892,7 @@ def begin_copy_by_resource_group( :param backup_name: The backup name. Required. :type backup_name: str :param parameters: The parameters needed for long term retention copy request. Is either a - model type or a IO type. Required. + CopyLongTermRetentionBackupParameters type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.CopyLongTermRetentionBackupParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2156,8 +2156,8 @@ def begin_update_by_resource_group( :type long_term_retention_database_name: str :param backup_name: The backup name. Required. :type backup_name: str - :param parameters: The requested backup resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested backup resource state. Is either a + UpdateLongTermRetentionBackupParameters type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.UpdateLongTermRetentionBackupParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_policies_operations.py index ea3975fc8a28..9b500c37dc80 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_long_term_retention_policies_operations.py @@ -433,8 +433,8 @@ def begin_create_or_update( :type database_name: str :param policy_name: The policy name. Should always be Default. "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.LongTermRetentionPolicyName - :param parameters: The long term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The long term retention policy info. Is either a LongTermRetentionPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.LongTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_maintenance_windows_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_maintenance_windows_operations.py index a65cecaf7a6a..dd092c762fe2 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_maintenance_windows_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_maintenance_windows_operations.py @@ -305,7 +305,7 @@ def create_or_update( # pylint: disable=inconsistent-return-statements :type database_name: str :param maintenance_window_name: Maintenance window name. Required. :type maintenance_window_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a MaintenanceWindows type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.MaintenanceWindows or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_backup_short_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_backup_short_term_retention_policies_operations.py index 704d04fe4b15..1d72fecbcaf1 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_backup_short_term_retention_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_backup_short_term_retention_policies_operations.py @@ -478,8 +478,8 @@ def begin_create_or_update( :type database_name: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ManagedShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + ManagedBackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -731,8 +731,8 @@ def begin_update( :type database_name: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ManagedShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + ManagedBackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_advanced_threat_protection_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_advanced_threat_protection_settings_operations.py index 9f4b090b1583..2eb2c040a47a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_advanced_threat_protection_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_advanced_threat_protection_settings_operations.py @@ -439,8 +439,8 @@ def create_or_update( "Default" Required. :type advanced_threat_protection_name: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionName - :param parameters: The managed database Advanced Threat Protection state. Is either a model - type or a IO type. Required. + :param parameters: The managed database Advanced Threat Protection state. Is either a + ManagedDatabaseAdvancedThreatProtection type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_recommended_sensitivity_labels_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_recommended_sensitivity_labels_operations.py index 5a5d458c534a..99df1c179981 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_recommended_sensitivity_labels_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_recommended_sensitivity_labels_operations.py @@ -172,7 +172,8 @@ def update( # pylint: disable=inconsistent-return-statements :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a RecommendedSensitivityLabelUpdateList type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdateList or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_security_alert_policies_operations.py index 66c277929817..75b8cdb47142 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_security_alert_policies_operations.py @@ -345,8 +345,8 @@ def create_or_update( :type database_name: str :param security_alert_policy_name: The name of the security alert policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName - :param parameters: The database security alert policy. Is either a model type or a IO type. - Required. + :param parameters: The database security alert policy. Is either a + ManagedDatabaseSecurityAlertPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseSecurityAlertPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_sensitivity_labels_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_sensitivity_labels_operations.py index 4846ca233d5b..b86a89076712 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_sensitivity_labels_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_sensitivity_labels_operations.py @@ -608,8 +608,8 @@ def create_or_update( :type table_name: str :param column_name: The name of the column. Required. :type column_name: str - :param parameters: The column sensitivity label resource. Is either a model type or a IO type. - Required. + :param parameters: The column sensitivity label resource. Is either a SensitivityLabel type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SensitivityLabel or IO :keyword sensitivity_label_source: The source of the sensitivity label. Default value is "current". Note that overriding this default value may result in unsupported behavior. @@ -1130,7 +1130,7 @@ def update( # pylint: disable=inconsistent-return-statements :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a SensitivityLabelUpdateList type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SensitivityLabelUpdateList or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_transparent_data_encryption_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_transparent_data_encryption_operations.py index e4b1479adbb5..f3e51f20f440 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_transparent_data_encryption_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_transparent_data_encryption_operations.py @@ -345,8 +345,8 @@ def create_or_update( :type database_name: str :param tde_name: The name of the transparent data encryption configuration. "current" Required. :type tde_name: str or ~azure.mgmt.sql.models.TransparentDataEncryptionName - :param parameters: The database transparent data encryption. Is either a model type or a IO - type. Required. + :param parameters: The database transparent data encryption. Is either a + ManagedTransparentDataEncryption type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedTransparentDataEncryption or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_vulnerability_assessment_rule_baselines_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_vulnerability_assessment_rule_baselines_operations.py index c718162405f4..b35fcf8eead3 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_vulnerability_assessment_rule_baselines_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_vulnerability_assessment_rule_baselines_operations.py @@ -400,8 +400,8 @@ def create_or_update( baseline on a database level rule and master for server level rule). Known values are: "master" and "default". Required. :type baseline_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentPolicyBaselineName - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseVulnerabilityAssessmentRuleBaseline type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessmentRuleBaseline or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_vulnerability_assessments_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_vulnerability_assessments_operations.py index 357c619f9bc6..6ca7960a3714 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_vulnerability_assessments_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_vulnerability_assessments_operations.py @@ -389,7 +389,8 @@ def create_or_update( :param vulnerability_assessment_name: The name of the vulnerability assessment. "default" Required. :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName - :param parameters: The requested resource. Is either a model type or a IO type. Required. + :param parameters: The requested resource. Is either a DatabaseVulnerabilityAssessment type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseVulnerabilityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_databases_operations.py index 6d7c129a4ab5..72fc59b469db 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_databases_operations.py @@ -719,8 +719,8 @@ def begin_create_or_update( :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The requested database resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested database resource state. Is either a ManagedDatabase type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabase or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1077,8 +1077,8 @@ def begin_update( :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: The requested database resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested database resource state. Is either a ManagedDatabaseUpdate + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1307,8 +1307,8 @@ def begin_cancel_move( :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Parameters of the cancel managed database move operation. Is either a model - type or a IO type. Required. + :param parameters: Parameters of the cancel managed database move operation. Is either a + ManagedDatabaseMoveDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseMoveDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1535,7 +1535,7 @@ def begin_complete_move( :param database_name: The name of the database. Required. :type database_name: str :param parameters: Parameters of the complete managed database move operation. Is either a - model type or a IO type. Required. + ManagedDatabaseMoveDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseMoveDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1764,7 +1764,7 @@ def begin_complete_restore( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The definition for completing the restore of this managed database. Is - either a model type or a IO type. Required. + either a CompleteDatabaseRestoreDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.CompleteDatabaseRestoreDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1990,8 +1990,8 @@ def begin_start_move( :type managed_instance_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Parameters of the start managed database move operation. Is either a model - type or a IO type. Required. + :param parameters: Parameters of the start managed database move operation. Is either a + ManagedDatabaseStartMoveDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseStartMoveDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_administrators_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_administrators_operations.py index 6488e4781749..829149981156 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_administrators_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_administrators_operations.py @@ -530,8 +530,8 @@ def begin_create_or_update( :type managed_instance_name: str :param administrator_name: "ActiveDirectory" Required. :type administrator_name: str or ~azure.mgmt.sql.models.AdministratorName - :param parameters: The requested administrator parameters. Is either a model type or a IO type. - Required. + :param parameters: The requested administrator parameters. Is either a + ManagedInstanceAdministrator type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceAdministrator or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_advanced_threat_protection_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_advanced_threat_protection_settings_operations.py index 2ca18e2ba194..70d054c7a8f8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_advanced_threat_protection_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_advanced_threat_protection_settings_operations.py @@ -510,8 +510,8 @@ def begin_create_or_update( "Default" Required. :type advanced_threat_protection_name: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionName - :param parameters: The managed instance Advanced Threat Protection state. Is either a model - type or a IO type. Required. + :param parameters: The managed instance Advanced Threat Protection state. Is either a + ManagedInstanceAdvancedThreatProtection type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_azure_ad_only_authentications_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_azure_ad_only_authentications_operations.py index 6377c05e41df..b318d6fb3472 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_azure_ad_only_authentications_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_azure_ad_only_authentications_operations.py @@ -460,7 +460,8 @@ def begin_create_or_update( "Default" Required. :type authentication_name: str or ~azure.mgmt.sql.models.AuthenticationName :param parameters: The required parameters for creating or updating an Active Directory only - authentication property. Is either a model type or a IO type. Required. + authentication property. Is either a ManagedInstanceAzureADOnlyAuthentication type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceAzureADOnlyAuthentication or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_dtcs_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_dtcs_operations.py index 81d088b54e7a..393467d607e7 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_dtcs_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_dtcs_operations.py @@ -488,8 +488,8 @@ def begin_create_or_update( :type managed_instance_name: str :param dtc_name: The name of the managed instance DTC. "current" Required. :type dtc_name: str or ~azure.mgmt.sql.models.DtcName - :param parameters: Managed instance DTC settings. Is either a model type or a IO type. - Required. + :param parameters: Managed instance DTC settings. Is either a ManagedInstanceDtc type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceDtc or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_encryption_protectors_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_encryption_protectors_operations.py index d9329fcbdd50..163395261381 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_encryption_protectors_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_encryption_protectors_operations.py @@ -662,8 +662,8 @@ def begin_create_or_update( :param encryption_protector_name: The name of the encryption protector to be updated. "current" Required. :type encryption_protector_name: str or ~azure.mgmt.sql.models.EncryptionProtectorName - :param parameters: The requested encryption protector resource state. Is either a model type or - a IO type. Required. + :param parameters: The requested encryption protector resource state. Is either a + ManagedInstanceEncryptionProtector type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceEncryptionProtector or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_keys_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_keys_operations.py index 3e7349b6567f..ef4ed6406fa1 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_keys_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_keys_operations.py @@ -527,8 +527,8 @@ def begin_create_or_update( :param key_name: The name of the managed instance key to be operated on (updated or created). Required. :type key_name: str - :param parameters: The requested managed instance key resource state. Is either a model type or - a IO type. Required. + :param parameters: The requested managed instance key resource state. Is either a + ManagedInstanceKey type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceKey or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_long_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_long_term_retention_policies_operations.py index 73dc62887640..30aa2db1f41f 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_long_term_retention_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_long_term_retention_policies_operations.py @@ -435,8 +435,8 @@ def begin_create_or_update( :type database_name: str :param policy_name: The policy name. Should always be Default. "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicyName - :param parameters: The long term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The long term retention policy info. Is either a + ManagedInstanceLongTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceLongTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_private_endpoint_connections_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_private_endpoint_connections_operations.py index b628ba8c0f0b..cc1e86554f21 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_private_endpoint_connections_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_private_endpoint_connections_operations.py @@ -449,7 +449,8 @@ def begin_create_or_update( :type managed_instance_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a ManagedInstancePrivateEndpointConnection type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstancePrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_tde_certificates_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_tde_certificates_operations.py index 8609b9b294dc..6e71f11ba931 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_tde_certificates_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_tde_certificates_operations.py @@ -242,8 +242,8 @@ def begin_create( :type resource_group_name: str :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param parameters: The requested TDE certificate to be created or updated. Is either a model - type or a IO type. Required. + :param parameters: The requested TDE certificate to be created or updated. Is either a + TdeCertificate type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.TdeCertificate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_vulnerability_assessments_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_vulnerability_assessments_operations.py index 5d869b6d2678..1b0922e4ecc9 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_vulnerability_assessments_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_vulnerability_assessments_operations.py @@ -375,7 +375,8 @@ def create_or_update( :param vulnerability_assessment_name: The name of the vulnerability assessment. "default" Required. :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName - :param parameters: The requested resource. Is either a model type or a IO type. Required. + :param parameters: The requested resource. Is either a ManagedInstanceVulnerabilityAssessment + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceVulnerabilityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instances_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instances_operations.py index d0ca04d404e1..0eca7ef2319a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instances_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instances_operations.py @@ -42,30 +42,18 @@ _SERIALIZER.client_side_validation = False -def build_list_by_instance_pool_request( - resource_group_name: str, - instance_pool_name: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: +def build_list_request(subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances", - ) # pylint: disable=line-too-long + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances") path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "instancePoolName": _SERIALIZER.url("instance_pool_name", instance_pool_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -82,18 +70,30 @@ def build_list_by_instance_pool_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request(subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_list_by_instance_pool_request( + resource_group_name: str, + instance_pool_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances", + ) # pylint: disable=line-too-long path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "instancePoolName": _SERIALIZER.url("instance_pool_name", instance_pool_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -116,8 +116,8 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -155,8 +155,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -190,8 +190,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -225,8 +225,8 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) # Construct URL _url = kwargs.pop( @@ -253,8 +253,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -283,32 +283,55 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_managed_instance_request( +def build_failover_request( resource_group_name: str, managed_instance_name: str, subscription_id: str, *, - number_of_queries: Optional[int] = None, - databases: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - interval: Optional[Union[str, _models.QueryTimeGrainType]] = None, - aggregation_function: Optional[Union[str, _models.AggregationFunctionType]] = None, - observation_metric: Optional[Union[str, _models.MetricType]] = None, + replica_type: Optional[Union[str, _models.ReplicaType]] = None, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if replica_type is not None: + _params["replicaType"] = _SERIALIZER.query("replica_type", replica_type, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_list_outbound_network_dependencies_by_managed_instance_request( + resource_group_name: str, managed_instance_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: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/outboundNetworkDependenciesEndpoints", ) # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -319,20 +342,6 @@ def build_list_by_managed_instance_request( _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - if number_of_queries is not None: - _params["numberOfQueries"] = _SERIALIZER.query("number_of_queries", number_of_queries, "int") - if databases is not None: - _params["databases"] = _SERIALIZER.query("databases", databases, "str") - if start_time is not None: - _params["startTime"] = _SERIALIZER.query("start_time", start_time, "str") - if end_time is not None: - _params["endTime"] = _SERIALIZER.query("end_time", end_time, "str") - if interval is not None: - _params["interval"] = _SERIALIZER.query("interval", interval, "str") - if aggregation_function is not None: - _params["aggregationFunction"] = _SERIALIZER.query("aggregation_function", aggregation_function, "str") - if observation_metric is not None: - _params["observationMetric"] = _SERIALIZER.query("observation_metric", observation_metric, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -341,23 +350,86 @@ def build_list_by_managed_instance_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_failover_request( +def build_start_request( + resource_group_name: str, managed_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_stop_request( + resource_group_name: str, managed_instance_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/stop", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_list_by_managed_instance_request( resource_group_name: str, managed_instance_name: str, subscription_id: str, *, - replica_type: Optional[Union[str, _models.ReplicaType]] = None, + number_of_queries: Optional[int] = None, + databases: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + interval: Optional[Union[str, _models.QueryTimeGrainType]] = None, + aggregation_function: Optional[Union[str, _models.AggregationFunctionType]] = None, + observation_metric: Optional[Union[str, _models.MetricType]] = None, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries", ) # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -368,11 +440,26 @@ def build_failover_request( _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters - if replica_type is not None: - _params["replicaType"] = _SERIALIZER.query("replica_type", replica_type, "str") + if number_of_queries is not None: + _params["numberOfQueries"] = _SERIALIZER.query("number_of_queries", number_of_queries, "int") + if databases is not None: + _params["databases"] = _SERIALIZER.query("databases", databases, "str") + if start_time is not None: + _params["startTime"] = _SERIALIZER.query("start_time", start_time, "str") + if end_time is not None: + _params["endTime"] = _SERIALIZER.query("end_time", end_time, "str") + if interval is not None: + _params["interval"] = _SERIALIZER.query("interval", interval, "str") + if aggregation_function is not None: + _params["aggregationFunction"] = _SERIALIZER.query("aggregation_function", aggregation_function, "str") + if observation_metric is not None: + _params["observationMetric"] = _SERIALIZER.query("observation_metric", observation_metric, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) class ManagedInstancesOperations: @@ -395,16 +482,9 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_instance_pool( - self, resource_group_name: str, instance_pool_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.ManagedInstance"]: - """Gets a list of all managed instances in an instance pool. + def list(self, expand: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ManagedInstance"]: + """Gets a list of all managed instances in the subscription. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param instance_pool_name: The instance pool name. Required. - :type instance_pool_name: str :param expand: The child resources to include in the response. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -415,8 +495,8 @@ def list_by_instance_pool( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.ManagedInstanceListResult] = kwargs.pop("cls", None) @@ -431,13 +511,11 @@ def list_by_instance_pool( def prepare_request(next_link=None): if not next_link: - request = build_list_by_instance_pool_request( - resource_group_name=resource_group_name, - instance_pool_name=instance_pool_name, + request = build_list_request( subscription_id=self._config.subscription_id, expand=expand, api_version=api_version, - template_url=self.list_by_instance_pool.metadata["url"], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -474,14 +552,19 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_instance_pool.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances" - } + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances"} @distributed_trace - def list(self, expand: Optional[str] = None, **kwargs: Any) -> Iterable["_models.ManagedInstance"]: - """Gets a list of all managed instances in the subscription. + def list_by_instance_pool( + self, resource_group_name: str, instance_pool_name: str, expand: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ManagedInstance"]: + """Gets a list of all managed instances in an instance pool. + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param instance_pool_name: The instance pool name. Required. + :type instance_pool_name: str :param expand: The child resources to include in the response. Default value is None. :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -492,8 +575,8 @@ def list(self, expand: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.ManagedInstanceListResult] = kwargs.pop("cls", None) @@ -508,11 +591,13 @@ def list(self, expand: Optional[str] = None, **kwargs: Any) -> Iterable["_models def prepare_request(next_link=None): if not next_link: - request = build_list_request( + request = build_list_by_instance_pool_request( + resource_group_name=resource_group_name, + instance_pool_name=instance_pool_name, subscription_id=self._config.subscription_id, expand=expand, api_version=api_version, - template_url=self.list.metadata["url"], + template_url=self.list_by_instance_pool.metadata["url"], headers=_headers, params=_params, ) @@ -549,7 +634,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances"} + list_by_instance_pool.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances" + } @distributed_trace def list_by_resource_group( @@ -570,8 +657,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.ManagedInstanceListResult] = kwargs.pop("cls", None) @@ -661,8 +748,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.ManagedInstance] = kwargs.pop("cls", None) @@ -718,8 +805,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ManagedInstance]] = kwargs.pop("cls", None) @@ -860,8 +947,8 @@ def begin_create_or_update( :type resource_group_name: str :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param parameters: The requested managed instance resource state. Is either a model type or a - IO type. Required. + :param parameters: The requested managed instance resource state. Is either a ManagedInstance + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -882,8 +969,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ManagedInstance] = kwargs.pop("cls", None) @@ -943,8 +1030,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1001,8 +1088,8 @@ def begin_delete(self, resource_group_name: str, managed_instance_name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1061,8 +1148,8 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ManagedInstance]] = kwargs.pop("cls", None) @@ -1200,8 +1287,8 @@ def begin_update( :type resource_group_name: str :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param parameters: The requested managed instance resource state. Is either a model type or a - IO type. Required. + :param parameters: The requested managed instance resource state. Is either a + ManagedInstanceUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedInstanceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1222,8 +1309,8 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ManagedInstance] = kwargs.pop("cls", None) @@ -1269,58 +1356,159 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}" } - @distributed_trace - def list_by_managed_instance( + def _failover_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, managed_instance_name: str, - number_of_queries: Optional[int] = None, - databases: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - interval: Optional[Union[str, _models.QueryTimeGrainType]] = None, - aggregation_function: Optional[Union[str, _models.AggregationFunctionType]] = None, - observation_metric: Optional[Union[str, _models.MetricType]] = None, + replica_type: Optional[Union[str, _models.ReplicaType]] = None, **kwargs: Any - ) -> Iterable["_models.TopQueries"]: - """Get top resource consuming queries of a managed instance. + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param number_of_queries: How many 'top queries' to return. Default is 5. Default value is - None. - :type number_of_queries: int - :param databases: Comma separated list of databases to be included into search. All DB's are - included if this parameter is not specified. Default value is None. - :type databases: str - :param start_time: Start time for observed period. Default value is None. - :type start_time: str - :param end_time: End time for observed period. Default value is None. - :type end_time: str - :param interval: The time step to be used to summarize the metric values. Default value is - PT1H. Known values are: "PT1H" and "P1D". Default value is None. - :type interval: str or ~azure.mgmt.sql.models.QueryTimeGrainType - :param aggregation_function: Aggregation function to be used, default value is 'sum'. Known - values are: "avg", "min", "max", "stdev", and "sum". Default value is None. - :type aggregation_function: str or ~azure.mgmt.sql.models.AggregationFunctionType - :param observation_metric: Metric to be used for ranking top queries. Default is 'cpu'. Known - values are: "cpu", "io", "logIo", "duration", and "dtu". Default value is None. - :type observation_metric: str or ~azure.mgmt.sql.models.MetricType - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TopQueries or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.TopQueries] - :raises ~azure.core.exceptions.HttpResponseError: + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_failover_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + subscription_id=self._config.subscription_id, + replica_type=replica_type, + api_version=api_version, + template_url=self._failover_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _failover_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover" + } + + @distributed_trace + def begin_failover( + self, + resource_group_name: str, + managed_instance_name: str, + replica_type: Optional[Union[str, _models.ReplicaType]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Failovers a managed instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance to failover. Required. + :type managed_instance_name: str + :param replica_type: The type of replica to be failed over. Known values are: "Primary" and + "ReadableSecondary". Default value is None. + :type replica_type: str or ~azure.mgmt.sql.models.ReplicaType + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) - cls: ClsType[_models.TopQueriesListResult] = 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._failover_initial( # type: ignore + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + replica_type=replica_type, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_failover.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover" + } + + @distributed_trace + def list_outbound_network_dependencies_by_managed_instance( + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any + ) -> Iterable["_models.OutboundEnvironmentEndpoint"]: + """Gets the collection of outbound network dependencies for the given managed instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpoint or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.OutboundEnvironmentEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.OutboundEnvironmentEndpointCollection] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1333,19 +1521,12 @@ def list_by_managed_instance( def prepare_request(next_link=None): if not next_link: - request = build_list_by_managed_instance_request( + request = build_list_outbound_network_dependencies_by_managed_instance_request( resource_group_name=resource_group_name, managed_instance_name=managed_instance_name, subscription_id=self._config.subscription_id, - number_of_queries=number_of_queries, - databases=databases, - start_time=start_time, - end_time=end_time, - interval=interval, - aggregation_function=aggregation_function, - observation_metric=observation_metric, api_version=api_version, - template_url=self.list_by_managed_instance.metadata["url"], + template_url=self.list_outbound_network_dependencies_by_managed_instance.metadata["url"], headers=_headers, params=_params, ) @@ -1360,7 +1541,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize("TopQueriesListResult", pipeline_response) + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1382,16 +1563,12 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_managed_instance.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries" + list_outbound_network_dependencies_by_managed_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/outboundNetworkDependenciesEndpoints" } - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - managed_instance_name: str, - replica_type: Optional[Union[str, _models.ReplicaType]] = None, - **kwargs: Any + def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1404,18 +1581,17 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_failover_request( + request = build_start_request( resource_group_name=resource_group_name, managed_instance_name=managed_instance_name, subscription_id=self._config.subscription_id, - replica_type=replica_type, api_version=api_version, - template_url=self._failover_initial.metadata["url"], + template_url=self._start_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1428,35 +1604,26 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _failover_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover" + _start_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/start" } @distributed_trace - def begin_failover( - self, - resource_group_name: str, - managed_instance_name: str, - replica_type: Optional[Union[str, _models.ReplicaType]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Failovers a managed instance. + def begin_start(self, resource_group_name: str, managed_instance_name: str, **kwargs: Any) -> LROPoller[None]: + """Starts the managed instance. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param managed_instance_name: The name of the managed instance to failover. Required. + :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param replica_type: The type of replica to be failed over. Known values are: "Primary" and - "ReadableSecondary". Default value is None. - :type replica_type: str or ~azure.mgmt.sql.models.ReplicaType :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -1472,18 +1639,17 @@ def begin_failover( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) 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._failover_initial( # type: ignore + raw_result = self._start_initial( # type: ignore resource_group_name=resource_group_name, managed_instance_name=managed_instance_name, - replica_type=replica_type, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1497,7 +1663,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -1511,6 +1679,239 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_failover.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/failover" + begin_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/start" + } + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any + ) -> None: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_stop_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/stop" + } + + @distributed_trace + def begin_stop(self, resource_group_name: str, managed_instance_name: str, **kwargs: Any) -> LROPoller[None]: + """Stops the managed instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + 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_initial( # type: ignore + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/stop" + } + + @distributed_trace + def list_by_managed_instance( + self, + resource_group_name: str, + managed_instance_name: str, + number_of_queries: Optional[int] = None, + databases: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + interval: Optional[Union[str, _models.QueryTimeGrainType]] = None, + aggregation_function: Optional[Union[str, _models.AggregationFunctionType]] = None, + observation_metric: Optional[Union[str, _models.MetricType]] = None, + **kwargs: Any + ) -> Iterable["_models.TopQueries"]: + """Get top resource consuming queries of a managed instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param number_of_queries: How many 'top queries' to return. Default is 5. Default value is + None. + :type number_of_queries: int + :param databases: Comma separated list of databases to be included into search. All DB's are + included if this parameter is not specified. Default value is None. + :type databases: str + :param start_time: Start time for observed period. Default value is None. + :type start_time: str + :param end_time: End time for observed period. Default value is None. + :type end_time: str + :param interval: The time step to be used to summarize the metric values. Default value is + PT1H. Known values are: "PT1H" and "P1D". Default value is None. + :type interval: str or ~azure.mgmt.sql.models.QueryTimeGrainType + :param aggregation_function: Aggregation function to be used, default value is 'sum'. Known + values are: "avg", "min", "max", "stdev", and "sum". Default value is None. + :type aggregation_function: str or ~azure.mgmt.sql.models.AggregationFunctionType + :param observation_metric: Metric to be used for ranking top queries. Default is 'cpu'. Known + values are: "cpu", "io", "logIo", "duration", and "dtu". Default value is None. + :type observation_metric: str or ~azure.mgmt.sql.models.MetricType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TopQueries or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.TopQueries] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.TopQueriesListResult] = kwargs.pop("cls", None) + + error_map = { + 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_managed_instance_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + subscription_id=self._config.subscription_id, + number_of_queries=number_of_queries, + databases=databases, + start_time=start_time, + end_time=end_time, + interval=interval, + aggregation_function=aggregation_function, + observation_metric=observation_metric, + api_version=api_version, + template_url=self.list_by_managed_instance.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TopQueriesListResult", 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) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_managed_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/topqueries" } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_ledger_digest_uploads_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_ledger_digest_uploads_operations.py new file mode 100644 index 000000000000..b9b71865482e --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_ledger_digest_uploads_operations.py @@ -0,0 +1,780 @@ +# pylint: disable=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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload + +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.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_database_request( + resource_group_name: str, managed_instance_name: str, database_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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + "ledgerDigestUploads": _SERIALIZER.url("ledger_digest_uploads", ledger_digest_uploads, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-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.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + "ledgerDigestUploads": _SERIALIZER.url("ledger_digest_uploads", ledger_digest_uploads, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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_disable_request( + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + "ledgerDigestUploads": _SERIALIZER.url("ledger_digest_uploads", ledger_digest_uploads, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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) + + +class ManagedLedgerDigestUploadsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.SqlManagementClient`'s + :attr:`managed_ledger_digest_uploads` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_database( + self, resource_group_name: str, managed_instance_name: str, database_name: str, **kwargs: Any + ) -> Iterable["_models.ManagedLedgerDigestUploads"]: + """Gets all ledger digest upload settings on a database. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedLedgerDigestUploads or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.ManagedLedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ManagedLedgerDigestUploadsListResult] = kwargs.pop("cls", None) + + error_map = { + 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_database_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_database.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedLedgerDigestUploadsListResult", 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) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + **kwargs: Any + ) -> _models.ManagedLedgerDigestUploads: + """Gets the current ledger digest upload configuration for a database. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :param ledger_digest_uploads: "current" Required. + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedLedgerDigestUploads or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ManagedLedgerDigestUploads + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ManagedLedgerDigestUploads] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ManagedLedgerDigestUploads", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + parameters: Union[_models.ManagedLedgerDigestUploads, IO], + **kwargs: Any + ) -> Optional[_models.ManagedLedgerDigestUploads]: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ManagedLedgerDigestUploads]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ManagedLedgerDigestUploads") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ManagedLedgerDigestUploads", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + parameters: _models.ManagedLedgerDigestUploads, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedLedgerDigestUploads]: + """Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :param ledger_digest_uploads: The name of the Ledger Digest Upload Configurations. "current" + Required. + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsName + :param parameters: The Ledger Digest Storage Endpoint. Required. + :type parameters: ~azure.mgmt.sql.models.ManagedLedgerDigestUploads + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedLedgerDigestUploads or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.ManagedLedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedLedgerDigestUploads]: + """Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :param ledger_digest_uploads: The name of the Ledger Digest Upload Configurations. "current" + Required. + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsName + :param parameters: The Ledger Digest Storage Endpoint. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedLedgerDigestUploads or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.ManagedLedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + parameters: Union[_models.ManagedLedgerDigestUploads, IO], + **kwargs: Any + ) -> LROPoller[_models.ManagedLedgerDigestUploads]: + """Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :param ledger_digest_uploads: The name of the Ledger Digest Upload Configurations. "current" + Required. + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsName + :param parameters: The Ledger Digest Storage Endpoint. Is either a ManagedLedgerDigestUploads + type or a IO type. Required. + :type parameters: ~azure.mgmt.sql.models.ManagedLedgerDigestUploads or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedLedgerDigestUploads or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.ManagedLedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ManagedLedgerDigestUploads] = 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_or_update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedLedgerDigestUploads", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}" + } + + def _disable_initial( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + **kwargs: Any + ) -> Optional[_models.ManagedLedgerDigestUploads]: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[Optional[_models.ManagedLedgerDigestUploads]] = kwargs.pop("cls", None) + + request = build_disable_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._disable_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("ManagedLedgerDigestUploads", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _disable_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable" + } + + @distributed_trace + def begin_disable( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + ledger_digest_uploads: Union[str, _models.ManagedLedgerDigestUploadsName], + **kwargs: Any + ) -> LROPoller[_models.ManagedLedgerDigestUploads]: + """Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param database_name: The name of the database. Required. + :type database_name: str + :param ledger_digest_uploads: "current" Required. + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.ManagedLedgerDigestUploadsName + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedLedgerDigestUploads or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.ManagedLedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ManagedLedgerDigestUploads] = 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, + managed_instance_name=managed_instance_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedLedgerDigestUploads", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_disable.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable" + } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py index 2f533964e20c..e58bfdd16273 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_restorable_dropped_database_backup_short_term_retention_policies_operations.py @@ -490,8 +490,8 @@ def begin_create_or_update( :type restorable_dropped_database_id: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ManagedShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + ManagedBackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -743,8 +743,8 @@ def begin_update( :type restorable_dropped_database_id: str :param policy_name: The policy name. Should always be "default". "default" Required. :type policy_name: str or ~azure.mgmt.sql.models.ManagedShortTermRetentionPolicyName - :param parameters: The short term retention policy info. Is either a model type or a IO type. - Required. + :param parameters: The short term retention policy info. Is either a + ManagedBackupShortTermRetentionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedBackupShortTermRetentionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_dns_aliases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_dns_aliases_operations.py index 3ef0fd871010..7c08dde81249 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_dns_aliases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_dns_aliases_operations.py @@ -551,7 +551,7 @@ def begin_create_or_update( :type managed_instance_name: str :param dns_alias_name: Required. :type dns_alias_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a ManagedServerDnsAliasCreation type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedServerDnsAliasCreation or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -908,7 +908,7 @@ def begin_acquire( :type managed_instance_name: str :param dns_alias_name: Required. :type dns_alias_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a ManagedServerDnsAliasAcquisition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedServerDnsAliasAcquisition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_security_alert_policies_operations.py index 863e26e8d591..325cc2d8dab6 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_security_alert_policies_operations.py @@ -413,8 +413,8 @@ def begin_create_or_update( :type managed_instance_name: str :param security_alert_policy_name: The name of the security alert policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName - :param parameters: The managed server security alert policy. Is either a model type or a IO - type. Required. + :param parameters: The managed server security alert policy. Is either a + ManagedServerSecurityAlertPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_outbound_firewall_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_outbound_firewall_rules_operations.py index cd4a7409904c..4d0eb9bbe93e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_outbound_firewall_rules_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_outbound_firewall_rules_operations.py @@ -432,7 +432,7 @@ def begin_create_or_update( :type server_name: str :param outbound_rule_fqdn: Required. :type outbound_rule_fqdn: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a OutboundFirewallRule type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.OutboundFirewallRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_private_endpoint_connections_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_private_endpoint_connections_operations.py index d60e1b5e37f0..0afebe339f82 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_private_endpoint_connections_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_private_endpoint_connections_operations.py @@ -447,7 +447,7 @@ def begin_create_or_update( :type server_name: str :param private_endpoint_connection_name: Required. :type private_endpoint_connection_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a PrivateEndpointConnection type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_recommended_sensitivity_labels_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_recommended_sensitivity_labels_operations.py index f7bac7ade34a..68475c9c2ec4 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_recommended_sensitivity_labels_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_recommended_sensitivity_labels_operations.py @@ -172,7 +172,8 @@ def update( # pylint: disable=inconsistent-return-statements :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a RecommendedSensitivityLabelUpdateList type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.RecommendedSensitivityLabelUpdateList or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_recoverable_databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_recoverable_databases_operations.py index 36502bf676a6..04ddc4e22d75 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_recoverable_databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_recoverable_databases_operations.py @@ -40,25 +40,26 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, server_name: str, database_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: Literal["2014-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2014-04-01")) + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "serverName": _SERIALIZER.url("server_name", server_name, "str"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -72,29 +73,43 @@ 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, + database_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2014-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2014-04-01")) + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "serverName": _SERIALIZER.url("server_name", server_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -122,72 +137,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get( - self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> _models.RecoverableDatabase: - """Gets a recoverable database, which is a resource representing a database's geo backup. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. 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. - :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: RecoverableDatabase or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.RecoverableDatabase - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 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: Literal["2014-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2014-04-01")) - cls: ClsType[_models.RecoverableDatabase] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - server_name=server_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecoverableDatabase", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}" - } - @distributed_trace def list_by_server( self, resource_group_name: str, server_name: str, **kwargs: Any @@ -207,7 +156,9 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2014-04-01"] = kwargs.pop("api_version", _params.pop("api-version", "2014-04-01")) + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) cls: ClsType[_models.RecoverableDatabaseListResult] = kwargs.pop("cls", None) error_map = { @@ -245,7 +196,7 @@ def extract_data(pipeline_response): list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -266,3 +217,84 @@ def get_next(next_link=None): list_by_server.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases" } + + @distributed_trace + def get( + self, + resource_group_name: str, + server_name: str, + database_name: str, + expand: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> _models.RecoverableDatabase: + """Gets a recoverable database. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. 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. + :type database_name: str + :param expand: The child resources to include in the response. Default value is None. + :type expand: str + :param filter: An OData filter expression that filters elements in the collection. Default + value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecoverableDatabase or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.RecoverableDatabase + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.RecoverableDatabase] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + expand=expand, + filter=filter, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("RecoverableDatabase", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recoverableDatabases/{databaseName}" + } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_restorable_dropped_databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_restorable_dropped_databases_operations.py index c1563f103531..155a6b35b4f5 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_restorable_dropped_databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_restorable_dropped_databases_operations.py @@ -46,8 +46,8 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -74,13 +74,20 @@ def build_list_by_server_request( def build_get_request( - resource_group_name: str, server_name: str, restorable_dropped_database_id: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + server_name: str, + restorable_dropped_database_id: str, + subscription_id: str, + *, + expand: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -101,6 +108,10 @@ def build_get_request( _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -148,8 +159,8 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.RestorableDroppedDatabaseListResult] = kwargs.pop("cls", None) @@ -212,7 +223,13 @@ def get_next(next_link=None): @distributed_trace def get( - self, resource_group_name: str, server_name: str, restorable_dropped_database_id: str, **kwargs: Any + self, + resource_group_name: str, + server_name: str, + restorable_dropped_database_id: str, + expand: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any ) -> _models.RestorableDroppedDatabase: """Gets a restorable dropped database. @@ -223,6 +240,11 @@ def get( :type server_name: str :param restorable_dropped_database_id: Required. :type restorable_dropped_database_id: str + :param expand: The child resources to include in the response. Default value is None. + :type expand: str + :param filter: An OData filter expression that filters elements in the collection. Default + value is None. + :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RestorableDroppedDatabase or the result of cls(response) :rtype: ~azure.mgmt.sql.models.RestorableDroppedDatabase @@ -239,8 +261,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-05-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-05-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.RestorableDroppedDatabase] = kwargs.pop("cls", None) @@ -249,6 +271,8 @@ def get( server_name=server_name, restorable_dropped_database_id=restorable_dropped_database_id, subscription_id=self._config.subscription_id, + expand=expand, + filter=filter, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_restore_points_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_restore_points_operations.py index ed3a5b1d4b5c..6df76e714cba 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_restore_points_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_restore_points_operations.py @@ -462,7 +462,7 @@ def begin_create( :param database_name: The name of the database. Required. :type database_name: str :param parameters: The definition for creating the restore point of this database. Is either a - model type or a IO type. Required. + CreateDatabaseRestorePointDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.CreateDatabaseRestorePointDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sensitivity_labels_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sensitivity_labels_operations.py index c2b9f50fcb9b..bb55b2a25d4a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sensitivity_labels_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sensitivity_labels_operations.py @@ -587,7 +587,7 @@ def update( # pylint: disable=inconsistent-return-statements :type server_name: str :param database_name: The name of the database. Required. :type database_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a SensitivityLabelUpdateList type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SensitivityLabelUpdateList or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1130,8 +1130,8 @@ def create_or_update( :type table_name: str :param column_name: The name of the column. Required. :type column_name: str - :param parameters: The column sensitivity label resource. Is either a model type or a IO type. - Required. + :param parameters: The column sensitivity label resource. Is either a SensitivityLabel type or + a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SensitivityLabel or IO :keyword sensitivity_label_source: The source of the sensitivity label. Default value is "current". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_advanced_threat_protection_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_advanced_threat_protection_settings_operations.py index 78e202ed4379..25f9c31ee353 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_advanced_threat_protection_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_advanced_threat_protection_settings_operations.py @@ -507,8 +507,8 @@ def begin_create_or_update( "Default" Required. :type advanced_threat_protection_name: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionName - :param parameters: The server Advanced Threat Protection state. Is either a model type or a IO - type. Required. + :param parameters: The server Advanced Threat Protection state. Is either a + ServerAdvancedThreatProtection type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerAdvancedThreatProtection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_advisors_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_advisors_operations.py index 4cc0e6ab8639..459c11023e55 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_advisors_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_advisors_operations.py @@ -378,7 +378,7 @@ def update( :type server_name: str :param advisor_name: The name of the Server Advisor. Required. :type advisor_name: str - :param parameters: The requested advisor resource state. Is either a model type or a IO type. + :param parameters: The requested advisor resource state. Is either a Advisor type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.Advisor or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_automatic_tuning_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_automatic_tuning_operations.py index 9b71fa7d4cb3..dabadb8bb010 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_automatic_tuning_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_automatic_tuning_operations.py @@ -259,8 +259,8 @@ def update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The requested automatic tuning resource state. Is either a model type or a - IO type. Required. + :param parameters: The requested automatic tuning resource state. Is either a + ServerAutomaticTuning type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerAutomaticTuning or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_administrators_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_administrators_operations.py index 845c52460a5b..d66edd31b133 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_administrators_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_administrators_operations.py @@ -453,7 +453,7 @@ def begin_create_or_update( Required. :type administrator_name: str or ~azure.mgmt.sql.models.AdministratorName :param parameters: The requested Azure Active Directory administrator Resource state. Is either - a model type or a IO type. Required. + a ServerAzureADAdministrator type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerAzureADAdministrator or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_only_authentications_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_only_authentications_operations.py index a704d79cb2b8..4c2fcf6f0735 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_only_authentications_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_azure_ad_only_authentications_operations.py @@ -458,7 +458,8 @@ def begin_create_or_update( "Default" Required. :type authentication_name: str or ~azure.mgmt.sql.models.AuthenticationName :param parameters: The required parameters for creating or updating an Active Directory only - authentication property. Is either a model type or a IO type. Required. + authentication property. Is either a ServerAzureADOnlyAuthentication type or a IO type. + Required. :type parameters: ~azure.mgmt.sql.models.ServerAzureADOnlyAuthentication or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_blob_auditing_policies_operations.py index 8b91c3c36107..6ba0af7a67c8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_blob_auditing_policies_operations.py @@ -480,8 +480,8 @@ def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: Properties of blob auditing policy. Is either a model type or a IO type. - Required. + :param parameters: Properties of blob auditing policy. Is either a ServerBlobAuditingPolicy + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerBlobAuditingPolicy or IO :keyword blob_auditing_policy_name: The name of the blob auditing policy. Default value is "default". Note that overriding this default value may result in unsupported behavior. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_communication_links_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_communication_links_operations.py index 72d6cbeae399..67c6801f0ed6 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_communication_links_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_communication_links_operations.py @@ -480,7 +480,7 @@ def begin_create_or_update( :param communication_link_name: The name of the server communication link. Required. :type communication_link_name: str :param parameters: The required parameters for creating a server communication link. Is either - a model type or a IO type. Required. + a ServerCommunicationLink type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerCommunicationLink or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_configuration_options_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_configuration_options_operations.py new file mode 100644 index 000000000000..5b4d878d62d4 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_configuration_options_operations.py @@ -0,0 +1,576 @@ +# pylint: disable=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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload + +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.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_managed_instance_request( + resource_group_name: str, managed_instance_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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "serverConfigurationOptionName": _SERIALIZER.url( + "server_configuration_option_name", server_configuration_option_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-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.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "serverConfigurationOptionName": _SERIALIZER.url( + "server_configuration_option_name", server_configuration_option_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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) + + +class ServerConfigurationOptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.SqlManagementClient`'s + :attr:`server_configuration_options` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_managed_instance( + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any + ) -> Iterable["_models.ServerConfigurationOption"]: + """Gets a list of managed instance server configuration options. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServerConfigurationOption or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.ServerConfigurationOption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ServerConfigurationOptionListResult] = kwargs.pop("cls", None) + + error_map = { + 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_managed_instance_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_managed_instance.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServerConfigurationOptionListResult", 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) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_managed_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + **kwargs: Any + ) -> _models.ServerConfigurationOption: + """Gets managed instance server configuration option. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param server_configuration_option_name: The name of the server configuration option. + "allowPolybaseExport" Required. + :type server_configuration_option_name: str or + ~azure.mgmt.sql.models.ServerConfigurationOptionName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerConfigurationOption or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ServerConfigurationOption + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ServerConfigurationOption] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + server_configuration_option_name=server_configuration_option_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServerConfigurationOption", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + parameters: Union[_models.ServerConfigurationOption, IO], + **kwargs: Any + ) -> _models.ServerConfigurationOption: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerConfigurationOption] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ServerConfigurationOption") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + server_configuration_option_name=server_configuration_option_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServerConfigurationOption", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + parameters: _models.ServerConfigurationOption, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerConfigurationOption]: + """Updates managed instance server configuration option. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param server_configuration_option_name: The name of the server configuration option. + "allowPolybaseExport" Required. + :type server_configuration_option_name: str or + ~azure.mgmt.sql.models.ServerConfigurationOptionName + :param parameters: Server configuration option parameters. Required. + :type parameters: ~azure.mgmt.sql.models.ServerConfigurationOption + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServerConfigurationOption or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.ServerConfigurationOption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerConfigurationOption]: + """Updates managed instance server configuration option. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param server_configuration_option_name: The name of the server configuration option. + "allowPolybaseExport" Required. + :type server_configuration_option_name: str or + ~azure.mgmt.sql.models.ServerConfigurationOptionName + :param parameters: Server configuration option parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServerConfigurationOption or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.ServerConfigurationOption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + server_configuration_option_name: Union[str, _models.ServerConfigurationOptionName], + parameters: Union[_models.ServerConfigurationOption, IO], + **kwargs: Any + ) -> LROPoller[_models.ServerConfigurationOption]: + """Updates managed instance server configuration option. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param server_configuration_option_name: The name of the server configuration option. + "allowPolybaseExport" Required. + :type server_configuration_option_name: str or + ~azure.mgmt.sql.models.ServerConfigurationOptionName + :param parameters: Server configuration option parameters. Is either a + ServerConfigurationOption type or a IO type. Required. + :type parameters: ~azure.mgmt.sql.models.ServerConfigurationOption or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServerConfigurationOption or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.ServerConfigurationOption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServerConfigurationOption] = 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_or_update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + server_configuration_option_name=server_configuration_option_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerConfigurationOption", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverConfigurationOptions/{serverConfigurationOptionName}" + } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_connection_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_connection_policies_operations.py index 1bccc8a9b093..4ec343a1ef2d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_connection_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_connection_policies_operations.py @@ -414,7 +414,7 @@ def begin_create_or_update( :param connection_policy_name: The name of the connection policy. "default" Required. :type connection_policy_name: str or ~azure.mgmt.sql.models.ConnectionPolicyName :param parameters: The required parameters for updating a server connection policy. Is either a - model type or a IO type. Required. + ServerConnectionPolicy type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerConnectionPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_dev_ops_audit_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_dev_ops_audit_settings_operations.py index 0da79e9568e5..e7691f0624b6 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_dev_ops_audit_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_dev_ops_audit_settings_operations.py @@ -499,8 +499,8 @@ def begin_create_or_update( :type server_name: str :param dev_ops_auditing_settings_name: "Default" Required. :type dev_ops_auditing_settings_name: str or ~azure.mgmt.sql.models.DevOpsAuditingSettingsName - :param parameters: Properties of DevOps audit settings. Is either a model type or a IO type. - Required. + :param parameters: Properties of DevOps audit settings. Is either a + ServerDevOpsAuditingSettings type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerDevOpsAuditingSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_dns_aliases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_dns_aliases_operations.py index e81f85c2f275..ba092a5ade89 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_dns_aliases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_dns_aliases_operations.py @@ -796,7 +796,7 @@ def begin_acquire( :type server_name: str :param dns_alias_name: The name of the server dns alias. Required. :type dns_alias_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a ServerDnsAliasAcquisition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerDnsAliasAcquisition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_keys_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_keys_operations.py index 6857fbcd2033..769daac437a4 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_keys_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_keys_operations.py @@ -518,7 +518,7 @@ def begin_create_or_update( https://YourVaultName.vault.azure.net/keys/YourKeyName/YourKeyVersion, then the server key name should be formatted as: YourVaultName_YourKeyName_YourKeyVersion. Required. :type key_name: str - :param parameters: The requested server key resource state. Is either a model type or a IO + :param parameters: The requested server key resource state. Is either a ServerKey type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerKey or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_security_alert_policies_operations.py index b4a24b55dd62..8bbe4b059d0b 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_security_alert_policies_operations.py @@ -413,8 +413,8 @@ def begin_create_or_update( :type server_name: str :param security_alert_policy_name: The name of the threat detection policy. "Default" Required. :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName - :param parameters: The server security alert policy. Is either a model type or a IO type. - Required. + :param parameters: The server security alert policy. Is either a ServerSecurityAlertPolicy type + or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_certificates_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_certificates_operations.py index 09ceb33e2892..f0e3bce5cb9d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_certificates_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_certificates_operations.py @@ -515,8 +515,8 @@ def begin_create_or_update( :type managed_instance_name: str :param certificate_name: Name of of the certificate to upload. Required. :type certificate_name: str - :param parameters: The server trust certificate info. Is either a model type or a IO type. - Required. + :param parameters: The server trust certificate info. Is either a ServerTrustCertificate type + or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerTrustCertificate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_groups_operations.py index e96cb2b83c6e..939212f074ca 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_groups_operations.py @@ -465,8 +465,8 @@ def begin_create_or_update( :type location_name: str :param server_trust_group_name: The name of the server trust group. Required. :type server_trust_group_name: str - :param parameters: The server trust group parameters. Is either a model type or a IO type. - Required. + :param parameters: The server trust group parameters. Is either a ServerTrustGroup type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.ServerTrustGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_vulnerability_assessments_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_vulnerability_assessments_operations.py index 7c61787afbf8..f63e2b74f5ea 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_vulnerability_assessments_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_vulnerability_assessments_operations.py @@ -375,7 +375,8 @@ def create_or_update( :param vulnerability_assessment_name: The name of the vulnerability assessment. "default" Required. :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName - :param parameters: The requested resource. Is either a model type or a IO type. Required. + :param parameters: The requested resource. Is either a ServerVulnerabilityAssessment type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.ServerVulnerabilityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_servers_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_servers_operations.py index 543e89d0baf8..12943d240b64 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_servers_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_servers_operations.py @@ -42,14 +42,71 @@ _SERIALIZER.client_side_validation = False +def build_check_name_availability_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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-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.Sql/checkNameAvailability") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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_list_request(subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + _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_resource_group_request( resource_group_name: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -82,8 +139,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -117,8 +174,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -152,8 +209,8 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) # Construct URL _url = kwargs.pop( @@ -180,8 +237,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -210,42 +267,14 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request(subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - _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_import_database_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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -274,19 +303,25 @@ def build_import_database_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_refresh_status_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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-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.Sql/checkNameAvailability") + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/refreshExternalGovernanceStatus", + ) # pylint: disable=line-too-long path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "serverName": _SERIALIZER.url("server_name", server_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -296,8 +331,6 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _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) @@ -322,6 +355,189 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def check_name_availability( + self, parameters: _models.CheckNameAvailabilityRequest, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Determines whether a resource can be created with the specified name. + + :param parameters: The name availability request parameters. Required. + :type parameters: ~azure.mgmt.sql.models.CheckNameAvailabilityRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Determines whether a resource can be created with the specified name. + + :param parameters: The name availability request parameters. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, parameters: Union[_models.CheckNameAvailabilityRequest, IO], **kwargs: Any + ) -> _models.CheckNameAvailabilityResponse: + """Determines whether a resource can be created with the specified name. + + :param parameters: The name availability request parameters. Is either a + CheckNameAvailabilityRequest type or a IO type. Required. + :type parameters: ~azure.mgmt.sql.models.CheckNameAvailabilityRequest or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "CheckNameAvailabilityRequest") + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.check_name_availability.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability" + } + + @distributed_trace + def list(self, expand: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Server"]: + """Gets a list of all servers in the subscription. + + :param expand: The child resources to include in the response. Default value is None. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Server or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.Server] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) + + error_map = { + 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_request( + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServerListResult", 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) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers"} + @distributed_trace def list_by_resource_group( self, resource_group_name: str, expand: Optional[str] = None, **kwargs: Any @@ -341,8 +557,8 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) @@ -432,8 +648,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.Server] = kwargs.pop("cls", None) @@ -485,8 +701,8 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) @@ -621,7 +837,7 @@ def begin_create_or_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The requested server resource state. Is either a model type or a IO type. + :param parameters: The requested server resource state. Is either a Server type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.Server or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -642,8 +858,8 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Server] = kwargs.pop("cls", None) @@ -703,8 +919,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -761,8 +977,8 @@ def begin_delete(self, resource_group_name: str, server_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -817,8 +1033,8 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.Server]] = kwargs.pop("cls", None) @@ -950,8 +1166,8 @@ def begin_update( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The requested server resource state. Is either a model type or a IO type. - Required. + :param parameters: The requested server resource state. Is either a ServerUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.ServerUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -971,8 +1187,8 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Server] = kwargs.pop("cls", None) @@ -1018,79 +1234,6 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}" } - @distributed_trace - def list(self, expand: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Server"]: - """Gets a list of all servers in the subscription. - - :param expand: The child resources to include in the response. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either Server or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.Server] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) - cls: ClsType[_models.ServerListResult] = kwargs.pop("cls", None) - - error_map = { - 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_request( - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ServerListResult", 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) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers"} - def _import_database_initial( self, resource_group_name: str, @@ -1109,8 +1252,8 @@ def _import_database_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Optional[_models.ImportExportOperationResult]] = kwargs.pop("cls", None) @@ -1248,8 +1391,8 @@ def begin_import_database( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The database import request parameters. Is either a model type or a IO type. - Required. + :param parameters: The database import request parameters. Is either a + ImportNewDatabaseDefinition type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.ImportNewDatabaseDefinition or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1270,8 +1413,8 @@ def begin_import_database( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ImportExportOperationResult] = kwargs.pop("cls", None) @@ -1317,57 +1460,9 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import" } - @overload - def check_name_availability( - self, parameters: _models.CheckNameAvailabilityRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Determines whether a resource can be created with the specified name. - - :param parameters: The name availability request parameters. Required. - :type parameters: ~azure.mgmt.sql.models.CheckNameAvailabilityRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Determines whether a resource can be created with the specified name. - - :param parameters: The name availability request parameters. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, parameters: Union[_models.CheckNameAvailabilityRequest, IO], **kwargs: Any - ) -> _models.CheckNameAvailabilityResponse: - """Determines whether a resource can be created with the specified name. - - :param parameters: The name availability request parameters. Is either a model type or a IO - type. Required. - :type parameters: ~azure.mgmt.sql.models.CheckNameAvailabilityRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResponse or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.CheckNameAvailabilityResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ + def _refresh_status_initial( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> Optional[_models.RefreshExternalGovernanceStatusOperationResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1376,30 +1471,20 @@ def check_name_availability( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CheckNameAvailabilityResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CheckNameAvailabilityRequest") + cls: ClsType[Optional[_models.RefreshExternalGovernanceStatusOperationResult]] = kwargs.pop("cls", None) - request = build_check_name_availability_request( + request = build_refresh_status_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, - template_url=self.check_name_availability.metadata["url"], + template_url=self._refresh_status_initial.metadata["url"], headers=_headers, params=_params, ) @@ -1412,17 +1497,93 @@ def check_name_availability( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("RefreshExternalGovernanceStatusOperationResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability" + _refresh_status_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/refreshExternalGovernanceStatus" + } + + @distributed_trace + def begin_refresh_status( + self, resource_group_name: str, server_name: str, **kwargs: Any + ) -> LROPoller[_models.RefreshExternalGovernanceStatusOperationResult]: + """Refresh external governance enablement status. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param server_name: The name of the server. Required. + :type server_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + RefreshExternalGovernanceStatusOperationResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.RefreshExternalGovernanceStatusOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.RefreshExternalGovernanceStatusOperationResult] = 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._refresh_status_initial( + resource_group_name=resource_group_name, + server_name=server_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RefreshExternalGovernanceStatusOperationResult", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_refresh_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/refreshExternalGovernanceStatus" } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_agent_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_agent_operations.py index 8cdf4ce891de..9915c42db81f 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_agent_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_agent_operations.py @@ -261,7 +261,7 @@ def create_or_update( :type resource_group_name: str :param managed_instance_name: The name of the managed instance. Required. :type managed_instance_name: str - :param parameters: Is either a model type or a IO type. Required. + :param parameters: Is either a SqlAgentConfiguration type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SqlAgentConfiguration or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessment_baselines_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessment_baselines_operations.py index 76f8de27296a..d66c61e4332a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessment_baselines_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessment_baselines_operations.py @@ -206,8 +206,8 @@ def create_or_update( :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName :param baseline_name: "default" Required. :type baseline_name: str or ~azure.mgmt.sql.models.BaselineName - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput or IO :keyword system_database_name: The vulnerability assessment system database name. Default value diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessment_rule_baseline_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessment_rule_baseline_operations.py index 9967e947e3c1..244f05867926 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessment_rule_baseline_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessment_rule_baseline_operations.py @@ -503,8 +503,8 @@ def create_or_update( :type baseline_name: str or ~azure.mgmt.sql.models.BaselineName :param rule_id: The vulnerability assessment rule ID. Required. :type rule_id: str - :param parameters: The requested rule baseline resource. Is either a model type or a IO type. - Required. + :param parameters: The requested rule baseline resource. Is either a + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput or IO :keyword system_database_name: The vulnerability assessment system database name. Default value diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessments_settings_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessments_settings_operations.py index 0a28e9e937c8..a013d2b56033 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessments_settings_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sql_vulnerability_assessments_settings_operations.py @@ -414,7 +414,8 @@ def create_or_update( :param vulnerability_assessment_name: The name of the SQL Vulnerability Assessment. "default" Required. :type vulnerability_assessment_name: str or ~azure.mgmt.sql.models.VulnerabilityAssessmentName - :param parameters: The requested resource. Is either a model type or a IO type. Required. + :param parameters: The requested resource. Is either a SqlVulnerabilityAssessment type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.SqlVulnerabilityAssessment or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_start_stop_managed_instance_schedules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_start_stop_managed_instance_schedules_operations.py new file mode 100644 index 000000000000..902b454c5f72 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_start_stop_managed_instance_schedules_operations.py @@ -0,0 +1,588 @@ +# pylint: disable=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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload + +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.pipeline.transport import HttpResponse +from azure.core.rest import 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 .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_instance_request( + resource_group_name: str, managed_instance_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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "startStopScheduleName": _SERIALIZER.url("start_stop_schedule_name", start_stop_schedule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-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.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "startStopScheduleName": _SERIALIZER.url("start_stop_schedule_name", start_stop_schedule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **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, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), + "startStopScheduleName": _SERIALIZER.url("start_stop_schedule_name", start_stop_schedule_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +class StartStopManagedInstanceSchedulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.SqlManagementClient`'s + :attr:`start_stop_managed_instance_schedules` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_instance( + self, resource_group_name: str, managed_instance_name: str, **kwargs: Any + ) -> Iterable["_models.StartStopManagedInstanceSchedule"]: + """Lists the managed instance's Start/Stop schedules. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StartStopManagedInstanceSchedule or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.StartStopManagedInstanceSchedule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.StartStopManagedInstanceScheduleListResult] = kwargs.pop("cls", None) + + error_map = { + 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_instance_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_instance.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StartStopManagedInstanceScheduleListResult", 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) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + **kwargs: Any + ) -> _models.StartStopManagedInstanceSchedule: + """Gets the managed instance's Start/Stop schedule. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param start_stop_schedule_name: Name of the managed instance Start/Stop schedule. "default" + Required. + :type start_stop_schedule_name: str or ~azure.mgmt.sql.models.StartStopScheduleName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StartStopManagedInstanceSchedule or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.StartStopManagedInstanceSchedule] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + start_stop_schedule_name=start_stop_schedule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("StartStopManagedInstanceSchedule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + parameters: _models.StartStopManagedInstanceSchedule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StartStopManagedInstanceSchedule: + """Creates or updates the managed instance's Start/Stop schedule. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param start_stop_schedule_name: Name of the managed instance Start/Stop schedule. "default" + Required. + :type start_stop_schedule_name: str or ~azure.mgmt.sql.models.StartStopScheduleName + :param parameters: The requested managed instance Start/Stop schedule. Required. + :type parameters: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StartStopManagedInstanceSchedule or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.StartStopManagedInstanceSchedule: + """Creates or updates the managed instance's Start/Stop schedule. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param start_stop_schedule_name: Name of the managed instance Start/Stop schedule. "default" + Required. + :type start_stop_schedule_name: str or ~azure.mgmt.sql.models.StartStopScheduleName + :param parameters: The requested managed instance Start/Stop schedule. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StartStopManagedInstanceSchedule or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + parameters: Union[_models.StartStopManagedInstanceSchedule, IO], + **kwargs: Any + ) -> _models.StartStopManagedInstanceSchedule: + """Creates or updates the managed instance's Start/Stop schedule. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param start_stop_schedule_name: Name of the managed instance Start/Stop schedule. "default" + Required. + :type start_stop_schedule_name: str or ~azure.mgmt.sql.models.StartStopScheduleName + :param parameters: The requested managed instance Start/Stop schedule. Is either a + StartStopManagedInstanceSchedule type or a IO type. Required. + :type parameters: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StartStopManagedInstanceSchedule or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.StartStopManagedInstanceSchedule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.StartStopManagedInstanceSchedule] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "StartStopManagedInstanceSchedule") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + start_stop_schedule_name=start_stop_schedule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("StartStopManagedInstanceSchedule", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("StartStopManagedInstanceSchedule", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + managed_instance_name: str, + start_stop_schedule_name: Union[str, _models.StartStopScheduleName], + **kwargs: Any + ) -> None: + """Deletes the managed instance's Start/Stop schedule. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. Required. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. Required. + :type managed_instance_name: str + :param start_stop_schedule_name: Name of the managed instance Start/Stop schedule. "default" + Required. + :type start_stop_schedule_name: str or ~azure.mgmt.sql.models.StartStopScheduleName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + start_stop_schedule_name=start_stop_schedule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/startStopSchedules/{startStopScheduleName}" + } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_agents_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_agents_operations.py index 79dbbaa0cea8..41b74e73bd47 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_agents_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_agents_operations.py @@ -496,7 +496,7 @@ def begin_create_or_update( :type server_name: str :param sync_agent_name: The name of the sync agent. Required. :type sync_agent_name: str - :param parameters: The requested sync agent resource state. Is either a model type or a IO + :param parameters: The requested sync agent resource state. Is either a SyncAgent type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SyncAgent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_groups_operations.py index 2cf4189d5610..99f55e8c27cd 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_groups_operations.py @@ -1263,7 +1263,7 @@ def begin_create_or_update( :type database_name: str :param sync_group_name: The name of the sync group. Required. :type sync_group_name: str - :param parameters: The requested sync group resource state. Is either a model type or a IO + :param parameters: The requested sync group resource state. Is either a SyncGroup type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SyncGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -1634,7 +1634,7 @@ def begin_update( :type database_name: str :param sync_group_name: The name of the sync group. Required. :type sync_group_name: str - :param parameters: The requested sync group resource state. Is either a model type or a IO + :param parameters: The requested sync group resource state. Is either a SyncGroup type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.SyncGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_members_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_members_operations.py index dad008521cbf..dad88c278687 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_members_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_members_operations.py @@ -622,8 +622,8 @@ def begin_create_or_update( :type sync_group_name: str :param sync_member_name: The name of the sync member. Required. :type sync_member_name: str - :param parameters: The requested sync member resource state. Is either a model type or a IO - type. Required. + :param parameters: The requested sync member resource state. Is either a SyncMember type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.SyncMember or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1025,8 +1025,8 @@ def begin_update( :type sync_group_name: str :param sync_member_name: The name of the sync member. Required. :type sync_member_name: str - :param parameters: The requested sync member resource state. Is either a model type or a IO - type. Required. + :param parameters: The requested sync member resource state. Is either a SyncMember type or a + IO type. Required. :type parameters: ~azure.mgmt.sql.models.SyncMember or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_tde_certificates_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_tde_certificates_operations.py index c0759bf8c622..044be63c88cc 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_tde_certificates_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_tde_certificates_operations.py @@ -234,8 +234,8 @@ def begin_create( :type resource_group_name: str :param server_name: The name of the server. Required. :type server_name: str - :param parameters: The requested TDE certificate to be created or updated. Is either a model - type or a IO type. Required. + :param parameters: The requested TDE certificate to be created or updated. Is either a + TdeCertificate type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.TdeCertificate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_transparent_data_encryptions_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_transparent_data_encryptions_operations.py index fcc37ed82013..79f0e25ac066 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_transparent_data_encryptions_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_transparent_data_encryptions_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -20,10 +20,12 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer @@ -40,32 +42,26 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, - server_name: str, - database_name: str, - tde_name: Union[str, _models.TransparentDataEncryptionName], - subscription_id: str, - **kwargs: Any +def build_list_by_database_request( + resource_group_name: str, server_name: str, database_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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption", ) # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "serverName": _SERIALIZER.url("server_name", server_name, "str"), "databaseName": _SERIALIZER.url("database_name", database_name, "str"), - "tdeName": _SERIALIZER.url("tde_name", tde_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -80,7 +76,7 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( +def build_get_request( resource_group_name: str, server_name: str, database_name: str, @@ -91,10 +87,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,33 +111,38 @@ def build_create_or_update_request( _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_database_request( - resource_group_name: str, server_name: str, database_name: str, subscription_id: str, **kwargs: Any +def build_create_or_update_request( + resource_group_name: str, + server_name: str, + database_name: str, + tde_name: Union[str, _models.TransparentDataEncryptionName], + subscription_id: str, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-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.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}", ) # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "serverName": _SERIALIZER.url("server_name", server_name, "str"), "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + "tdeName": _SERIALIZER.url("tde_name", tde_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -152,9 +152,11 @@ def build_list_by_database_request( _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="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) class TransparentDataEncryptionsOperations: @@ -176,6 +178,93 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list_by_database( + self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any + ) -> Iterable["_models.LogicalDatabaseTransparentDataEncryption"]: + """Gets a list of the logical database's transparent data encryption. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. 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 logical database for which the transparent data + encryption is defined. Required. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LogicalDatabaseTransparentDataEncryption or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + cls: ClsType[_models.LogicalDatabaseTransparentDataEncryptionListResult] = kwargs.pop("cls", None) + + error_map = { + 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_database_request( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_database.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + request = HttpRequest("GET", next_link) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryptionListResult", 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) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_database.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption" + } + @distributed_trace def get( self, @@ -213,8 +302,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) cls: ClsType[_models.LogicalDatabaseTransparentDataEncryption] = kwargs.pop("cls", None) @@ -253,8 +342,85 @@ def get( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}" } + def _create_or_update_initial( + self, + resource_group_name: str, + server_name: str, + database_name: str, + tde_name: Union[str, _models.TransparentDataEncryptionName], + parameters: Union[_models.LogicalDatabaseTransparentDataEncryption, IO], + **kwargs: Any + ) -> Optional[_models.LogicalDatabaseTransparentDataEncryption]: + error_map = { + 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: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.LogicalDatabaseTransparentDataEncryption]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "LogicalDatabaseTransparentDataEncryption") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + tde_name=tde_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryption", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryption", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}" + } + @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -264,7 +430,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.LogicalDatabaseTransparentDataEncryption]: + ) -> LROPoller[_models.LogicalDatabaseTransparentDataEncryption]: """Updates a logical database's transparent data encryption configuration. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -283,13 +449,22 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogicalDatabaseTransparentDataEncryption or None or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption or None + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LogicalDatabaseTransparentDataEncryption + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -299,7 +474,7 @@ def create_or_update( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.LogicalDatabaseTransparentDataEncryption]: + ) -> LROPoller[_models.LogicalDatabaseTransparentDataEncryption]: """Updates a logical database's transparent data encryption configuration. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,13 +493,22 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogicalDatabaseTransparentDataEncryption or None or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption or None + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LogicalDatabaseTransparentDataEncryption + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def create_or_update( + def begin_create_or_update( self, resource_group_name: str, server_name: str, @@ -332,7 +516,7 @@ def create_or_update( tde_name: Union[str, _models.TransparentDataEncryptionName], parameters: Union[_models.LogicalDatabaseTransparentDataEncryption, IO], **kwargs: Any - ) -> Optional[_models.LogicalDatabaseTransparentDataEncryption]: + ) -> LROPoller[_models.LogicalDatabaseTransparentDataEncryption]: """Updates a logical database's transparent data encryption configuration. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -345,168 +529,76 @@ def create_or_update( :type database_name: str :param tde_name: The name of the transparent data encryption configuration. "current" Required. :type tde_name: str or ~azure.mgmt.sql.models.TransparentDataEncryptionName - :param parameters: The database transparent data encryption. Is either a model type or a IO - type. Required. + :param parameters: The database transparent data encryption. Is either a + LogicalDatabaseTransparentDataEncryption type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogicalDatabaseTransparentDataEncryption or None or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption or None + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LogicalDatabaseTransparentDataEncryption + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 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: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") + api_version: Literal["2022-08-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.LogicalDatabaseTransparentDataEncryption]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "LogicalDatabaseTransparentDataEncryption") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - server_name=server_name, - database_name=database_name, - tde_name=tde_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create_or_update.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryption", pipeline_response) + cls: ClsType[_models.LogicalDatabaseTransparentDataEncryption] = 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_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + tde_name=tde_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) - if response.status_code == 201: + def get_long_running_output(pipeline_response): deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryption", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}" - } - - @distributed_trace - def list_by_database( - self, resource_group_name: str, server_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.LogicalDatabaseTransparentDataEncryption"]: - """Gets a list of the logical database's transparent data encryption. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. 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 logical database for which the transparent data - encryption is defined. Required. - :type database_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LogicalDatabaseTransparentDataEncryption or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.LogicalDatabaseTransparentDataEncryption] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2021-02-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2021-02-01-preview") - ) - cls: ClsType[_models.LogicalDatabaseTransparentDataEncryptionListResult] = kwargs.pop("cls", None) - - error_map = { - 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_database_request( - resource_group_name=resource_group_name, - server_name=server_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_database.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - request = HttpRequest("GET", next_link) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("LogicalDatabaseTransparentDataEncryptionListResult", 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) + return cls(pipeline_response, deserialized, {}) + return deserialized - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - list_by_database.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption" + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}" } diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_virtual_clusters_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_virtual_clusters_operations.py index 29398edd1dad..fd0c6df97f8d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_virtual_clusters_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_virtual_clusters_operations.py @@ -726,8 +726,8 @@ def begin_update( :type resource_group_name: str :param virtual_cluster_name: The name of the virtual cluster. Required. :type virtual_cluster_name: str - :param parameters: The requested virtual cluster resource state. Is either a model type or a IO - type. Required. + :param parameters: The requested virtual cluster resource state. Is either a + VirtualClusterUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.VirtualClusterUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_virtual_network_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_virtual_network_rules_operations.py index f7130dafe2bf..060c176f6aac 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_virtual_network_rules_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_virtual_network_rules_operations.py @@ -432,8 +432,8 @@ def begin_create_or_update( :type server_name: str :param virtual_network_rule_name: The name of the virtual network rule. Required. :type virtual_network_rule_name: str - :param parameters: The requested virtual Network Rule Resource state. Is either a model type or - a IO type. Required. + :param parameters: The requested virtual Network Rule Resource state. Is either a + VirtualNetworkRule type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.VirtualNetworkRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_workload_classifiers_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_workload_classifiers_operations.py index f864ea12572c..15e7ff8e93d6 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_workload_classifiers_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_workload_classifiers_operations.py @@ -504,8 +504,8 @@ def begin_create_or_update( :param workload_classifier_name: The name of the workload classifier to create/update. Required. :type workload_classifier_name: str - :param parameters: The properties of the workload classifier. Is either a model type or a IO - type. Required. + :param parameters: The properties of the workload classifier. Is either a WorkloadClassifier + type or a IO type. Required. :type parameters: ~azure.mgmt.sql.models.WorkloadClassifier or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_workload_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_workload_groups_operations.py index 18a0345c0140..32ae6272b1a1 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_workload_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_workload_groups_operations.py @@ -465,8 +465,8 @@ def begin_create_or_update( :type database_name: str :param workload_group_name: The name of the workload group. Required. :type workload_group_name: str - :param parameters: The requested workload group state. Is either a model type or a IO type. - Required. + :param parameters: The requested workload group state. Is either a WorkloadGroup type or a IO + type. Required. :type parameters: ~azure.mgmt.sql.models.WorkloadGroup or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_already_exists.py b/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_already_exists.py index a283e5dcb908..ea31c2f591c4 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_already_exists.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_already_exists.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAlreadyExists.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CheckNameAvailabilityServerAlreadyExists.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_available.py b/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_available.py index 60d7a5e2b27c..557f2cb60d47 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_available.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_available.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAvailable.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CheckNameAvailabilityServerAvailable.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_invalid.py b/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_invalid.py index 437eedb54a1f..ec0342bb9b55 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_invalid.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/check_name_availability_server_invalid.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerInvalid.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CheckNameAvailabilityServerInvalid.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_configured_backup_storage_redundancy.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_configured_backup_storage_redundancy.py index 776be65d2087..d2944209261d 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_configured_backup_storage_redundancy.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_configured_backup_storage_redundancy.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseConfiguredBackupStorageRedundancy.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseConfiguredBackupStorageRedundancy.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_copy_mode.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_copy_mode.py index cf6a37a38f70..052689a3aca1 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_copy_mode.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_copy_mode.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseCopyMode.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseCopyMode.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_enclave.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_enclave.py index 7fe7ab0bc489..9d9482994b36 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_enclave.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_enclave.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseDefaultEnclave.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseDefaultEnclave.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_mode.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_mode.py index 9fca87c06715..711541112ae5 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_mode.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_mode.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseDefaultMode.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseDefaultMode.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_mode_with_keys_and_encryption_protector.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_mode_with_keys_and_encryption_protector.py new file mode 100644 index 000000000000..345a3b82be84 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_default_mode_with_keys_and_encryption_protector.py @@ -0,0 +1,62 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python create_database_default_mode_with_keys_and_encryption_protector.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.databases.begin_create_or_update( + resource_group_name="Default-SQL-SouthEastAsia", + server_name="testsvr", + database_name="testdb", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/Default-SQL-SouthEastAsia/providers/Microsoft.ManagedIdentity/userAssignedIdentities/umi": {} + }, + }, + "location": "southeastasia", + "properties": { + "collation": "SQL_Latin1_General_CP1_CI_AS", + "createMode": "Default", + "encryptionProtector": "https://your-key-vault-name.vault.azure.net/yourKey/yourKeyVersion", + "keys": { + "https://your-key-vault-name.vault.azure.net/yourKey/yourKeyVersion": {}, + "https://your-key-vault-name.vault.azure.net/yourKey2/yourKey2Version": {}, + }, + "maxSizeBytes": 1073741824, + }, + "sku": {"name": "S0", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseDefaultModeWithKeysAndEncryptionProtector.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_ledger.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_ledger.py index eaae7fb5a1b3..246eb7fd5816 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_ledger.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_ledger.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseLedger.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseLedger.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_maintenance_configuration.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_maintenance_configuration.py index 3256d82643fd..b6072c509e03 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_maintenance_configuration.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_maintenance_configuration.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseMaintenanceConfiguration.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseMaintenanceConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_min.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_min.py index 9c66a520b2a6..7c19c2231c4a 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_min.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_min.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseMin.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseMin.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_named_replica.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_named_replica.py index 9b4f9758023c..f4cad8dd68dc 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_named_replica.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_named_replica.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseNamedReplica.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseNamedReplica.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_pitr_mode.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_pitr_mode.py index 88b4fc545e82..295bdcc8cfdc 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_pitr_mode.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_pitr_mode.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabasePITRMode.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabasePITRMode.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_secondary_mode.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_secondary_mode.py index 42e8b1cdd70a..3afea3a4344b 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_secondary_mode.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_secondary_mode.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseSecondaryMode.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseSecondaryMode.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_standby_mode.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_standby_mode.py index a270469d50f6..34e96de963b4 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_standby_mode.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_standby_mode.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseStandbyMode.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseStandbyMode.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_vbs_enclave.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_vbs_enclave.py index 8daa04b83bb1..dfef7c3f2bf9 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_vbs_enclave.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_vbs_enclave.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseVBSEnclave.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseVBSEnclave.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_database_with_availability_zone.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_with_availability_zone.py new file mode 100644 index 000000000000..cf25b6278e3d --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_database_with_availability_zone.py @@ -0,0 +1,52 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python create_database_with_availability_zone.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.databases.begin_create_or_update( + resource_group_name="Default-SQL-SouthEastAsia", + server_name="testsvr", + database_name="testdb", + parameters={ + "location": "southeastasia", + "properties": { + "availabilityZone": "1", + "collation": "SQL_Latin1_General_CP1_CI_AS", + "createMode": "Default", + "maxSizeBytes": 1073741824, + }, + "sku": {"name": "S0", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDatabaseWithAvailabilityZone.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_pitr.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_pitr.py index b409d6b8172b..cf5dc8d21a18 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_pitr.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_pitr.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionPITR.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDwDatabaseCrossSubscriptionPITR.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_recovery.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_recovery.py index a384ba708ff5..ec95a00ec0ef 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_recovery.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_recovery.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRecovery.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDwDatabaseCrossSubscriptionRecovery.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_restore.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_restore.py index c80d67d8df46..acc69f0cd9a6 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_restore.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_dw_database_cross_subscription_restore.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRestore.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateDwDatabaseCrossSubscriptionRestore.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_vcore_database_by_service_objective.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_vcore_database_by_service_objective.py index 64b69569b15a..07d8a39f77a3 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_vcore_database_by_service_objective.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_vcore_database_by_service_objective.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateVCoreDatabaseByServiceObjective.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateVCoreDatabaseByServiceObjective.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/create_vcore_database_by_sku_name_capacity.py b/sdk/sql/azure-mgmt-sql/generated_samples/create_vcore_database_by_sku_name_capacity.py index dad309baea08..d4c4af7b71ce 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/create_vcore_database_by_sku_name_capacity.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/create_vcore_database_by_sku_name_capacity.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateVCoreDatabaseBySkuNameCapacity.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/CreateVCoreDatabaseBySkuNameCapacity.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/database_encryption_protector_revalidate.py b/sdk/sql/azure-mgmt-sql/generated_samples/database_encryption_protector_revalidate.py new file mode 100644 index 000000000000..017f35059eb0 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/database_encryption_protector_revalidate.py @@ -0,0 +1,43 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python database_encryption_protector_revalidate.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.database_encryption_protectors.begin_revalidate( + resource_group_name="sqlcrudtest-7398", + server_name="sqlcrudtest-4645", + database_name="sqlcrudtestdb-2342", + encryption_protector_name="current", + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/DatabaseEncryptionProtectorRevalidate.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/database_encryption_protector_revert.py b/sdk/sql/azure-mgmt-sql/generated_samples/database_encryption_protector_revert.py new file mode 100644 index 000000000000..e86cceca6f5d --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/database_encryption_protector_revert.py @@ -0,0 +1,43 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python database_encryption_protector_revert.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.database_encryption_protectors.begin_revert( + resource_group_name="sqlcrudtest-7398", + server_name="sqlcrudtest-4645", + database_name="sqlcrudtestdb-2342", + encryption_protector_name="current", + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/DatabaseEncryptionProtectorRevert.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/delete_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/delete_database.py index 34e2113c8729..c45d354710cf 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/delete_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/delete_database.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/DeleteDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/DeleteDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/export_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/export_database.py index 4495f1f452ed..77cb62f2ab15 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/export_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/export_database.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ExportDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ExportDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/export_database_with_network_isolation.py b/sdk/sql/azure-mgmt-sql/generated_samples/export_database_with_network_isolation.py index 4f3f11533d69..a05c68c90ba6 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/export_database_with_network_isolation.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/export_database_with_network_isolation.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ExportDatabaseWithNetworkIsolation.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ExportDatabaseWithNetworkIsolation.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/failover_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/failover_database.py index 3ad026496905..ce0336dfb4fb 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/failover_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/failover_database.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/FailoverDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/FailoverDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/failover_managed_instance.py b/sdk/sql/azure-mgmt-sql/generated_samples/failover_managed_instance.py index d875350121bf..1a94151fa33f 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/failover_managed_instance.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/failover_managed_instance.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/FailoverManagedInstance.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/FailoverManagedInstance.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/get_database_with_availability_zone.py b/sdk/sql/azure-mgmt-sql/generated_samples/get_database_with_availability_zone.py new file mode 100644 index 000000000000..b391c439d1e6 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/get_database_with_availability_zone.py @@ -0,0 +1,42 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python get_database_with_availability_zone.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.databases.get( + resource_group_name="Default-SQL-SouthEastAsia", + server_name="testsvr", + database_name="testdb", + ) + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetDatabaseWithAvailabilityZone.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/get_restorable_dropped_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/get_restorable_dropped_database.py index 98be3cabb77c..9ca8c2c16f52 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/get_restorable_dropped_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/get_restorable_dropped_database.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetRestorableDroppedDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/get_restorable_dropped_database_with_expand_equals_keys.py b/sdk/sql/azure-mgmt-sql/generated_samples/get_restorable_dropped_database_with_expand_equals_keys.py new file mode 100644 index 000000000000..e1a708dbdef4 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/get_restorable_dropped_database_with_expand_equals_keys.py @@ -0,0 +1,42 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python get_restorable_dropped_database_with_expand_equals_keys.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.restorable_dropped_databases.get( + resource_group_name="Default-SQL-SouthEastAsia", + server_name="testsvr", + restorable_dropped_database_id="testdb,131403269876900000", + ) + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetRestorableDroppedDatabaseWithExpandEqualsKeys.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database.py index 81af97d69edc..556f241a43d7 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/GetVCoreDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetVCoreDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_default_enclave.py b/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_default_enclave.py index c78aa20af8ee..28d0374ddbd8 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_default_enclave.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_default_enclave.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/GetVCoreDatabaseDefaultEnclave.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetVCoreDatabaseDefaultEnclave.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_vbs_enclave.py b/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_vbs_enclave.py index 94b4712d6c9a..7ced979d5692 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_vbs_enclave.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_vbs_enclave.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/GetVCoreDatabaseVBSEnclave.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetVCoreDatabaseVBSEnclave.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_with_expand_equals_keys.py b/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_with_expand_equals_keys.py new file mode 100644 index 000000000000..fc70f561e356 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/get_vcore_database_with_expand_equals_keys.py @@ -0,0 +1,42 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python get_vcore_database_with_expand_equals_keys.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.databases.get( + resource_group_name="Default-SQL-SouthEastAsia", + server_name="testsvr", + database_name="testdb", + ) + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/GetVCoreDatabaseWithExpandEqualsKeys.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/import_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/import_database.py index 05a7b73e024b..42a3d23dca71 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/import_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/import_database.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ImportDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ImportDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/import_database_with_network_isolation.py b/sdk/sql/azure-mgmt-sql/generated_samples/import_database_with_network_isolation.py index 4f6b108fbe7f..77bb06f8c83d 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/import_database_with_network_isolation.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/import_database_with_network_isolation.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ImportDatabaseWithNetworkIsolation.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ImportDatabaseWithNetworkIsolation.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/import_new_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/import_new_database.py index 945b426e91f2..1f2bb5b5af2d 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/import_new_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/import_new_database.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ImportNewDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/import_new_database_with_network_isolation.py b/sdk/sql/azure-mgmt-sql/generated_samples/import_new_database_with_network_isolation.py index 1a8273b45cf0..070f3961af53 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/import_new_database_with_network_isolation.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/import_new_database_with_network_isolation.py @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabaseWithNetworkIsolation.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ImportNewDatabaseWithNetworkIsolation.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/list_databases_by_elastic_pool.py b/sdk/sql/azure-mgmt-sql/generated_samples/list_databases_by_elastic_pool.py index 69c6a9e85c80..1c59bdd77425 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/list_databases_by_elastic_pool.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/list_databases_by_elastic_pool.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListDatabasesByElasticPool.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ListDatabasesByElasticPool.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/list_outbound_network_dependencies_by_managed_instance.py b/sdk/sql/azure-mgmt-sql/generated_samples/list_outbound_network_dependencies_by_managed_instance.py new file mode 100644 index 000000000000..48fdf6081bf7 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/list_outbound_network_dependencies_by_managed_instance.py @@ -0,0 +1,42 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python list_outbound_network_dependencies_by_managed_instance.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="20d7082a-0fc7-4468-82bd-542694d5042b", + ) + + response = client.managed_instances.list_outbound_network_dependencies_by_managed_instance( + resource_group_name="sqlcrudtest-7398", + managed_instance_name="testinstance", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ListOutboundNetworkDependenciesByManagedInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/list_restorable_dropped_databases_by_server.py b/sdk/sql/azure-mgmt-sql/generated_samples/list_restorable_dropped_databases_by_server.py index aba91e284733..4539ede5dc15 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/list_restorable_dropped_databases_by_server.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/list_restorable_dropped_databases_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListRestorableDroppedDatabasesByServer.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ListRestorableDroppedDatabasesByServer.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_databases_by_server.py b/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_databases_by_server.py index df25e77370db..d1ec0cb7faf2 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_databases_by_server.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_databases_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListVCoreDatabasesByServer.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ListVCoreDatabasesByServer.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_databases_enclave_type_by_server.py b/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_databases_enclave_type_by_server.py index 398e9c1d61f2..ae814ceb5594 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_databases_enclave_type_by_server.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_databases_enclave_type_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListVCoreDatabasesEnclaveTypeByServer.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ListVCoreDatabasesEnclaveTypeByServer.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_inaccessible_databases_by_server.py b/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_inaccessible_databases_by_server.py index d2179ce18012..a792f36a2331 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_inaccessible_databases_by_server.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/list_vcore_inaccessible_databases_by_server.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListVCoreInaccessibleDatabasesByServer.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ListVCoreInaccessibleDatabasesByServer.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_create_max.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_create_max.py index 5605fb8e6b74..e0401f347476 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_create_max.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_create_max.py @@ -66,6 +66,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMax.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceCreateMax.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_create_min.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_create_min.py index 61cb60c287fd..4ab8ecbb7b95 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_create_min.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_create_min.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMin.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceCreateMin.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_delete.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_delete.py index e1f680402704..29c89ef643ab 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_delete.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceDelete.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceDelete.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_get.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_get.py index 5a5252298f1f..a6cc7a52d030 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_get.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGet.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGet.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_get_with_expand_equals_administrators.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_get_with_expand_equals_administrators.py index 17c325dddad2..9781d74484ce 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_get_with_expand_equals_administrators.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_get_with_expand_equals_administrators.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list.py index c50f5ce77da5..49d792656d56 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceList.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceList.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_instance_pool.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_instance_pool.py index 7cfa8dc84e40..92e4153e9679 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_instance_pool.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_instance_pool.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePool.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePool.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_instance_pool_with_expand_equals_administrators.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_instance_pool_with_expand_equals_administrators.py index 1a66e87bc905..e2ee4fdbee94 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_instance_pool_with_expand_equals_administrators.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_instance_pool_with_expand_equals_administrators.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_resource_group.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_resource_group.py index 48f0082fd8a1..54289539533c 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_resource_group.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroup.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_resource_group_with_expand_equals_administrators.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_resource_group_with_expand_equals_administrators.py index 1360a6d44cd6..2c238e081935 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_resource_group_with_expand_equals_administrators.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_by_resource_group_with_expand_equals_administrators.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroupWithExpandEqualsAdministrators.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByResourceGroupWithExpandEqualsAdministrators.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_with_expand_equals_administrators.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_with_expand_equals_administrators.py index 0a81cbaae679..90393d47e055 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_with_expand_equals_administrators.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_list_with_expand_equals_administrators.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListWithExpandEqualsAdministrators.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListWithExpandEqualsAdministrators.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_remove_maintenance_configuration.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_remove_maintenance_configuration.py index 55018e729a9a..6295d31b73fb 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_remove_maintenance_configuration.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_remove_maintenance_configuration.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceRemoveMaintenanceConfiguration.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceRemoveMaintenanceConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list.py index 5d45b8bdc2bf..545cb78f0368 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesList.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceTopQueriesList.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list_max.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list_max.py index e2ad638ed9a8..f777e163e4cb 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list_max.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list_max.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMax.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceTopQueriesListMax.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list_min.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list_min.py index 5513025b7386..d23c5757233d 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list_min.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_top_queries_list_min.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMin.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceTopQueriesListMin.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_update_max.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_update_max.py index 236fef388cd2..b11b5c06b793 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_update_max.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_update_max.py @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMax.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceUpdateMax.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_update_min.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_update_min.py index a310e6ea7654..6aa5e16e9857 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_update_min.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_instance_update_min.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMin.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceUpdateMin.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_disable.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_disable.py new file mode 100644 index 000000000000..75f04048a3d8 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_disable.py @@ -0,0 +1,43 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python managed_ledger_digest_uploads_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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.managed_ledger_digest_uploads.begin_disable( + resource_group_name="ledgertestrg", + managed_instance_name="ledgertestserver", + database_name="testdb", + ledger_digest_uploads="current", + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedLedgerDigestUploadsDisable.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_enable.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_enable.py new file mode 100644 index 000000000000..13ba7724c590 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_enable.py @@ -0,0 +1,44 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python managed_ledger_digest_uploads_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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.managed_ledger_digest_uploads.begin_create_or_update( + resource_group_name="ledgertestrg", + managed_instance_name="ledgertestserver", + database_name="testdb", + ledger_digest_uploads="current", + parameters={"properties": {"digestStorageEndpoint": "https://MyAccount.blob.core.windows.net"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedLedgerDigestUploadsEnable.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_get.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_get.py new file mode 100644 index 000000000000..f12d515b967b --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_get.py @@ -0,0 +1,43 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python managed_ledger_digest_uploads_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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.managed_ledger_digest_uploads.get( + resource_group_name="ledgertestrg", + managed_instance_name="ledgertestserver", + database_name="testdb", + ledger_digest_uploads="current", + ) + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedLedgerDigestUploadsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_list.py b/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_list.py new file mode 100644 index 000000000000..7787ebdb1c2a --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/managed_ledger_digest_uploads_list.py @@ -0,0 +1,43 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python managed_ledger_digest_uploads_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, + 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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.managed_ledger_digest_uploads.list_by_database( + resource_group_name="ledgertestrg", + managed_instance_name="ledgertestserver", + database_name="testdb", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedLedgerDigestUploadsList.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/patch_database_default_enclave.py b/sdk/sql/azure-mgmt-sql/generated_samples/patch_database_default_enclave.py index e1458f65ed2b..5095dd5779a9 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/patch_database_default_enclave.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/patch_database_default_enclave.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchDatabaseDefaultEnclave.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/PatchDatabaseDefaultEnclave.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/patch_database_vbs_enclave.py b/sdk/sql/azure-mgmt-sql/generated_samples/patch_database_vbs_enclave.py index d57219dfd6d8..59a501db0735 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/patch_database_vbs_enclave.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/patch_database_vbs_enclave.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchDatabaseVBSEnclave.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/PatchDatabaseVBSEnclave.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database.py index d13cf6e236b5..8df904ecd43c 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchVCoreDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/PatchVCoreDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_assign_maintenance_configuration.py b/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_assign_maintenance_configuration.py index 5cf255aa8790..8d167b03abed 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_assign_maintenance_configuration.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_assign_maintenance_configuration.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchVCoreDatabaseAssignMaintenanceConfiguration.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/PatchVCoreDatabaseAssignMaintenanceConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_reset_maintenance_configuration.py b/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_reset_maintenance_configuration.py index 9dfc4bc24738..156840558c10 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_reset_maintenance_configuration.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_reset_maintenance_configuration.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchVCoreDatabaseResetMaintenanceConfiguration.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/PatchVCoreDatabaseResetMaintenanceConfiguration.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_with_keys_and_encryption_protector.py b/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_with_keys_and_encryption_protector.py new file mode 100644 index 000000000000..38dce910c356 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/patch_vcore_database_with_keys_and_encryption_protector.py @@ -0,0 +1,59 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python patch_vcore_database_with_keys_and_encryption_protector.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.databases.begin_update( + resource_group_name="Default-SQL-SouthEastAsia", + server_name="testsvr", + database_name="testdb", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/Default-SQL-SouthEastAsia/providers/Microsoft.ManagedIdentity/userAssignedIdentities/umi": {}, + "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/Default-SQL-SouthEastAsia/providers/Microsoft.ManagedIdentity/userAssignedIdentities/umiToDelete": None, + }, + }, + "properties": { + "encryptionProtector": "https://your-key-vault-name.vault.azure.net/yourKey/yourKeyVersion", + "keys": { + "https://your-key-vault-name.vault.azure.net/yourKey/yourKeyVersion": {}, + "https://your-key-vault-name.vault.azure.net/yourKey2/yourKey2VersionToDelete": None, + }, + }, + "sku": {"name": "S0", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/PatchVCoreDatabaseWithKeysAndEncryptionProtector.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/pause_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/pause_database.py index fd25770a390e..abe4288cd416 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/pause_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/pause_database.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PauseDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/PauseDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_get.py b/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_get.py index fb58435add85..f6cf32abb685 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_get.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseGet.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/RecoverableDatabaseGet.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_get_with_expand_equals_keys.py b/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_get_with_expand_equals_keys.py new file mode 100644 index 000000000000..5a81540bfa1b --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_get_with_expand_equals_keys.py @@ -0,0 +1,42 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python recoverable_database_get_with_expand_equals_keys.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.recoverable_databases.get( + resource_group_name="recoverabledatabasetest-6852", + server_name="recoverabledatabasetest-2080", + database_name="recoverabledatabasetest-9187", + ) + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/RecoverableDatabaseGetWithExpandEqualsKeys.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_list.py b/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_list.py index 5185a6bd85ab..2b331b5aa356 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_list.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/recoverable_database_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseList.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/RecoverableDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/refresh_external_governance_status.py b/sdk/sql/azure-mgmt-sql/generated_samples/refresh_external_governance_status.py new file mode 100644 index 000000000000..549b0d96e8e6 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/refresh_external_governance_status.py @@ -0,0 +1,41 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python refresh_external_governance_status.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.servers.begin_refresh_status( + resource_group_name="sqlcrudtest-7398", + server_name="sqlcrudtest-4645", + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/RefreshExternalGovernanceStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/rename_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/rename_database.py index 585af8c56f22..536e4550d297 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/rename_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/rename_database.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/RenameDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/RenameDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/resume_database.py b/sdk/sql/azure-mgmt-sql/generated_samples/resume_database.py index 8fb84fb0ccf9..7a189b6773e4 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/resume_database.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/resume_database.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ResumeDatabase.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ResumeDatabase.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_get.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_get.py new file mode 100644 index 000000000000..9cf4fd777daa --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_get.py @@ -0,0 +1,42 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python server_configuration_option_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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.server_configuration_options.get( + resource_group_name="testrg", + managed_instance_name="testinstance", + server_configuration_option_name="allowPolybaseExport", + ) + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerConfigurationOptionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_list.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_list.py new file mode 100644 index 000000000000..7161d79e97d8 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_list.py @@ -0,0 +1,42 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python server_configuration_option_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, + 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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.server_configuration_options.list_by_managed_instance( + resource_group_name="testrg", + managed_instance_name="testinstance", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerConfigurationOptionList.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_update.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_update.py new file mode 100644 index 000000000000..01a4be920b1d --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_configuration_option_update.py @@ -0,0 +1,43 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python server_configuration_option_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, + 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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.server_configuration_options.begin_create_or_update( + resource_group_name="testrg", + managed_instance_name="testinstance", + server_configuration_option_name="allowPolybaseExport", + parameters={"properties": {"serverConfigurationOptionValue": 1}}, + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerConfigurationOptionUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_create.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_create.py index 72806f5310cd..af7e191c8942 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/server_create.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_create.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerCreate.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerCreate.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_delete.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_delete.py index 55adb0acde2a..1d89eaca3b5e 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/server_delete.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerDelete.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerDelete.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_get.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_get.py index 1f11d02516fb..7a7ce546a9c6 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/server_get.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGet.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerGet.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_get_with_expand_equals_administrators.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_get_with_expand_equals_administrators.py index d77c905e12be..ae06f2da6cb5 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/server_get_with_expand_equals_administrators.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_get_with_expand_equals_administrators.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGetWithExpandEqualsAdministrators.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerGetWithExpandEqualsAdministrators.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_list.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_list.py index c5bf00eff6f1..3a17427bdd6d 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/server_list.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerList.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerList.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_list_by_resource_group.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_list_by_resource_group.py index ed00c6144493..33df2b4bd4de 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/server_list_by_resource_group.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroup.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_list_by_resource_group_with_expand_equals_administrators.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_list_by_resource_group_with_expand_equals_administrators.py index de3ca30d5975..d2732c19a5b8 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/server_list_by_resource_group_with_expand_equals_administrators.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_list_by_resource_group_with_expand_equals_administrators.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroupWithExpandEqualsAdministrators.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerListByResourceGroupWithExpandEqualsAdministrators.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_list_with_expand_equals_administrators.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_list_with_expand_equals_administrators.py index 44393f0ac9b6..6377239fe6cf 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/server_list_with_expand_equals_administrators.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_list_with_expand_equals_administrators.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListWithExpandEqualsAdministrators.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerListWithExpandEqualsAdministrators.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/server_update.py b/sdk/sql/azure-mgmt-sql/generated_samples/server_update.py index a14317738c89..5460e9e91e00 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/server_update.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/server_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerUpdate.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ServerUpdate.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/start_managed_instance.py b/sdk/sql/azure-mgmt-sql/generated_samples/start_managed_instance.py new file mode 100644 index 000000000000..1d60eb1bc6e3 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/start_managed_instance.py @@ -0,0 +1,41 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python start_managed_instance.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.managed_instances.begin_start( + resource_group_name="startrg", + managed_instance_name="mitostart", + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/StartManagedInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_create_or_update_max.py b/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_create_or_update_max.py new file mode 100644 index 000000000000..89755a7be20e --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_create_or_update_max.py @@ -0,0 +1,52 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python start_stop_managed_instance_schedule_create_or_update_max.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.start_stop_managed_instance_schedules.create_or_update( + resource_group_name="schedulerg", + managed_instance_name="schedulemi", + start_stop_schedule_name="default", + parameters={ + "properties": { + "description": "This is a schedule for our Dev/Test environment.", + "scheduleList": [ + {"startDay": "Thursday", "startTime": "18:00", "stopDay": "Thursday", "stopTime": "17:00"}, + {"startDay": "Thursday", "startTime": "15:00", "stopDay": "Thursday", "stopTime": "14:00"}, + ], + "timeZoneId": "Central European Standard Time", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/StartStopManagedInstanceScheduleCreateOrUpdateMax.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_create_or_update_min.py b/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_create_or_update_min.py new file mode 100644 index 000000000000..f4cbaa9d0d70 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_create_or_update_min.py @@ -0,0 +1,50 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python start_stop_managed_instance_schedule_create_or_update_min.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.start_stop_managed_instance_schedules.create_or_update( + resource_group_name="schedulerg", + managed_instance_name="schedulemi", + start_stop_schedule_name="default", + parameters={ + "properties": { + "scheduleList": [ + {"startDay": "Thursday", "startTime": "18:00", "stopDay": "Thursday", "stopTime": "17:00"}, + {"startDay": "Thursday", "startTime": "15:00", "stopDay": "Thursday", "stopTime": "14:00"}, + ] + } + }, + ) + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/StartStopManagedInstanceScheduleCreateOrUpdateMin.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_delete.py b/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_delete.py new file mode 100644 index 000000000000..0e549544924f --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_delete.py @@ -0,0 +1,42 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python start_stop_managed_instance_schedule_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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.start_stop_managed_instance_schedules.delete( + resource_group_name="schedulerg", + managed_instance_name="schedulemi", + start_stop_schedule_name="default", + ) + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/StartStopManagedInstanceScheduleDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_get.py b/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_get.py new file mode 100644 index 000000000000..54a5c3c48876 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_get.py @@ -0,0 +1,42 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python start_stop_managed_instance_schedule_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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.start_stop_managed_instance_schedules.get( + resource_group_name="schedulerg", + managed_instance_name="schedulemi", + start_stop_schedule_name="default", + ) + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/StartStopManagedInstanceScheduleGet.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_list.py b/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_list.py new file mode 100644 index 000000000000..6ad618beea22 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/start_stop_managed_instance_schedule_list.py @@ -0,0 +1,42 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python start_stop_managed_instance_schedule_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, + 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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.start_stop_managed_instance_schedules.list_by_instance( + resource_group_name="schedulerg", + managed_instance_name="schedulemi", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/StartStopManagedInstanceScheduleList.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/stop_managed_instance.py b/sdk/sql/azure-mgmt-sql/generated_samples/stop_managed_instance.py new file mode 100644 index 000000000000..0179cee60d51 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/stop_managed_instance.py @@ -0,0 +1,41 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python stop_managed_instance.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.managed_instances.begin_stop( + resource_group_name="stoprg", + managed_instance_name="mitostop", + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/StopManagedInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_get.py b/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_get.py index e20bf2611fc8..9e8902943254 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_get.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionGet.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/TransparentDataEncryptionGet.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_list.py b/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_list.py index afa18a94a318..3e2275f884ea 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_list.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionList.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/TransparentDataEncryptionList.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_update.py b/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_update.py index 33e08c6b71db..1fcc0d06ed56 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_update.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/transparent_data_encryption_update.py @@ -29,16 +29,16 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.transparent_data_encryptions.create_or_update( + response = client.transparent_data_encryptions.begin_create_or_update( resource_group_name="securitytde-42-rg", server_name="securitytde-42", database_name="testdb", tde_name="current", parameters={"properties": {"state": "Enabled"}}, - ) + ).result() print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionUpdate.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/TransparentDataEncryptionUpdate.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/update_database_hyperscale_migration_perform_cutover.py b/sdk/sql/azure-mgmt-sql/generated_samples/update_database_hyperscale_migration_perform_cutover.py new file mode 100644 index 000000000000..7333e3337a07 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/update_database_hyperscale_migration_perform_cutover.py @@ -0,0 +1,53 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python update_database_hyperscale_migration_perform_cutover.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.databases.begin_create_or_update( + resource_group_name="Default-SQL-SouthEastAsia", + server_name="testsvr", + database_name="testdb", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/userAssignedIdentities/umi": {}, + "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/userAssignedIdentities/umiToDelete": None, + }, + }, + "location": "southeastasia", + "properties": {"performCutover": True}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/UpdateDatabaseHyperscaleMigrationPerformCutover.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/update_database_hyperscale_migration_with_manual_cutover.py b/sdk/sql/azure-mgmt-sql/generated_samples/update_database_hyperscale_migration_with_manual_cutover.py new file mode 100644 index 000000000000..d97a71851802 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/generated_samples/update_database_hyperscale_migration_with_manual_cutover.py @@ -0,0 +1,54 @@ +# 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.sql import SqlManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-sql +# USAGE + python update_database_hyperscale_migration_with_manual_cutover.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 = SqlManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.databases.begin_create_or_update( + resource_group_name="Default-SQL-SouthEastAsia", + server_name="testsvr", + database_name="testdb", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/userAssignedIdentities/umi": {}, + "/subscriptions/00000000-1111-2222-3333-444444444444/resourcegroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/userAssignedIdentities/umiToDelete": None, + }, + }, + "location": "southeastasia", + "properties": {"manualCutover": True}, + "sku": {"name": "HS_Gen5_2", "tier": "Hyperscale"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/UpdateDatabaseHyperscaleMigrationWithManualCutover.json +if __name__ == "__main__": + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/upgrade_data_warehouse.py b/sdk/sql/azure-mgmt-sql/generated_samples/upgrade_data_warehouse.py index f5e9033c5a07..3329756d0281 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/upgrade_data_warehouse.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/upgrade_data_warehouse.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/UpgradeDataWarehouse.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/UpgradeDataWarehouse.json if __name__ == "__main__": main()