| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Linq; |
| | 5 | | using System.Threading; |
| | 6 | | using System.Threading.Tasks; |
| | 7 | | using Azure.Core.Pipeline; |
| | 8 | |
|
| | 9 | | namespace Azure.Storage.Queues.Models |
| | 10 | | { |
| | 11 | | internal class GetQueuesAsyncCollection : StorageCollectionEnumerator<QueueItem> |
| | 12 | | { |
| | 13 | | private readonly QueueServiceClient _client; |
| | 14 | | private readonly QueueTraits _traits; |
| | 15 | | private readonly string _prefix; |
| | 16 | |
|
| 38 | 17 | | public GetQueuesAsyncCollection( |
| 38 | 18 | | QueueServiceClient client, |
| 38 | 19 | | QueueTraits traits, |
| 38 | 20 | | string prefix) |
| | 21 | | { |
| 38 | 22 | | _client = client; |
| 38 | 23 | | _traits = traits; |
| 38 | 24 | | _prefix = prefix; |
| 38 | 25 | | } |
| | 26 | |
|
| | 27 | | public override async ValueTask<Page<QueueItem>> GetNextPageAsync( |
| | 28 | | string continuationToken, |
| | 29 | | int? pageSizeHint, |
| | 30 | | bool async, |
| | 31 | | CancellationToken cancellationToken) |
| | 32 | | { |
| 38 | 33 | | Response<QueuesSegment> response = await _client.GetQueuesInternal( |
| 38 | 34 | | continuationToken, |
| 38 | 35 | | _traits, |
| 38 | 36 | | _prefix, |
| 38 | 37 | | pageSizeHint, |
| 38 | 38 | | async, |
| 38 | 39 | | cancellationToken).ConfigureAwait(false); |
| | 40 | |
|
| 36 | 41 | | return Page<QueueItem>.FromValues( |
| 36 | 42 | | response.Value.QueueItems.ToArray(), |
| 36 | 43 | | response.Value.NextMarker, |
| 36 | 44 | | response.GetRawResponse()); |
| 36 | 45 | | } |
| | 46 | | } |
| | 47 | | } |