public async virtual Task <Response <VpnServerConfiguration> > GetAsync(string vpnServerConfigurationName, CancellationToken cancellationToken = default) { if (vpnServerConfigurationName == null) { throw new ArgumentNullException(nameof(vpnServerConfigurationName)); } using var scope = _clientDiagnostics.CreateScope("VpnServerConfigurationCollection.Get"); scope.Start(); try { var response = await _vpnServerConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vpnServerConfigurationName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new VpnServerConfiguration(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <VpnServerConfigurationResource> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _vpnServerConfigurationClientDiagnostics.CreateScope("VpnServerConfigurationResource.Get"); scope.Start(); try { var response = await _vpnServerConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); 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; } }