コード例 #1
0
        public async virtual Task <Response <CustomIpPrefix> > GetAsync(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 = await _restClient.GetAsync(Id.ResourceGroupName, customIpPrefixName, expand, cancellationToken : cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new CustomIpPrefix(Parent, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #2
0
        public virtual async Task <Response <CustomIPPrefixResource> > GetAsync(string expand = null, CancellationToken cancellationToken = default)
        {
            using var scope = _customIPPrefixClientDiagnostics.CreateScope("CustomIPPrefixResource.Get");
            scope.Start();
            try
            {
                var response = await _customIPPrefixRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken).ConfigureAwait(false);

                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;
            }
        }
コード例 #3
0
        public async virtual Task <Response <CustomIpPrefix> > GetAsync(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 = await _customIpPrefixCustomIPPrefixesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, customIpPrefixName, expand, cancellationToken).ConfigureAwait(false);

                if (response.Value == null)
                {
                    throw await _customIpPrefixCustomIPPrefixesClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
                }
                return(Response.FromValue(new CustomIpPrefix(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }