| | 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.Text.Json; |
| | 10 | | using System.Threading; |
| | 11 | | using System.Threading.Tasks; |
| | 12 | | using Azure; |
| | 13 | | using Azure.Core; |
| | 14 | | using Azure.Core.Pipeline; |
| | 15 | | using Azure.ResourceManager.Network.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.Network |
| | 18 | | { |
| | 19 | | internal partial class AvailablePrivateEndpointTypesRestOperations |
| | 20 | | { |
| | 21 | | private string subscriptionId; |
| | 22 | | private Uri endpoint; |
| | 23 | | private ClientDiagnostics _clientDiagnostics; |
| | 24 | | private HttpPipeline _pipeline; |
| | 25 | |
|
| | 26 | | /// <summary> Initializes a new instance of AvailablePrivateEndpointTypesRestOperations. </summary> |
| | 27 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 28 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 29 | | /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 30 | | /// <param name="endpoint"> server parameter. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 0 | 32 | | public AvailablePrivateEndpointTypesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, s |
| | 33 | | { |
| 0 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 0 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 0 | 40 | | this.subscriptionId = subscriptionId; |
| 0 | 41 | | this.endpoint = endpoint; |
| 0 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 43 | | _pipeline = pipeline; |
| 0 | 44 | | } |
| | 45 | |
|
| | 46 | | internal HttpMessage CreateListRequest(string location) |
| | 47 | | { |
| 0 | 48 | | var message = _pipeline.CreateMessage(); |
| 0 | 49 | | var request = message.Request; |
| 0 | 50 | | request.Method = RequestMethod.Get; |
| 0 | 51 | | var uri = new RawRequestUriBuilder(); |
| 0 | 52 | | uri.Reset(endpoint); |
| 0 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 54 | | uri.AppendPath(subscriptionId, true); |
| 0 | 55 | | uri.AppendPath("/providers/Microsoft.Network/locations/", false); |
| 0 | 56 | | uri.AppendPath(location, true); |
| 0 | 57 | | uri.AppendPath("/availablePrivateEndpointTypes", false); |
| 0 | 58 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 59 | | request.Uri = uri; |
| 0 | 60 | | return message; |
| | 61 | | } |
| | 62 | |
|
| | 63 | | /// <summary> Returns all of the resource types that can be linked to a Private Endpoint in this subscription in |
| | 64 | | /// <param name="location"> The location of the domain name. </param> |
| | 65 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 66 | | public async Task<Response<AvailablePrivateEndpointTypesResult>> ListAsync(string location, CancellationToken ca |
| | 67 | | { |
| 0 | 68 | | if (location == null) |
| | 69 | | { |
| 0 | 70 | | throw new ArgumentNullException(nameof(location)); |
| | 71 | | } |
| | 72 | |
|
| 0 | 73 | | using var message = CreateListRequest(location); |
| 0 | 74 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 75 | | switch (message.Response.Status) |
| | 76 | | { |
| | 77 | | case 200: |
| | 78 | | { |
| 0 | 79 | | AvailablePrivateEndpointTypesResult value = default; |
| 0 | 80 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 81 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 82 | | { |
| 0 | 83 | | value = null; |
| | 84 | | } |
| | 85 | | else |
| | 86 | | { |
| 0 | 87 | | value = AvailablePrivateEndpointTypesResult.DeserializeAvailablePrivateEndpointTypesResult(d |
| | 88 | | } |
| 0 | 89 | | return Response.FromValue(value, message.Response); |
| | 90 | | } |
| | 91 | | default: |
| 0 | 92 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 93 | | } |
| 0 | 94 | | } |
| | 95 | |
|
| | 96 | | /// <summary> Returns all of the resource types that can be linked to a Private Endpoint in this subscription in |
| | 97 | | /// <param name="location"> The location of the domain name. </param> |
| | 98 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 99 | | public Response<AvailablePrivateEndpointTypesResult> List(string location, CancellationToken cancellationToken = |
| | 100 | | { |
| 0 | 101 | | if (location == null) |
| | 102 | | { |
| 0 | 103 | | throw new ArgumentNullException(nameof(location)); |
| | 104 | | } |
| | 105 | |
|
| 0 | 106 | | using var message = CreateListRequest(location); |
| 0 | 107 | | _pipeline.Send(message, cancellationToken); |
| 0 | 108 | | switch (message.Response.Status) |
| | 109 | | { |
| | 110 | | case 200: |
| | 111 | | { |
| 0 | 112 | | AvailablePrivateEndpointTypesResult value = default; |
| 0 | 113 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 114 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 115 | | { |
| 0 | 116 | | value = null; |
| | 117 | | } |
| | 118 | | else |
| | 119 | | { |
| 0 | 120 | | value = AvailablePrivateEndpointTypesResult.DeserializeAvailablePrivateEndpointTypesResult(d |
| | 121 | | } |
| 0 | 122 | | return Response.FromValue(value, message.Response); |
| | 123 | | } |
| | 124 | | default: |
| 0 | 125 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 126 | | } |
| 0 | 127 | | } |
| | 128 | |
|
| | 129 | | internal HttpMessage CreateListByResourceGroupRequest(string location, string resourceGroupName) |
| | 130 | | { |
| 0 | 131 | | var message = _pipeline.CreateMessage(); |
| 0 | 132 | | var request = message.Request; |
| 0 | 133 | | request.Method = RequestMethod.Get; |
| 0 | 134 | | var uri = new RawRequestUriBuilder(); |
| 0 | 135 | | uri.Reset(endpoint); |
| 0 | 136 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 137 | | uri.AppendPath(subscriptionId, true); |
| 0 | 138 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 139 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 140 | | uri.AppendPath("/providers/Microsoft.Network/locations/", false); |
| 0 | 141 | | uri.AppendPath(location, true); |
| 0 | 142 | | uri.AppendPath("/availablePrivateEndpointTypes", false); |
| 0 | 143 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 144 | | request.Uri = uri; |
| 0 | 145 | | return message; |
| | 146 | | } |
| | 147 | |
|
| | 148 | | /// <summary> Returns all of the resource types that can be linked to a Private Endpoint in this subscription in |
| | 149 | | /// <param name="location"> The location of the domain name. </param> |
| | 150 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 151 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 152 | | public async Task<Response<AvailablePrivateEndpointTypesResult>> ListByResourceGroupAsync(string location, strin |
| | 153 | | { |
| 0 | 154 | | if (location == null) |
| | 155 | | { |
| 0 | 156 | | throw new ArgumentNullException(nameof(location)); |
| | 157 | | } |
| 0 | 158 | | if (resourceGroupName == null) |
| | 159 | | { |
| 0 | 160 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 161 | | } |
| | 162 | |
|
| 0 | 163 | | using var message = CreateListByResourceGroupRequest(location, resourceGroupName); |
| 0 | 164 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 165 | | switch (message.Response.Status) |
| | 166 | | { |
| | 167 | | case 200: |
| | 168 | | { |
| 0 | 169 | | AvailablePrivateEndpointTypesResult value = default; |
| 0 | 170 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 171 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 172 | | { |
| 0 | 173 | | value = null; |
| | 174 | | } |
| | 175 | | else |
| | 176 | | { |
| 0 | 177 | | value = AvailablePrivateEndpointTypesResult.DeserializeAvailablePrivateEndpointTypesResult(d |
| | 178 | | } |
| 0 | 179 | | return Response.FromValue(value, message.Response); |
| | 180 | | } |
| | 181 | | default: |
| 0 | 182 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 183 | | } |
| 0 | 184 | | } |
| | 185 | |
|
| | 186 | | /// <summary> Returns all of the resource types that can be linked to a Private Endpoint in this subscription in |
| | 187 | | /// <param name="location"> The location of the domain name. </param> |
| | 188 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 189 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 190 | | public Response<AvailablePrivateEndpointTypesResult> ListByResourceGroup(string location, string resourceGroupNa |
| | 191 | | { |
| 0 | 192 | | if (location == null) |
| | 193 | | { |
| 0 | 194 | | throw new ArgumentNullException(nameof(location)); |
| | 195 | | } |
| 0 | 196 | | if (resourceGroupName == null) |
| | 197 | | { |
| 0 | 198 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 199 | | } |
| | 200 | |
|
| 0 | 201 | | using var message = CreateListByResourceGroupRequest(location, resourceGroupName); |
| 0 | 202 | | _pipeline.Send(message, cancellationToken); |
| 0 | 203 | | switch (message.Response.Status) |
| | 204 | | { |
| | 205 | | case 200: |
| | 206 | | { |
| 0 | 207 | | AvailablePrivateEndpointTypesResult value = default; |
| 0 | 208 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 209 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 210 | | { |
| 0 | 211 | | value = null; |
| | 212 | | } |
| | 213 | | else |
| | 214 | | { |
| 0 | 215 | | value = AvailablePrivateEndpointTypesResult.DeserializeAvailablePrivateEndpointTypesResult(d |
| | 216 | | } |
| 0 | 217 | | return Response.FromValue(value, message.Response); |
| | 218 | | } |
| | 219 | | default: |
| 0 | 220 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 221 | | } |
| 0 | 222 | | } |
| | 223 | |
|
| | 224 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string location) |
| | 225 | | { |
| 0 | 226 | | var message = _pipeline.CreateMessage(); |
| 0 | 227 | | var request = message.Request; |
| 0 | 228 | | request.Method = RequestMethod.Get; |
| 0 | 229 | | var uri = new RawRequestUriBuilder(); |
| 0 | 230 | | uri.Reset(endpoint); |
| 0 | 231 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 232 | | request.Uri = uri; |
| 0 | 233 | | return message; |
| | 234 | | } |
| | 235 | |
|
| | 236 | | /// <summary> Returns all of the resource types that can be linked to a Private Endpoint in this subscription in |
| | 237 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 238 | | /// <param name="location"> The location of the domain name. </param> |
| | 239 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 240 | | public async Task<Response<AvailablePrivateEndpointTypesResult>> ListNextPageAsync(string nextLink, string locat |
| | 241 | | { |
| 0 | 242 | | if (nextLink == null) |
| | 243 | | { |
| 0 | 244 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 245 | | } |
| 0 | 246 | | if (location == null) |
| | 247 | | { |
| 0 | 248 | | throw new ArgumentNullException(nameof(location)); |
| | 249 | | } |
| | 250 | |
|
| 0 | 251 | | using var message = CreateListNextPageRequest(nextLink, location); |
| 0 | 252 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 253 | | switch (message.Response.Status) |
| | 254 | | { |
| | 255 | | case 200: |
| | 256 | | { |
| 0 | 257 | | AvailablePrivateEndpointTypesResult value = default; |
| 0 | 258 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 259 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 260 | | { |
| 0 | 261 | | value = null; |
| | 262 | | } |
| | 263 | | else |
| | 264 | | { |
| 0 | 265 | | value = AvailablePrivateEndpointTypesResult.DeserializeAvailablePrivateEndpointTypesResult(d |
| | 266 | | } |
| 0 | 267 | | return Response.FromValue(value, message.Response); |
| | 268 | | } |
| | 269 | | default: |
| 0 | 270 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 271 | | } |
| 0 | 272 | | } |
| | 273 | |
|
| | 274 | | /// <summary> Returns all of the resource types that can be linked to a Private Endpoint in this subscription in |
| | 275 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 276 | | /// <param name="location"> The location of the domain name. </param> |
| | 277 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 278 | | public Response<AvailablePrivateEndpointTypesResult> ListNextPage(string nextLink, string location, Cancellation |
| | 279 | | { |
| 0 | 280 | | if (nextLink == null) |
| | 281 | | { |
| 0 | 282 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 283 | | } |
| 0 | 284 | | if (location == null) |
| | 285 | | { |
| 0 | 286 | | throw new ArgumentNullException(nameof(location)); |
| | 287 | | } |
| | 288 | |
|
| 0 | 289 | | using var message = CreateListNextPageRequest(nextLink, location); |
| 0 | 290 | | _pipeline.Send(message, cancellationToken); |
| 0 | 291 | | switch (message.Response.Status) |
| | 292 | | { |
| | 293 | | case 200: |
| | 294 | | { |
| 0 | 295 | | AvailablePrivateEndpointTypesResult value = default; |
| 0 | 296 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 297 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 298 | | { |
| 0 | 299 | | value = null; |
| | 300 | | } |
| | 301 | | else |
| | 302 | | { |
| 0 | 303 | | value = AvailablePrivateEndpointTypesResult.DeserializeAvailablePrivateEndpointTypesResult(d |
| | 304 | | } |
| 0 | 305 | | return Response.FromValue(value, message.Response); |
| | 306 | | } |
| | 307 | | default: |
| 0 | 308 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 309 | | } |
| 0 | 310 | | } |
| | 311 | |
|
| | 312 | | internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string location, string resourceG |
| | 313 | | { |
| 0 | 314 | | var message = _pipeline.CreateMessage(); |
| 0 | 315 | | var request = message.Request; |
| 0 | 316 | | request.Method = RequestMethod.Get; |
| 0 | 317 | | var uri = new RawRequestUriBuilder(); |
| 0 | 318 | | uri.Reset(endpoint); |
| 0 | 319 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 320 | | request.Uri = uri; |
| 0 | 321 | | return message; |
| | 322 | | } |
| | 323 | |
|
| | 324 | | /// <summary> Returns all of the resource types that can be linked to a Private Endpoint in this subscription in |
| | 325 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 326 | | /// <param name="location"> The location of the domain name. </param> |
| | 327 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 328 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 329 | | public async Task<Response<AvailablePrivateEndpointTypesResult>> ListByResourceGroupNextPageAsync(string nextLin |
| | 330 | | { |
| 0 | 331 | | if (nextLink == null) |
| | 332 | | { |
| 0 | 333 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 334 | | } |
| 0 | 335 | | if (location == null) |
| | 336 | | { |
| 0 | 337 | | throw new ArgumentNullException(nameof(location)); |
| | 338 | | } |
| 0 | 339 | | if (resourceGroupName == null) |
| | 340 | | { |
| 0 | 341 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 342 | | } |
| | 343 | |
|
| 0 | 344 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, location, resourceGroupName); |
| 0 | 345 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 346 | | switch (message.Response.Status) |
| | 347 | | { |
| | 348 | | case 200: |
| | 349 | | { |
| 0 | 350 | | AvailablePrivateEndpointTypesResult value = default; |
| 0 | 351 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 352 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 353 | | { |
| 0 | 354 | | value = null; |
| | 355 | | } |
| | 356 | | else |
| | 357 | | { |
| 0 | 358 | | value = AvailablePrivateEndpointTypesResult.DeserializeAvailablePrivateEndpointTypesResult(d |
| | 359 | | } |
| 0 | 360 | | return Response.FromValue(value, message.Response); |
| | 361 | | } |
| | 362 | | default: |
| 0 | 363 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 364 | | } |
| 0 | 365 | | } |
| | 366 | |
|
| | 367 | | /// <summary> Returns all of the resource types that can be linked to a Private Endpoint in this subscription in |
| | 368 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 369 | | /// <param name="location"> The location of the domain name. </param> |
| | 370 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 371 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 372 | | public Response<AvailablePrivateEndpointTypesResult> ListByResourceGroupNextPage(string nextLink, string locatio |
| | 373 | | { |
| 0 | 374 | | if (nextLink == null) |
| | 375 | | { |
| 0 | 376 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 377 | | } |
| 0 | 378 | | if (location == null) |
| | 379 | | { |
| 0 | 380 | | throw new ArgumentNullException(nameof(location)); |
| | 381 | | } |
| 0 | 382 | | if (resourceGroupName == null) |
| | 383 | | { |
| 0 | 384 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 385 | | } |
| | 386 | |
|
| 0 | 387 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, location, resourceGroupName); |
| 0 | 388 | | _pipeline.Send(message, cancellationToken); |
| 0 | 389 | | switch (message.Response.Status) |
| | 390 | | { |
| | 391 | | case 200: |
| | 392 | | { |
| 0 | 393 | | AvailablePrivateEndpointTypesResult value = default; |
| 0 | 394 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 395 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 396 | | { |
| 0 | 397 | | value = null; |
| | 398 | | } |
| | 399 | | else |
| | 400 | | { |
| 0 | 401 | | value = AvailablePrivateEndpointTypesResult.DeserializeAvailablePrivateEndpointTypesResult(d |
| | 402 | | } |
| 0 | 403 | | return Response.FromValue(value, message.Response); |
| | 404 | | } |
| | 405 | | default: |
| 0 | 406 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 407 | | } |
| 0 | 408 | | } |
| | 409 | | } |
| | 410 | | } |