public async virtual Task <Response <ReplicationLink> > GetAsync(string linkId, CancellationToken cancellationToken = default) { if (linkId == null) { throw new ArgumentNullException(nameof(linkId)); } using var scope = _clientDiagnostics.CreateScope("ReplicationLinkCollection.Get"); scope.Start(); try { var response = await _replicationLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, linkId, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new ReplicationLink(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <ReplicationLinkResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _replicationLinkClientDiagnostics.CreateScope("ReplicationLinkResource.Get"); scope.Start(); try { var response = await _replicationLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ReplicationLinkResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }