public async virtual Task <Response <ExpressRouteLink> > GetAsync(string linkName, CancellationToken cancellationToken = default) { if (linkName == null) { throw new ArgumentNullException(nameof(linkName)); } using var scope = _clientDiagnostics.CreateScope("ExpressRouteLinkCollection.Get"); scope.Start(); try { var response = await _expressRouteLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new ExpressRouteLink(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <ExpressRouteLinkResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _expressRouteLinkClientDiagnostics.CreateScope("ExpressRouteLinkResource.Get"); scope.Start(); try { var response = await _expressRouteLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ExpressRouteLinkResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }