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