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