public virtual ResourceLinkDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _resourceLinkClientDiagnostics.CreateScope("ResourceLink.Delete"); scope.Start(); try { var response = _resourceLinkRestClient.Delete(Id, cancellationToken); var operation = new ResourceLinkDeleteOperation(response); if (waitForCompletion) { operation.WaitForCompletionResponse(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ResourceLinkDeleteOperation> DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _resourceLinkClientDiagnostics.CreateScope("ResourceLink.Delete"); scope.Start(); try { var response = await _resourceLinkRestClient.DeleteAsync(Id, cancellationToken).ConfigureAwait(false); var operation = new ResourceLinkDeleteOperation(response); if (waitForCompletion) { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }