Example #1
0
        public virtual Response <GatewayResource> Get(string gatewayName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(gatewayName, nameof(gatewayName));

            using var scope = _gatewayResourceGatewaysClientDiagnostics.CreateScope("GatewayResourceCollection.Get");
            scope.Start();
            try
            {
                var response = _gatewayResourceGatewaysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayName, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new GatewayResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Example #2
0
 public virtual Response <GatewayResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _gatewayResourceGatewaysClientDiagnostics.CreateScope("GatewayResource.Get");
     scope.Start();
     try
     {
         var response = _gatewayResourceGatewaysRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new GatewayResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }