| | 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.AppConfiguration.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.AppConfiguration |
| | 17 | | { |
| | 18 | | /// <summary> The service client. </summary> |
| | 19 | | public partial class Operations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 8 | 23 | | internal RestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of Operations for mocking. </summary> |
| 8 | 25 | | protected Operations() |
| | 26 | | { |
| 8 | 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="subscriptionId"> The Microsoft Azure subscription ID. </param> |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| | 33 | | /// <param name="apiVersion"> Api Version. </param> |
| 8 | 34 | | internal Operations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpo |
| | 35 | | { |
| 8 | 36 | | RestClient = new RestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); |
| 8 | 37 | | _clientDiagnostics = clientDiagnostics; |
| 8 | 38 | | _pipeline = pipeline; |
| 8 | 39 | | } |
| | 40 | |
|
| | 41 | | /// <summary> Checks whether the configuration store name is available for use. </summary> |
| | 42 | | /// <param name="checkNameAvailabilityParameters"> The object containing information for the availability reques |
| | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 44 | | public virtual async Task<Response<NameAvailabilityStatus>> CheckNameAvailabilityAsync(CheckNameAvailabilityPara |
| | 45 | | { |
| 2 | 46 | | using var scope = _clientDiagnostics.CreateScope("Operations.CheckNameAvailability"); |
| 2 | 47 | | scope.Start(); |
| | 48 | | try |
| | 49 | | { |
| 2 | 50 | | return await RestClient.CheckNameAvailabilityAsync(checkNameAvailabilityParameters, cancellationToken).C |
| | 51 | | } |
| 0 | 52 | | catch (Exception e) |
| | 53 | | { |
| 0 | 54 | | scope.Failed(e); |
| 0 | 55 | | throw; |
| | 56 | | } |
| 2 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> Checks whether the configuration store name is available for use. </summary> |
| | 60 | | /// <param name="checkNameAvailabilityParameters"> The object containing information for the availability reques |
| | 61 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 62 | | public virtual Response<NameAvailabilityStatus> CheckNameAvailability(CheckNameAvailabilityParameters checkNameA |
| | 63 | | { |
| 2 | 64 | | using var scope = _clientDiagnostics.CreateScope("Operations.CheckNameAvailability"); |
| 2 | 65 | | scope.Start(); |
| | 66 | | try |
| | 67 | | { |
| 2 | 68 | | return RestClient.CheckNameAvailability(checkNameAvailabilityParameters, cancellationToken); |
| | 69 | | } |
| 0 | 70 | | catch (Exception e) |
| | 71 | | { |
| 0 | 72 | | scope.Failed(e); |
| 0 | 73 | | throw; |
| | 74 | | } |
| 2 | 75 | | } |
| | 76 | |
|
| | 77 | | /// <summary> Lists the operations available from this provider. </summary> |
| | 78 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 79 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 80 | | public virtual AsyncPageable<OperationDefinition> ListAsync(string skipToken = null, CancellationToken cancellat |
| | 81 | | { |
| | 82 | | async Task<Page<OperationDefinition>> FirstPageFunc(int? pageSizeHint) |
| | 83 | | { |
| 2 | 84 | | using var scope = _clientDiagnostics.CreateScope("Operations.List"); |
| 2 | 85 | | scope.Start(); |
| | 86 | | try |
| | 87 | | { |
| 2 | 88 | | var response = await RestClient.ListAsync(skipToken, cancellationToken).ConfigureAwait(false); |
| 2 | 89 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 90 | | } |
| 0 | 91 | | catch (Exception e) |
| | 92 | | { |
| 0 | 93 | | scope.Failed(e); |
| 0 | 94 | | throw; |
| | 95 | | } |
| 2 | 96 | | } |
| | 97 | | async Task<Page<OperationDefinition>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 98 | | { |
| 0 | 99 | | using var scope = _clientDiagnostics.CreateScope("Operations.List"); |
| 0 | 100 | | scope.Start(); |
| | 101 | | try |
| | 102 | | { |
| 0 | 103 | | var response = await RestClient.ListNextPageAsync(nextLink, skipToken, cancellationToken).ConfigureA |
| 0 | 104 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 105 | | } |
| 0 | 106 | | catch (Exception e) |
| | 107 | | { |
| 0 | 108 | | scope.Failed(e); |
| 0 | 109 | | throw; |
| | 110 | | } |
| 0 | 111 | | } |
| 2 | 112 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 113 | | } |
| | 114 | |
|
| | 115 | | /// <summary> Lists the operations available from this provider. </summary> |
| | 116 | | /// <param name="skipToken"> A skip token is used to continue retrieving items after an operation returns a part |
| | 117 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 118 | | public virtual Pageable<OperationDefinition> List(string skipToken = null, CancellationToken cancellationToken = |
| | 119 | | { |
| | 120 | | Page<OperationDefinition> FirstPageFunc(int? pageSizeHint) |
| | 121 | | { |
| 2 | 122 | | using var scope = _clientDiagnostics.CreateScope("Operations.List"); |
| 2 | 123 | | scope.Start(); |
| | 124 | | try |
| | 125 | | { |
| 2 | 126 | | var response = RestClient.List(skipToken, cancellationToken); |
| 2 | 127 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 128 | | } |
| 0 | 129 | | catch (Exception e) |
| | 130 | | { |
| 0 | 131 | | scope.Failed(e); |
| 0 | 132 | | throw; |
| | 133 | | } |
| 2 | 134 | | } |
| | 135 | | Page<OperationDefinition> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 136 | | { |
| 0 | 137 | | using var scope = _clientDiagnostics.CreateScope("Operations.List"); |
| 0 | 138 | | scope.Start(); |
| | 139 | | try |
| | 140 | | { |
| 0 | 141 | | var response = RestClient.ListNextPage(nextLink, skipToken, cancellationToken); |
| 0 | 142 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 143 | | } |
| 0 | 144 | | catch (Exception e) |
| | 145 | | { |
| 0 | 146 | | scope.Failed(e); |
| 0 | 147 | | throw; |
| | 148 | | } |
| 0 | 149 | | } |
| 2 | 150 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 151 | | } |
| | 152 | | } |
| | 153 | | } |