public virtual Response <VpnSiteLinkResource> Get(string vpnSiteLinkName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vpnSiteLinkName, nameof(vpnSiteLinkName)); using var scope = _vpnSiteLinkClientDiagnostics.CreateScope("VpnSiteLinkCollection.Get"); scope.Start(); try { var response = _vpnSiteLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vpnSiteLinkName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VpnSiteLinkResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VpnSiteLink> Get(CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("VpnSiteLink.Get"); scope.Start(); try { var response = _vpnSiteLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VpnSiteLink(this, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }