コード例 #1
0
        public async virtual Task <Response <StorageQueue> > GetAsync(string queueName, CancellationToken cancellationToken = default)
        {
            if (queueName == null)
            {
                throw new ArgumentNullException(nameof(queueName));
            }

            using var scope = _clientDiagnostics.CreateScope("StorageQueueCollection.Get");
            scope.Start();
            try
            {
                var response = await _queueRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, queueName, cancellationToken).ConfigureAwait(false);

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

                if (response.Value == null)
                {
                    throw new RequestFailedException(response.GetRawResponse());
                }
                return(Response.FromValue(new StorageQueueResource(Client, response.Value), response.GetRawResponse()));
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }