public virtual Response <ExpressRouteLink> Get(string linkName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(linkName, nameof(linkName)); using var scope = _expressRouteLinkClientDiagnostics.CreateScope("ExpressRouteLinkCollection.Get"); scope.Start(); try { var response = _expressRouteLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, linkName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new ExpressRouteLink(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <ExpressRouteLinkResource> Get(CancellationToken cancellationToken = default) { using var scope = _expressRouteLinkClientDiagnostics.CreateScope("ExpressRouteLinkResource.Get"); scope.Start(); try { var response = _expressRouteLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); 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; } }