| | | 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 | | |
| | | 15 | | namespace Azure.ResourceManager.Network |
| | | 16 | | { |
| | | 17 | | internal partial class VpnServerConfigurationsAssociatedWithVirtualWanRestOperations |
| | | 18 | | { |
| | | 19 | | private string subscriptionId; |
| | | 20 | | private Uri endpoint; |
| | | 21 | | private ClientDiagnostics _clientDiagnostics; |
| | | 22 | | private HttpPipeline _pipeline; |
| | | 23 | | |
| | | 24 | | /// <summary> Initializes a new instance of VpnServerConfigurationsAssociatedWithVirtualWanRestOperations. </sum |
| | | 25 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | | 26 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | | 27 | | /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | | 28 | | /// <param name="endpoint"> server parameter. </param> |
| | | 29 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| | 0 | 30 | | public VpnServerConfigurationsAssociatedWithVirtualWanRestOperations(ClientDiagnostics clientDiagnostics, HttpPi |
| | | 31 | | { |
| | 0 | 32 | | if (subscriptionId == null) |
| | | 33 | | { |
| | 0 | 34 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | | 35 | | } |
| | 0 | 36 | | endpoint ??= new Uri("https://management.azure.com"); |
| | | 37 | | |
| | 0 | 38 | | this.subscriptionId = subscriptionId; |
| | 0 | 39 | | this.endpoint = endpoint; |
| | 0 | 40 | | _clientDiagnostics = clientDiagnostics; |
| | 0 | 41 | | _pipeline = pipeline; |
| | 0 | 42 | | } |
| | | 43 | | |
| | | 44 | | internal HttpMessage CreateListRequest(string resourceGroupName, string virtualWANName) |
| | | 45 | | { |
| | 0 | 46 | | var message = _pipeline.CreateMessage(); |
| | 0 | 47 | | var request = message.Request; |
| | 0 | 48 | | request.Method = RequestMethod.Post; |
| | 0 | 49 | | var uri = new RawRequestUriBuilder(); |
| | 0 | 50 | | uri.Reset(endpoint); |
| | 0 | 51 | | uri.AppendPath("/subscriptions/", false); |
| | 0 | 52 | | uri.AppendPath(subscriptionId, true); |
| | 0 | 53 | | uri.AppendPath("/resourceGroups/", false); |
| | 0 | 54 | | uri.AppendPath(resourceGroupName, true); |
| | 0 | 55 | | uri.AppendPath("/providers/Microsoft.Network/virtualWans/", false); |
| | 0 | 56 | | uri.AppendPath(virtualWANName, true); |
| | 0 | 57 | | uri.AppendPath("/vpnServerConfigurations", false); |
| | 0 | 58 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| | 0 | 59 | | request.Uri = uri; |
| | 0 | 60 | | return message; |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | /// <summary> Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. </summa |
| | | 64 | | /// <param name="resourceGroupName"> The resource group name. </param> |
| | | 65 | | /// <param name="virtualWANName"> The name of the VirtualWAN whose associated VpnServerConfigurations is needed. |
| | | 66 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 67 | | public async Task<Response> ListAsync(string resourceGroupName, string virtualWANName, CancellationToken cancell |
| | | 68 | | { |
| | 0 | 69 | | if (resourceGroupName == null) |
| | | 70 | | { |
| | 0 | 71 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 72 | | } |
| | 0 | 73 | | if (virtualWANName == null) |
| | | 74 | | { |
| | 0 | 75 | | throw new ArgumentNullException(nameof(virtualWANName)); |
| | | 76 | | } |
| | | 77 | | |
| | 0 | 78 | | using var message = CreateListRequest(resourceGroupName, virtualWANName); |
| | 0 | 79 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| | 0 | 80 | | switch (message.Response.Status) |
| | | 81 | | { |
| | | 82 | | case 200: |
| | | 83 | | case 202: |
| | 0 | 84 | | return message.Response; |
| | | 85 | | default: |
| | 0 | 86 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | | 87 | | } |
| | 0 | 88 | | } |
| | | 89 | | |
| | | 90 | | /// <summary> Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. </summa |
| | | 91 | | /// <param name="resourceGroupName"> The resource group name. </param> |
| | | 92 | | /// <param name="virtualWANName"> The name of the VirtualWAN whose associated VpnServerConfigurations is needed. |
| | | 93 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 94 | | public Response List(string resourceGroupName, string virtualWANName, CancellationToken cancellationToken = defa |
| | | 95 | | { |
| | 0 | 96 | | if (resourceGroupName == null) |
| | | 97 | | { |
| | 0 | 98 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 99 | | } |
| | 0 | 100 | | if (virtualWANName == null) |
| | | 101 | | { |
| | 0 | 102 | | throw new ArgumentNullException(nameof(virtualWANName)); |
| | | 103 | | } |
| | | 104 | | |
| | 0 | 105 | | using var message = CreateListRequest(resourceGroupName, virtualWANName); |
| | 0 | 106 | | _pipeline.Send(message, cancellationToken); |
| | 0 | 107 | | switch (message.Response.Status) |
| | | 108 | | { |
| | | 109 | | case 200: |
| | | 110 | | case 202: |
| | 0 | 111 | | return message.Response; |
| | | 112 | | default: |
| | 0 | 113 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | | 114 | | } |
| | 0 | 115 | | } |
| | | 116 | | } |
| | | 117 | | } |