public virtual Response <VirtualNetworkGatewayConnectionResource> Get(string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(virtualNetworkGatewayConnectionName, nameof(virtualNetworkGatewayConnectionName));

            using var scope = _virtualNetworkGatewayConnectionClientDiagnostics.CreateScope("VirtualNetworkGatewayConnectionCollection.Get");
            scope.Start();
            try
            {
                var response = _virtualNetworkGatewayConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, virtualNetworkGatewayConnectionName, cancellationToken);
                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;
            }
        }
示例#2
0
        public virtual Response <VirtualNetworkGatewayConnection> Get(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 = _restClient.Get(Id.ResourceGroupName, virtualNetworkGatewayConnectionName, cancellationToken: cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new VirtualNetworkGatewayConnection(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 public virtual Response <VirtualNetworkGatewayConnection> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _virtualNetworkGatewayConnectionClientDiagnostics.CreateScope("VirtualNetworkGatewayConnection.Get");
     scope.Start();
     try
     {
         var response = _virtualNetworkGatewayConnectionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw _virtualNetworkGatewayConnectionClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new VirtualNetworkGatewayConnection(ArmClient, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }