public virtual Response <LocalNetworkGateway> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _localNetworkGatewayClientDiagnostics.CreateScope("LocalNetworkGateway.Get");
     scope.Start();
     try
     {
         var response = _localNetworkGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw _localNetworkGatewayClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new LocalNetworkGateway(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
示例#2
0
        public virtual Response <LocalNetworkGateway> Get(string localNetworkGatewayName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(localNetworkGatewayName, nameof(localNetworkGatewayName));

            using var scope = _localNetworkGatewayClientDiagnostics.CreateScope("LocalNetworkGatewayCollection.Get");
            scope.Start();
            try
            {
                var response = _localNetworkGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, localNetworkGatewayName, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new LocalNetworkGateway(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
示例#3
0
        public virtual Response <LocalNetworkGateway> Get(string localNetworkGatewayName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("LocalNetworkGatewayContainer.Get");
            scope.Start();
            try
            {
                if (localNetworkGatewayName == null)
                {
                    throw new ArgumentNullException(nameof(localNetworkGatewayName));
                }

                var response = _restClient.Get(Id.ResourceGroupName, localNetworkGatewayName, cancellationToken: cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new LocalNetworkGateway(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }