| | 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.Resources.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Resources |
| | 17 | | { |
| | 18 | | /// <summary> The Service service client. </summary> |
| | 19 | | public partial class ServiceOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal ServiceRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of ServiceOperations for mocking. </summary> |
| 0 | 25 | | protected ServiceOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of ServiceOperations. </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> |
| 0 | 32 | | internal ServiceOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null) |
| | 33 | | { |
| 0 | 34 | | RestClient = new ServiceRestOperations(clientDiagnostics, pipeline, endpoint); |
| 0 | 35 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 36 | | _pipeline = pipeline; |
| 0 | 37 | | } |
| | 38 | |
|
| | 39 | | /// <summary> Lists all of the available Microsoft.Features REST API operations. </summary> |
| | 40 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 41 | | public virtual AsyncPageable<OperationAutoGenerated> ListOperationsAsync(CancellationToken cancellationToken = d |
| | 42 | | { |
| | 43 | | async Task<Page<OperationAutoGenerated>> FirstPageFunc(int? pageSizeHint) |
| | 44 | | { |
| 0 | 45 | | using var scope = _clientDiagnostics.CreateScope("ServiceOperations.ListOperations"); |
| 0 | 46 | | scope.Start(); |
| | 47 | | try |
| | 48 | | { |
| 0 | 49 | | var response = await RestClient.ListOperationsAsync(cancellationToken).ConfigureAwait(false); |
| 0 | 50 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 51 | | } |
| 0 | 52 | | catch (Exception e) |
| | 53 | | { |
| 0 | 54 | | scope.Failed(e); |
| 0 | 55 | | throw; |
| | 56 | | } |
| 0 | 57 | | } |
| | 58 | | async Task<Page<OperationAutoGenerated>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 59 | | { |
| 0 | 60 | | using var scope = _clientDiagnostics.CreateScope("ServiceOperations.ListOperations"); |
| 0 | 61 | | scope.Start(); |
| | 62 | | try |
| | 63 | | { |
| 0 | 64 | | var response = await RestClient.ListOperationsNextPageAsync(nextLink, cancellationToken).ConfigureAw |
| 0 | 65 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 66 | | } |
| 0 | 67 | | catch (Exception e) |
| | 68 | | { |
| 0 | 69 | | scope.Failed(e); |
| 0 | 70 | | throw; |
| | 71 | | } |
| 0 | 72 | | } |
| 0 | 73 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 74 | | } |
| | 75 | |
|
| | 76 | | /// <summary> Lists all of the available Microsoft.Features REST API operations. </summary> |
| | 77 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 78 | | public virtual Pageable<OperationAutoGenerated> ListOperations(CancellationToken cancellationToken = default) |
| | 79 | | { |
| | 80 | | Page<OperationAutoGenerated> FirstPageFunc(int? pageSizeHint) |
| | 81 | | { |
| 0 | 82 | | using var scope = _clientDiagnostics.CreateScope("ServiceOperations.ListOperations"); |
| 0 | 83 | | scope.Start(); |
| | 84 | | try |
| | 85 | | { |
| 0 | 86 | | var response = RestClient.ListOperations(cancellationToken); |
| 0 | 87 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 88 | | } |
| 0 | 89 | | catch (Exception e) |
| | 90 | | { |
| 0 | 91 | | scope.Failed(e); |
| 0 | 92 | | throw; |
| | 93 | | } |
| 0 | 94 | | } |
| | 95 | | Page<OperationAutoGenerated> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 96 | | { |
| 0 | 97 | | using var scope = _clientDiagnostics.CreateScope("ServiceOperations.ListOperations"); |
| 0 | 98 | | scope.Start(); |
| | 99 | | try |
| | 100 | | { |
| 0 | 101 | | var response = RestClient.ListOperationsNextPage(nextLink, cancellationToken); |
| 0 | 102 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 103 | | } |
| 0 | 104 | | catch (Exception e) |
| | 105 | | { |
| 0 | 106 | | scope.Failed(e); |
| 0 | 107 | | throw; |
| | 108 | | } |
| 0 | 109 | | } |
| 0 | 110 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 111 | | } |
| | 112 | | } |
| | 113 | | } |