public virtual ServerCommunicationLinkDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _serverCommunicationLinkClientDiagnostics.CreateScope("ServerCommunicationLink.Delete"); scope.Start(); try { var response = _serverCommunicationLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); var operation = new ServerCommunicationLinkDeleteOperation(response); if (waitForCompletion) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ServerCommunicationLinkDeleteOperation> DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ServerCommunicationLink.Delete"); scope.Start(); try { var response = await _serverCommunicationLinksRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); var operation = new ServerCommunicationLinkDeleteOperation(response); if (waitForCompletion) { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }