| | 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 Skus service client. </summary> |
| | 19 | | public partial class SkusOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 4 | 23 | | internal SkusRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of SkusOperations for mocking. </summary> |
| 240 | 25 | | protected SkusOperations() |
| | 26 | | { |
| 240 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of SkusOperations. </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="subscriptionId"> The ID of the target subscription. </param> |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| | 33 | | /// <param name="apiVersion"> Api Version. </param> |
| 240 | 34 | | internal SkusOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri e |
| | 35 | | { |
| 240 | 36 | | RestClient = new SkusRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); |
| 240 | 37 | | _clientDiagnostics = clientDiagnostics; |
| 240 | 38 | | _pipeline = pipeline; |
| 240 | 39 | | } |
| | 40 | |
|
| | 41 | | /// <summary> Lists the available SKUs supported by Microsoft.Storage for given subscription. </summary> |
| | 42 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 43 | | public virtual AsyncPageable<SkuInformation> ListAsync(CancellationToken cancellationToken = default) |
| | 44 | | { |
| | 45 | | async Task<Page<SkuInformation>> FirstPageFunc(int? pageSizeHint) |
| | 46 | | { |
| 2 | 47 | | using var scope = _clientDiagnostics.CreateScope("SkusOperations.List"); |
| 2 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 2 | 51 | | var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); |
| 2 | 52 | | return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); |
| | 53 | | } |
| 0 | 54 | | catch (Exception e) |
| | 55 | | { |
| 0 | 56 | | scope.Failed(e); |
| 0 | 57 | | throw; |
| | 58 | | } |
| 2 | 59 | | } |
| 2 | 60 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); |
| | 61 | | } |
| | 62 | |
|
| | 63 | | /// <summary> Lists the available SKUs supported by Microsoft.Storage for given subscription. </summary> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Pageable<SkuInformation> List(CancellationToken cancellationToken = default) |
| | 66 | | { |
| | 67 | | Page<SkuInformation> FirstPageFunc(int? pageSizeHint) |
| | 68 | | { |
| 2 | 69 | | using var scope = _clientDiagnostics.CreateScope("SkusOperations.List"); |
| 2 | 70 | | scope.Start(); |
| | 71 | | try |
| | 72 | | { |
| 2 | 73 | | var response = RestClient.List(cancellationToken); |
| 2 | 74 | | return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); |
| | 75 | | } |
| 0 | 76 | | catch (Exception e) |
| | 77 | | { |
| 0 | 78 | | scope.Failed(e); |
| 0 | 79 | | throw; |
| | 80 | | } |
| 2 | 81 | | } |
| 2 | 82 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, null); |
| | 83 | | } |
| | 84 | | } |
| | 85 | | } |