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 e72bde3586c6..dffd67378330 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 @@ -177,6 +177,7 @@ from ._models_py3 import TrackedResource from ._models_py3 import TransparentDataEncryption from ._models_py3 import TransparentDataEncryptionActivity + from ._models_py3 import UnlinkParameters from ._models_py3 import Usage from ._models_py3 import VirtualCluster from ._models_py3 import VirtualClusterUpdate @@ -354,6 +355,7 @@ from ._models import TrackedResource from ._models import TransparentDataEncryption from ._models import TransparentDataEncryptionActivity + from ._models import UnlinkParameters from ._models import Usage from ._models import VirtualCluster from ._models import VirtualClusterUpdate @@ -375,6 +377,8 @@ from ._paged_models import ElasticPoolOperationPaged from ._paged_models import ElasticPoolPaged from ._paged_models import EncryptionProtectorPaged +from ._paged_models import ExtendedDatabaseBlobAuditingPolicyPaged +from ._paged_models import ExtendedServerBlobAuditingPolicyPaged from ._paged_models import FailoverGroupPaged from ._paged_models import FirewallRulePaged from ._paged_models import GeoBackupPolicyPaged @@ -705,6 +709,7 @@ 'TrackedResource', 'TransparentDataEncryption', 'TransparentDataEncryptionActivity', + 'UnlinkParameters', 'Usage', 'VirtualCluster', 'VirtualClusterUpdate', @@ -748,6 +753,8 @@ 'SubscriptionUsagePaged', 'VirtualClusterPaged', 'VirtualNetworkRulePaged', + 'ExtendedDatabaseBlobAuditingPolicyPaged', + 'ExtendedServerBlobAuditingPolicyPaged', 'ServerBlobAuditingPolicyPaged', 'DatabaseBlobAuditingPolicyPaged', 'DatabaseVulnerabilityAssessmentPaged', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py index 153ccd9289e9..7db0245e3bfd 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py @@ -802,8 +802,17 @@ class DatabaseBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -2671,8 +2680,17 @@ class ExtendedDatabaseBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -2831,8 +2849,17 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -7778,8 +7805,17 @@ class ServerBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -9609,6 +9645,23 @@ def __init__(self, **kwargs): self.percent_complete = None +class UnlinkParameters(Model): + """Represents the parameters for Unlink Replication Link request. + + :param forced_termination: Determines whether link will be terminated in a + forced or a friendly way. + :type forced_termination: bool + """ + + _attribute_map = { + 'forced_termination': {'key': 'forcedTermination', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(UnlinkParameters, self).__init__(**kwargs) + self.forced_termination = kwargs.get('forced_termination', None) + + class Usage(Model): """ARM usage. 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 70e81e62ae62..a55834d1f551 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 @@ -802,8 +802,17 @@ class DatabaseBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -2671,8 +2680,17 @@ class ExtendedDatabaseBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -2831,8 +2849,17 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -7778,8 +7805,17 @@ class ServerBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -9609,6 +9645,23 @@ def __init__(self, **kwargs) -> None: self.percent_complete = None +class UnlinkParameters(Model): + """Represents the parameters for Unlink Replication Link request. + + :param forced_termination: Determines whether link will be terminated in a + forced or a friendly way. + :type forced_termination: bool + """ + + _attribute_map = { + 'forced_termination': {'key': 'forcedTermination', 'type': 'bool'}, + } + + def __init__(self, *, forced_termination: bool=None, **kwargs) -> None: + super(UnlinkParameters, self).__init__(**kwargs) + self.forced_termination = forced_termination + + class Usage(Model): """ARM usage. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py index a4d68805b28f..62dcecdff07f 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py @@ -454,6 +454,32 @@ class VirtualNetworkRulePaged(Paged): def __init__(self, *args, **kwargs): super(VirtualNetworkRulePaged, self).__init__(*args, **kwargs) +class ExtendedDatabaseBlobAuditingPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ExtendedDatabaseBlobAuditingPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ExtendedDatabaseBlobAuditingPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ExtendedDatabaseBlobAuditingPolicyPaged, self).__init__(*args, **kwargs) +class ExtendedServerBlobAuditingPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ExtendedServerBlobAuditingPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ExtendedServerBlobAuditingPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ExtendedServerBlobAuditingPolicyPaged, self).__init__(*args, **kwargs) class ServerBlobAuditingPolicyPaged(Paged): """ A paging container for iterating over a list of :class:`ServerBlobAuditingPolicy ` object diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py index ea9c9d8d7aaf..8603d99a6acd 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py @@ -185,3 +185,81 @@ def create_or_update( return deserialized create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}'} + + def list_by_database( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists extended auditing settings of a database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of + ExtendedDatabaseBlobAuditingPolicy + :rtype: + ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicyPaged[~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ExtendedDatabaseBlobAuditingPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py index dff8fac62031..728bf1c26c9d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py @@ -212,3 +212,77 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}'} + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Lists extended auditing settings of a server. + + :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 dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ExtendedServerBlobAuditingPolicy + :rtype: + ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicyPaged[~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_server.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ExtendedServerBlobAuditingPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py index bebd9d62e04d..7cb1cad8ec04 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py @@ -354,6 +354,106 @@ def get_long_running_output(response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) failover_allow_data_loss.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss'} + + def _unlink_initial( + self, resource_group_name, server_name, database_name, link_id, forced_termination=None, custom_headers=None, raw=False, **operation_config): + parameters = models.UnlinkParameters(forced_termination=forced_termination) + + # Construct URL + url = self.unlink.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'linkId': self._serialize.url("link_id", link_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'UnlinkParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def unlink( + self, resource_group_name, server_name, database_name, link_id, forced_termination=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a database replication link in forced or friendly way. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database that has the + replication link to be failed over. + :type database_name: str + :param link_id: The ID of the replication link to be failed over. + :type link_id: str + :param forced_termination: Determines whether link will be terminated + in a forced or a friendly way. + :type forced_termination: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._unlink_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + link_id=link_id, + forced_termination=forced_termination, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + unlink.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink'} + def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): """Lists a database's replication links. diff --git a/sdk/sql/azure-mgmt-sql/setup.py b/sdk/sql/azure-mgmt-sql/setup.py index e6b06f525bc1..97474e8ab13e 100644 --- a/sdk/sql/azure-mgmt-sql/setup.py +++ b/sdk/sql/azure-mgmt-sql/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)