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