diff --git a/sdk/sql/azure-mgmt-sql/_meta.json b/sdk/sql/azure-mgmt-sql/_meta.json index 7d5073a6c099e..ec4cd97a387ec 100644 --- a/sdk/sql/azure-mgmt-sql/_meta.json +++ b/sdk/sql/azure-mgmt-sql/_meta.json @@ -4,8 +4,8 @@ "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "b9b91929c304f8fb44002267b6c98d9fb9dde014", + "commit": "b55607c879f1f995be07f6adcf7616772b9eca62", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/sql/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/sql/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "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 a6f3006ba5bc4..5d4c38e63fa82 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 @@ -16,7 +16,7 @@ from . import models from ._configuration import SqlManagementClientConfiguration -from .operations import BackupShortTermRetentionPoliciesOperations, CapabilitiesOperations, DataMaskingPoliciesOperations, DataMaskingRulesOperations, DataWarehouseUserActivitiesOperations, DatabaseAdvancedThreatProtectionSettingsOperations, DatabaseAdvisorsOperations, DatabaseAutomaticTuningOperations, DatabaseBlobAuditingPoliciesOperations, DatabaseColumnsOperations, DatabaseExtensionsOperations, DatabaseOperationsOperations, DatabaseRecommendedActionsOperations, DatabaseSchemasOperations, DatabaseSecurityAlertPoliciesOperations, DatabaseTablesOperations, DatabaseUsagesOperations, DatabaseVulnerabilityAssessmentRuleBaselinesOperations, DatabaseVulnerabilityAssessmentScansOperations, DatabaseVulnerabilityAssessmentsOperations, DatabasesOperations, DeletedServersOperations, DistributedAvailabilityGroupsOperations, ElasticPoolActivitiesOperations, ElasticPoolDatabaseActivitiesOperations, ElasticPoolOperationsOperations, ElasticPoolsOperations, EncryptionProtectorsOperations, EndpointCertificatesOperations, ExtendedDatabaseBlobAuditingPoliciesOperations, ExtendedServerBlobAuditingPoliciesOperations, FailoverGroupsOperations, FirewallRulesOperations, GeoBackupPoliciesOperations, IPv6FirewallRulesOperations, InstanceFailoverGroupsOperations, InstancePoolsOperations, JobAgentsOperations, JobCredentialsOperations, JobExecutionsOperations, JobStepExecutionsOperations, JobStepsOperations, JobTargetExecutionsOperations, JobTargetGroupsOperations, JobVersionsOperations, JobsOperations, LedgerDigestUploadsOperations, LongTermRetentionBackupsOperations, LongTermRetentionManagedInstanceBackupsOperations, LongTermRetentionPoliciesOperations, MaintenanceWindowOptionsOperations, MaintenanceWindowsOperations, ManagedBackupShortTermRetentionPoliciesOperations, ManagedDatabaseColumnsOperations, ManagedDatabaseQueriesOperations, ManagedDatabaseRecommendedSensitivityLabelsOperations, ManagedDatabaseRestoreDetailsOperations, ManagedDatabaseSchemasOperations, ManagedDatabaseSecurityAlertPoliciesOperations, ManagedDatabaseSecurityEventsOperations, ManagedDatabaseSensitivityLabelsOperations, ManagedDatabaseTablesOperations, ManagedDatabaseTransparentDataEncryptionOperations, ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations, ManagedDatabaseVulnerabilityAssessmentScansOperations, ManagedDatabaseVulnerabilityAssessmentsOperations, ManagedDatabasesOperations, ManagedInstanceAdministratorsOperations, ManagedInstanceAzureADOnlyAuthenticationsOperations, ManagedInstanceEncryptionProtectorsOperations, ManagedInstanceKeysOperations, ManagedInstanceLongTermRetentionPoliciesOperations, ManagedInstanceOperationsOperations, ManagedInstancePrivateEndpointConnectionsOperations, ManagedInstancePrivateLinkResourcesOperations, ManagedInstanceTdeCertificatesOperations, ManagedInstanceVulnerabilityAssessmentsOperations, ManagedInstancesOperations, ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations, ManagedServerDnsAliasesOperations, ManagedServerSecurityAlertPoliciesOperations, Operations, OutboundFirewallRulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RecommendedSensitivityLabelsOperations, RecoverableDatabasesOperations, RecoverableManagedDatabasesOperations, ReplicationLinksOperations, RestorableDroppedDatabasesOperations, RestorableDroppedManagedDatabasesOperations, RestorePointsOperations, SensitivityLabelsOperations, ServerAdvancedThreatProtectionSettingsOperations, ServerAdvisorsOperations, ServerAutomaticTuningOperations, ServerAzureADAdministratorsOperations, ServerAzureADOnlyAuthenticationsOperations, ServerBlobAuditingPoliciesOperations, ServerCommunicationLinksOperations, ServerConnectionPoliciesOperations, ServerDevOpsAuditSettingsOperations, ServerDnsAliasesOperations, ServerKeysOperations, ServerOperationsOperations, ServerSecurityAlertPoliciesOperations, ServerTrustCertificatesOperations, ServerTrustGroupsOperations, ServerUsagesOperations, ServerVulnerabilityAssessmentsOperations, ServersOperations, ServiceObjectivesOperations, SqlAgentOperations, SubscriptionUsagesOperations, SyncAgentsOperations, SyncGroupsOperations, SyncMembersOperations, TdeCertificatesOperations, TimeZonesOperations, TransparentDataEncryptionsOperations, UsagesOperations, VirtualClustersOperations, VirtualNetworkRulesOperations, WorkloadClassifiersOperations, WorkloadGroupsOperations +from .operations import BackupShortTermRetentionPoliciesOperations, CapabilitiesOperations, DataMaskingPoliciesOperations, DataMaskingRulesOperations, DataWarehouseUserActivitiesOperations, DatabaseAdvancedThreatProtectionSettingsOperations, DatabaseAdvisorsOperations, DatabaseAutomaticTuningOperations, DatabaseBlobAuditingPoliciesOperations, DatabaseColumnsOperations, DatabaseExtensionsOperations, DatabaseOperationsOperations, DatabaseRecommendedActionsOperations, DatabaseSchemasOperations, DatabaseSecurityAlertPoliciesOperations, DatabaseTablesOperations, DatabaseUsagesOperations, DatabaseVulnerabilityAssessmentRuleBaselinesOperations, DatabaseVulnerabilityAssessmentScansOperations, DatabaseVulnerabilityAssessmentsOperations, DatabasesOperations, DeletedServersOperations, DistributedAvailabilityGroupsOperations, ElasticPoolActivitiesOperations, ElasticPoolDatabaseActivitiesOperations, ElasticPoolOperationsOperations, ElasticPoolsOperations, EncryptionProtectorsOperations, EndpointCertificatesOperations, ExtendedDatabaseBlobAuditingPoliciesOperations, ExtendedServerBlobAuditingPoliciesOperations, FailoverGroupsOperations, FirewallRulesOperations, GeoBackupPoliciesOperations, IPv6FirewallRulesOperations, InstanceFailoverGroupsOperations, InstancePoolsOperations, JobAgentsOperations, JobCredentialsOperations, JobExecutionsOperations, JobStepExecutionsOperations, JobStepsOperations, JobTargetExecutionsOperations, JobTargetGroupsOperations, JobVersionsOperations, JobsOperations, LedgerDigestUploadsOperations, LongTermRetentionBackupsOperations, LongTermRetentionManagedInstanceBackupsOperations, LongTermRetentionPoliciesOperations, MaintenanceWindowOptionsOperations, MaintenanceWindowsOperations, ManagedBackupShortTermRetentionPoliciesOperations, ManagedDatabaseAdvancedThreatProtectionSettingsOperations, ManagedDatabaseColumnsOperations, ManagedDatabaseQueriesOperations, ManagedDatabaseRecommendedSensitivityLabelsOperations, ManagedDatabaseRestoreDetailsOperations, ManagedDatabaseSchemasOperations, ManagedDatabaseSecurityAlertPoliciesOperations, ManagedDatabaseSecurityEventsOperations, ManagedDatabaseSensitivityLabelsOperations, ManagedDatabaseTablesOperations, ManagedDatabaseTransparentDataEncryptionOperations, ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations, ManagedDatabaseVulnerabilityAssessmentScansOperations, ManagedDatabaseVulnerabilityAssessmentsOperations, ManagedDatabasesOperations, ManagedInstanceAdministratorsOperations, ManagedInstanceAdvancedThreatProtectionSettingsOperations, ManagedInstanceAzureADOnlyAuthenticationsOperations, ManagedInstanceDtcsOperations, ManagedInstanceEncryptionProtectorsOperations, ManagedInstanceKeysOperations, ManagedInstanceLongTermRetentionPoliciesOperations, ManagedInstanceOperationsOperations, ManagedInstancePrivateEndpointConnectionsOperations, ManagedInstancePrivateLinkResourcesOperations, ManagedInstanceTdeCertificatesOperations, ManagedInstanceVulnerabilityAssessmentsOperations, ManagedInstancesOperations, ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations, ManagedServerDnsAliasesOperations, ManagedServerSecurityAlertPoliciesOperations, Operations, OutboundFirewallRulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RecommendedSensitivityLabelsOperations, RecoverableDatabasesOperations, RecoverableManagedDatabasesOperations, ReplicationLinksOperations, RestorableDroppedDatabasesOperations, RestorableDroppedManagedDatabasesOperations, RestorePointsOperations, SensitivityLabelsOperations, ServerAdvancedThreatProtectionSettingsOperations, ServerAdvisorsOperations, ServerAutomaticTuningOperations, ServerAzureADAdministratorsOperations, ServerAzureADOnlyAuthenticationsOperations, ServerBlobAuditingPoliciesOperations, ServerCommunicationLinksOperations, ServerConnectionPoliciesOperations, ServerDevOpsAuditSettingsOperations, ServerDnsAliasesOperations, ServerKeysOperations, ServerOperationsOperations, ServerSecurityAlertPoliciesOperations, ServerTrustCertificatesOperations, ServerTrustGroupsOperations, ServerUsagesOperations, ServerVulnerabilityAssessmentsOperations, ServersOperations, ServiceObjectivesOperations, SqlAgentOperations, SubscriptionUsagesOperations, SyncAgentsOperations, SyncGroupsOperations, SyncMembersOperations, TdeCertificatesOperations, TimeZonesOperations, TransparentDataEncryptionsOperations, UsagesOperations, VirtualClustersOperations, VirtualNetworkRulesOperations, WorkloadClassifiersOperations, WorkloadGroupsOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -317,8 +317,6 @@ class SqlManagementClient: # pylint: disable=too-many-instance-attributes :vartype ipv6_firewall_rules: azure.mgmt.sql.operations.IPv6FirewallRulesOperations :ivar endpoint_certificates: EndpointCertificatesOperations operations :vartype endpoint_certificates: azure.mgmt.sql.operations.EndpointCertificatesOperations - :ivar replication_links: ReplicationLinksOperations operations - :vartype replication_links: azure.mgmt.sql.operations.ReplicationLinksOperations :ivar managed_database_sensitivity_labels: ManagedDatabaseSensitivityLabelsOperations operations :vartype managed_database_sensitivity_labels: @@ -357,6 +355,18 @@ class SqlManagementClient: # pylint: disable=too-many-instance-attributes :ivar managed_server_dns_aliases: ManagedServerDnsAliasesOperations operations :vartype managed_server_dns_aliases: azure.mgmt.sql.operations.ManagedServerDnsAliasesOperations + :ivar managed_instance_dtcs: ManagedInstanceDtcsOperations operations + :vartype managed_instance_dtcs: azure.mgmt.sql.operations.ManagedInstanceDtcsOperations + :ivar managed_database_advanced_threat_protection_settings: + ManagedDatabaseAdvancedThreatProtectionSettingsOperations operations + :vartype managed_database_advanced_threat_protection_settings: + azure.mgmt.sql.operations.ManagedDatabaseAdvancedThreatProtectionSettingsOperations + :ivar managed_instance_advanced_threat_protection_settings: + ManagedInstanceAdvancedThreatProtectionSettingsOperations operations + :vartype managed_instance_advanced_threat_protection_settings: + azure.mgmt.sql.operations.ManagedInstanceAdvancedThreatProtectionSettingsOperations + :ivar replication_links: ReplicationLinksOperations operations + :vartype replication_links: azure.mgmt.sql.operations.ReplicationLinksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID that identifies an Azure subscription. @@ -720,9 +730,6 @@ def __init__( self.endpoint_certificates = EndpointCertificatesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_links = ReplicationLinksOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.managed_database_sensitivity_labels = ManagedDatabaseSensitivityLabelsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -756,6 +763,18 @@ def __init__( self.managed_server_dns_aliases = ManagedServerDnsAliasesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.managed_instance_dtcs = ManagedInstanceDtcsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_database_advanced_threat_protection_settings = ManagedDatabaseAdvancedThreatProtectionSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_instance_advanced_threat_protection_settings = ManagedInstanceAdvancedThreatProtectionSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.replication_links = ReplicationLinksOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( 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 0cc2e55e6243b..c78e629b6f086 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.0b3" +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 7661fedb80a82..2080a29c7de68 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 @@ -16,7 +16,7 @@ from .. import models from ._configuration import SqlManagementClientConfiguration -from .operations import BackupShortTermRetentionPoliciesOperations, CapabilitiesOperations, DataMaskingPoliciesOperations, DataMaskingRulesOperations, DataWarehouseUserActivitiesOperations, DatabaseAdvancedThreatProtectionSettingsOperations, DatabaseAdvisorsOperations, DatabaseAutomaticTuningOperations, DatabaseBlobAuditingPoliciesOperations, DatabaseColumnsOperations, DatabaseExtensionsOperations, DatabaseOperationsOperations, DatabaseRecommendedActionsOperations, DatabaseSchemasOperations, DatabaseSecurityAlertPoliciesOperations, DatabaseTablesOperations, DatabaseUsagesOperations, DatabaseVulnerabilityAssessmentRuleBaselinesOperations, DatabaseVulnerabilityAssessmentScansOperations, DatabaseVulnerabilityAssessmentsOperations, DatabasesOperations, DeletedServersOperations, DistributedAvailabilityGroupsOperations, ElasticPoolActivitiesOperations, ElasticPoolDatabaseActivitiesOperations, ElasticPoolOperationsOperations, ElasticPoolsOperations, EncryptionProtectorsOperations, EndpointCertificatesOperations, ExtendedDatabaseBlobAuditingPoliciesOperations, ExtendedServerBlobAuditingPoliciesOperations, FailoverGroupsOperations, FirewallRulesOperations, GeoBackupPoliciesOperations, IPv6FirewallRulesOperations, InstanceFailoverGroupsOperations, InstancePoolsOperations, JobAgentsOperations, JobCredentialsOperations, JobExecutionsOperations, JobStepExecutionsOperations, JobStepsOperations, JobTargetExecutionsOperations, JobTargetGroupsOperations, JobVersionsOperations, JobsOperations, LedgerDigestUploadsOperations, LongTermRetentionBackupsOperations, LongTermRetentionManagedInstanceBackupsOperations, LongTermRetentionPoliciesOperations, MaintenanceWindowOptionsOperations, MaintenanceWindowsOperations, ManagedBackupShortTermRetentionPoliciesOperations, ManagedDatabaseColumnsOperations, ManagedDatabaseQueriesOperations, ManagedDatabaseRecommendedSensitivityLabelsOperations, ManagedDatabaseRestoreDetailsOperations, ManagedDatabaseSchemasOperations, ManagedDatabaseSecurityAlertPoliciesOperations, ManagedDatabaseSecurityEventsOperations, ManagedDatabaseSensitivityLabelsOperations, ManagedDatabaseTablesOperations, ManagedDatabaseTransparentDataEncryptionOperations, ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations, ManagedDatabaseVulnerabilityAssessmentScansOperations, ManagedDatabaseVulnerabilityAssessmentsOperations, ManagedDatabasesOperations, ManagedInstanceAdministratorsOperations, ManagedInstanceAzureADOnlyAuthenticationsOperations, ManagedInstanceEncryptionProtectorsOperations, ManagedInstanceKeysOperations, ManagedInstanceLongTermRetentionPoliciesOperations, ManagedInstanceOperationsOperations, ManagedInstancePrivateEndpointConnectionsOperations, ManagedInstancePrivateLinkResourcesOperations, ManagedInstanceTdeCertificatesOperations, ManagedInstanceVulnerabilityAssessmentsOperations, ManagedInstancesOperations, ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations, ManagedServerDnsAliasesOperations, ManagedServerSecurityAlertPoliciesOperations, Operations, OutboundFirewallRulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RecommendedSensitivityLabelsOperations, RecoverableDatabasesOperations, RecoverableManagedDatabasesOperations, ReplicationLinksOperations, RestorableDroppedDatabasesOperations, RestorableDroppedManagedDatabasesOperations, RestorePointsOperations, SensitivityLabelsOperations, ServerAdvancedThreatProtectionSettingsOperations, ServerAdvisorsOperations, ServerAutomaticTuningOperations, ServerAzureADAdministratorsOperations, ServerAzureADOnlyAuthenticationsOperations, ServerBlobAuditingPoliciesOperations, ServerCommunicationLinksOperations, ServerConnectionPoliciesOperations, ServerDevOpsAuditSettingsOperations, ServerDnsAliasesOperations, ServerKeysOperations, ServerOperationsOperations, ServerSecurityAlertPoliciesOperations, ServerTrustCertificatesOperations, ServerTrustGroupsOperations, ServerUsagesOperations, ServerVulnerabilityAssessmentsOperations, ServersOperations, ServiceObjectivesOperations, SqlAgentOperations, SubscriptionUsagesOperations, SyncAgentsOperations, SyncGroupsOperations, SyncMembersOperations, TdeCertificatesOperations, TimeZonesOperations, TransparentDataEncryptionsOperations, UsagesOperations, VirtualClustersOperations, VirtualNetworkRulesOperations, WorkloadClassifiersOperations, WorkloadGroupsOperations +from .operations import BackupShortTermRetentionPoliciesOperations, CapabilitiesOperations, DataMaskingPoliciesOperations, DataMaskingRulesOperations, DataWarehouseUserActivitiesOperations, DatabaseAdvancedThreatProtectionSettingsOperations, DatabaseAdvisorsOperations, DatabaseAutomaticTuningOperations, DatabaseBlobAuditingPoliciesOperations, DatabaseColumnsOperations, DatabaseExtensionsOperations, DatabaseOperationsOperations, DatabaseRecommendedActionsOperations, DatabaseSchemasOperations, DatabaseSecurityAlertPoliciesOperations, DatabaseTablesOperations, DatabaseUsagesOperations, DatabaseVulnerabilityAssessmentRuleBaselinesOperations, DatabaseVulnerabilityAssessmentScansOperations, DatabaseVulnerabilityAssessmentsOperations, DatabasesOperations, DeletedServersOperations, DistributedAvailabilityGroupsOperations, ElasticPoolActivitiesOperations, ElasticPoolDatabaseActivitiesOperations, ElasticPoolOperationsOperations, ElasticPoolsOperations, EncryptionProtectorsOperations, EndpointCertificatesOperations, ExtendedDatabaseBlobAuditingPoliciesOperations, ExtendedServerBlobAuditingPoliciesOperations, FailoverGroupsOperations, FirewallRulesOperations, GeoBackupPoliciesOperations, IPv6FirewallRulesOperations, InstanceFailoverGroupsOperations, InstancePoolsOperations, JobAgentsOperations, JobCredentialsOperations, JobExecutionsOperations, JobStepExecutionsOperations, JobStepsOperations, JobTargetExecutionsOperations, JobTargetGroupsOperations, JobVersionsOperations, JobsOperations, LedgerDigestUploadsOperations, LongTermRetentionBackupsOperations, LongTermRetentionManagedInstanceBackupsOperations, LongTermRetentionPoliciesOperations, MaintenanceWindowOptionsOperations, MaintenanceWindowsOperations, ManagedBackupShortTermRetentionPoliciesOperations, ManagedDatabaseAdvancedThreatProtectionSettingsOperations, ManagedDatabaseColumnsOperations, ManagedDatabaseQueriesOperations, ManagedDatabaseRecommendedSensitivityLabelsOperations, ManagedDatabaseRestoreDetailsOperations, ManagedDatabaseSchemasOperations, ManagedDatabaseSecurityAlertPoliciesOperations, ManagedDatabaseSecurityEventsOperations, ManagedDatabaseSensitivityLabelsOperations, ManagedDatabaseTablesOperations, ManagedDatabaseTransparentDataEncryptionOperations, ManagedDatabaseVulnerabilityAssessmentRuleBaselinesOperations, ManagedDatabaseVulnerabilityAssessmentScansOperations, ManagedDatabaseVulnerabilityAssessmentsOperations, ManagedDatabasesOperations, ManagedInstanceAdministratorsOperations, ManagedInstanceAdvancedThreatProtectionSettingsOperations, ManagedInstanceAzureADOnlyAuthenticationsOperations, ManagedInstanceDtcsOperations, ManagedInstanceEncryptionProtectorsOperations, ManagedInstanceKeysOperations, ManagedInstanceLongTermRetentionPoliciesOperations, ManagedInstanceOperationsOperations, ManagedInstancePrivateEndpointConnectionsOperations, ManagedInstancePrivateLinkResourcesOperations, ManagedInstanceTdeCertificatesOperations, ManagedInstanceVulnerabilityAssessmentsOperations, ManagedInstancesOperations, ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesOperations, ManagedServerDnsAliasesOperations, ManagedServerSecurityAlertPoliciesOperations, Operations, OutboundFirewallRulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RecommendedSensitivityLabelsOperations, RecoverableDatabasesOperations, RecoverableManagedDatabasesOperations, ReplicationLinksOperations, RestorableDroppedDatabasesOperations, RestorableDroppedManagedDatabasesOperations, RestorePointsOperations, SensitivityLabelsOperations, ServerAdvancedThreatProtectionSettingsOperations, ServerAdvisorsOperations, ServerAutomaticTuningOperations, ServerAzureADAdministratorsOperations, ServerAzureADOnlyAuthenticationsOperations, ServerBlobAuditingPoliciesOperations, ServerCommunicationLinksOperations, ServerConnectionPoliciesOperations, ServerDevOpsAuditSettingsOperations, ServerDnsAliasesOperations, ServerKeysOperations, ServerOperationsOperations, ServerSecurityAlertPoliciesOperations, ServerTrustCertificatesOperations, ServerTrustGroupsOperations, ServerUsagesOperations, ServerVulnerabilityAssessmentsOperations, ServersOperations, ServiceObjectivesOperations, SqlAgentOperations, SubscriptionUsagesOperations, SyncAgentsOperations, SyncGroupsOperations, SyncMembersOperations, TdeCertificatesOperations, TimeZonesOperations, TransparentDataEncryptionsOperations, UsagesOperations, VirtualClustersOperations, VirtualNetworkRulesOperations, WorkloadClassifiersOperations, WorkloadGroupsOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -323,8 +323,6 @@ class SqlManagementClient: # pylint: disable=too-many-instance-attributes :vartype ipv6_firewall_rules: azure.mgmt.sql.aio.operations.IPv6FirewallRulesOperations :ivar endpoint_certificates: EndpointCertificatesOperations operations :vartype endpoint_certificates: azure.mgmt.sql.aio.operations.EndpointCertificatesOperations - :ivar replication_links: ReplicationLinksOperations operations - :vartype replication_links: azure.mgmt.sql.aio.operations.ReplicationLinksOperations :ivar managed_database_sensitivity_labels: ManagedDatabaseSensitivityLabelsOperations operations :vartype managed_database_sensitivity_labels: @@ -363,6 +361,18 @@ class SqlManagementClient: # pylint: disable=too-many-instance-attributes :ivar managed_server_dns_aliases: ManagedServerDnsAliasesOperations operations :vartype managed_server_dns_aliases: azure.mgmt.sql.aio.operations.ManagedServerDnsAliasesOperations + :ivar managed_instance_dtcs: ManagedInstanceDtcsOperations operations + :vartype managed_instance_dtcs: azure.mgmt.sql.aio.operations.ManagedInstanceDtcsOperations + :ivar managed_database_advanced_threat_protection_settings: + ManagedDatabaseAdvancedThreatProtectionSettingsOperations operations + :vartype managed_database_advanced_threat_protection_settings: + azure.mgmt.sql.aio.operations.ManagedDatabaseAdvancedThreatProtectionSettingsOperations + :ivar managed_instance_advanced_threat_protection_settings: + ManagedInstanceAdvancedThreatProtectionSettingsOperations operations + :vartype managed_instance_advanced_threat_protection_settings: + azure.mgmt.sql.aio.operations.ManagedInstanceAdvancedThreatProtectionSettingsOperations + :ivar replication_links: ReplicationLinksOperations operations + :vartype replication_links: azure.mgmt.sql.aio.operations.ReplicationLinksOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID that identifies an Azure subscription. @@ -726,9 +736,6 @@ def __init__( self.endpoint_certificates = EndpointCertificatesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.replication_links = ReplicationLinksOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.managed_database_sensitivity_labels = ManagedDatabaseSensitivityLabelsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -762,6 +769,18 @@ def __init__( self.managed_server_dns_aliases = ManagedServerDnsAliasesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.managed_instance_dtcs = ManagedInstanceDtcsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_database_advanced_threat_protection_settings = ManagedDatabaseAdvancedThreatProtectionSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_instance_advanced_threat_protection_settings = ManagedInstanceAdvancedThreatProtectionSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.replication_links = ReplicationLinksOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( 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 3848df9ec3ed4..1c4ae650bde1b 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 @@ -119,7 +119,6 @@ from ._server_trust_certificates_operations import ServerTrustCertificatesOperations from ._ipv6_firewall_rules_operations import IPv6FirewallRulesOperations from ._endpoint_certificates_operations import EndpointCertificatesOperations -from ._replication_links_operations import ReplicationLinksOperations from ._managed_database_sensitivity_labels_operations import ManagedDatabaseSensitivityLabelsOperations from ._managed_database_recommended_sensitivity_labels_operations import ManagedDatabaseRecommendedSensitivityLabelsOperations from ._sensitivity_labels_operations import SensitivityLabelsOperations @@ -131,6 +130,10 @@ from ._database_advanced_threat_protection_settings_operations import DatabaseAdvancedThreatProtectionSettingsOperations from ._server_advanced_threat_protection_settings_operations import ServerAdvancedThreatProtectionSettingsOperations from ._managed_server_dns_aliases_operations import ManagedServerDnsAliasesOperations +from ._managed_instance_dtcs_operations import ManagedInstanceDtcsOperations +from ._managed_database_advanced_threat_protection_settings_operations import ManagedDatabaseAdvancedThreatProtectionSettingsOperations +from ._managed_instance_advanced_threat_protection_settings_operations import ManagedInstanceAdvancedThreatProtectionSettingsOperations +from ._replication_links_operations import ReplicationLinksOperations from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import @@ -249,7 +252,6 @@ 'ServerTrustCertificatesOperations', 'IPv6FirewallRulesOperations', 'EndpointCertificatesOperations', - 'ReplicationLinksOperations', 'ManagedDatabaseSensitivityLabelsOperations', 'ManagedDatabaseRecommendedSensitivityLabelsOperations', 'SensitivityLabelsOperations', @@ -261,6 +263,10 @@ 'DatabaseAdvancedThreatProtectionSettingsOperations', 'ServerAdvancedThreatProtectionSettingsOperations', 'ManagedServerDnsAliasesOperations', + 'ManagedInstanceDtcsOperations', + 'ManagedDatabaseAdvancedThreatProtectionSettingsOperations', + 'ManagedInstanceAdvancedThreatProtectionSettingsOperations', + 'ReplicationLinksOperations', ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() \ No newline at end of file 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 8c9b58526bc14..32d71f99acc63 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 @@ -264,7 +264,7 @@ def list_by_server( :type server_name: str :param skip_token: Default value is None. :type skip_token: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -275,7 +275,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseListResult] error_map = { @@ -361,7 +361,7 @@ async def get( :type server_name: str :param database_name: The name of the database. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -377,7 +377,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Database] @@ -431,7 +431,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Database]] @@ -498,7 +498,7 @@ async def begin_create_or_update( :type database_name: str :param parameters: The requested database resource state. :type parameters: ~azure.mgmt.sql.models.Database - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -517,7 +517,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[_models.Database] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -583,7 +583,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -634,7 +634,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type server_name: str :param database_name: The name of the database. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -652,7 +652,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( @@ -714,7 +714,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Database]] @@ -778,7 +778,7 @@ async def begin_update( :type database_name: str :param parameters: The requested database resource state. :type parameters: ~azure.mgmt.sql.models.DatabaseUpdate - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -797,7 +797,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[_models.Database] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -864,7 +864,7 @@ async def _export_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ImportExportOperationResult]] @@ -928,7 +928,7 @@ async def begin_export( :type database_name: str :param parameters: The database export request parameters. :type parameters: ~azure.mgmt.sql.models.ExportDatabaseDefinition - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -947,7 +947,7 @@ async def begin_export( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[_models.ImportExportOperationResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1014,7 +1014,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -1069,7 +1069,7 @@ async def begin_failover( # pylint: disable=inconsistent-return-statements :type database_name: str :param replica_type: The type of replica to be failed over. Default value is None. :type replica_type: str or ~azure.mgmt.sql.models.ReplicaType - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1087,7 +1087,7 @@ async def begin_failover( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( @@ -1150,7 +1150,7 @@ async def _import_method_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ImportExportOperationResult]] @@ -1214,7 +1214,7 @@ async def begin_import_method( :type database_name: str :param parameters: The database import request parameters. :type parameters: ~azure.mgmt.sql.models.ImportExistingDatabaseDefinition - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1233,7 +1233,7 @@ async def begin_import_method( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[_models.ImportExportOperationResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1304,7 +1304,7 @@ async def rename( # pylint: disable=inconsistent-return-statements :type database_name: str :param parameters: The resource move definition for renaming this database. :type parameters: ~azure.mgmt.sql.models.ResourceMoveDefinition - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1320,7 +1320,7 @@ 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -1373,7 +1373,7 @@ async def _pause_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Database]] @@ -1430,7 +1430,7 @@ async def begin_pause( :type server_name: str :param database_name: The name of the database to be paused. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1449,7 +1449,7 @@ async def begin_pause( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Database] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( @@ -1512,7 +1512,7 @@ async def _resume_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Database]] @@ -1569,7 +1569,7 @@ async def begin_resume( :type server_name: str :param database_name: The name of the database to be resumed. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1588,7 +1588,7 @@ async def begin_resume( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Database] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( @@ -1651,7 +1651,7 @@ 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -1702,7 +1702,7 @@ async def begin_upgrade_data_warehouse( # pylint: disable=inconsistent-return-s :type server_name: str :param database_name: The name of the database to be upgraded. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1720,7 +1720,7 @@ async def begin_upgrade_data_warehouse( # pylint: disable=inconsistent-return-s _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( @@ -1783,7 +1783,7 @@ def list_by_elastic_pool( :type server_name: str :param elastic_pool_name: The name of the elastic pool. :type elastic_pool_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1794,7 +1794,7 @@ def list_by_elastic_pool( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseListResult] error_map = { @@ -1877,7 +1877,7 @@ def list_inaccessible_by_server( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1888,7 +1888,7 @@ def list_inaccessible_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseListResult] error_map = { 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 new file mode 100644 index 0000000000000..0f66dc4814c44 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_database_advanced_threat_protection_settings_operations.py @@ -0,0 +1,307 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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._managed_database_advanced_threat_protection_settings_operations import build_create_or_update_request, build_get_request, build_list_by_database_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedDatabaseAdvancedThreatProtectionSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.aio.SqlManagementClient`'s + :attr:`managed_database_advanced_threat_protection_settings` 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.ManagedDatabaseAdvancedThreatProtectionListResult]: + """Gets a list of managed database's Advanced Threat Protection states. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedDatabaseAdvancedThreatProtectionListResult + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedDatabaseAdvancedThreatProtectionListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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) # type: ignore + + else: + + 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=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedDatabaseAdvancedThreatProtectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(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) + + pipeline_response = 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}/advancedThreatProtectionSettings"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + **kwargs: Any + ) -> _models.ManagedDatabaseAdvancedThreatProtection: + """Gets a managed database's Advanced Threat Protection state. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param advanced_threat_protection_name: The name of the Advanced Threat Protection state. + :type advanced_threat_protection_name: str or + ~azure.mgmt.sql.models.AdvancedThreatProtectionName + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedDatabaseAdvancedThreatProtection, or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedDatabaseAdvancedThreatProtection] + + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + advanced_threat_protection_name=advanced_threat_protection_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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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('ManagedDatabaseAdvancedThreatProtection', 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}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + parameters: _models.ManagedDatabaseAdvancedThreatProtection, + **kwargs: Any + ) -> _models.ManagedDatabaseAdvancedThreatProtection: + """Creates or updates a managed database's Advanced Threat Protection state. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param advanced_threat_protection_name: The name of the Advanced Threat Protection state. + :type advanced_threat_protection_name: str or + ~azure.mgmt.sql.models.AdvancedThreatProtectionName + :param parameters: The managed database Advanced Threat Protection state. + :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtection + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedDatabaseAdvancedThreatProtection, or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedDatabaseAdvancedThreatProtection] + + _json = self._serialize.body(parameters, 'ManagedDatabaseAdvancedThreatProtection') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + advanced_threat_protection_name=advanced_threat_protection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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('ManagedDatabaseAdvancedThreatProtection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedDatabaseAdvancedThreatProtection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"} # type: ignore + 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 new file mode 100644 index 0000000000000..cedc3978b8065 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_advanced_threat_protection_settings_operations.py @@ -0,0 +1,365 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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_instance_advanced_threat_protection_settings_operations import build_create_or_update_request_initial, build_get_request, build_list_by_instance_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedInstanceAdvancedThreatProtectionSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.aio.SqlManagementClient`'s + :attr:`managed_instance_advanced_threat_protection_settings` 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.ManagedInstanceAdvancedThreatProtectionListResult]: + """Get the managed instance's Advanced Threat Protection settings. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedInstanceAdvancedThreatProtectionListResult + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceAdvancedThreatProtectionListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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) # type: ignore + + else: + + 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=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedInstanceAdvancedThreatProtectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(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) + + pipeline_response = 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}/advancedThreatProtectionSettings"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + managed_instance_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + **kwargs: Any + ) -> _models.ManagedInstanceAdvancedThreatProtection: + """Get a managed instance's Advanced Threat Protection state. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param advanced_threat_protection_name: The name of the Advanced Threat Protection state. + :type advanced_threat_protection_name: str or + ~azure.mgmt.sql.models.AdvancedThreatProtectionName + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedInstanceAdvancedThreatProtection, or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceAdvancedThreatProtection] + + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + advanced_threat_protection_name=advanced_threat_protection_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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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('ManagedInstanceAdvancedThreatProtection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + managed_instance_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + parameters: _models.ManagedInstanceAdvancedThreatProtection, + **kwargs: Any + ) -> Optional[_models.ManagedInstanceAdvancedThreatProtection]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedInstanceAdvancedThreatProtection]] + + _json = self._serialize.body(parameters, 'ManagedInstanceAdvancedThreatProtection') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + advanced_threat_protection_name=advanced_threat_protection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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('ManagedInstanceAdvancedThreatProtection', 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}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + parameters: _models.ManagedInstanceAdvancedThreatProtection, + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedInstanceAdvancedThreatProtection]: + """Creates or updates Advanced Threat Protection settings. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param advanced_threat_protection_name: The name of the Advanced Threat Protection state. + :type advanced_threat_protection_name: str or + ~azure.mgmt.sql.models.AdvancedThreatProtectionName + :param parameters: The managed instance Advanced Threat Protection state. + :type parameters: ~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtection + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: 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 + ManagedInstanceAdvancedThreatProtection or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceAdvancedThreatProtection] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + advanced_threat_protection_name=advanced_threat_protection_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('ManagedInstanceAdvancedThreatProtection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"} # type: ignore 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 new file mode 100644 index 0000000000000..f59d72a8a6f33 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_instance_dtcs_operations.py @@ -0,0 +1,360 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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_instance_dtcs_operations import build_create_or_update_request_initial, build_get_request, build_list_by_managed_instance_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedInstanceDtcsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.aio.SqlManagementClient`'s + :attr:`managed_instance_dtcs` 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.ManagedInstanceDtcListResult]: + """Gets a list of managed instance DTC settings. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedInstanceDtcListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.ManagedInstanceDtcListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceDtcListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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) # type: ignore + + else: + + 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=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedInstanceDtcListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(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) + + pipeline_response = 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}/dtc"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + managed_instance_name: str, + dtc_name: Union[str, "_models.DtcName"], + **kwargs: Any + ) -> _models.ManagedInstanceDtc: + """Gets managed instance DTC settings. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param dtc_name: The name of the managed instance DTC. + :type dtc_name: str or ~azure.mgmt.sql.models.DtcName + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedInstanceDtc, or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ManagedInstanceDtc + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceDtc] + + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + dtc_name=dtc_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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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('ManagedInstanceDtc', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + managed_instance_name: str, + dtc_name: Union[str, "_models.DtcName"], + parameters: _models.ManagedInstanceDtc, + **kwargs: Any + ) -> _models.ManagedInstanceDtc: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceDtc] + + _json = self._serialize.body(parameters, 'ManagedInstanceDtc') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + dtc_name=dtc_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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('ManagedInstanceDtc', 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}/dtc/{dtcName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + dtc_name: Union[str, "_models.DtcName"], + parameters: _models.ManagedInstanceDtc, + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedInstanceDtc]: + """Updates managed instance DTC settings. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param dtc_name: The name of the managed instance DTC. + :type dtc_name: str or ~azure.mgmt.sql.models.DtcName + :param parameters: Managed instance DTC settings. + :type parameters: ~azure.mgmt.sql.models.ManagedInstanceDtc + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: 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 ManagedInstanceDtc or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.ManagedInstanceDtc] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceDtc] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + dtc_name=dtc_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('ManagedInstanceDtc', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}"} # type: ignore diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_replication_links_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_replication_links_operations.py index 05bee6bb57d6a..49dc1135de079 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_replication_links_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_replication_links_operations.py @@ -22,7 +22,7 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._replication_links_operations import build_delete_request, build_failover_allow_data_loss_request_initial, build_failover_request_initial, build_get_request, build_list_by_database_request, build_list_by_server_request +from ...operations._replication_links_operations import build_delete_request_initial, build_failover_allow_data_loss_request_initial, build_failover_request_initial, build_get_request, build_list_by_database_request, build_list_by_server_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +63,7 @@ def list_by_database( :type server_name: str :param database_name: The name of the database. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -76,7 +76,7 @@ def list_by_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicationLinkListResult] error_map = { @@ -165,7 +165,7 @@ async def get( :type database_name: str :param link_id: The name of the replication link. :type link_id: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -181,7 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicationLink] @@ -220,8 +220,7 @@ async def get( get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}"} # type: ignore - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, @@ -229,25 +228,6 @@ async def delete( # pylint: disable=inconsistent-return-statements link_id: str, **kwargs: Any ) -> None: - """Deletes the replication link. - - :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. - :type resource_group_name: str - :param server_name: The name of the server. - :type server_name: str - :param database_name: The name of the database. - :type database_name: str - :param link_id: - :type link_id: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :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 } @@ -256,18 +236,18 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] - request = build_delete_request( + request = build_delete_request_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, link_id=link_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self._delete_initial.metadata['url'], headers=_headers, params=_params, ) @@ -281,15 +261,100 @@ async def delete( # pylint: disable=inconsistent-return-statements ) 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) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}"} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + server_name: str, + database_name: str, + link_id: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the replication link. + + :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. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param link_id: + :type link_id: str + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + link_id=link_id, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}"} # type: ignore async def _failover_initial( self, @@ -307,7 +372,7 @@ async def _failover_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ReplicationLink]] @@ -368,7 +433,7 @@ async def begin_failover( :type database_name: str :param link_id: The name of the replication link. :type link_id: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -387,7 +452,7 @@ async def begin_failover( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicationLink] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( @@ -452,7 +517,7 @@ async def _failover_allow_data_loss_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ReplicationLink]] @@ -513,7 +578,7 @@ async def begin_failover_allow_data_loss( :type database_name: str :param link_id: The name of the replication link. :type link_id: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -532,7 +597,7 @@ async def begin_failover_allow_data_loss( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicationLink] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( @@ -595,7 +660,7 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -608,7 +673,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicationLinkListResult] error_map = { 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 2f1e6cc8375a7..4e156433b75f7 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 @@ -149,6 +149,8 @@ from ._models_py3 import ManagedBackupShortTermRetentionPolicy from ._models_py3 import ManagedBackupShortTermRetentionPolicyListResult from ._models_py3 import ManagedDatabase +from ._models_py3 import ManagedDatabaseAdvancedThreatProtection +from ._models_py3 import ManagedDatabaseAdvancedThreatProtectionListResult from ._models_py3 import ManagedDatabaseListResult from ._models_py3 import ManagedDatabaseRestoreDetailsResult from ._models_py3 import ManagedDatabaseSecurityAlertPolicy @@ -157,8 +159,14 @@ from ._models_py3 import ManagedInstance from ._models_py3 import ManagedInstanceAdministrator from ._models_py3 import ManagedInstanceAdministratorListResult +from ._models_py3 import ManagedInstanceAdvancedThreatProtection +from ._models_py3 import ManagedInstanceAdvancedThreatProtectionListResult from ._models_py3 import ManagedInstanceAzureADOnlyAuthListResult from ._models_py3 import ManagedInstanceAzureADOnlyAuthentication +from ._models_py3 import ManagedInstanceDtc +from ._models_py3 import ManagedInstanceDtcListResult +from ._models_py3 import ManagedInstanceDtcSecuritySettings +from ._models_py3 import ManagedInstanceDtcTransactionManagerCommunicationSettings from ._models_py3 import ManagedInstanceEditionCapability from ._models_py3 import ManagedInstanceEncryptionProtector from ._models_py3 import ManagedInstanceEncryptionProtectorListResult @@ -402,6 +410,7 @@ DayOfWeek, DiffBackupIntervalInHours, DnsRefreshConfigurationPropertiesStatus, + DtcName, ElasticPoolLicenseType, ElasticPoolState, EncryptionProtectorName, @@ -648,6 +657,8 @@ 'ManagedBackupShortTermRetentionPolicy', 'ManagedBackupShortTermRetentionPolicyListResult', 'ManagedDatabase', + 'ManagedDatabaseAdvancedThreatProtection', + 'ManagedDatabaseAdvancedThreatProtectionListResult', 'ManagedDatabaseListResult', 'ManagedDatabaseRestoreDetailsResult', 'ManagedDatabaseSecurityAlertPolicy', @@ -656,8 +667,14 @@ 'ManagedInstance', 'ManagedInstanceAdministrator', 'ManagedInstanceAdministratorListResult', + 'ManagedInstanceAdvancedThreatProtection', + 'ManagedInstanceAdvancedThreatProtectionListResult', 'ManagedInstanceAzureADOnlyAuthListResult', 'ManagedInstanceAzureADOnlyAuthentication', + 'ManagedInstanceDtc', + 'ManagedInstanceDtcListResult', + 'ManagedInstanceDtcSecuritySettings', + 'ManagedInstanceDtcTransactionManagerCommunicationSettings', 'ManagedInstanceEditionCapability', 'ManagedInstanceEncryptionProtector', 'ManagedInstanceEncryptionProtectorListResult', @@ -898,6 +915,7 @@ 'DayOfWeek', 'DiffBackupIntervalInHours', 'DnsRefreshConfigurationPropertiesStatus', + 'DtcName', 'ElasticPoolLicenseType', 'ElasticPoolState', 'EncryptionProtectorName', 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 c0a21a0ef0b27..912dd747c4adb 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 @@ -890,7 +890,7 @@ class Database(TrackedResource): within an elastic pool. :vartype high_availability_replica_count: int :ivar secondary_type: The secondary type of the database if it is a secondary. Valid values - are Geo and Named. Known values are: "Geo", "Named". + are Geo, Named and Standby. Known values are: "Geo", "Named", "Standby". :vartype secondary_type: str or ~azure.mgmt.sql.models.SecondaryType :ivar current_sku: The name and tier of the SKU. :vartype current_sku: ~azure.mgmt.sql.models.Sku @@ -927,12 +927,15 @@ class Database(TrackedResource): :ivar source_resource_id: The resource identifier of the source associated with the create operation of this database. + This property is only supported for DataWarehouse edition and allows to restore across + subscriptions. + When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. - When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing - database or existing sql pool, and restorePointInTime must be specified. + When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the + existing database or existing sql pool, and restorePointInTime must be specified. When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. @@ -940,9 +943,6 @@ class Database(TrackedResource): When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. - This property allows to restore across subscriptions which is only supported for DataWarehouse - edition. - When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details about “x-ms-authorization-auxiliary” header see @@ -1163,7 +1163,7 @@ def __init__( within an elastic pool. :paramtype high_availability_replica_count: int :keyword secondary_type: The secondary type of the database if it is a secondary. Valid values - are Geo and Named. Known values are: "Geo", "Named". + are Geo, Named and Standby. Known values are: "Geo", "Named", "Standby". :paramtype secondary_type: str or ~azure.mgmt.sql.models.SecondaryType :keyword auto_pause_delay: Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. @@ -1187,12 +1187,15 @@ def __init__( :keyword source_resource_id: The resource identifier of the source associated with the create operation of this database. + This property is only supported for DataWarehouse edition and allows to restore across + subscriptions. + When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. - When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of an existing - database or existing sql pool, and restorePointInTime must be specified. + When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the + existing database or existing sql pool, and restorePointInTime must be specified. When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or restorable dropped sql pool. @@ -1200,9 +1203,6 @@ def __init__( When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql pool. - This property allows to restore across subscriptions which is only supported for DataWarehouse - edition. - When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details about “x-ms-authorization-auxiliary” header see @@ -2539,7 +2539,7 @@ class DatabaseUpdate(msrest.serialization.Model): within an elastic pool. :vartype high_availability_replica_count: int :ivar secondary_type: The secondary type of the database if it is a secondary. Valid values - are Geo and Named. Known values are: "Geo", "Named". + are Geo, Named and Standby. Known values are: "Geo", "Named", "Standby". :vartype secondary_type: str or ~azure.mgmt.sql.models.SecondaryType :ivar current_sku: The name and tier of the SKU. :vartype current_sku: ~azure.mgmt.sql.models.Sku @@ -2756,7 +2756,7 @@ def __init__( within an elastic pool. :paramtype high_availability_replica_count: int :keyword secondary_type: The secondary type of the database if it is a secondary. Valid values - are Geo and Named. Known values are: "Geo", "Named". + are Geo, Named and Standby. Known values are: "Geo", "Named", "Standby". :paramtype secondary_type: str or ~azure.mgmt.sql.models.SecondaryType :keyword auto_pause_delay: Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled. @@ -9384,6 +9384,94 @@ def __init__( self.last_backup_name = last_backup_name +class ManagedDatabaseAdvancedThreatProtection(ProxyResource): + """A managed database Advanced Threat Protection. + + 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: SystemData of AdvancedThreatProtectionResource. + :vartype system_data: ~azure.mgmt.sql.models.SystemData + :ivar state: Specifies the state of the Advanced Threat Protection, whether it is enabled or + disabled or a state has not been applied yet on the specific database or server. Known values + are: "New", "Enabled", "Disabled". + :vartype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState + :ivar creation_time: Specifies the UTC creation time of the policy. + :vartype creation_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'creation_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "_models.AdvancedThreatProtectionState"]] = None, + **kwargs + ): + """ + :keyword state: Specifies the state of the Advanced Threat Protection, whether it is enabled or + disabled or a state has not been applied yet on the specific database or server. Known values + are: "New", "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState + """ + super(ManagedDatabaseAdvancedThreatProtection, self).__init__(**kwargs) + self.system_data = None + self.state = state + self.creation_time = None + + +class ManagedDatabaseAdvancedThreatProtectionListResult(msrest.serialization.Model): + """A list of the managed database's Advanced Threat Protection settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of results. + :vartype value: list[~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtection] + :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': '[ManagedDatabaseAdvancedThreatProtection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ManagedDatabaseAdvancedThreatProtectionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class ManagedDatabaseListResult(msrest.serialization.Model): """A list of managed databases. @@ -10231,6 +10319,94 @@ def __init__( self.next_link = None +class ManagedInstanceAdvancedThreatProtection(ProxyResource): + """A managed instance Advanced Threat Protection. + + 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: SystemData of AdvancedThreatProtectionResource. + :vartype system_data: ~azure.mgmt.sql.models.SystemData + :ivar state: Specifies the state of the Advanced Threat Protection, whether it is enabled or + disabled or a state has not been applied yet on the specific database or server. Known values + are: "New", "Enabled", "Disabled". + :vartype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState + :ivar creation_time: Specifies the UTC creation time of the policy. + :vartype creation_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'creation_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + state: Optional[Union[str, "_models.AdvancedThreatProtectionState"]] = None, + **kwargs + ): + """ + :keyword state: Specifies the state of the Advanced Threat Protection, whether it is enabled or + disabled or a state has not been applied yet on the specific database or server. Known values + are: "New", "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.sql.models.AdvancedThreatProtectionState + """ + super(ManagedInstanceAdvancedThreatProtection, self).__init__(**kwargs) + self.system_data = None + self.state = state + self.creation_time = None + + +class ManagedInstanceAdvancedThreatProtectionListResult(msrest.serialization.Model): + """A list of the managed instance's Advanced Threat Protection settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of results. + :vartype value: list[~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtection] + :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': '[ManagedInstanceAdvancedThreatProtection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ManagedInstanceAdvancedThreatProtectionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class ManagedInstanceAzureADOnlyAuthentication(ProxyResource): """Azure Active Directory only authentication. @@ -10305,6 +10481,188 @@ def __init__( self.next_link = None +class ManagedInstanceDtc(ProxyResource): + """SQL Managed Instance DTC. + + 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 dtc_enabled: Active status of managed instance DTC. + :vartype dtc_enabled: bool + :ivar security_settings: Security settings of managed instance DTC. + :vartype security_settings: ~azure.mgmt.sql.models.ManagedInstanceDtcSecuritySettings + :ivar external_dns_suffix_search_list: External dns suffix search list of managed instance DTC. + :vartype external_dns_suffix_search_list: list[str] + :ivar dtc_host_name_dns_suffix: Host name dns suffix of managed instance DTC. + :vartype dtc_host_name_dns_suffix: str + :ivar provisioning_state: Provisioning state of managed instance DTC. Known values are: + "Created", "InProgress", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.sql.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'dtc_host_name_dns_suffix': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'dtc_enabled': {'key': 'properties.dtcEnabled', 'type': 'bool'}, + 'security_settings': {'key': 'properties.securitySettings', 'type': 'ManagedInstanceDtcSecuritySettings'}, + 'external_dns_suffix_search_list': {'key': 'properties.externalDnsSuffixSearchList', 'type': '[str]'}, + 'dtc_host_name_dns_suffix': {'key': 'properties.dtcHostNameDnsSuffix', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + dtc_enabled: Optional[bool] = None, + security_settings: Optional["_models.ManagedInstanceDtcSecuritySettings"] = None, + external_dns_suffix_search_list: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword dtc_enabled: Active status of managed instance DTC. + :paramtype dtc_enabled: bool + :keyword security_settings: Security settings of managed instance DTC. + :paramtype security_settings: ~azure.mgmt.sql.models.ManagedInstanceDtcSecuritySettings + :keyword external_dns_suffix_search_list: External dns suffix search list of managed instance + DTC. + :paramtype external_dns_suffix_search_list: list[str] + """ + super(ManagedInstanceDtc, self).__init__(**kwargs) + self.dtc_enabled = dtc_enabled + self.security_settings = security_settings + self.external_dns_suffix_search_list = external_dns_suffix_search_list + self.dtc_host_name_dns_suffix = None + self.provisioning_state = None + + +class ManagedInstanceDtcListResult(msrest.serialization.Model): + """A list of managed instance's DTCs. + + 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.ManagedInstanceDtc] + :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': '[ManagedInstanceDtc]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ManagedInstanceDtcListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ManagedInstanceDtcSecuritySettings(msrest.serialization.Model): + """The Security Settings of managed instance DTC. + + :ivar transaction_manager_communication_settings: Transaction Manager communication settings of + managed instance DTC. + :vartype transaction_manager_communication_settings: + ~azure.mgmt.sql.models.ManagedInstanceDtcTransactionManagerCommunicationSettings + :ivar xa_transactions_enabled: Allow XA Transactions to managed instance DTC. + :vartype xa_transactions_enabled: bool + :ivar sna_lu6_point2_transactions_enabled: Allow SNA LU 6.2 to managed instance DTC. + :vartype sna_lu6_point2_transactions_enabled: bool + """ + + _attribute_map = { + 'transaction_manager_communication_settings': {'key': 'transactionManagerCommunicationSettings', 'type': 'ManagedInstanceDtcTransactionManagerCommunicationSettings'}, + 'xa_transactions_enabled': {'key': 'xaTransactionsEnabled', 'type': 'bool'}, + 'sna_lu6_point2_transactions_enabled': {'key': 'snaLu6point2TransactionsEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + transaction_manager_communication_settings: Optional["_models.ManagedInstanceDtcTransactionManagerCommunicationSettings"] = None, + xa_transactions_enabled: Optional[bool] = None, + sna_lu6_point2_transactions_enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword transaction_manager_communication_settings: Transaction Manager communication settings + of managed instance DTC. + :paramtype transaction_manager_communication_settings: + ~azure.mgmt.sql.models.ManagedInstanceDtcTransactionManagerCommunicationSettings + :keyword xa_transactions_enabled: Allow XA Transactions to managed instance DTC. + :paramtype xa_transactions_enabled: bool + :keyword sna_lu6_point2_transactions_enabled: Allow SNA LU 6.2 to managed instance DTC. + :paramtype sna_lu6_point2_transactions_enabled: bool + """ + super(ManagedInstanceDtcSecuritySettings, self).__init__(**kwargs) + self.transaction_manager_communication_settings = transaction_manager_communication_settings + self.xa_transactions_enabled = xa_transactions_enabled + self.sna_lu6_point2_transactions_enabled = sna_lu6_point2_transactions_enabled + + +class ManagedInstanceDtcTransactionManagerCommunicationSettings(msrest.serialization.Model): + """The Transaction Manager Communication Settings of managed instance DTC. + + :ivar allow_inbound_enabled: Allow Inbound traffic to managed instance DTC. + :vartype allow_inbound_enabled: bool + :ivar allow_outbound_enabled: Allow Outbound traffic of managed instance DTC. + :vartype allow_outbound_enabled: bool + :ivar authentication: Authentication type of managed instance DTC. + :vartype authentication: str + """ + + _attribute_map = { + 'allow_inbound_enabled': {'key': 'allowInboundEnabled', 'type': 'bool'}, + 'allow_outbound_enabled': {'key': 'allowOutboundEnabled', 'type': 'bool'}, + 'authentication': {'key': 'authentication', 'type': 'str'}, + } + + def __init__( + self, + *, + allow_inbound_enabled: Optional[bool] = None, + allow_outbound_enabled: Optional[bool] = None, + authentication: Optional[str] = None, + **kwargs + ): + """ + :keyword allow_inbound_enabled: Allow Inbound traffic to managed instance DTC. + :paramtype allow_inbound_enabled: bool + :keyword allow_outbound_enabled: Allow Outbound traffic of managed instance DTC. + :paramtype allow_outbound_enabled: bool + :keyword authentication: Authentication type of managed instance DTC. + :paramtype authentication: str + """ + super(ManagedInstanceDtcTransactionManagerCommunicationSettings, self).__init__(**kwargs) + self.allow_inbound_enabled = allow_inbound_enabled + self.allow_outbound_enabled = allow_outbound_enabled + self.authentication = authentication + + class ManagedInstanceEditionCapability(msrest.serialization.Model): """The managed server capability. @@ -14654,7 +15012,7 @@ class ReplicationLink(ProxyResource): :vartype replication_state: str or ~azure.mgmt.sql.models.ReplicationState :ivar is_termination_allowed: Whether the user is currently allowed to terminate the link. :vartype is_termination_allowed: bool - :ivar link_type: Link type (GEO, NAMED). Known values are: "GEO", "NAMED". + :ivar link_type: Link type (GEO, NAMED, STANDBY). Known values are: "GEO", "NAMED", "STANDBY". :vartype link_type: str or ~azure.mgmt.sql.models.ReplicationLinkType """ 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 915d56476ceff..d61d975418827 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 @@ -130,7 +130,7 @@ class AutomaticTuningServerReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): AUTO_CONFIGURED = "AutoConfigured" class BackupStorageRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The storage account type used to store backups for this database. + """The storage redundancy type of the copied backup """ GEO = "Geo" @@ -392,6 +392,10 @@ class DnsRefreshConfigurationPropertiesStatus(str, Enum, metaclass=CaseInsensiti SUCCEEDED = "Succeeded" FAILED = "Failed" +class DtcName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + CURRENT = "current" + class ElasticPoolLicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to apply for this elastic pool. """ @@ -831,11 +835,12 @@ class RecommendedSensitivityLabelUpdateKind(str, Enum, metaclass=CaseInsensitive DISABLE = "disable" class ReplicationLinkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Link type (GEO, NAMED). + """Link type (GEO, NAMED, STANDBY). """ GEO = "GEO" NAMED = "NAMED" + STANDBY = "STANDBY" class ReplicationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The replication mode of a distributed availability group. Parameter will be ignored during link @@ -889,11 +894,13 @@ class SampleName(str, Enum, metaclass=CaseInsensitiveEnumMeta): WIDE_WORLD_IMPORTERS_FULL = "WideWorldImportersFull" class SecondaryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The secondary type of the database if it is a secondary. Valid values are Geo and Named. + """The secondary type of the database if it is a secondary. Valid values are Geo, Named and + Standby. """ GEO = "Geo" NAMED = "Named" + STANDBY = "Standby" class SecurityAlertPolicyName(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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 3848df9ec3ed4..1c4ae650bde1b 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 @@ -119,7 +119,6 @@ from ._server_trust_certificates_operations import ServerTrustCertificatesOperations from ._ipv6_firewall_rules_operations import IPv6FirewallRulesOperations from ._endpoint_certificates_operations import EndpointCertificatesOperations -from ._replication_links_operations import ReplicationLinksOperations from ._managed_database_sensitivity_labels_operations import ManagedDatabaseSensitivityLabelsOperations from ._managed_database_recommended_sensitivity_labels_operations import ManagedDatabaseRecommendedSensitivityLabelsOperations from ._sensitivity_labels_operations import SensitivityLabelsOperations @@ -131,6 +130,10 @@ from ._database_advanced_threat_protection_settings_operations import DatabaseAdvancedThreatProtectionSettingsOperations from ._server_advanced_threat_protection_settings_operations import ServerAdvancedThreatProtectionSettingsOperations from ._managed_server_dns_aliases_operations import ManagedServerDnsAliasesOperations +from ._managed_instance_dtcs_operations import ManagedInstanceDtcsOperations +from ._managed_database_advanced_threat_protection_settings_operations import ManagedDatabaseAdvancedThreatProtectionSettingsOperations +from ._managed_instance_advanced_threat_protection_settings_operations import ManagedInstanceAdvancedThreatProtectionSettingsOperations +from ._replication_links_operations import ReplicationLinksOperations from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import @@ -249,7 +252,6 @@ 'ServerTrustCertificatesOperations', 'IPv6FirewallRulesOperations', 'EndpointCertificatesOperations', - 'ReplicationLinksOperations', 'ManagedDatabaseSensitivityLabelsOperations', 'ManagedDatabaseRecommendedSensitivityLabelsOperations', 'SensitivityLabelsOperations', @@ -261,6 +263,10 @@ 'DatabaseAdvancedThreatProtectionSettingsOperations', 'ServerAdvancedThreatProtectionSettingsOperations', 'ManagedServerDnsAliasesOperations', + 'ManagedInstanceDtcsOperations', + 'ManagedDatabaseAdvancedThreatProtectionSettingsOperations', + 'ManagedInstanceAdvancedThreatProtectionSettingsOperations', + 'ReplicationLinksOperations', ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() \ No newline at end of file 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 98d063270a740..c1ed74fa307ab 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 @@ -121,7 +121,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -161,7 +161,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -203,7 +203,7 @@ def build_create_or_update_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") @@ -246,7 +246,7 @@ def build_delete_request_initial( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") # pylint: disable=line-too-long path_format_arguments = { @@ -282,7 +282,7 @@ def build_update_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") @@ -329,7 +329,7 @@ def build_export_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") @@ -374,7 +374,7 @@ def build_failover_request_initial( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover") # pylint: disable=line-too-long path_format_arguments = { @@ -412,7 +412,7 @@ def build_import_method_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") @@ -459,7 +459,7 @@ def build_rename_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move") # pylint: disable=line-too-long @@ -500,7 +500,7 @@ def build_pause_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -539,7 +539,7 @@ def build_resume_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -577,7 +577,7 @@ def build_upgrade_data_warehouse_request_initial( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse") # pylint: disable=line-too-long path_format_arguments = { @@ -610,7 +610,7 @@ 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -648,7 +648,7 @@ 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -912,7 +912,7 @@ def list_by_server( :type server_name: str :param skip_token: Default value is None. :type skip_token: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -923,7 +923,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseListResult] error_map = { @@ -1009,7 +1009,7 @@ def get( :type server_name: str :param database_name: The name of the database. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1025,7 +1025,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Database] @@ -1079,7 +1079,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Database]] @@ -1146,7 +1146,7 @@ def begin_create_or_update( :type database_name: str :param parameters: The requested database resource state. :type parameters: ~azure.mgmt.sql.models.Database - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1164,7 +1164,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[_models.Database] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -1230,7 +1230,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -1281,7 +1281,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type server_name: str :param database_name: The name of the database. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1299,7 +1299,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( @@ -1361,7 +1361,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Database]] @@ -1425,7 +1425,7 @@ def begin_update( :type database_name: str :param parameters: The requested database resource state. :type parameters: ~azure.mgmt.sql.models.DatabaseUpdate - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1443,7 +1443,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[_models.Database] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -1510,7 +1510,7 @@ def _export_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ImportExportOperationResult]] @@ -1574,7 +1574,7 @@ def begin_export( :type database_name: str :param parameters: The database export request parameters. :type parameters: ~azure.mgmt.sql.models.ExportDatabaseDefinition - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1593,7 +1593,7 @@ def begin_export( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[_models.ImportExportOperationResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -1660,7 +1660,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -1715,7 +1715,7 @@ def begin_failover( # pylint: disable=inconsistent-return-statements :type database_name: str :param replica_type: The type of replica to be failed over. Default value is None. :type replica_type: str or ~azure.mgmt.sql.models.ReplicaType - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1733,7 +1733,7 @@ def begin_failover( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( @@ -1796,7 +1796,7 @@ def _import_method_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ImportExportOperationResult]] @@ -1860,7 +1860,7 @@ def begin_import_method( :type database_name: str :param parameters: The database import request parameters. :type parameters: ~azure.mgmt.sql.models.ImportExistingDatabaseDefinition - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1879,7 +1879,7 @@ def begin_import_method( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[_models.ImportExportOperationResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] @@ -1950,7 +1950,7 @@ def rename( # pylint: disable=inconsistent-return-statements :type database_name: str :param parameters: The resource move definition for renaming this database. :type parameters: ~azure.mgmt.sql.models.ResourceMoveDefinition - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1966,7 +1966,7 @@ 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -2019,7 +2019,7 @@ def _pause_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Database]] @@ -2076,7 +2076,7 @@ def begin_pause( :type server_name: str :param database_name: The name of the database to be paused. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2094,7 +2094,7 @@ def begin_pause( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Database] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( @@ -2157,7 +2157,7 @@ def _resume_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Database]] @@ -2214,7 +2214,7 @@ def begin_resume( :type server_name: str :param database_name: The name of the database to be resumed. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2232,7 +2232,7 @@ def begin_resume( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.Database] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( @@ -2295,7 +2295,7 @@ 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -2346,7 +2346,7 @@ def begin_upgrade_data_warehouse( # pylint: disable=inconsistent-return-stateme :type server_name: str :param database_name: The name of the database to be upgraded. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2364,7 +2364,7 @@ def begin_upgrade_data_warehouse( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( @@ -2427,7 +2427,7 @@ def list_by_elastic_pool( :type server_name: str :param elastic_pool_name: The name of the elastic pool. :type elastic_pool_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2438,7 +2438,7 @@ def list_by_elastic_pool( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseListResult] error_map = { @@ -2521,7 +2521,7 @@ def list_inaccessible_by_server( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2532,7 +2532,7 @@ def list_inaccessible_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.DatabaseListResult] error_map = { 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 new file mode 100644 index 0000000000000..fc5ca492c847c --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_database_advanced_threat_protection_settings_operations.py @@ -0,0 +1,438 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 .._vendor import _convert_request, _format_url_section +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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}") # 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'), + "advancedThreatProtectionName": _SERIALIZER.url("advanced_threat_protection_name", advanced_threat_protection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + subscription_id: str, + *, + json: Optional[_models.ManagedDatabaseAdvancedThreatProtection] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}") # 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'), + "advancedThreatProtectionName": _SERIALIZER.url("advanced_threat_protection_name", advanced_threat_protection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + +class ManagedDatabaseAdvancedThreatProtectionSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.SqlManagementClient`'s + :attr:`managed_database_advanced_threat_protection_settings` 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.ManagedDatabaseAdvancedThreatProtectionListResult]: + """Gets a list of managed database's Advanced Threat Protection states. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedDatabaseAdvancedThreatProtectionListResult + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedDatabaseAdvancedThreatProtectionListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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) # type: ignore + + else: + + 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=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedDatabaseAdvancedThreatProtectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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}/advancedThreatProtectionSettings"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + **kwargs: Any + ) -> _models.ManagedDatabaseAdvancedThreatProtection: + """Gets a managed database's Advanced Threat Protection state. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param advanced_threat_protection_name: The name of the Advanced Threat Protection state. + :type advanced_threat_protection_name: str or + ~azure.mgmt.sql.models.AdvancedThreatProtectionName + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedDatabaseAdvancedThreatProtection, or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedDatabaseAdvancedThreatProtection] + + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + advanced_threat_protection_name=advanced_threat_protection_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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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('ManagedDatabaseAdvancedThreatProtection', 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}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + database_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + parameters: _models.ManagedDatabaseAdvancedThreatProtection, + **kwargs: Any + ) -> _models.ManagedDatabaseAdvancedThreatProtection: + """Creates or updates a managed database's Advanced Threat Protection state. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param advanced_threat_protection_name: The name of the Advanced Threat Protection state. + :type advanced_threat_protection_name: str or + ~azure.mgmt.sql.models.AdvancedThreatProtectionName + :param parameters: The managed database Advanced Threat Protection state. + :type parameters: ~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtection + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedDatabaseAdvancedThreatProtection, or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ManagedDatabaseAdvancedThreatProtection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedDatabaseAdvancedThreatProtection] + + _json = self._serialize.body(parameters, 'ManagedDatabaseAdvancedThreatProtection') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + database_name=database_name, + advanced_threat_protection_name=advanced_threat_protection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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('ManagedDatabaseAdvancedThreatProtection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedDatabaseAdvancedThreatProtection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"} # type: ignore + 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 new file mode 100644 index 0000000000000..2eacc898ea3a7 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_advanced_threat_protection_settings_operations.py @@ -0,0 +1,490 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 .._vendor import _convert_request, _format_url_section +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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}") # 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'), + "advancedThreatProtectionName": _SERIALIZER.url("advanced_threat_protection_name", advanced_threat_protection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_initial( + resource_group_name: str, + managed_instance_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + subscription_id: str, + *, + json: Optional[_models.ManagedInstanceAdvancedThreatProtection] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}") # 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'), + "advancedThreatProtectionName": _SERIALIZER.url("advanced_threat_protection_name", advanced_threat_protection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + +class ManagedInstanceAdvancedThreatProtectionSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.SqlManagementClient`'s + :attr:`managed_instance_advanced_threat_protection_settings` 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.ManagedInstanceAdvancedThreatProtectionListResult]: + """Get the managed instance's Advanced Threat Protection settings. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedInstanceAdvancedThreatProtectionListResult + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceAdvancedThreatProtectionListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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) # type: ignore + + else: + + 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=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedInstanceAdvancedThreatProtectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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}/advancedThreatProtectionSettings"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + managed_instance_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + **kwargs: Any + ) -> _models.ManagedInstanceAdvancedThreatProtection: + """Get a managed instance's Advanced Threat Protection state. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param advanced_threat_protection_name: The name of the Advanced Threat Protection state. + :type advanced_threat_protection_name: str or + ~azure.mgmt.sql.models.AdvancedThreatProtectionName + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedInstanceAdvancedThreatProtection, or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceAdvancedThreatProtection] + + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + advanced_threat_protection_name=advanced_threat_protection_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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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('ManagedInstanceAdvancedThreatProtection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + managed_instance_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + parameters: _models.ManagedInstanceAdvancedThreatProtection, + **kwargs: Any + ) -> Optional[_models.ManagedInstanceAdvancedThreatProtection]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedInstanceAdvancedThreatProtection]] + + _json = self._serialize.body(parameters, 'ManagedInstanceAdvancedThreatProtection') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + advanced_threat_protection_name=advanced_threat_protection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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('ManagedInstanceAdvancedThreatProtection', 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}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + advanced_threat_protection_name: Union[str, "_models.AdvancedThreatProtectionName"], + parameters: _models.ManagedInstanceAdvancedThreatProtection, + **kwargs: Any + ) -> LROPoller[_models.ManagedInstanceAdvancedThreatProtection]: + """Creates or updates Advanced Threat Protection settings. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param advanced_threat_protection_name: The name of the Advanced Threat Protection state. + :type advanced_threat_protection_name: str or + ~azure.mgmt.sql.models.AdvancedThreatProtectionName + :param parameters: The managed instance Advanced Threat Protection state. + :type parameters: ~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtection + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: 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 ManagedInstanceAdvancedThreatProtection + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.ManagedInstanceAdvancedThreatProtection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceAdvancedThreatProtection] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + advanced_threat_protection_name=advanced_threat_protection_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('ManagedInstanceAdvancedThreatProtection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}"} # type: ignore 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 new file mode 100644 index 0000000000000..0dbe0bfaf8e23 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_instance_dtcs_operations.py @@ -0,0 +1,484 @@ +# 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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 .._vendor import _convert_request, _format_url_section +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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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, + dtc_name: Union[str, "_models.DtcName"], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}") # 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'), + "dtcName": _SERIALIZER.url("dtc_name", dtc_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_initial( + resource_group_name: str, + managed_instance_name: str, + dtc_name: Union[str, "_models.DtcName"], + subscription_id: str, + *, + json: Optional[_models.ManagedInstanceDtc] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}") # 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'), + "dtcName": _SERIALIZER.url("dtc_name", dtc_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + +class ManagedInstanceDtcsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.sql.SqlManagementClient`'s + :attr:`managed_instance_dtcs` 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.ManagedInstanceDtcListResult]: + """Gets a list of managed instance DTC settings. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedInstanceDtcListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.ManagedInstanceDtcListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceDtcListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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) # type: ignore + + else: + + 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=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedInstanceDtcListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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}/dtc"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + managed_instance_name: str, + dtc_name: Union[str, "_models.DtcName"], + **kwargs: Any + ) -> _models.ManagedInstanceDtc: + """Gets managed instance DTC settings. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param dtc_name: The name of the managed instance DTC. + :type dtc_name: str or ~azure.mgmt.sql.models.DtcName + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedInstanceDtc, or the result of cls(response) + :rtype: ~azure.mgmt.sql.models.ManagedInstanceDtc + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceDtc] + + + request = build_get_request( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + dtc_name=dtc_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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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('ManagedInstanceDtc', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + managed_instance_name: str, + dtc_name: Union[str, "_models.DtcName"], + parameters: _models.ManagedInstanceDtc, + **kwargs: Any + ) -> _models.ManagedInstanceDtc: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceDtc] + + _json = self._serialize.body(parameters, 'ManagedInstanceDtc') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + dtc_name=dtc_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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('ManagedInstanceDtc', 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}/dtc/{dtcName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + managed_instance_name: str, + dtc_name: Union[str, "_models.DtcName"], + parameters: _models.ManagedInstanceDtc, + **kwargs: Any + ) -> LROPoller[_models.ManagedInstanceDtc]: + """Updates managed instance DTC settings. + + :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. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param dtc_name: The name of the managed instance DTC. + :type dtc_name: str or ~azure.mgmt.sql.models.DtcName + :param parameters: Managed instance DTC settings. + :type parameters: ~azure.mgmt.sql.models.ManagedInstanceDtc + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: 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 ManagedInstanceDtc or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.ManagedInstanceDtc] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedInstanceDtc] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + dtc_name=dtc_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('ManagedInstanceDtc', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/dtc/{dtcName}"} # type: ignore diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py index f8e73550ca642..f0522f2489f0e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py @@ -39,7 +39,7 @@ def build_list_by_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -79,7 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -109,7 +109,7 @@ def build_get_request( ) -def build_delete_request( +def build_delete_request_initial( resource_group_name: str, server_name: str, database_name: str, @@ -119,7 +119,7 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}") # pylint: disable=line-too-long path_format_arguments = { @@ -154,7 +154,7 @@ def build_failover_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -195,7 +195,7 @@ def build_failover_allow_data_loss_request_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -234,7 +234,7 @@ def build_list_by_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -298,7 +298,7 @@ def list_by_database( :type server_name: str :param database_name: The name of the database. :type database_name: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -310,7 +310,7 @@ def list_by_database( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicationLinkListResult] error_map = { @@ -399,7 +399,7 @@ def get( :type database_name: str :param link_id: The name of the replication link. :type link_id: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -415,7 +415,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicationLink] @@ -454,8 +454,7 @@ def get( get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}"} # type: ignore - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, server_name: str, @@ -463,25 +462,6 @@ def delete( # pylint: disable=inconsistent-return-statements link_id: str, **kwargs: Any ) -> None: - """Deletes the replication link. - - :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. - :type resource_group_name: str - :param server_name: The name of the server. - :type server_name: str - :param database_name: The name of the database. - :type database_name: str - :param link_id: - :type link_id: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :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 } @@ -490,18 +470,18 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] - request = build_delete_request( + request = build_delete_request_initial( resource_group_name=resource_group_name, server_name=server_name, database_name=database_name, link_id=link_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self._delete_initial.metadata['url'], headers=_headers, params=_params, ) @@ -515,15 +495,100 @@ def delete( # pylint: disable=inconsistent-return-statements ) 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) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}"} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + server_name: str, + database_name: str, + link_id: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the replication link. + + :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. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param link_id: + :type link_id: str + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + link_id=link_id, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}"} # type: ignore def _failover_initial( self, @@ -541,7 +606,7 @@ def _failover_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ReplicationLink]] @@ -602,7 +667,7 @@ def begin_failover( :type database_name: str :param link_id: The name of the replication link. :type link_id: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -621,7 +686,7 @@ def begin_failover( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicationLink] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( @@ -686,7 +751,7 @@ def _failover_allow_data_loss_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ReplicationLink]] @@ -747,7 +812,7 @@ def begin_failover_allow_data_loss( :type database_name: str :param link_id: The name of the replication link. :type link_id: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -766,7 +831,7 @@ def begin_failover_allow_data_loss( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicationLink] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( @@ -829,7 +894,7 @@ def list_by_server( :type resource_group_name: str :param server_name: The name of the server. :type server_name: str - :keyword api_version: Api Version. Default value is "2021-11-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2022-02-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -841,7 +906,7 @@ def list_by_server( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[_models.ReplicationLinkListResult] error_map = {