| | 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.Network.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Network |
| | 17 | | { |
| | 18 | | /// <summary> The AvailableServiceAliases service client. </summary> |
| | 19 | | public partial class AvailableServiceAliasesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal AvailableServiceAliasesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of AvailableServiceAliasesOperations for mocking. </summary> |
| 0 | 25 | | protected AvailableServiceAliasesOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of AvailableServiceAliasesOperations. </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 subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| 0 | 33 | | internal AvailableServiceAliasesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string su |
| | 34 | | { |
| 0 | 35 | | RestClient = new AvailableServiceAliasesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets all available service aliases for this subscription in this region. </summary> |
| | 41 | | /// <param name="location"> The location. </param> |
| | 42 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 43 | | public virtual AsyncPageable<AvailableServiceAlias> ListAsync(string location, CancellationToken cancellationTok |
| | 44 | | { |
| 0 | 45 | | if (location == null) |
| | 46 | | { |
| 0 | 47 | | throw new ArgumentNullException(nameof(location)); |
| | 48 | | } |
| | 49 | |
|
| | 50 | | async Task<Page<AvailableServiceAlias>> FirstPageFunc(int? pageSizeHint) |
| | 51 | | { |
| 0 | 52 | | using var scope = _clientDiagnostics.CreateScope("AvailableServiceAliasesOperations.List"); |
| 0 | 53 | | scope.Start(); |
| | 54 | | try |
| | 55 | | { |
| 0 | 56 | | var response = await RestClient.ListAsync(location, cancellationToken).ConfigureAwait(false); |
| 0 | 57 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 58 | | } |
| 0 | 59 | | catch (Exception e) |
| | 60 | | { |
| 0 | 61 | | scope.Failed(e); |
| 0 | 62 | | throw; |
| | 63 | | } |
| 0 | 64 | | } |
| | 65 | | async Task<Page<AvailableServiceAlias>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 66 | | { |
| 0 | 67 | | using var scope = _clientDiagnostics.CreateScope("AvailableServiceAliasesOperations.List"); |
| 0 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 0 | 71 | | var response = await RestClient.ListNextPageAsync(nextLink, location, cancellationToken).ConfigureAw |
| 0 | 72 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 73 | | } |
| 0 | 74 | | catch (Exception e) |
| | 75 | | { |
| 0 | 76 | | scope.Failed(e); |
| 0 | 77 | | throw; |
| | 78 | | } |
| 0 | 79 | | } |
| 0 | 80 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 81 | | } |
| | 82 | |
|
| | 83 | | /// <summary> Gets all available service aliases for this subscription in this region. </summary> |
| | 84 | | /// <param name="location"> The location. </param> |
| | 85 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 86 | | public virtual Pageable<AvailableServiceAlias> List(string location, CancellationToken cancellationToken = defau |
| | 87 | | { |
| 0 | 88 | | if (location == null) |
| | 89 | | { |
| 0 | 90 | | throw new ArgumentNullException(nameof(location)); |
| | 91 | | } |
| | 92 | |
|
| | 93 | | Page<AvailableServiceAlias> FirstPageFunc(int? pageSizeHint) |
| | 94 | | { |
| 0 | 95 | | using var scope = _clientDiagnostics.CreateScope("AvailableServiceAliasesOperations.List"); |
| 0 | 96 | | scope.Start(); |
| | 97 | | try |
| | 98 | | { |
| 0 | 99 | | var response = RestClient.List(location, cancellationToken); |
| 0 | 100 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 101 | | } |
| 0 | 102 | | catch (Exception e) |
| | 103 | | { |
| 0 | 104 | | scope.Failed(e); |
| 0 | 105 | | throw; |
| | 106 | | } |
| 0 | 107 | | } |
| | 108 | | Page<AvailableServiceAlias> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 109 | | { |
| 0 | 110 | | using var scope = _clientDiagnostics.CreateScope("AvailableServiceAliasesOperations.List"); |
| 0 | 111 | | scope.Start(); |
| | 112 | | try |
| | 113 | | { |
| 0 | 114 | | var response = RestClient.ListNextPage(nextLink, location, cancellationToken); |
| 0 | 115 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 116 | | } |
| 0 | 117 | | catch (Exception e) |
| | 118 | | { |
| 0 | 119 | | scope.Failed(e); |
| 0 | 120 | | throw; |
| | 121 | | } |
| 0 | 122 | | } |
| 0 | 123 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 124 | | } |
| | 125 | |
|
| | 126 | | /// <summary> Gets all available service aliases for this resource group in this region. </summary> |
| | 127 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 128 | | /// <param name="location"> The location. </param> |
| | 129 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 130 | | public virtual AsyncPageable<AvailableServiceAlias> ListByResourceGroupAsync(string resourceGroupName, string lo |
| | 131 | | { |
| 0 | 132 | | if (resourceGroupName == null) |
| | 133 | | { |
| 0 | 134 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 135 | | } |
| 0 | 136 | | if (location == null) |
| | 137 | | { |
| 0 | 138 | | throw new ArgumentNullException(nameof(location)); |
| | 139 | | } |
| | 140 | |
|
| | 141 | | async Task<Page<AvailableServiceAlias>> FirstPageFunc(int? pageSizeHint) |
| | 142 | | { |
| 0 | 143 | | using var scope = _clientDiagnostics.CreateScope("AvailableServiceAliasesOperations.ListByResourceGroup" |
| 0 | 144 | | scope.Start(); |
| | 145 | | try |
| | 146 | | { |
| 0 | 147 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, location, cancellationTo |
| 0 | 148 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 149 | | } |
| 0 | 150 | | catch (Exception e) |
| | 151 | | { |
| 0 | 152 | | scope.Failed(e); |
| 0 | 153 | | throw; |
| | 154 | | } |
| 0 | 155 | | } |
| | 156 | | async Task<Page<AvailableServiceAlias>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 157 | | { |
| 0 | 158 | | using var scope = _clientDiagnostics.CreateScope("AvailableServiceAliasesOperations.ListByResourceGroup" |
| 0 | 159 | | scope.Start(); |
| | 160 | | try |
| | 161 | | { |
| 0 | 162 | | var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, locati |
| 0 | 163 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 164 | | } |
| 0 | 165 | | catch (Exception e) |
| | 166 | | { |
| 0 | 167 | | scope.Failed(e); |
| 0 | 168 | | throw; |
| | 169 | | } |
| 0 | 170 | | } |
| 0 | 171 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 172 | | } |
| | 173 | |
|
| | 174 | | /// <summary> Gets all available service aliases for this resource group in this region. </summary> |
| | 175 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 176 | | /// <param name="location"> The location. </param> |
| | 177 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 178 | | public virtual Pageable<AvailableServiceAlias> ListByResourceGroup(string resourceGroupName, string location, Ca |
| | 179 | | { |
| 0 | 180 | | if (resourceGroupName == null) |
| | 181 | | { |
| 0 | 182 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 183 | | } |
| 0 | 184 | | if (location == null) |
| | 185 | | { |
| 0 | 186 | | throw new ArgumentNullException(nameof(location)); |
| | 187 | | } |
| | 188 | |
|
| | 189 | | Page<AvailableServiceAlias> FirstPageFunc(int? pageSizeHint) |
| | 190 | | { |
| 0 | 191 | | using var scope = _clientDiagnostics.CreateScope("AvailableServiceAliasesOperations.ListByResourceGroup" |
| 0 | 192 | | scope.Start(); |
| | 193 | | try |
| | 194 | | { |
| 0 | 195 | | var response = RestClient.ListByResourceGroup(resourceGroupName, location, cancellationToken); |
| 0 | 196 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 197 | | } |
| 0 | 198 | | catch (Exception e) |
| | 199 | | { |
| 0 | 200 | | scope.Failed(e); |
| 0 | 201 | | throw; |
| | 202 | | } |
| 0 | 203 | | } |
| | 204 | | Page<AvailableServiceAlias> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 205 | | { |
| 0 | 206 | | using var scope = _clientDiagnostics.CreateScope("AvailableServiceAliasesOperations.ListByResourceGroup" |
| 0 | 207 | | scope.Start(); |
| | 208 | | try |
| | 209 | | { |
| 0 | 210 | | var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, location, cancell |
| 0 | 211 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 212 | | } |
| 0 | 213 | | catch (Exception e) |
| | 214 | | { |
| 0 | 215 | | scope.Failed(e); |
| 0 | 216 | | throw; |
| | 217 | | } |
| 0 | 218 | | } |
| 0 | 219 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 220 | | } |
| | 221 | | } |
| | 222 | | } |