| | 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 VpnLinkConnectionsRestOperations |
| | 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 VpnLinkConnectionsRestOperations. </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 VpnLinkConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subsc |
| | 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 CreateListByVpnConnectionRequest(string resourceGroupName, string gatewayName, string conne |
| | 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("/resourceGroups/", false); |
| 0 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 57 | | uri.AppendPath("/providers/Microsoft.Network/vpnGateways/", false); |
| 0 | 58 | | uri.AppendPath(gatewayName, true); |
| 0 | 59 | | uri.AppendPath("/vpnConnections/", false); |
| 0 | 60 | | uri.AppendPath(connectionName, true); |
| 0 | 61 | | uri.AppendPath("/vpnLinkConnections", false); |
| 0 | 62 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 63 | | request.Uri = uri; |
| 0 | 64 | | return message; |
| | 65 | | } |
| | 66 | |
|
| | 67 | | /// <summary> Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection. < |
| | 68 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | 69 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 70 | | /// <param name="connectionName"> The name of the vpn connection. </param> |
| | 71 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 72 | | public async Task<Response<ListVpnSiteLinkConnectionsResult>> ListByVpnConnectionAsync(string resourceGroupName, |
| | 73 | | { |
| 0 | 74 | | if (resourceGroupName == null) |
| | 75 | | { |
| 0 | 76 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 77 | | } |
| 0 | 78 | | if (gatewayName == null) |
| | 79 | | { |
| 0 | 80 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 81 | | } |
| 0 | 82 | | if (connectionName == null) |
| | 83 | | { |
| 0 | 84 | | throw new ArgumentNullException(nameof(connectionName)); |
| | 85 | | } |
| | 86 | |
|
| 0 | 87 | | using var message = CreateListByVpnConnectionRequest(resourceGroupName, gatewayName, connectionName); |
| 0 | 88 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 89 | | switch (message.Response.Status) |
| | 90 | | { |
| | 91 | | case 200: |
| | 92 | | { |
| 0 | 93 | | ListVpnSiteLinkConnectionsResult value = default; |
| 0 | 94 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 95 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| 0 | 97 | | value = null; |
| | 98 | | } |
| | 99 | | else |
| | 100 | | { |
| 0 | 101 | | value = ListVpnSiteLinkConnectionsResult.DeserializeListVpnSiteLinkConnectionsResult(documen |
| | 102 | | } |
| 0 | 103 | | return Response.FromValue(value, message.Response); |
| | 104 | | } |
| | 105 | | default: |
| 0 | 106 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 107 | | } |
| 0 | 108 | | } |
| | 109 | |
|
| | 110 | | /// <summary> Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection. < |
| | 111 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | 112 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 113 | | /// <param name="connectionName"> The name of the vpn connection. </param> |
| | 114 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 115 | | public Response<ListVpnSiteLinkConnectionsResult> ListByVpnConnection(string resourceGroupName, string gatewayNa |
| | 116 | | { |
| 0 | 117 | | if (resourceGroupName == null) |
| | 118 | | { |
| 0 | 119 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 120 | | } |
| 0 | 121 | | if (gatewayName == null) |
| | 122 | | { |
| 0 | 123 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 124 | | } |
| 0 | 125 | | if (connectionName == null) |
| | 126 | | { |
| 0 | 127 | | throw new ArgumentNullException(nameof(connectionName)); |
| | 128 | | } |
| | 129 | |
|
| 0 | 130 | | using var message = CreateListByVpnConnectionRequest(resourceGroupName, gatewayName, connectionName); |
| 0 | 131 | | _pipeline.Send(message, cancellationToken); |
| 0 | 132 | | switch (message.Response.Status) |
| | 133 | | { |
| | 134 | | case 200: |
| | 135 | | { |
| 0 | 136 | | ListVpnSiteLinkConnectionsResult value = default; |
| 0 | 137 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 138 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 139 | | { |
| 0 | 140 | | value = null; |
| | 141 | | } |
| | 142 | | else |
| | 143 | | { |
| 0 | 144 | | value = ListVpnSiteLinkConnectionsResult.DeserializeListVpnSiteLinkConnectionsResult(documen |
| | 145 | | } |
| 0 | 146 | | return Response.FromValue(value, message.Response); |
| | 147 | | } |
| | 148 | | default: |
| 0 | 149 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 150 | | } |
| 0 | 151 | | } |
| | 152 | |
|
| | 153 | | internal HttpMessage CreateListByVpnConnectionNextPageRequest(string nextLink, string resourceGroupName, string |
| | 154 | | { |
| 0 | 155 | | var message = _pipeline.CreateMessage(); |
| 0 | 156 | | var request = message.Request; |
| 0 | 157 | | request.Method = RequestMethod.Get; |
| 0 | 158 | | var uri = new RawRequestUriBuilder(); |
| 0 | 159 | | uri.Reset(endpoint); |
| 0 | 160 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 161 | | request.Uri = uri; |
| 0 | 162 | | return message; |
| | 163 | | } |
| | 164 | |
|
| | 165 | | /// <summary> Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection. < |
| | 166 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 167 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | 168 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 169 | | /// <param name="connectionName"> The name of the vpn connection. </param> |
| | 170 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 171 | | public async Task<Response<ListVpnSiteLinkConnectionsResult>> ListByVpnConnectionNextPageAsync(string nextLink, |
| | 172 | | { |
| 0 | 173 | | if (nextLink == null) |
| | 174 | | { |
| 0 | 175 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 176 | | } |
| 0 | 177 | | if (resourceGroupName == null) |
| | 178 | | { |
| 0 | 179 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 180 | | } |
| 0 | 181 | | if (gatewayName == null) |
| | 182 | | { |
| 0 | 183 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 184 | | } |
| 0 | 185 | | if (connectionName == null) |
| | 186 | | { |
| 0 | 187 | | throw new ArgumentNullException(nameof(connectionName)); |
| | 188 | | } |
| | 189 | |
|
| 0 | 190 | | using var message = CreateListByVpnConnectionNextPageRequest(nextLink, resourceGroupName, gatewayName, conne |
| 0 | 191 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 192 | | switch (message.Response.Status) |
| | 193 | | { |
| | 194 | | case 200: |
| | 195 | | { |
| 0 | 196 | | ListVpnSiteLinkConnectionsResult value = default; |
| 0 | 197 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 198 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 199 | | { |
| 0 | 200 | | value = null; |
| | 201 | | } |
| | 202 | | else |
| | 203 | | { |
| 0 | 204 | | value = ListVpnSiteLinkConnectionsResult.DeserializeListVpnSiteLinkConnectionsResult(documen |
| | 205 | | } |
| 0 | 206 | | return Response.FromValue(value, message.Response); |
| | 207 | | } |
| | 208 | | default: |
| 0 | 209 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 210 | | } |
| 0 | 211 | | } |
| | 212 | |
|
| | 213 | | /// <summary> Retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection. < |
| | 214 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 215 | | /// <param name="resourceGroupName"> The resource group name of the VpnGateway. </param> |
| | 216 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 217 | | /// <param name="connectionName"> The name of the vpn connection. </param> |
| | 218 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 219 | | public Response<ListVpnSiteLinkConnectionsResult> ListByVpnConnectionNextPage(string nextLink, string resourceGr |
| | 220 | | { |
| 0 | 221 | | if (nextLink == null) |
| | 222 | | { |
| 0 | 223 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 224 | | } |
| 0 | 225 | | if (resourceGroupName == null) |
| | 226 | | { |
| 0 | 227 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 228 | | } |
| 0 | 229 | | if (gatewayName == null) |
| | 230 | | { |
| 0 | 231 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 232 | | } |
| 0 | 233 | | if (connectionName == null) |
| | 234 | | { |
| 0 | 235 | | throw new ArgumentNullException(nameof(connectionName)); |
| | 236 | | } |
| | 237 | |
|
| 0 | 238 | | using var message = CreateListByVpnConnectionNextPageRequest(nextLink, resourceGroupName, gatewayName, conne |
| 0 | 239 | | _pipeline.Send(message, cancellationToken); |
| 0 | 240 | | switch (message.Response.Status) |
| | 241 | | { |
| | 242 | | case 200: |
| | 243 | | { |
| 0 | 244 | | ListVpnSiteLinkConnectionsResult value = default; |
| 0 | 245 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 246 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 247 | | { |
| 0 | 248 | | value = null; |
| | 249 | | } |
| | 250 | | else |
| | 251 | | { |
| 0 | 252 | | value = ListVpnSiteLinkConnectionsResult.DeserializeListVpnSiteLinkConnectionsResult(documen |
| | 253 | | } |
| 0 | 254 | | return Response.FromValue(value, message.Response); |
| | 255 | | } |
| | 256 | | default: |
| 0 | 257 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 258 | | } |
| 0 | 259 | | } |
| | 260 | | } |
| | 261 | | } |