Beispiel #1
0
        public virtual Response <HubRouteTable> Get(string routeTableName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(routeTableName, nameof(routeTableName));

            using var scope = _hubRouteTableClientDiagnostics.CreateScope("HubRouteTableCollection.Get");
            scope.Start();
            try
            {
                var response = _hubRouteTableRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, routeTableName, cancellationToken);
                if (response.Value == null)
                {
                    throw _hubRouteTableClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new HubRouteTable(ArmClient, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Beispiel #2
0
        public virtual Response <HubRouteTable> Get(string routeTableName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("HubRouteTableContainer.Get");
            scope.Start();
            try
            {
                if (routeTableName == null)
                {
                    throw new ArgumentNullException(nameof(routeTableName));
                }

                var response = _restClient.Get(Id.ResourceGroupName, Id.Name, routeTableName, cancellationToken: cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new HubRouteTable(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
 public virtual Response <HubRouteTableResource> Get(CancellationToken cancellationToken = default)
 {
     using var scope = _hubRouteTableClientDiagnostics.CreateScope("HubRouteTableResource.Get");
     scope.Start();
     try
     {
         var response = _hubRouteTableRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new HubRouteTableResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }