diff --git a/sdk/sql/azure-mgmt-sql/_meta.json b/sdk/sql/azure-mgmt-sql/_meta.json index c004568ac673..20d11117b87d 100644 --- a/sdk/sql/azure-mgmt-sql/_meta.json +++ b/sdk/sql/azure-mgmt-sql/_meta.json @@ -4,8 +4,8 @@ "@autorest/python@5.12.0", "@autorest/modelerfour@4.19.3" ], - "commit": "989a7d0e47a71a77d9a8e56f2a3eee0d366b6909", + "commit": "efb5fb908a3e04c04af543eeddddb93cfc79d3ac", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/sql/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/sql/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.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/_metadata.json b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_metadata.json index f57a6721378b..7793600aa09b 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_metadata.json +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_metadata.json @@ -1,6 +1,6 @@ { "chosen_version": "", - "total_api_version_list": ["2014-04-01", "2020-11-01-preview", "2021-02-01-preview", "2021-05-01-preview", "2021-08-01-preview"], + "total_api_version_list": ["2014-04-01", "2020-11-01-preview", "2021-02-01-preview", "2021-05-01-preview"], "client": { "name": "SqlManagementClient", "filename": "_sql_management_client", @@ -214,9 +214,6 @@ "managed_instances": "ManagedInstancesOperations", "restorable_dropped_databases": "RestorableDroppedDatabasesOperations", "restorable_dropped_managed_databases": "RestorableDroppedManagedDatabasesOperations", - "server_connection_policies": "ServerConnectionPoliciesOperations", - "distributed_availability_groups": "DistributedAvailabilityGroupsOperations", - "server_trust_certificates": "ServerTrustCertificatesOperations", - "ipv6_firewall_rules": "IPv6FirewallRulesOperations" + "server_connection_policies": "ServerConnectionPoliciesOperations" } } \ 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 e1dd40845f99..3bb580d2ae2d 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 @@ -15,7 +15,7 @@ from . import models from ._configuration import SqlManagementClientConfiguration -from .operations import BackupShortTermRetentionPoliciesOperations, CapabilitiesOperations, DataMaskingPoliciesOperations, DataMaskingRulesOperations, DataWarehouseUserActivitiesOperations, DatabaseAdvisorsOperations, DatabaseAutomaticTuningOperations, DatabaseBlobAuditingPoliciesOperations, DatabaseColumnsOperations, DatabaseExtensionsOperations, DatabaseOperationsOperations, DatabaseRecommendedActionsOperations, DatabaseSchemasOperations, DatabaseSecurityAlertPoliciesOperations, DatabaseTablesOperations, DatabaseUsagesOperations, DatabaseVulnerabilityAssessmentRuleBaselinesOperations, DatabaseVulnerabilityAssessmentScansOperations, DatabaseVulnerabilityAssessmentsOperations, DatabasesOperations, DeletedServersOperations, DistributedAvailabilityGroupsOperations, ElasticPoolActivitiesOperations, ElasticPoolDatabaseActivitiesOperations, ElasticPoolOperationsOperations, ElasticPoolsOperations, EncryptionProtectorsOperations, 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, ManagedServerSecurityAlertPoliciesOperations, Operations, OutboundFirewallRulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RecommendedSensitivityLabelsOperations, RecoverableDatabasesOperations, RecoverableManagedDatabasesOperations, ReplicationLinksOperations, RestorableDroppedDatabasesOperations, RestorableDroppedManagedDatabasesOperations, RestorePointsOperations, SensitivityLabelsOperations, 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, DatabaseAdvisorsOperations, DatabaseAutomaticTuningOperations, DatabaseBlobAuditingPoliciesOperations, DatabaseColumnsOperations, DatabaseExtensionsOperations, DatabaseOperationsOperations, DatabaseRecommendedActionsOperations, DatabaseSchemasOperations, DatabaseSecurityAlertPoliciesOperations, DatabaseTablesOperations, DatabaseUsagesOperations, DatabaseVulnerabilityAssessmentRuleBaselinesOperations, DatabaseVulnerabilityAssessmentScansOperations, DatabaseVulnerabilityAssessmentsOperations, DatabasesOperations, DeletedServersOperations, ElasticPoolActivitiesOperations, ElasticPoolDatabaseActivitiesOperations, ElasticPoolOperationsOperations, ElasticPoolsOperations, EncryptionProtectorsOperations, ExtendedDatabaseBlobAuditingPoliciesOperations, ExtendedServerBlobAuditingPoliciesOperations, FailoverGroupsOperations, FirewallRulesOperations, GeoBackupPoliciesOperations, 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, ManagedServerSecurityAlertPoliciesOperations, Operations, OutboundFirewallRulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RecommendedSensitivityLabelsOperations, RecoverableDatabasesOperations, RecoverableManagedDatabasesOperations, ReplicationLinksOperations, RestorableDroppedDatabasesOperations, RestorableDroppedManagedDatabasesOperations, RestorePointsOperations, SensitivityLabelsOperations, ServerAdvisorsOperations, ServerAutomaticTuningOperations, ServerAzureADAdministratorsOperations, ServerAzureADOnlyAuthenticationsOperations, ServerBlobAuditingPoliciesOperations, ServerCommunicationLinksOperations, ServerConnectionPoliciesOperations, ServerDevOpsAuditSettingsOperations, ServerDnsAliasesOperations, ServerKeysOperations, ServerOperationsOperations, ServerSecurityAlertPoliciesOperations, 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 @@ -334,13 +334,6 @@ class SqlManagementClient: :ivar server_connection_policies: ServerConnectionPoliciesOperations operations :vartype server_connection_policies: azure.mgmt.sql.operations.ServerConnectionPoliciesOperations - :ivar distributed_availability_groups: DistributedAvailabilityGroupsOperations operations - :vartype distributed_availability_groups: - azure.mgmt.sql.operations.DistributedAvailabilityGroupsOperations - :ivar server_trust_certificates: ServerTrustCertificatesOperations operations - :vartype server_trust_certificates: azure.mgmt.sql.operations.ServerTrustCertificatesOperations - :ivar ipv6_firewall_rules: IPv6FirewallRulesOperations operations - :vartype ipv6_firewall_rules: azure.mgmt.sql.operations.IPv6FirewallRulesOperations :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. @@ -483,9 +476,6 @@ def __init__( self.restorable_dropped_databases = RestorableDroppedDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) self.restorable_dropped_managed_databases = RestorableDroppedManagedDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) self.server_connection_policies = ServerConnectionPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) - self.distributed_availability_groups = DistributedAvailabilityGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.server_trust_certificates = ServerTrustCertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.ipv6_firewall_rules = IPv6FirewallRulesOperations(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 30888d1aebd8..c78e629b6f08 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_version.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.0.0b2" +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 97e72fc0010d..2292c4f44c59 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 @@ -15,7 +15,7 @@ from .. import models from ._configuration import SqlManagementClientConfiguration -from .operations import BackupShortTermRetentionPoliciesOperations, CapabilitiesOperations, DataMaskingPoliciesOperations, DataMaskingRulesOperations, DataWarehouseUserActivitiesOperations, DatabaseAdvisorsOperations, DatabaseAutomaticTuningOperations, DatabaseBlobAuditingPoliciesOperations, DatabaseColumnsOperations, DatabaseExtensionsOperations, DatabaseOperationsOperations, DatabaseRecommendedActionsOperations, DatabaseSchemasOperations, DatabaseSecurityAlertPoliciesOperations, DatabaseTablesOperations, DatabaseUsagesOperations, DatabaseVulnerabilityAssessmentRuleBaselinesOperations, DatabaseVulnerabilityAssessmentScansOperations, DatabaseVulnerabilityAssessmentsOperations, DatabasesOperations, DeletedServersOperations, DistributedAvailabilityGroupsOperations, ElasticPoolActivitiesOperations, ElasticPoolDatabaseActivitiesOperations, ElasticPoolOperationsOperations, ElasticPoolsOperations, EncryptionProtectorsOperations, 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, ManagedServerSecurityAlertPoliciesOperations, Operations, OutboundFirewallRulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RecommendedSensitivityLabelsOperations, RecoverableDatabasesOperations, RecoverableManagedDatabasesOperations, ReplicationLinksOperations, RestorableDroppedDatabasesOperations, RestorableDroppedManagedDatabasesOperations, RestorePointsOperations, SensitivityLabelsOperations, 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, DatabaseAdvisorsOperations, DatabaseAutomaticTuningOperations, DatabaseBlobAuditingPoliciesOperations, DatabaseColumnsOperations, DatabaseExtensionsOperations, DatabaseOperationsOperations, DatabaseRecommendedActionsOperations, DatabaseSchemasOperations, DatabaseSecurityAlertPoliciesOperations, DatabaseTablesOperations, DatabaseUsagesOperations, DatabaseVulnerabilityAssessmentRuleBaselinesOperations, DatabaseVulnerabilityAssessmentScansOperations, DatabaseVulnerabilityAssessmentsOperations, DatabasesOperations, DeletedServersOperations, ElasticPoolActivitiesOperations, ElasticPoolDatabaseActivitiesOperations, ElasticPoolOperationsOperations, ElasticPoolsOperations, EncryptionProtectorsOperations, ExtendedDatabaseBlobAuditingPoliciesOperations, ExtendedServerBlobAuditingPoliciesOperations, FailoverGroupsOperations, FirewallRulesOperations, GeoBackupPoliciesOperations, 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, ManagedServerSecurityAlertPoliciesOperations, Operations, OutboundFirewallRulesOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, RecommendedSensitivityLabelsOperations, RecoverableDatabasesOperations, RecoverableManagedDatabasesOperations, ReplicationLinksOperations, RestorableDroppedDatabasesOperations, RestorableDroppedManagedDatabasesOperations, RestorePointsOperations, SensitivityLabelsOperations, ServerAdvisorsOperations, ServerAutomaticTuningOperations, ServerAzureADAdministratorsOperations, ServerAzureADOnlyAuthenticationsOperations, ServerBlobAuditingPoliciesOperations, ServerCommunicationLinksOperations, ServerConnectionPoliciesOperations, ServerDevOpsAuditSettingsOperations, ServerDnsAliasesOperations, ServerKeysOperations, ServerOperationsOperations, ServerSecurityAlertPoliciesOperations, 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 @@ -339,14 +339,6 @@ class SqlManagementClient: :ivar server_connection_policies: ServerConnectionPoliciesOperations operations :vartype server_connection_policies: azure.mgmt.sql.aio.operations.ServerConnectionPoliciesOperations - :ivar distributed_availability_groups: DistributedAvailabilityGroupsOperations operations - :vartype distributed_availability_groups: - azure.mgmt.sql.aio.operations.DistributedAvailabilityGroupsOperations - :ivar server_trust_certificates: ServerTrustCertificatesOperations operations - :vartype server_trust_certificates: - azure.mgmt.sql.aio.operations.ServerTrustCertificatesOperations - :ivar ipv6_firewall_rules: IPv6FirewallRulesOperations operations - :vartype ipv6_firewall_rules: azure.mgmt.sql.aio.operations.IPv6FirewallRulesOperations :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. @@ -489,9 +481,6 @@ def __init__( self.restorable_dropped_databases = RestorableDroppedDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) self.restorable_dropped_managed_databases = RestorableDroppedManagedDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) self.server_connection_policies = ServerConnectionPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) - self.distributed_availability_groups = DistributedAvailabilityGroupsOperations(self._client, self._config, self._serialize, self._deserialize) - self.server_trust_certificates = ServerTrustCertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.ipv6_firewall_rules = IPv6FirewallRulesOperations(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 93f085e62a96..9c66a696010c 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 @@ -124,9 +124,6 @@ from ._restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from ._restorable_dropped_managed_databases_operations import RestorableDroppedManagedDatabasesOperations from ._server_connection_policies_operations import ServerConnectionPoliciesOperations -from ._distributed_availability_groups_operations import DistributedAvailabilityGroupsOperations -from ._server_trust_certificates_operations import ServerTrustCertificatesOperations -from ._ipv6_firewall_rules_operations import IPv6FirewallRulesOperations __all__ = [ 'RecoverableDatabasesOperations', @@ -247,7 +244,4 @@ 'RestorableDroppedDatabasesOperations', 'RestorableDroppedManagedDatabasesOperations', 'ServerConnectionPoliciesOperations', - 'DistributedAvailabilityGroupsOperations', - 'ServerTrustCertificatesOperations', - 'IPv6FirewallRulesOperations', ] diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py deleted file mode 100644 index 12537dfd34c7..000000000000 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py +++ /dev/null @@ -1,537 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -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.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._distributed_availability_groups_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_instance_request, build_update_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DistributedAvailabilityGroupsOperations: - """DistributedAvailabilityGroupsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.sql.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_by_instance( - self, - resource_group_name: str, - managed_instance_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.DistributedAvailabilityGroupsListResult"]: - """Gets a list of a distributed availability groups in instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DistributedAvailabilityGroupsListResult or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.DistributedAvailabilityGroupsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DistributedAvailabilityGroupsListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - 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, - template_url=self.list_by_instance.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DistributedAvailabilityGroupsListResult", 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(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}/distributedAvailabilityGroups'} # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - **kwargs: Any - ) -> "_models.DistributedAvailabilityGroup": - """Gets a distributed availability group info. - - :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 distributed_availability_group_name: The distributed availability group name. - :type distributed_availability_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DistributedAvailabilityGroup, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.DistributedAvailabilityGroup - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DistributedAvailabilityGroup"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(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('DistributedAvailabilityGroup', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: "_models.DistributedAvailabilityGroup", - **kwargs: Any - ) -> Optional["_models.DistributedAvailabilityGroup"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DistributedAvailabilityGroup"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'DistributedAvailabilityGroup') - - request = build_create_or_update_request_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DistributedAvailabilityGroup', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DistributedAvailabilityGroup', 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}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: "_models.DistributedAvailabilityGroup", - **kwargs: Any - ) -> AsyncLROPoller["_models.DistributedAvailabilityGroup"]: - """Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group info. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroup - :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 DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DistributedAvailabilityGroup"] - 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( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - parameters=parameters, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DistributedAvailabilityGroup', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - 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}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_delete_request_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. - :type distributed_availability_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - 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( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - cls=lambda x,y,z: x, - **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 = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: "_models.DistributedAvailabilityGroup", - **kwargs: Any - ) -> Optional["_models.DistributedAvailabilityGroup"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DistributedAvailabilityGroup"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'DistributedAvailabilityGroup') - - request = build_update_request_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(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('DistributedAvailabilityGroup', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: "_models.DistributedAvailabilityGroup", - **kwargs: Any - ) -> AsyncLROPoller["_models.DistributedAvailabilityGroup"]: - """Updates a distributed availability group replication mode. - - :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 distributed_availability_group_name: The distributed availability group name. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group info. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroup - :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 DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DistributedAvailabilityGroup"] - 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._update_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - parameters=parameters, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DistributedAvailabilityGroup', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_elastic_pools_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_elastic_pools_operations.py index ef4b05068f30..bd2823e91f76 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_elastic_pools_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_elastic_pools_operations.py @@ -229,7 +229,7 @@ def list_by_server( :param server_name: The name of the server. :type server_name: str :param skip: The number of elements in the collection to skip. - :type skip: long + :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ElasticPoolListResult or the result of cls(response) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ipv6_firewall_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ipv6_firewall_rules_operations.py deleted file mode 100644 index e56ca7ce3bb3..000000000000 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ipv6_firewall_rules_operations.py +++ /dev/null @@ -1,299 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -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.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._ipv6_firewall_rules_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_server_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class IPv6FirewallRulesOperations: - """IPv6FirewallRulesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.sql.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - server_name: str, - firewall_rule_name: str, - **kwargs: Any - ) -> "_models.IPv6FirewallRule": - """Gets an IPv6 firewall rule. - - :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 firewall_rule_name: The name of the firewall rule. - :type firewall_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IPv6FirewallRule, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.IPv6FirewallRule - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IPv6FirewallRule"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_group_name=resource_group_name, - server_name=server_name, - firewall_rule_name=firewall_rule_name, - subscription_id=self._config.subscription_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(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('IPv6FirewallRule', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}'} # type: ignore - - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - server_name: str, - firewall_rule_name: str, - parameters: "_models.IPv6FirewallRule", - **kwargs: Any - ) -> "_models.IPv6FirewallRule": - """Creates or updates an IPv6 firewall rule. - - :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 firewall_rule_name: The name of the firewall rule. - :type firewall_rule_name: str - :param parameters: The required parameters for creating or updating an IPv6 firewall rule. - :type parameters: ~azure.mgmt.sql.models.IPv6FirewallRule - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IPv6FirewallRule, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.IPv6FirewallRule - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IPv6FirewallRule"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'IPv6FirewallRule') - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - server_name=server_name, - firewall_rule_name=firewall_rule_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(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('IPv6FirewallRule', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('IPv6FirewallRule', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}'} # type: ignore - - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - server_name: str, - firewall_rule_name: str, - **kwargs: Any - ) -> None: - """Deletes an IPv6 firewall rule. - - :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 firewall_rule_name: The name of the firewall rule. - :type firewall_rule_name: 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 - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_delete_request( - resource_group_name=resource_group_name, - server_name=server_name, - firewall_rule_name=firewall_rule_name, - subscription_id=self._config.subscription_id, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}'} # type: ignore - - - @distributed_trace - def list_by_server( - self, - resource_group_name: str, - server_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.IPv6FirewallRuleListResult"]: - """Gets a list of IPv6 firewall rules. - - :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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IPv6FirewallRuleListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.IPv6FirewallRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IPv6FirewallRuleListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_server_request( - resource_group_name=resource_group_name, - server_name=server_name, - subscription_id=self._config.subscription_id, - template_url=self.list_by_server.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_server_request( - resource_group_name=resource_group_name, - server_name=server_name, - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("IPv6FirewallRuleListResult", 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(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_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules'} # type: ignore diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_certificates_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_certificates_operations.py deleted file mode 100644 index dfb52f73dda0..000000000000 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_trust_certificates_operations.py +++ /dev/null @@ -1,413 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -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.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._server_trust_certificates_operations import build_create_or_update_request_initial, build_delete_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 ServerTrustCertificatesOperations: - """ServerTrustCertificatesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.sql.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.ServerTrustCertificate": - """Gets a server trust certificate that was uploaded from box to Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :param certificate_name: Name of of the certificate to get. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServerTrustCertificate, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.ServerTrustCertificate - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerTrustCertificate"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(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('ServerTrustCertificate', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}'} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - parameters: "_models.ServerTrustCertificate", - **kwargs: Any - ) -> Optional["_models.ServerTrustCertificate"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ServerTrustCertificate"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'ServerTrustCertificate') - - request = build_create_or_update_request_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ServerTrustCertificate', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ServerTrustCertificate', 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}/serverTrustCertificates/{certificateName}'} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - parameters: "_models.ServerTrustCertificate", - **kwargs: Any - ) -> AsyncLROPoller["_models.ServerTrustCertificate"]: - """Uploads a server trust certificate from box to Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :param certificate_name: Name of of the certificate to upload. - :type certificate_name: str - :param parameters: The server trust certificate info. - :type parameters: ~azure.mgmt.sql.models.ServerTrustCertificate - :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 ServerTrustCertificate or the result - of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.ServerTrustCertificate] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerTrustCertificate"] - 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( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - certificate_name=certificate_name, - parameters=parameters, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServerTrustCertificate', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - 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}/serverTrustCertificates/{certificateName}'} # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_delete_request_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}'} # type: ignore - - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :param certificate_name: Name of of the certificate to delete. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - 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( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - certificate_name=certificate_name, - cls=lambda x,y,z: x, - **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 = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}'} # type: ignore - - @distributed_trace - def list_by_instance( - self, - resource_group_name: str, - managed_instance_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ServerTrustCertificatesListResult"]: - """Gets a list of the server trust certificates which are used for secure communication between - SQL On-Prem instance and the given Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServerTrustCertificatesListResult or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.sql.models.ServerTrustCertificatesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerTrustCertificatesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - 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, - template_url=self.list_by_instance.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ServerTrustCertificatesListResult", 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(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}/serverTrustCertificates'} # type: ignore 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 12239edc245a..429e3bbc40af 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 @@ -53,8 +53,6 @@ from ._models_py3 import Delegation from ._models_py3 import DeletedServer from ._models_py3 import DeletedServerListResult -from ._models_py3 import DistributedAvailabilityGroup -from ._models_py3 import DistributedAvailabilityGroupsListResult from ._models_py3 import EditionCapability from ._models_py3 import ElasticPool from ._models_py3 import ElasticPoolActivity @@ -87,9 +85,6 @@ from ._models_py3 import FirewallRuleListResult from ._models_py3 import GeoBackupPolicy from ._models_py3 import GeoBackupPolicyListResult -from ._models_py3 import IPv6FirewallRule -from ._models_py3 import IPv6FirewallRuleList -from ._models_py3 import IPv6FirewallRuleListResult from ._models_py3 import ImportExistingDatabaseDefinition from ._models_py3 import ImportExportExtensionsOperationListResult from ._models_py3 import ImportExportExtensionsOperationResult @@ -287,8 +282,6 @@ from ._models_py3 import ServerOperationListResult from ._models_py3 import ServerPrivateEndpointConnection from ._models_py3 import ServerSecurityAlertPolicy -from ._models_py3 import ServerTrustCertificate -from ._models_py3 import ServerTrustCertificatesListResult from ._models_py3 import ServerTrustGroup from ._models_py3 import ServerTrustGroupListResult from ._models_py3 import ServerUpdate @@ -447,7 +440,6 @@ RecommendedSensitivityLabelUpdateKind, ReplicaType, ReplicationLinkType, - ReplicationMode, ReplicationRole, ReplicationState, RestoreDetailsName, @@ -541,8 +533,6 @@ 'Delegation', 'DeletedServer', 'DeletedServerListResult', - 'DistributedAvailabilityGroup', - 'DistributedAvailabilityGroupsListResult', 'EditionCapability', 'ElasticPool', 'ElasticPoolActivity', @@ -575,9 +565,6 @@ 'FirewallRuleListResult', 'GeoBackupPolicy', 'GeoBackupPolicyListResult', - 'IPv6FirewallRule', - 'IPv6FirewallRuleList', - 'IPv6FirewallRuleListResult', 'ImportExistingDatabaseDefinition', 'ImportExportExtensionsOperationListResult', 'ImportExportExtensionsOperationResult', @@ -775,8 +762,6 @@ 'ServerOperationListResult', 'ServerPrivateEndpointConnection', 'ServerSecurityAlertPolicy', - 'ServerTrustCertificate', - 'ServerTrustCertificatesListResult', 'ServerTrustGroup', 'ServerTrustGroupListResult', 'ServerUpdate', @@ -932,7 +917,6 @@ 'RecommendedSensitivityLabelUpdateKind', 'ReplicaType', 'ReplicationLinkType', - 'ReplicationMode', 'ReplicationRole', 'ReplicationState', 'RestoreDetailsName', 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 d9617616b321..1181db4acc72 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 @@ -3464,135 +3464,6 @@ def __init__( self.next_link = None -class DistributedAvailabilityGroup(ProxyResource): - """Distributed availability group between box and Sql Managed Instance. - - 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 target_database: The name of the target database. - :vartype target_database: str - :ivar source_endpoint: The source endpoint. - :vartype source_endpoint: str - :ivar primary_availability_group_name: The primary availability group name. - :vartype primary_availability_group_name: str - :ivar secondary_availability_group_name: The secondary availability group name. - :vartype secondary_availability_group_name: str - :ivar replication_mode: The replication mode of a distributed availability group. Parameter - will be ignored during link creation. Possible values include: "Async", "Sync". - :vartype replication_mode: str or ~azure.mgmt.sql.models.ReplicationMode - :ivar distributed_availability_group_id: The distributed availability group id. - :vartype distributed_availability_group_id: str - :ivar source_replica_id: The source replica id. - :vartype source_replica_id: str - :ivar target_replica_id: The target replica id. - :vartype target_replica_id: str - :ivar link_state: The link state. - :vartype link_state: str - :ivar last_hardened_lsn: The last hardened lsn. - :vartype last_hardened_lsn: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'distributed_availability_group_id': {'readonly': True}, - 'source_replica_id': {'readonly': True}, - 'target_replica_id': {'readonly': True}, - 'link_state': {'readonly': True}, - 'last_hardened_lsn': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'target_database': {'key': 'properties.targetDatabase', 'type': 'str'}, - 'source_endpoint': {'key': 'properties.sourceEndpoint', 'type': 'str'}, - 'primary_availability_group_name': {'key': 'properties.primaryAvailabilityGroupName', 'type': 'str'}, - 'secondary_availability_group_name': {'key': 'properties.secondaryAvailabilityGroupName', 'type': 'str'}, - 'replication_mode': {'key': 'properties.replicationMode', 'type': 'str'}, - 'distributed_availability_group_id': {'key': 'properties.distributedAvailabilityGroupId', 'type': 'str'}, - 'source_replica_id': {'key': 'properties.sourceReplicaId', 'type': 'str'}, - 'target_replica_id': {'key': 'properties.targetReplicaId', 'type': 'str'}, - 'link_state': {'key': 'properties.linkState', 'type': 'str'}, - 'last_hardened_lsn': {'key': 'properties.lastHardenedLsn', 'type': 'str'}, - } - - def __init__( - self, - *, - target_database: Optional[str] = None, - source_endpoint: Optional[str] = None, - primary_availability_group_name: Optional[str] = None, - secondary_availability_group_name: Optional[str] = None, - replication_mode: Optional[Union[str, "ReplicationMode"]] = None, - **kwargs - ): - """ - :keyword target_database: The name of the target database. - :paramtype target_database: str - :keyword source_endpoint: The source endpoint. - :paramtype source_endpoint: str - :keyword primary_availability_group_name: The primary availability group name. - :paramtype primary_availability_group_name: str - :keyword secondary_availability_group_name: The secondary availability group name. - :paramtype secondary_availability_group_name: str - :keyword replication_mode: The replication mode of a distributed availability group. Parameter - will be ignored during link creation. Possible values include: "Async", "Sync". - :paramtype replication_mode: str or ~azure.mgmt.sql.models.ReplicationMode - """ - super(DistributedAvailabilityGroup, self).__init__(**kwargs) - self.target_database = target_database - self.source_endpoint = source_endpoint - self.primary_availability_group_name = primary_availability_group_name - self.secondary_availability_group_name = secondary_availability_group_name - self.replication_mode = replication_mode - self.distributed_availability_group_id = None - self.source_replica_id = None - self.target_replica_id = None - self.link_state = None - self.last_hardened_lsn = None - - -class DistributedAvailabilityGroupsListResult(msrest.serialization.Model): - """A list of distributed availability groups in instance. - - 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.DistributedAvailabilityGroup] - :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': '[DistributedAvailabilityGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DistributedAvailabilityGroupsListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class EditionCapability(msrest.serialization.Model): """The edition capability. @@ -3705,9 +3576,6 @@ class ElasticPool(TrackedResource): :ivar maintenance_configuration_id: Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. :vartype maintenance_configuration_id: str - :ivar high_availability_replica_count: The number of secondary replicas associated with the - elastic pool that are used to provide high availability. - :vartype high_availability_replica_count: int """ _validation = { @@ -3735,7 +3603,6 @@ class ElasticPool(TrackedResource): 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, 'maintenance_configuration_id': {'key': 'properties.maintenanceConfigurationId', 'type': 'str'}, - 'high_availability_replica_count': {'key': 'properties.highAvailabilityReplicaCount', 'type': 'int'}, } def __init__( @@ -3749,7 +3616,6 @@ def __init__( zone_redundant: Optional[bool] = None, license_type: Optional[Union[str, "ElasticPoolLicenseType"]] = None, maintenance_configuration_id: Optional[str] = None, - high_availability_replica_count: Optional[int] = None, **kwargs ): """ @@ -3781,9 +3647,6 @@ def __init__( :keyword maintenance_configuration_id: Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. :paramtype maintenance_configuration_id: str - :keyword high_availability_replica_count: The number of secondary replicas associated with the - elastic pool that are used to provide high availability. - :paramtype high_availability_replica_count: int """ super(ElasticPool, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku @@ -3795,7 +3658,6 @@ def __init__( self.zone_redundant = zone_redundant self.license_type = license_type self.maintenance_configuration_id = maintenance_configuration_id - self.high_availability_replica_count = high_availability_replica_count class ElasticPoolActivity(ProxyResource): @@ -4585,10 +4447,6 @@ class ElasticPoolUpdate(msrest.serialization.Model): :ivar maintenance_configuration_id: Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. :vartype maintenance_configuration_id: str - :ivar high_availability_replica_count: The number of secondary replicas associated with the - elastic pool that are used to provide high availability. Applicable only to Hyperscale elastic - pools. - :vartype high_availability_replica_count: int """ _attribute_map = { @@ -4599,7 +4457,6 @@ class ElasticPoolUpdate(msrest.serialization.Model): 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, 'maintenance_configuration_id': {'key': 'properties.maintenanceConfigurationId', 'type': 'str'}, - 'high_availability_replica_count': {'key': 'properties.highAvailabilityReplicaCount', 'type': 'int'}, } def __init__( @@ -4612,7 +4469,6 @@ def __init__( zone_redundant: Optional[bool] = None, license_type: Optional[Union[str, "ElasticPoolLicenseType"]] = None, maintenance_configuration_id: Optional[str] = None, - high_availability_replica_count: Optional[int] = None, **kwargs ): """ @@ -4633,10 +4489,6 @@ def __init__( :keyword maintenance_configuration_id: Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the maintenance updates will will occur. :paramtype maintenance_configuration_id: str - :keyword high_availability_replica_count: The number of secondary replicas associated with the - elastic pool that are used to provide high availability. Applicable only to Hyperscale elastic - pools. - :paramtype high_availability_replica_count: int """ super(ElasticPoolUpdate, self).__init__(**kwargs) self.sku = sku @@ -4646,7 +4498,6 @@ def __init__( self.zone_redundant = zone_redundant self.license_type = license_type self.maintenance_configuration_id = maintenance_configuration_id - self.high_availability_replica_count = high_availability_replica_count class EncryptionProtector(ProxyResource): @@ -6912,116 +6763,6 @@ def __init__( self.reason = reason -class IPv6FirewallRule(ProxyResourceWithWritableName): - """An IPv6 server firewall rule. - - 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 start_i_pv6_address: The start IP address of the firewall rule. Must be IPv6 format. - :vartype start_i_pv6_address: str - :ivar end_i_pv6_address: The end IP address of the firewall rule. Must be IPv6 format. Must be - greater than or equal to startIpAddress. - :vartype end_i_pv6_address: str - """ - - _validation = { - 'id': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_i_pv6_address': {'key': 'properties.startIPv6Address', 'type': 'str'}, - 'end_i_pv6_address': {'key': 'properties.endIPv6Address', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - start_i_pv6_address: Optional[str] = None, - end_i_pv6_address: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Resource name. - :paramtype name: str - :keyword start_i_pv6_address: The start IP address of the firewall rule. Must be IPv6 format. - :paramtype start_i_pv6_address: str - :keyword end_i_pv6_address: The end IP address of the firewall rule. Must be IPv6 format. Must - be greater than or equal to startIpAddress. - :paramtype end_i_pv6_address: str - """ - super(IPv6FirewallRule, self).__init__(name=name, **kwargs) - self.start_i_pv6_address = start_i_pv6_address - self.end_i_pv6_address = end_i_pv6_address - - -class IPv6FirewallRuleList(msrest.serialization.Model): - """A list of IPv6 server firewall rules. - - :ivar values: - :vartype values: list[~azure.mgmt.sql.models.IPv6FirewallRule] - """ - - _attribute_map = { - 'values': {'key': 'values', 'type': '[IPv6FirewallRule]'}, - } - - def __init__( - self, - *, - values: Optional[List["IPv6FirewallRule"]] = None, - **kwargs - ): - """ - :keyword values: - :paramtype values: list[~azure.mgmt.sql.models.IPv6FirewallRule] - """ - super(IPv6FirewallRuleList, self).__init__(**kwargs) - self.values = values - - -class IPv6FirewallRuleListResult(msrest.serialization.Model): - """The response to a list IPv6 firewall rules request. - - 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.IPv6FirewallRule] - :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': '[IPv6FirewallRule]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(IPv6FirewallRuleListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class Job(ProxyResource): """A job. @@ -16876,90 +16617,6 @@ def __init__( self.creation_time = None -class ServerTrustCertificate(ProxyResource): - """Server trust certificate imported from box to enable connection between box and Sql Managed Instance. - - 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 public_blob: The certificate public blob. - :vartype public_blob: str - :ivar thumbprint: The certificate thumbprint. - :vartype thumbprint: str - :ivar certificate_name: The certificate name. - :vartype certificate_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'thumbprint': {'readonly': True}, - 'certificate_name': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'public_blob': {'key': 'properties.publicBlob', 'type': 'str'}, - 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, - 'certificate_name': {'key': 'properties.certificateName', 'type': 'str'}, - } - - def __init__( - self, - *, - public_blob: Optional[str] = None, - **kwargs - ): - """ - :keyword public_blob: The certificate public blob. - :paramtype public_blob: str - """ - super(ServerTrustCertificate, self).__init__(**kwargs) - self.public_blob = public_blob - self.thumbprint = None - self.certificate_name = None - - -class ServerTrustCertificatesListResult(msrest.serialization.Model): - """A list of the server trust certificates which are used for secure communication between SQL On-Prem instance and the given Sql Managed Instance. - - 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.ServerTrustCertificate] - :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': '[ServerTrustCertificate]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ServerTrustCertificatesListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class ServerTrustGroup(ProxyResource): """A server trust group. 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 a271e38af484..8e0820b34b1b 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 @@ -825,14 +825,6 @@ class ReplicationLinkType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GEO = "GEO" NAMED = "NAMED" -class ReplicationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The replication mode of a distributed availability group. Parameter will be ignored during link - creation. - """ - - ASYNC_ENUM = "Async" - SYNC = "Sync" - class ReplicationRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Local replication role. """ 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 93f085e62a96..9c66a696010c 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 @@ -124,9 +124,6 @@ from ._restorable_dropped_databases_operations import RestorableDroppedDatabasesOperations from ._restorable_dropped_managed_databases_operations import RestorableDroppedManagedDatabasesOperations from ._server_connection_policies_operations import ServerConnectionPoliciesOperations -from ._distributed_availability_groups_operations import DistributedAvailabilityGroupsOperations -from ._server_trust_certificates_operations import ServerTrustCertificatesOperations -from ._ipv6_firewall_rules_operations import IPv6FirewallRulesOperations __all__ = [ 'RecoverableDatabasesOperations', @@ -247,7 +244,4 @@ 'RestorableDroppedDatabasesOperations', 'RestorableDroppedManagedDatabasesOperations', 'ServerConnectionPoliciesOperations', - 'DistributedAvailabilityGroupsOperations', - 'ServerTrustCertificatesOperations', - 'IPv6FirewallRulesOperations', ] diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py deleted file mode 100644 index 1a421f336125..000000000000 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py +++ /dev/null @@ -1,734 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings - -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.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -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: - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups') - 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 - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_get_request( - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, 'str'), - "distributedAvailabilityGroupName": _SERIALIZER.url("distributed_availability_group_name", distributed_availability_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, 'str'), - "distributedAvailabilityGroupName": _SERIALIZER.url("distributed_availability_group_name", distributed_availability_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-05-01-preview" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, 'str'), - "distributedAvailabilityGroupName": _SERIALIZER.url("distributed_availability_group_name", distributed_availability_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - **kwargs - ) - - -def build_update_request_initial( - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, 'str'), - "distributedAvailabilityGroupName": _SERIALIZER.url("distributed_availability_group_name", distributed_availability_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - -class DistributedAvailabilityGroupsOperations(object): - """DistributedAvailabilityGroupsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.sql.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_by_instance( - self, - resource_group_name: str, - managed_instance_name: str, - **kwargs: Any - ) -> Iterable["_models.DistributedAvailabilityGroupsListResult"]: - """Gets a list of a distributed availability groups in instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DistributedAvailabilityGroupsListResult or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.DistributedAvailabilityGroupsListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DistributedAvailabilityGroupsListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - 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, - template_url=self.list_by_instance.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DistributedAvailabilityGroupsListResult", 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(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}/distributedAvailabilityGroups'} # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - **kwargs: Any - ) -> "_models.DistributedAvailabilityGroup": - """Gets a distributed availability group info. - - :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 distributed_availability_group_name: The distributed availability group name. - :type distributed_availability_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DistributedAvailabilityGroup, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.DistributedAvailabilityGroup - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DistributedAvailabilityGroup"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(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('DistributedAvailabilityGroup', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: "_models.DistributedAvailabilityGroup", - **kwargs: Any - ) -> Optional["_models.DistributedAvailabilityGroup"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DistributedAvailabilityGroup"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'DistributedAvailabilityGroup') - - request = build_create_or_update_request_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DistributedAvailabilityGroup', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DistributedAvailabilityGroup', 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}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: "_models.DistributedAvailabilityGroup", - **kwargs: Any - ) -> LROPoller["_models.DistributedAvailabilityGroup"]: - """Creates a distributed availability group between Sql On-Prem and Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group info. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroup - :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 DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DistributedAvailabilityGroup"] - 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( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - parameters=parameters, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DistributedAvailabilityGroup', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - 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}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - def _delete_initial( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_delete_request_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. - :type distributed_availability_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - 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( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - cls=lambda x,y,z: x, - **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 = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: "_models.DistributedAvailabilityGroup", - **kwargs: Any - ) -> Optional["_models.DistributedAvailabilityGroup"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DistributedAvailabilityGroup"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'DistributedAvailabilityGroup') - - request = build_update_request_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(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('DistributedAvailabilityGroup', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: "_models.DistributedAvailabilityGroup", - **kwargs: Any - ) -> LROPoller["_models.DistributedAvailabilityGroup"]: - """Updates a distributed availability group replication mode. - - :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 distributed_availability_group_name: The distributed availability group name. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group info. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroup - :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 DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DistributedAvailabilityGroup"] - 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._update_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - parameters=parameters, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DistributedAvailabilityGroup', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}'} # type: ignore diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_elastic_pools_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_elastic_pools_operations.py index 416b7bfef71d..fa5bc60d615e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_elastic_pools_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_elastic_pools_operations.py @@ -114,7 +114,7 @@ def build_list_by_server_request( skip: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01-preview" + api_version = "2020-11-01-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools') @@ -129,7 +129,7 @@ def build_list_by_server_request( # Construct parameters query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if skip is not None: - query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'long') + query_parameters['$skip'] = _SERIALIZER.query("skip", skip, 'int') query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers @@ -152,7 +152,7 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01-preview" + api_version = "2020-11-01-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}') @@ -194,7 +194,7 @@ def build_create_or_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01-preview" + api_version = "2020-11-01-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}') @@ -235,7 +235,7 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01-preview" + api_version = "2020-11-01-preview" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}') path_format_arguments = { @@ -271,7 +271,7 @@ def build_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01-preview" + api_version = "2020-11-01-preview" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}') @@ -312,7 +312,7 @@ def build_failover_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01-preview" + api_version = "2020-11-01-preview" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/failover') path_format_arguments = { @@ -537,7 +537,7 @@ def list_by_server( :param server_name: The name of the server. :type server_name: str :param skip: The number of elements in the collection to skip. - :type skip: long + :type skip: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ElasticPoolListResult or the result of cls(response) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ipv6_firewall_rules_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ipv6_firewall_rules_operations.py deleted file mode 100644 index 821f73d63364..000000000000 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ipv6_firewall_rules_operations.py +++ /dev/null @@ -1,449 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings - -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.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - resource_group_name: str, - server_name: str, - firewall_rule_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-08-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "serverName": _SERIALIZER.url("server_name", server_name, 'str'), - "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request( - resource_group_name: str, - server_name: str, - firewall_rule_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-08-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "serverName": _SERIALIZER.url("server_name", server_name, 'str'), - "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request( - resource_group_name: str, - server_name: str, - firewall_rule_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-08-01-preview" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "serverName": _SERIALIZER.url("server_name", server_name, 'str'), - "firewallRuleName": _SERIALIZER.url("firewall_rule_name", firewall_rule_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - **kwargs - ) - - -def build_list_by_server_request( - resource_group_name: str, - server_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-08-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "serverName": _SERIALIZER.url("server_name", server_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -class IPv6FirewallRulesOperations(object): - """IPv6FirewallRulesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.sql.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - server_name: str, - firewall_rule_name: str, - **kwargs: Any - ) -> "_models.IPv6FirewallRule": - """Gets an IPv6 firewall rule. - - :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 firewall_rule_name: The name of the firewall rule. - :type firewall_rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IPv6FirewallRule, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.IPv6FirewallRule - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IPv6FirewallRule"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_group_name=resource_group_name, - server_name=server_name, - firewall_rule_name=firewall_rule_name, - subscription_id=self._config.subscription_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(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('IPv6FirewallRule', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}'} # type: ignore - - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - server_name: str, - firewall_rule_name: str, - parameters: "_models.IPv6FirewallRule", - **kwargs: Any - ) -> "_models.IPv6FirewallRule": - """Creates or updates an IPv6 firewall rule. - - :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 firewall_rule_name: The name of the firewall rule. - :type firewall_rule_name: str - :param parameters: The required parameters for creating or updating an IPv6 firewall rule. - :type parameters: ~azure.mgmt.sql.models.IPv6FirewallRule - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IPv6FirewallRule, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.IPv6FirewallRule - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IPv6FirewallRule"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'IPv6FirewallRule') - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - server_name=server_name, - firewall_rule_name=firewall_rule_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self.create_or_update.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(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('IPv6FirewallRule', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('IPv6FirewallRule', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}'} # type: ignore - - - @distributed_trace - def delete( - self, - resource_group_name: str, - server_name: str, - firewall_rule_name: str, - **kwargs: Any - ) -> None: - """Deletes an IPv6 firewall rule. - - :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 firewall_rule_name: The name of the firewall rule. - :type firewall_rule_name: 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 - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_delete_request( - resource_group_name=resource_group_name, - server_name=server_name, - firewall_rule_name=firewall_rule_name, - subscription_id=self._config.subscription_id, - template_url=self.delete.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules/{firewallRuleName}'} # type: ignore - - - @distributed_trace - def list_by_server( - self, - resource_group_name: str, - server_name: str, - **kwargs: Any - ) -> Iterable["_models.IPv6FirewallRuleListResult"]: - """Gets a list of IPv6 firewall rules. - - :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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IPv6FirewallRuleListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.IPv6FirewallRuleListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.IPv6FirewallRuleListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_server_request( - resource_group_name=resource_group_name, - server_name=server_name, - subscription_id=self._config.subscription_id, - template_url=self.list_by_server.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_server_request( - resource_group_name=resource_group_name, - server_name=server_name, - subscription_id=self._config.subscription_id, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("IPv6FirewallRuleListResult", 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(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_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/ipv6FirewallRules'} # type: ignore diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_certificates_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_certificates_operations.py deleted file mode 100644 index 4159f22816bc..000000000000 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_trust_certificates_operations.py +++ /dev/null @@ -1,563 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings - -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.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - subscription_id: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-05-01-preview" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}') - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - url = _format_url_section(url, **path_format_arguments) - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - return HttpRequest( - method="DELETE", - url=url, - params=query_parameters, - **kwargs - ) - - -def build_list_by_instance_request( - resource_group_name: str, - managed_instance_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates') - 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 - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - -class ServerTrustCertificatesOperations(object): - """ServerTrustCertificatesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.sql.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.ServerTrustCertificate": - """Gets a server trust certificate that was uploaded from box to Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :param certificate_name: Name of of the certificate to get. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServerTrustCertificate, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.ServerTrustCertificate - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerTrustCertificate"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_get_request( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(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('ServerTrustCertificate', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}'} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - parameters: "_models.ServerTrustCertificate", - **kwargs: Any - ) -> Optional["_models.ServerTrustCertificate"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ServerTrustCertificate"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(parameters, 'ServerTrustCertificate') - - request = build_create_or_update_request_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ServerTrustCertificate', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ServerTrustCertificate', 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}/serverTrustCertificates/{certificateName}'} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - parameters: "_models.ServerTrustCertificate", - **kwargs: Any - ) -> LROPoller["_models.ServerTrustCertificate"]: - """Uploads a server trust certificate from box to Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :param certificate_name: Name of of the certificate to upload. - :type certificate_name: str - :param parameters: The server trust certificate info. - :type parameters: ~azure.mgmt.sql.models.ServerTrustCertificate - :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 ServerTrustCertificate or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.ServerTrustCertificate] - :raises: ~azure.core.exceptions.HttpResponseError - """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerTrustCertificate"] - 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( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - certificate_name=certificate_name, - parameters=parameters, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServerTrustCertificate', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - 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}/serverTrustCertificates/{certificateName}'} # type: ignore - - def _delete_initial( - self, - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - - request = build_delete_request_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - certificate_name=certificate_name, - subscription_id=self._config.subscription_id, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}'} # type: ignore - - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - managed_instance_name: str, - certificate_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :param certificate_name: Name of of the certificate to delete. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - 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( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - certificate_name=certificate_name, - cls=lambda x,y,z: x, - **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 = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = 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 - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}'} # type: ignore - - @distributed_trace - def list_by_instance( - self, - resource_group_name: str, - managed_instance_name: str, - **kwargs: Any - ) -> Iterable["_models.ServerTrustCertificatesListResult"]: - """Gets a list of the server trust certificates which are used for secure communication between - SQL On-Prem instance and the given Sql Managed Instance. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. - :type managed_instance_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServerTrustCertificatesListResult or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.sql.models.ServerTrustCertificatesListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerTrustCertificatesListResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - 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, - template_url=self.list_by_instance.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - 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, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ServerTrustCertificatesListResult", 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(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}/serverTrustCertificates'} # type: ignore