コード例 #1
0
 public virtual Response <CustomIPPrefixResource> Get(string expand = null, CancellationToken cancellationToken = default)
 {
     using var scope = _customIPPrefixClientDiagnostics.CreateScope("CustomIPPrefixResource.Get");
     scope.Start();
     try
     {
         var response = _customIPPrefixRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken);
         if (response.Value == null)
         {
             throw new RequestFailedException(response.GetRawResponse());
         }
         return(Response.FromValue(new CustomIPPrefixResource(Client, response.Value), response.GetRawResponse()));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
コード例 #2
0
        public virtual Response <CustomIpPrefix> Get(string customIpPrefixName, string expand = null, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(customIpPrefixName, nameof(customIpPrefixName));

            using var scope = _customIpPrefixCustomIPPrefixesClientDiagnostics.CreateScope("CustomIpPrefixCollection.Get");
            scope.Start();
            try
            {
                var response = _customIpPrefixCustomIPPrefixesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, customIpPrefixName, expand, cancellationToken);
                if (response.Value == null)
                {
                    throw _customIpPrefixCustomIPPrefixesClientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new CustomIpPrefix(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #3
0
        public virtual Response <CustomIpPrefix> Get(string customIpPrefixName, string expand = null, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("CustomIpPrefixContainer.Get");
            scope.Start();
            try
            {
                if (customIpPrefixName == null)
                {
                    throw new ArgumentNullException(nameof(customIpPrefixName));
                }

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