public virtual Response <VpnSite> Get(CancellationToken cancellationToken = default) { using var scope = _vpnSiteClientDiagnostics.CreateScope("VpnSite.Get"); scope.Start(); try { var response = _vpnSiteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) { throw _vpnSiteClientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VpnSite(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VpnSite> Get(string vpnSiteName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(vpnSiteName, nameof(vpnSiteName)); using var scope = _vpnSiteClientDiagnostics.CreateScope("VpnSiteCollection.Get"); scope.Start(); try { var response = _vpnSiteRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vpnSiteName, cancellationToken); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VpnSite(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <VpnSite> Get(string vpnSiteName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("VpnSiteCollection.Get"); scope.Start(); try { if (vpnSiteName == null) { throw new ArgumentNullException(nameof(vpnSiteName)); } var response = _restClient.Get(Id.ResourceGroupName, vpnSiteName, cancellationToken: cancellationToken); if (response.Value == null) { throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VpnSite(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }