コード例 #1
0
        public async virtual Task <Response <DscpConfiguration> > GetAsync(string dscpConfigurationName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("DscpConfigurationContainer.Get");
            scope.Start();
            try
            {
                if (dscpConfigurationName == null)
                {
                    throw new ArgumentNullException(nameof(dscpConfigurationName));
                }

                var response = await _restClient.GetAsync(Id.ResourceGroupName, dscpConfigurationName, cancellationToken : cancellationToken).ConfigureAwait(false);

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

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new DscpConfiguration(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
コード例 #3
0
        public async virtual Task <Response <DscpConfiguration> > GetAsync(string dscpConfigurationName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(dscpConfigurationName, nameof(dscpConfigurationName));

            using var scope = _dscpConfigurationClientDiagnostics.CreateScope("DscpConfigurationCollection.Get");
            scope.Start();
            try
            {
                var response = await _dscpConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dscpConfigurationName, cancellationToken).ConfigureAwait(false);

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