public async virtual Task <Response <VirtualNetworkGatewayConnection> > GetAsync(string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("VirtualNetworkGatewayConnectionCollection.Get"); scope.Start(); try { if (virtualNetworkGatewayConnectionName == null) { throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); } var response = await _restClient.GetAsync(Id.ResourceGroupName, virtualNetworkGatewayConnectionName, cancellationToken : cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new VirtualNetworkGatewayConnection(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <VirtualNetworkGatewayConnectionResource> > GetAsync(string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(virtualNetworkGatewayConnectionName, nameof(virtualNetworkGatewayConnectionName)); using var scope = _virtualNetworkGatewayConnectionClientDiagnostics.CreateScope("VirtualNetworkGatewayConnectionCollection.Get"); scope.Start(); try { var response = await _virtualNetworkGatewayConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkGatewayConnectionName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new VirtualNetworkGatewayConnectionResource(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <VirtualNetworkGatewayConnection> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _virtualNetworkGatewayConnectionClientDiagnostics.CreateScope("VirtualNetworkGatewayConnection.Get"); scope.Start(); try { var response = await _virtualNetworkGatewayConnectionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _virtualNetworkGatewayConnectionClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new VirtualNetworkGatewayConnection(ArmClient, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }