Skip to content

Commit

Permalink
Generated from c86d57b97fd2eaae90672eeb2b067b0c138a2890
Browse files Browse the repository at this point in the history
Adding decription of unlink action to Replication Link Swagger
  • Loading branch information
SDK Automation committed Apr 1, 2020
1 parent 98e00dd commit c560c66
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -705,6 +707,7 @@
'TrackedResource',
'TransparentDataEncryption',
'TransparentDataEncryptionActivity',
'UnlinkParameters',
'Usage',
'VirtualCluster',
'VirtualClusterUpdate',
Expand Down
17 changes: 17 additions & 0 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9609,6 +9609,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.
Expand Down
17 changes: 17 additions & 0 deletions sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -9609,6 +9609,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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<None> if raw==True
:rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
:raises: :class:`CloudError<msrestazure.azure_exceptions.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.
Expand Down

0 comments on commit c560c66

Please sign in to comment.