| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Threading; |
| | 10 | | using System.Threading.Tasks; |
| | 11 | | using Azure; |
| | 12 | | using Azure.Core; |
| | 13 | | using Azure.Core.Pipeline; |
| | 14 | | using Azure.ResourceManager.Storage.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Storage |
| | 17 | | { |
| | 18 | | /// <summary> The service client. </summary> |
| | 19 | | public partial class Operations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal RestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of Operations for mocking. </summary> |
| 0 | 25 | | protected Operations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of Operations. </summary> |
| | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 31 | | /// <param name="endpoint"> server parameter. </param> |
| | 32 | | /// <param name="apiVersion"> Api Version. </param> |
| 0 | 33 | | internal Operations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null, string apiV |
| | 34 | | { |
| 0 | 35 | | RestClient = new RestOperations(clientDiagnostics, pipeline, endpoint, apiVersion); |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Lists all of the available Storage Rest API operations. </summary> |
| | 41 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 42 | | public virtual AsyncPageable<Operation> ListAsync(CancellationToken cancellationToken = default) |
| | 43 | | { |
| | 44 | | async Task<Page<Operation>> FirstPageFunc(int? pageSizeHint) |
| | 45 | | { |
| 0 | 46 | | using var scope = _clientDiagnostics.CreateScope("Operations.List"); |
| 0 | 47 | | scope.Start(); |
| | 48 | | try |
| | 49 | | { |
| 0 | 50 | | var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); |
| 0 | 51 | | return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 0 | 58 | | } |
| 0 | 59 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); |
| | 60 | | } |
| | 61 | |
|
| | 62 | | /// <summary> Lists all of the available Storage Rest API operations. </summary> |
| | 63 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 64 | | public virtual Pageable<Operation> List(CancellationToken cancellationToken = default) |
| | 65 | | { |
| | 66 | | Page<Operation> FirstPageFunc(int? pageSizeHint) |
| | 67 | | { |
| 0 | 68 | | using var scope = _clientDiagnostics.CreateScope("Operations.List"); |
| 0 | 69 | | scope.Start(); |
| | 70 | | try |
| | 71 | | { |
| 0 | 72 | | var response = RestClient.List(cancellationToken); |
| 0 | 73 | | return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); |
| | 74 | | } |
| 0 | 75 | | catch (Exception e) |
| | 76 | | { |
| 0 | 77 | | scope.Failed(e); |
| 0 | 78 | | throw; |
| | 79 | | } |
| 0 | 80 | | } |
| 0 | 81 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, null); |
| | 82 | | } |
| | 83 | | } |
| | 84 | | } |