Exemple #1
0
 public virtual Response <ApplicationGateway> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _applicationGatewayClientDiagnostics.CreateScope("ApplicationGateway.Get");
     scope.Start();
     try
     {
         var response = _applicationGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new ApplicationGateway(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Exemple #2
0
        public virtual Response <ApplicationGatewayResource> Get(string applicationGatewayName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(applicationGatewayName, nameof(applicationGatewayName));

            using var scope = _applicationGatewayClientDiagnostics.CreateScope("ApplicationGatewayCollection.Get");
            scope.Start();
            try
            {
                var response = _applicationGatewayRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, applicationGatewayName, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new ApplicationGatewayResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemple #3
0
        public virtual Response <ApplicationGateway> Get(string applicationGatewayName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("ApplicationGatewayContainer.Get");
            scope.Start();
            try
            {
                if (applicationGatewayName == null)
                {
                    throw new ArgumentNullException(nameof(applicationGatewayName));
                }

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