@@ -354,6 +354,106 @@ def get_long_running_output(response):
354354 return LROPoller (self ._client , raw_result , get_long_running_output , polling_method )
355355 failover_allow_data_loss .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss' }
356356
357+
358+ def _unlink_initial (
359+ self , resource_group_name , server_name , database_name , link_id , forced_termination = None , custom_headers = None , raw = False , ** operation_config ):
360+ parameters = models .UnlinkParameters (forced_termination = forced_termination )
361+
362+ # Construct URL
363+ url = self .unlink .metadata ['url' ]
364+ path_format_arguments = {
365+ 'subscriptionId' : self ._serialize .url ("self.config.subscription_id" , self .config .subscription_id , 'str' ),
366+ 'resourceGroupName' : self ._serialize .url ("resource_group_name" , resource_group_name , 'str' ),
367+ 'serverName' : self ._serialize .url ("server_name" , server_name , 'str' ),
368+ 'databaseName' : self ._serialize .url ("database_name" , database_name , 'str' ),
369+ 'linkId' : self ._serialize .url ("link_id" , link_id , 'str' )
370+ }
371+ url = self ._client .format_url (url , ** path_format_arguments )
372+
373+ # Construct parameters
374+ query_parameters = {}
375+ query_parameters ['api-version' ] = self ._serialize .query ("self.api_version" , self .api_version , 'str' )
376+
377+ # Construct headers
378+ header_parameters = {}
379+ header_parameters ['Content-Type' ] = 'application/json; charset=utf-8'
380+ if self .config .generate_client_request_id :
381+ header_parameters ['x-ms-client-request-id' ] = str (uuid .uuid1 ())
382+ if custom_headers :
383+ header_parameters .update (custom_headers )
384+ if self .config .accept_language is not None :
385+ header_parameters ['accept-language' ] = self ._serialize .header ("self.config.accept_language" , self .config .accept_language , 'str' )
386+
387+ # Construct body
388+ body_content = self ._serialize .body (parameters , 'UnlinkParameters' )
389+
390+ # Construct and send request
391+ request = self ._client .post (url , query_parameters , header_parameters , body_content )
392+ response = self ._client .send (request , stream = False , ** operation_config )
393+
394+ if response .status_code not in [202 , 204 ]:
395+ exp = CloudError (response )
396+ exp .request_id = response .headers .get ('x-ms-request-id' )
397+ raise exp
398+
399+ if raw :
400+ client_raw_response = ClientRawResponse (None , response )
401+ return client_raw_response
402+
403+ def unlink (
404+ self , resource_group_name , server_name , database_name , link_id , forced_termination = None , custom_headers = None , raw = False , polling = True , ** operation_config ):
405+ """Deletes a database replication link in forced or friendly way.
406+
407+ :param resource_group_name: The name of the resource group that
408+ contains the resource. You can obtain this value from the Azure
409+ Resource Manager API or the portal.
410+ :type resource_group_name: str
411+ :param server_name: The name of the server.
412+ :type server_name: str
413+ :param database_name: The name of the database that has the
414+ replication link to be failed over.
415+ :type database_name: str
416+ :param link_id: The ID of the replication link to be failed over.
417+ :type link_id: str
418+ :param forced_termination: Determines whether link will be terminated
419+ in a forced or a friendly way.
420+ :type forced_termination: bool
421+ :param dict custom_headers: headers that will be added to the request
422+ :param bool raw: The poller return type is ClientRawResponse, the
423+ direct response alongside the deserialized response
424+ :param polling: True for ARMPolling, False for no polling, or a
425+ polling object for personal polling strategy
426+ :return: An instance of LROPoller that returns None or
427+ ClientRawResponse<None> if raw==True
428+ :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
429+ ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
430+ :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
431+ """
432+ raw_result = self ._unlink_initial (
433+ resource_group_name = resource_group_name ,
434+ server_name = server_name ,
435+ database_name = database_name ,
436+ link_id = link_id ,
437+ forced_termination = forced_termination ,
438+ custom_headers = custom_headers ,
439+ raw = True ,
440+ ** operation_config
441+ )
442+
443+ def get_long_running_output (response ):
444+ if raw :
445+ client_raw_response = ClientRawResponse (None , response )
446+ return client_raw_response
447+
448+ lro_delay = operation_config .get (
449+ 'long_running_operation_timeout' ,
450+ self .config .long_running_operation_timeout )
451+ if polling is True : polling_method = ARMPolling (lro_delay , ** operation_config )
452+ elif polling is False : polling_method = NoPolling ()
453+ else : polling_method = polling
454+ return LROPoller (self ._client , raw_result , get_long_running_output , polling_method )
455+ unlink .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink' }
456+
357457 def list_by_database (
358458 self , resource_group_name , server_name , database_name , custom_headers = None , raw = False , ** operation_config ):
359459 """Lists a database's replication links.
0 commit comments