public async virtual Task <Response <BlobContainer> > GetAsync(string containerName, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("BlobContainerContainer.Get"); scope.Start(); try { if (containerName == null) { throw new ArgumentNullException(nameof(containerName)); } var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, containerName, cancellationToken : cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new BlobContainer(Parent, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <Response <BlobContainer> > GetAsync(string containerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(containerName, nameof(containerName)); using var scope = _blobContainerClientDiagnostics.CreateScope("BlobContainerCollection.Get"); scope.Start(); try { var response = await _blobContainerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, containerName, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw new RequestFailedException(response.GetRawResponse()); } return(Response.FromValue(new BlobContainer(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <Response <BlobContainer> > GetAsync(CancellationToken cancellationToken = default) { using var scope = _blobContainerClientDiagnostics.CreateScope("BlobContainer.Get"); scope.Start(); try { var response = await _blobContainerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) { throw await _blobContainerClientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); } return(Response.FromValue(new BlobContainer(Client, response.Value), response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } }