| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | #pragma warning disable SA1402 // File may only contain a single type |
| | 5 | |
|
| | 6 | | using System.Threading; |
| | 7 | | using System.Threading.Tasks; |
| | 8 | |
|
| | 9 | | namespace Azure.Storage.Blobs.Models |
| | 10 | | { |
| | 11 | | internal class FilterBlobsAsyncCollection : StorageCollectionEnumerator<TaggedBlobItem> |
| | 12 | | { |
| | 13 | | private readonly BlobServiceClient _client; |
| | 14 | | private readonly string _expression; |
| | 15 | |
|
| 16 | 16 | | public FilterBlobsAsyncCollection( |
| 16 | 17 | | BlobServiceClient client, |
| 16 | 18 | | string expression) |
| | 19 | | { |
| 16 | 20 | | _client = client; |
| 16 | 21 | | _expression = expression; |
| 16 | 22 | | } |
| | 23 | |
|
| | 24 | | public override async ValueTask<Page<TaggedBlobItem>> GetNextPageAsync( |
| | 25 | | string continuationToken, |
| | 26 | | int? pageSizeHint, |
| | 27 | | bool async, |
| | 28 | | CancellationToken cancellationToken) |
| | 29 | | { |
| 16 | 30 | | Response<FilterBlobSegment> response = await _client.FindBlobsByTagsInternal( |
| 16 | 31 | | marker: continuationToken, |
| 16 | 32 | | expression: _expression, |
| 16 | 33 | | pageSizeHint: pageSizeHint, |
| 16 | 34 | | async: async, |
| 16 | 35 | | cancellationToken: cancellationToken) |
| 16 | 36 | | .ConfigureAwait(false); |
| | 37 | |
|
| 12 | 38 | | return Page<TaggedBlobItem>.FromValues( |
| 12 | 39 | | response.Value.Blobs.ToBlobTagItems(), |
| 12 | 40 | | response.Value.NextMarker, |
| 12 | 41 | | response.GetRawResponse()); |
| 12 | 42 | | } |
| | 43 | | } |
| | 44 | | } |