Exemplo n.º 1
0
        public virtual Response <SubnetResource> Get(string subnetName, string expand = null, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subnetName, nameof(subnetName));

            using var scope = _subnetClientDiagnostics.CreateScope("SubnetCollection.Get");
            scope.Start();
            try
            {
                var response = _subnetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, subnetName, expand, cancellationToken);
                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new SubnetResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
        public virtual Response <Subnet> Get(string subnetName, string expand = null, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("SubnetCollection.Get");
            scope.Start();
            try
            {
                if (subnetName == null)
                {
                    throw new ArgumentNullException(nameof(subnetName));
                }

                var response = _restClient.Get(Id.ResourceGroupName, Id.Name, subnetName, expand, cancellationToken: cancellationToken);
                if (response.Value == null)
                {
                    throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new Subnet(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Exemplo n.º 3
0
 public virtual Response <Subnet> Get(string expand = null, CancellationToken cancellationToken = default)
 {
     using var scope = _subnetClientDiagnostics.CreateScope("Subnet.Get");
     scope.Start();
     try
     {
         var response = _subnetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken);
         if (response.Value == null)
         {
             throw _subnetClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new Subnet(ArmClient, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }