示例#1
0
 /// <summary>
 /// The <see cref="GetBlobContainersInternal"/> operation returns a
 /// single segment of blob containers in the storage account, starting
 /// from the specified <paramref name="continuationToken"/>.  Use an empty
 /// <paramref name="continuationToken"/> to start enumeration from the beginning
 /// and the <see cref="BlobContainersSegment.NextMarker"/> if it's not
 /// empty to make subsequent calls to <see cref="GetBlobContainersAsync"/>
 /// to continue enumerating the containers segment by segment.
 /// Containers are ordered lexicographically by name.
 ///
 /// For more information, see <see href="https://docs.microsoft.com/rest/api/storageservices/list-containers2"/>.
 /// </summary>
 /// <param name="continuationToken">
 /// An optional string value that identifies the segment of the list
 /// of blob containers to be returned with the next listing operation.  The
 /// operation returns a non-empty <see cref="BlobContainersSegment.NextMarker"/>
 /// if the listing operation did not return all blob containers remaining
 /// to be listed with the current segment.  The NextMarker value can
 /// be used as the value for the <paramref name="continuationToken"/> parameter
 /// in a subsequent call to request the next segment of list items.
 /// </param>
 /// <param name="traits">
 /// Specifies trait options for shaping the blob containers.
 /// </param>
 /// <param name="prefix">
 /// Specifies a string that filters the results to return only containers
 /// whose name begins with the specified <paramref name="prefix"/>.
 /// </param>
 /// <param name="pageSizeHint">
 /// Gets or sets a value indicating the size of the page that should be
 /// requested.
 /// </param>
 /// <param name="async">
 /// Whether to invoke the operation asynchronously.
 /// </param>
 /// <param name="cancellationToken">
 /// Optional <see cref="CancellationToken"/> to propagate
 /// notifications that the operation should be cancelled.
 /// </param>
 /// <returns>
 /// A <see cref="Response{BlobContainersSegment}"/> describing a
 /// segment of the blob containers in the storage account.
 /// </returns>
 /// <remarks>
 /// A <see cref="StorageRequestFailedException"/> will be thrown if
 /// a failure occurs.
 /// </remarks>
 internal async Task <Response <BlobContainersSegment> > GetBlobContainersInternal(
     string continuationToken,
     BlobContainerTraits traits,
     string prefix,
     int?pageSizeHint,
     bool async,
     CancellationToken cancellationToken)
 {
     using (Pipeline.BeginLoggingScope(nameof(BlobServiceClient)))
     {
         Pipeline.LogMethodEnter(
             nameof(BlobServiceClient),
             message:
             $"{nameof(Uri)}: {Uri}\n" +
             $"{nameof(continuationToken)}: {continuationToken}\n" +
             $"{nameof(traits)}: {traits}");
         try
         {
             return(await BlobRestClient.Service.ListBlobContainersSegmentAsync(
                        Pipeline,
                        Uri,
                        marker : continuationToken,
                        prefix : prefix,
                        maxresults : pageSizeHint,
                        include : traits.AsIncludeType(),
                        async : async,
                        cancellationToken : cancellationToken)
                    .ConfigureAwait(false));
         }
         catch (Exception ex)
         {
             Pipeline.LogException(ex);
             throw;
         }
         finally
         {
             Pipeline.LogMethodExit(nameof(BlobServiceClient));
         }
     }
 }