예제 #1
0
        public async virtual Task <Response <QueueService> > GetAsync(string queueServiceName, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("QueueServiceContainer.Get");
            scope.Start();
            try
            {
                if (queueServiceName == null)
                {
                    throw new ArgumentNullException(nameof(queueServiceName));
                }

                var response = await _restClient.GetServicePropertiesAsync(Id.ResourceGroupName, Id.Name, queueServiceName, cancellationToken : cancellationToken).ConfigureAwait(false);

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

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