| | 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 P2SVpnGatewaysRestOperations |
| | 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 P2SVpnGatewaysRestOperations. </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 P2SVpnGatewaysRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscript |
| | 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 CreateGetRequest(string resourceGroupName, string gatewayName) |
| | 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/p2svpnGateways/", false); |
| 0 | 58 | | uri.AppendPath(gatewayName, true); |
| 0 | 59 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 60 | | request.Uri = uri; |
| 0 | 61 | | return message; |
| | 62 | | } |
| | 63 | |
|
| | 64 | | /// <summary> Retrieves the details of a virtual wan p2s vpn gateway. </summary> |
| | 65 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 66 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 67 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 68 | | public async Task<Response<P2SVpnGateway>> GetAsync(string resourceGroupName, string gatewayName, CancellationTo |
| | 69 | | { |
| 0 | 70 | | if (resourceGroupName == null) |
| | 71 | | { |
| 0 | 72 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 73 | | } |
| 0 | 74 | | if (gatewayName == null) |
| | 75 | | { |
| 0 | 76 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 77 | | } |
| | 78 | |
|
| 0 | 79 | | using var message = CreateGetRequest(resourceGroupName, gatewayName); |
| 0 | 80 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 81 | | switch (message.Response.Status) |
| | 82 | | { |
| | 83 | | case 200: |
| | 84 | | { |
| 0 | 85 | | P2SVpnGateway value = default; |
| 0 | 86 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 87 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 88 | | { |
| 0 | 89 | | value = null; |
| | 90 | | } |
| | 91 | | else |
| | 92 | | { |
| 0 | 93 | | value = P2SVpnGateway.DeserializeP2SVpnGateway(document.RootElement); |
| | 94 | | } |
| 0 | 95 | | return Response.FromValue(value, message.Response); |
| | 96 | | } |
| | 97 | | default: |
| 0 | 98 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 99 | | } |
| 0 | 100 | | } |
| | 101 | |
|
| | 102 | | /// <summary> Retrieves the details of a virtual wan p2s vpn gateway. </summary> |
| | 103 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 104 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 105 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 106 | | public Response<P2SVpnGateway> Get(string resourceGroupName, string gatewayName, CancellationToken cancellationT |
| | 107 | | { |
| 0 | 108 | | if (resourceGroupName == null) |
| | 109 | | { |
| 0 | 110 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 111 | | } |
| 0 | 112 | | if (gatewayName == null) |
| | 113 | | { |
| 0 | 114 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 115 | | } |
| | 116 | |
|
| 0 | 117 | | using var message = CreateGetRequest(resourceGroupName, gatewayName); |
| 0 | 118 | | _pipeline.Send(message, cancellationToken); |
| 0 | 119 | | switch (message.Response.Status) |
| | 120 | | { |
| | 121 | | case 200: |
| | 122 | | { |
| 0 | 123 | | P2SVpnGateway value = default; |
| 0 | 124 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 125 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 126 | | { |
| 0 | 127 | | value = null; |
| | 128 | | } |
| | 129 | | else |
| | 130 | | { |
| 0 | 131 | | value = P2SVpnGateway.DeserializeP2SVpnGateway(document.RootElement); |
| | 132 | | } |
| 0 | 133 | | return Response.FromValue(value, message.Response); |
| | 134 | | } |
| | 135 | | default: |
| 0 | 136 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 137 | | } |
| 0 | 138 | | } |
| | 139 | |
|
| | 140 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string gatewayName, P2SVpnGateway p2S |
| | 141 | | { |
| 0 | 142 | | var message = _pipeline.CreateMessage(); |
| 0 | 143 | | var request = message.Request; |
| 0 | 144 | | request.Method = RequestMethod.Put; |
| 0 | 145 | | var uri = new RawRequestUriBuilder(); |
| 0 | 146 | | uri.Reset(endpoint); |
| 0 | 147 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 148 | | uri.AppendPath(subscriptionId, true); |
| 0 | 149 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 150 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 151 | | uri.AppendPath("/providers/Microsoft.Network/p2svpnGateways/", false); |
| 0 | 152 | | uri.AppendPath(gatewayName, true); |
| 0 | 153 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 154 | | request.Uri = uri; |
| 0 | 155 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 156 | | var content = new Utf8JsonRequestContent(); |
| 0 | 157 | | content.JsonWriter.WriteObjectValue(p2SVpnGatewayParameters); |
| 0 | 158 | | request.Content = content; |
| 0 | 159 | | return message; |
| | 160 | | } |
| | 161 | |
|
| | 162 | | /// <summary> Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. |
| | 163 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 164 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 165 | | /// <param name="p2SVpnGatewayParameters"> Parameters supplied to create or Update a virtual wan p2s vpn gateway |
| | 166 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 167 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string gatewayName, P2SVpnGateway p2SV |
| | 168 | | { |
| 0 | 169 | | if (resourceGroupName == null) |
| | 170 | | { |
| 0 | 171 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 172 | | } |
| 0 | 173 | | if (gatewayName == null) |
| | 174 | | { |
| 0 | 175 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 176 | | } |
| 0 | 177 | | if (p2SVpnGatewayParameters == null) |
| | 178 | | { |
| 0 | 179 | | throw new ArgumentNullException(nameof(p2SVpnGatewayParameters)); |
| | 180 | | } |
| | 181 | |
|
| 0 | 182 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, gatewayName, p2SVpnGatewayParameters); |
| 0 | 183 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 184 | | switch (message.Response.Status) |
| | 185 | | { |
| | 186 | | case 200: |
| | 187 | | case 201: |
| 0 | 188 | | return message.Response; |
| | 189 | | default: |
| 0 | 190 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 191 | | } |
| 0 | 192 | | } |
| | 193 | |
|
| | 194 | | /// <summary> Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. |
| | 195 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 196 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 197 | | /// <param name="p2SVpnGatewayParameters"> Parameters supplied to create or Update a virtual wan p2s vpn gateway |
| | 198 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 199 | | public Response CreateOrUpdate(string resourceGroupName, string gatewayName, P2SVpnGateway p2SVpnGatewayParamete |
| | 200 | | { |
| 0 | 201 | | if (resourceGroupName == null) |
| | 202 | | { |
| 0 | 203 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 204 | | } |
| 0 | 205 | | if (gatewayName == null) |
| | 206 | | { |
| 0 | 207 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 208 | | } |
| 0 | 209 | | if (p2SVpnGatewayParameters == null) |
| | 210 | | { |
| 0 | 211 | | throw new ArgumentNullException(nameof(p2SVpnGatewayParameters)); |
| | 212 | | } |
| | 213 | |
|
| 0 | 214 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, gatewayName, p2SVpnGatewayParameters); |
| 0 | 215 | | _pipeline.Send(message, cancellationToken); |
| 0 | 216 | | switch (message.Response.Status) |
| | 217 | | { |
| | 218 | | case 200: |
| | 219 | | case 201: |
| 0 | 220 | | return message.Response; |
| | 221 | | default: |
| 0 | 222 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 223 | | } |
| 0 | 224 | | } |
| | 225 | |
|
| | 226 | | internal HttpMessage CreateUpdateTagsRequest(string resourceGroupName, string gatewayName, TagsObject p2SVpnGate |
| | 227 | | { |
| 0 | 228 | | var message = _pipeline.CreateMessage(); |
| 0 | 229 | | var request = message.Request; |
| 0 | 230 | | request.Method = RequestMethod.Patch; |
| 0 | 231 | | var uri = new RawRequestUriBuilder(); |
| 0 | 232 | | uri.Reset(endpoint); |
| 0 | 233 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 234 | | uri.AppendPath(subscriptionId, true); |
| 0 | 235 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 236 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 237 | | uri.AppendPath("/providers/Microsoft.Network/p2svpnGateways/", false); |
| 0 | 238 | | uri.AppendPath(gatewayName, true); |
| 0 | 239 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 240 | | request.Uri = uri; |
| 0 | 241 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 242 | | var content = new Utf8JsonRequestContent(); |
| 0 | 243 | | content.JsonWriter.WriteObjectValue(p2SVpnGatewayParameters); |
| 0 | 244 | | request.Content = content; |
| 0 | 245 | | return message; |
| | 246 | | } |
| | 247 | |
|
| | 248 | | /// <summary> Updates virtual wan p2s vpn gateway tags. </summary> |
| | 249 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 250 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 251 | | /// <param name="p2SVpnGatewayParameters"> Parameters supplied to update a virtual wan p2s vpn gateway tags. </p |
| | 252 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 253 | | public async Task<Response<P2SVpnGateway>> UpdateTagsAsync(string resourceGroupName, string gatewayName, TagsObj |
| | 254 | | { |
| 0 | 255 | | if (resourceGroupName == null) |
| | 256 | | { |
| 0 | 257 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 258 | | } |
| 0 | 259 | | if (gatewayName == null) |
| | 260 | | { |
| 0 | 261 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 262 | | } |
| 0 | 263 | | if (p2SVpnGatewayParameters == null) |
| | 264 | | { |
| 0 | 265 | | throw new ArgumentNullException(nameof(p2SVpnGatewayParameters)); |
| | 266 | | } |
| | 267 | |
|
| 0 | 268 | | using var message = CreateUpdateTagsRequest(resourceGroupName, gatewayName, p2SVpnGatewayParameters); |
| 0 | 269 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 270 | | switch (message.Response.Status) |
| | 271 | | { |
| | 272 | | case 200: |
| | 273 | | { |
| 0 | 274 | | P2SVpnGateway value = default; |
| 0 | 275 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 276 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 277 | | { |
| 0 | 278 | | value = null; |
| | 279 | | } |
| | 280 | | else |
| | 281 | | { |
| 0 | 282 | | value = P2SVpnGateway.DeserializeP2SVpnGateway(document.RootElement); |
| | 283 | | } |
| 0 | 284 | | return Response.FromValue(value, message.Response); |
| | 285 | | } |
| | 286 | | default: |
| 0 | 287 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 288 | | } |
| 0 | 289 | | } |
| | 290 | |
|
| | 291 | | /// <summary> Updates virtual wan p2s vpn gateway tags. </summary> |
| | 292 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 293 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 294 | | /// <param name="p2SVpnGatewayParameters"> Parameters supplied to update a virtual wan p2s vpn gateway tags. </p |
| | 295 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 296 | | public Response<P2SVpnGateway> UpdateTags(string resourceGroupName, string gatewayName, TagsObject p2SVpnGateway |
| | 297 | | { |
| 0 | 298 | | if (resourceGroupName == null) |
| | 299 | | { |
| 0 | 300 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 301 | | } |
| 0 | 302 | | if (gatewayName == null) |
| | 303 | | { |
| 0 | 304 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 305 | | } |
| 0 | 306 | | if (p2SVpnGatewayParameters == null) |
| | 307 | | { |
| 0 | 308 | | throw new ArgumentNullException(nameof(p2SVpnGatewayParameters)); |
| | 309 | | } |
| | 310 | |
|
| 0 | 311 | | using var message = CreateUpdateTagsRequest(resourceGroupName, gatewayName, p2SVpnGatewayParameters); |
| 0 | 312 | | _pipeline.Send(message, cancellationToken); |
| 0 | 313 | | switch (message.Response.Status) |
| | 314 | | { |
| | 315 | | case 200: |
| | 316 | | { |
| 0 | 317 | | P2SVpnGateway value = default; |
| 0 | 318 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 319 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 320 | | { |
| 0 | 321 | | value = null; |
| | 322 | | } |
| | 323 | | else |
| | 324 | | { |
| 0 | 325 | | value = P2SVpnGateway.DeserializeP2SVpnGateway(document.RootElement); |
| | 326 | | } |
| 0 | 327 | | return Response.FromValue(value, message.Response); |
| | 328 | | } |
| | 329 | | default: |
| 0 | 330 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 331 | | } |
| 0 | 332 | | } |
| | 333 | |
|
| | 334 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string gatewayName) |
| | 335 | | { |
| 0 | 336 | | var message = _pipeline.CreateMessage(); |
| 0 | 337 | | var request = message.Request; |
| 0 | 338 | | request.Method = RequestMethod.Delete; |
| 0 | 339 | | var uri = new RawRequestUriBuilder(); |
| 0 | 340 | | uri.Reset(endpoint); |
| 0 | 341 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 342 | | uri.AppendPath(subscriptionId, true); |
| 0 | 343 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 344 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 345 | | uri.AppendPath("/providers/Microsoft.Network/p2svpnGateways/", false); |
| 0 | 346 | | uri.AppendPath(gatewayName, true); |
| 0 | 347 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 348 | | request.Uri = uri; |
| 0 | 349 | | return message; |
| | 350 | | } |
| | 351 | |
|
| | 352 | | /// <summary> Deletes a virtual wan p2s vpn gateway. </summary> |
| | 353 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 354 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 355 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 356 | | public async Task<Response> DeleteAsync(string resourceGroupName, string gatewayName, CancellationToken cancella |
| | 357 | | { |
| 0 | 358 | | if (resourceGroupName == null) |
| | 359 | | { |
| 0 | 360 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 361 | | } |
| 0 | 362 | | if (gatewayName == null) |
| | 363 | | { |
| 0 | 364 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 365 | | } |
| | 366 | |
|
| 0 | 367 | | using var message = CreateDeleteRequest(resourceGroupName, gatewayName); |
| 0 | 368 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 369 | | switch (message.Response.Status) |
| | 370 | | { |
| | 371 | | case 200: |
| | 372 | | case 202: |
| | 373 | | case 204: |
| 0 | 374 | | return message.Response; |
| | 375 | | default: |
| 0 | 376 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 377 | | } |
| 0 | 378 | | } |
| | 379 | |
|
| | 380 | | /// <summary> Deletes a virtual wan p2s vpn gateway. </summary> |
| | 381 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 382 | | /// <param name="gatewayName"> The name of the gateway. </param> |
| | 383 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 384 | | public Response Delete(string resourceGroupName, string gatewayName, CancellationToken cancellationToken = defau |
| | 385 | | { |
| 0 | 386 | | if (resourceGroupName == null) |
| | 387 | | { |
| 0 | 388 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 389 | | } |
| 0 | 390 | | if (gatewayName == null) |
| | 391 | | { |
| 0 | 392 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 393 | | } |
| | 394 | |
|
| 0 | 395 | | using var message = CreateDeleteRequest(resourceGroupName, gatewayName); |
| 0 | 396 | | _pipeline.Send(message, cancellationToken); |
| 0 | 397 | | switch (message.Response.Status) |
| | 398 | | { |
| | 399 | | case 200: |
| | 400 | | case 202: |
| | 401 | | case 204: |
| 0 | 402 | | return message.Response; |
| | 403 | | default: |
| 0 | 404 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 405 | | } |
| 0 | 406 | | } |
| | 407 | |
|
| | 408 | | internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName) |
| | 409 | | { |
| 0 | 410 | | var message = _pipeline.CreateMessage(); |
| 0 | 411 | | var request = message.Request; |
| 0 | 412 | | request.Method = RequestMethod.Get; |
| 0 | 413 | | var uri = new RawRequestUriBuilder(); |
| 0 | 414 | | uri.Reset(endpoint); |
| 0 | 415 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 416 | | uri.AppendPath(subscriptionId, true); |
| 0 | 417 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 418 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 419 | | uri.AppendPath("/providers/Microsoft.Network/p2svpnGateways", false); |
| 0 | 420 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 421 | | request.Uri = uri; |
| 0 | 422 | | return message; |
| | 423 | | } |
| | 424 | |
|
| | 425 | | /// <summary> Lists all the P2SVpnGateways in a resource group. </summary> |
| | 426 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 427 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 428 | | public async Task<Response<ListP2SVpnGatewaysResult>> ListByResourceGroupAsync(string resourceGroupName, Cancell |
| | 429 | | { |
| 0 | 430 | | if (resourceGroupName == null) |
| | 431 | | { |
| 0 | 432 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 433 | | } |
| | 434 | |
|
| 0 | 435 | | using var message = CreateListByResourceGroupRequest(resourceGroupName); |
| 0 | 436 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 437 | | switch (message.Response.Status) |
| | 438 | | { |
| | 439 | | case 200: |
| | 440 | | { |
| 0 | 441 | | ListP2SVpnGatewaysResult value = default; |
| 0 | 442 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 443 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 444 | | { |
| 0 | 445 | | value = null; |
| | 446 | | } |
| | 447 | | else |
| | 448 | | { |
| 0 | 449 | | value = ListP2SVpnGatewaysResult.DeserializeListP2SVpnGatewaysResult(document.RootElement); |
| | 450 | | } |
| 0 | 451 | | return Response.FromValue(value, message.Response); |
| | 452 | | } |
| | 453 | | default: |
| 0 | 454 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 455 | | } |
| 0 | 456 | | } |
| | 457 | |
|
| | 458 | | /// <summary> Lists all the P2SVpnGateways in a resource group. </summary> |
| | 459 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 460 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 461 | | public Response<ListP2SVpnGatewaysResult> ListByResourceGroup(string resourceGroupName, CancellationToken cancel |
| | 462 | | { |
| 0 | 463 | | if (resourceGroupName == null) |
| | 464 | | { |
| 0 | 465 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 466 | | } |
| | 467 | |
|
| 0 | 468 | | using var message = CreateListByResourceGroupRequest(resourceGroupName); |
| 0 | 469 | | _pipeline.Send(message, cancellationToken); |
| 0 | 470 | | switch (message.Response.Status) |
| | 471 | | { |
| | 472 | | case 200: |
| | 473 | | { |
| 0 | 474 | | ListP2SVpnGatewaysResult value = default; |
| 0 | 475 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 476 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 477 | | { |
| 0 | 478 | | value = null; |
| | 479 | | } |
| | 480 | | else |
| | 481 | | { |
| 0 | 482 | | value = ListP2SVpnGatewaysResult.DeserializeListP2SVpnGatewaysResult(document.RootElement); |
| | 483 | | } |
| 0 | 484 | | return Response.FromValue(value, message.Response); |
| | 485 | | } |
| | 486 | | default: |
| 0 | 487 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 488 | | } |
| 0 | 489 | | } |
| | 490 | |
|
| | 491 | | internal HttpMessage CreateListRequest() |
| | 492 | | { |
| 0 | 493 | | var message = _pipeline.CreateMessage(); |
| 0 | 494 | | var request = message.Request; |
| 0 | 495 | | request.Method = RequestMethod.Get; |
| 0 | 496 | | var uri = new RawRequestUriBuilder(); |
| 0 | 497 | | uri.Reset(endpoint); |
| 0 | 498 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 499 | | uri.AppendPath(subscriptionId, true); |
| 0 | 500 | | uri.AppendPath("/providers/Microsoft.Network/p2svpnGateways", false); |
| 0 | 501 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 502 | | request.Uri = uri; |
| 0 | 503 | | return message; |
| | 504 | | } |
| | 505 | |
|
| | 506 | | /// <summary> Lists all the P2SVpnGateways in a subscription. </summary> |
| | 507 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 508 | | public async Task<Response<ListP2SVpnGatewaysResult>> ListAsync(CancellationToken cancellationToken = default) |
| | 509 | | { |
| 0 | 510 | | using var message = CreateListRequest(); |
| 0 | 511 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 512 | | switch (message.Response.Status) |
| | 513 | | { |
| | 514 | | case 200: |
| | 515 | | { |
| 0 | 516 | | ListP2SVpnGatewaysResult value = default; |
| 0 | 517 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 518 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 519 | | { |
| 0 | 520 | | value = null; |
| | 521 | | } |
| | 522 | | else |
| | 523 | | { |
| 0 | 524 | | value = ListP2SVpnGatewaysResult.DeserializeListP2SVpnGatewaysResult(document.RootElement); |
| | 525 | | } |
| 0 | 526 | | return Response.FromValue(value, message.Response); |
| | 527 | | } |
| | 528 | | default: |
| 0 | 529 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 530 | | } |
| 0 | 531 | | } |
| | 532 | |
|
| | 533 | | /// <summary> Lists all the P2SVpnGateways in a subscription. </summary> |
| | 534 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 535 | | public Response<ListP2SVpnGatewaysResult> List(CancellationToken cancellationToken = default) |
| | 536 | | { |
| 0 | 537 | | using var message = CreateListRequest(); |
| 0 | 538 | | _pipeline.Send(message, cancellationToken); |
| 0 | 539 | | switch (message.Response.Status) |
| | 540 | | { |
| | 541 | | case 200: |
| | 542 | | { |
| 0 | 543 | | ListP2SVpnGatewaysResult value = default; |
| 0 | 544 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 545 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 546 | | { |
| 0 | 547 | | value = null; |
| | 548 | | } |
| | 549 | | else |
| | 550 | | { |
| 0 | 551 | | value = ListP2SVpnGatewaysResult.DeserializeListP2SVpnGatewaysResult(document.RootElement); |
| | 552 | | } |
| 0 | 553 | | return Response.FromValue(value, message.Response); |
| | 554 | | } |
| | 555 | | default: |
| 0 | 556 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 557 | | } |
| 0 | 558 | | } |
| | 559 | |
|
| | 560 | | internal HttpMessage CreateGenerateVpnProfileRequest(string resourceGroupName, string gatewayName, P2SVpnProfile |
| | 561 | | { |
| 0 | 562 | | var message = _pipeline.CreateMessage(); |
| 0 | 563 | | var request = message.Request; |
| 0 | 564 | | request.Method = RequestMethod.Post; |
| 0 | 565 | | var uri = new RawRequestUriBuilder(); |
| 0 | 566 | | uri.Reset(endpoint); |
| 0 | 567 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 568 | | uri.AppendPath(subscriptionId, true); |
| 0 | 569 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 570 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 571 | | uri.AppendPath("/providers/Microsoft.Network/p2svpnGateways/", false); |
| 0 | 572 | | uri.AppendPath(gatewayName, true); |
| 0 | 573 | | uri.AppendPath("/generatevpnprofile", false); |
| 0 | 574 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 575 | | request.Uri = uri; |
| 0 | 576 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 577 | | var content = new Utf8JsonRequestContent(); |
| 0 | 578 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 579 | | request.Content = content; |
| 0 | 580 | | return message; |
| | 581 | | } |
| | 582 | |
|
| | 583 | | /// <summary> Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. </summa |
| | 584 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 585 | | /// <param name="gatewayName"> The name of the P2SVpnGateway. </param> |
| | 586 | | /// <param name="parameters"> Parameters supplied to the generate P2SVpnGateway VPN client package operation. </ |
| | 587 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 588 | | public async Task<Response> GenerateVpnProfileAsync(string resourceGroupName, string gatewayName, P2SVpnProfileP |
| | 589 | | { |
| 0 | 590 | | if (resourceGroupName == null) |
| | 591 | | { |
| 0 | 592 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 593 | | } |
| 0 | 594 | | if (gatewayName == null) |
| | 595 | | { |
| 0 | 596 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 597 | | } |
| 0 | 598 | | if (parameters == null) |
| | 599 | | { |
| 0 | 600 | | throw new ArgumentNullException(nameof(parameters)); |
| | 601 | | } |
| | 602 | |
|
| 0 | 603 | | using var message = CreateGenerateVpnProfileRequest(resourceGroupName, gatewayName, parameters); |
| 0 | 604 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 605 | | switch (message.Response.Status) |
| | 606 | | { |
| | 607 | | case 200: |
| | 608 | | case 202: |
| 0 | 609 | | return message.Response; |
| | 610 | | default: |
| 0 | 611 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 612 | | } |
| 0 | 613 | | } |
| | 614 | |
|
| | 615 | | /// <summary> Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. </summa |
| | 616 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 617 | | /// <param name="gatewayName"> The name of the P2SVpnGateway. </param> |
| | 618 | | /// <param name="parameters"> Parameters supplied to the generate P2SVpnGateway VPN client package operation. </ |
| | 619 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 620 | | public Response GenerateVpnProfile(string resourceGroupName, string gatewayName, P2SVpnProfileParameters paramet |
| | 621 | | { |
| 0 | 622 | | if (resourceGroupName == null) |
| | 623 | | { |
| 0 | 624 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 625 | | } |
| 0 | 626 | | if (gatewayName == null) |
| | 627 | | { |
| 0 | 628 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 629 | | } |
| 0 | 630 | | if (parameters == null) |
| | 631 | | { |
| 0 | 632 | | throw new ArgumentNullException(nameof(parameters)); |
| | 633 | | } |
| | 634 | |
|
| 0 | 635 | | using var message = CreateGenerateVpnProfileRequest(resourceGroupName, gatewayName, parameters); |
| 0 | 636 | | _pipeline.Send(message, cancellationToken); |
| 0 | 637 | | switch (message.Response.Status) |
| | 638 | | { |
| | 639 | | case 200: |
| | 640 | | case 202: |
| 0 | 641 | | return message.Response; |
| | 642 | | default: |
| 0 | 643 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 644 | | } |
| 0 | 645 | | } |
| | 646 | |
|
| | 647 | | internal HttpMessage CreateGetP2SVpnConnectionHealthRequest(string resourceGroupName, string gatewayName) |
| | 648 | | { |
| 0 | 649 | | var message = _pipeline.CreateMessage(); |
| 0 | 650 | | var request = message.Request; |
| 0 | 651 | | request.Method = RequestMethod.Post; |
| 0 | 652 | | var uri = new RawRequestUriBuilder(); |
| 0 | 653 | | uri.Reset(endpoint); |
| 0 | 654 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 655 | | uri.AppendPath(subscriptionId, true); |
| 0 | 656 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 657 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 658 | | uri.AppendPath("/providers/Microsoft.Network/p2svpnGateways/", false); |
| 0 | 659 | | uri.AppendPath(gatewayName, true); |
| 0 | 660 | | uri.AppendPath("/getP2sVpnConnectionHealth", false); |
| 0 | 661 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 662 | | request.Uri = uri; |
| 0 | 663 | | return message; |
| | 664 | | } |
| | 665 | |
|
| | 666 | | /// <summary> Gets the connection health of P2S clients of the virtual wan P2SVpnGateway in the specified resour |
| | 667 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 668 | | /// <param name="gatewayName"> The name of the P2SVpnGateway. </param> |
| | 669 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 670 | | public async Task<Response> GetP2SVpnConnectionHealthAsync(string resourceGroupName, string gatewayName, Cancell |
| | 671 | | { |
| 0 | 672 | | if (resourceGroupName == null) |
| | 673 | | { |
| 0 | 674 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 675 | | } |
| 0 | 676 | | if (gatewayName == null) |
| | 677 | | { |
| 0 | 678 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 679 | | } |
| | 680 | |
|
| 0 | 681 | | using var message = CreateGetP2SVpnConnectionHealthRequest(resourceGroupName, gatewayName); |
| 0 | 682 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 683 | | switch (message.Response.Status) |
| | 684 | | { |
| | 685 | | case 200: |
| | 686 | | case 202: |
| 0 | 687 | | return message.Response; |
| | 688 | | default: |
| 0 | 689 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 690 | | } |
| 0 | 691 | | } |
| | 692 | |
|
| | 693 | | /// <summary> Gets the connection health of P2S clients of the virtual wan P2SVpnGateway in the specified resour |
| | 694 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 695 | | /// <param name="gatewayName"> The name of the P2SVpnGateway. </param> |
| | 696 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 697 | | public Response GetP2SVpnConnectionHealth(string resourceGroupName, string gatewayName, CancellationToken cancel |
| | 698 | | { |
| 0 | 699 | | if (resourceGroupName == null) |
| | 700 | | { |
| 0 | 701 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 702 | | } |
| 0 | 703 | | if (gatewayName == null) |
| | 704 | | { |
| 0 | 705 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 706 | | } |
| | 707 | |
|
| 0 | 708 | | using var message = CreateGetP2SVpnConnectionHealthRequest(resourceGroupName, gatewayName); |
| 0 | 709 | | _pipeline.Send(message, cancellationToken); |
| 0 | 710 | | switch (message.Response.Status) |
| | 711 | | { |
| | 712 | | case 200: |
| | 713 | | case 202: |
| 0 | 714 | | return message.Response; |
| | 715 | | default: |
| 0 | 716 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 717 | | } |
| 0 | 718 | | } |
| | 719 | |
|
| | 720 | | internal HttpMessage CreateGetP2SVpnConnectionHealthDetailedRequest(string resourceGroupName, string gatewayName |
| | 721 | | { |
| 0 | 722 | | var message = _pipeline.CreateMessage(); |
| 0 | 723 | | var request0 = message.Request; |
| 0 | 724 | | request0.Method = RequestMethod.Post; |
| 0 | 725 | | var uri = new RawRequestUriBuilder(); |
| 0 | 726 | | uri.Reset(endpoint); |
| 0 | 727 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 728 | | uri.AppendPath(subscriptionId, true); |
| 0 | 729 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 730 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 731 | | uri.AppendPath("/providers/Microsoft.Network/p2svpnGateways/", false); |
| 0 | 732 | | uri.AppendPath(gatewayName, true); |
| 0 | 733 | | uri.AppendPath("/getP2sVpnConnectionHealthDetailed", false); |
| 0 | 734 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 735 | | request0.Uri = uri; |
| 0 | 736 | | request0.Headers.Add("Content-Type", "application/json"); |
| 0 | 737 | | var content = new Utf8JsonRequestContent(); |
| 0 | 738 | | content.JsonWriter.WriteObjectValue(request); |
| 0 | 739 | | request0.Content = content; |
| 0 | 740 | | return message; |
| | 741 | | } |
| | 742 | |
|
| | 743 | | /// <summary> Gets the sas url to get the connection health detail of P2S clients of the virtual wan P2SVpnGatew |
| | 744 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 745 | | /// <param name="gatewayName"> The name of the P2SVpnGateway. </param> |
| | 746 | | /// <param name="request"> Request parameters supplied to get p2s vpn connections detailed health. </param> |
| | 747 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 748 | | public async Task<Response> GetP2SVpnConnectionHealthDetailedAsync(string resourceGroupName, string gatewayName, |
| | 749 | | { |
| 0 | 750 | | if (resourceGroupName == null) |
| | 751 | | { |
| 0 | 752 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 753 | | } |
| 0 | 754 | | if (gatewayName == null) |
| | 755 | | { |
| 0 | 756 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 757 | | } |
| 0 | 758 | | if (request == null) |
| | 759 | | { |
| 0 | 760 | | throw new ArgumentNullException(nameof(request)); |
| | 761 | | } |
| | 762 | |
|
| 0 | 763 | | using var message = CreateGetP2SVpnConnectionHealthDetailedRequest(resourceGroupName, gatewayName, request); |
| 0 | 764 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 765 | | switch (message.Response.Status) |
| | 766 | | { |
| | 767 | | case 200: |
| | 768 | | case 202: |
| 0 | 769 | | return message.Response; |
| | 770 | | default: |
| 0 | 771 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 772 | | } |
| 0 | 773 | | } |
| | 774 | |
|
| | 775 | | /// <summary> Gets the sas url to get the connection health detail of P2S clients of the virtual wan P2SVpnGatew |
| | 776 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 777 | | /// <param name="gatewayName"> The name of the P2SVpnGateway. </param> |
| | 778 | | /// <param name="request"> Request parameters supplied to get p2s vpn connections detailed health. </param> |
| | 779 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 780 | | public Response GetP2SVpnConnectionHealthDetailed(string resourceGroupName, string gatewayName, P2SVpnConnection |
| | 781 | | { |
| 0 | 782 | | if (resourceGroupName == null) |
| | 783 | | { |
| 0 | 784 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 785 | | } |
| 0 | 786 | | if (gatewayName == null) |
| | 787 | | { |
| 0 | 788 | | throw new ArgumentNullException(nameof(gatewayName)); |
| | 789 | | } |
| 0 | 790 | | if (request == null) |
| | 791 | | { |
| 0 | 792 | | throw new ArgumentNullException(nameof(request)); |
| | 793 | | } |
| | 794 | |
|
| 0 | 795 | | using var message = CreateGetP2SVpnConnectionHealthDetailedRequest(resourceGroupName, gatewayName, request); |
| 0 | 796 | | _pipeline.Send(message, cancellationToken); |
| 0 | 797 | | switch (message.Response.Status) |
| | 798 | | { |
| | 799 | | case 200: |
| | 800 | | case 202: |
| 0 | 801 | | return message.Response; |
| | 802 | | default: |
| 0 | 803 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 804 | | } |
| 0 | 805 | | } |
| | 806 | |
|
| | 807 | | internal HttpMessage CreateDisconnectP2SVpnConnectionsRequest(string resourceGroupName, string p2SVpnGatewayName |
| | 808 | | { |
| 0 | 809 | | var message = _pipeline.CreateMessage(); |
| 0 | 810 | | var request0 = message.Request; |
| 0 | 811 | | request0.Method = RequestMethod.Post; |
| 0 | 812 | | var uri = new RawRequestUriBuilder(); |
| 0 | 813 | | uri.Reset(endpoint); |
| 0 | 814 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 815 | | uri.AppendPath(subscriptionId, true); |
| 0 | 816 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 817 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 818 | | uri.AppendPath("/providers/Microsoft.Network/p2svpnGateways/", false); |
| 0 | 819 | | uri.AppendPath(p2SVpnGatewayName, true); |
| 0 | 820 | | uri.AppendPath("/disconnectP2sVpnConnections", false); |
| 0 | 821 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 822 | | request0.Uri = uri; |
| 0 | 823 | | request0.Headers.Add("Content-Type", "application/json"); |
| 0 | 824 | | var content = new Utf8JsonRequestContent(); |
| 0 | 825 | | content.JsonWriter.WriteObjectValue(request); |
| 0 | 826 | | request0.Content = content; |
| 0 | 827 | | return message; |
| | 828 | | } |
| | 829 | |
|
| | 830 | | /// <summary> Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource group. < |
| | 831 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 832 | | /// <param name="p2SVpnGatewayName"> The name of the P2S Vpn Gateway. </param> |
| | 833 | | /// <param name="request"> The parameters are supplied to disconnect p2s vpn connections. </param> |
| | 834 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 835 | | public async Task<Response> DisconnectP2SVpnConnectionsAsync(string resourceGroupName, string p2SVpnGatewayName, |
| | 836 | | { |
| 0 | 837 | | if (resourceGroupName == null) |
| | 838 | | { |
| 0 | 839 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 840 | | } |
| 0 | 841 | | if (p2SVpnGatewayName == null) |
| | 842 | | { |
| 0 | 843 | | throw new ArgumentNullException(nameof(p2SVpnGatewayName)); |
| | 844 | | } |
| 0 | 845 | | if (request == null) |
| | 846 | | { |
| 0 | 847 | | throw new ArgumentNullException(nameof(request)); |
| | 848 | | } |
| | 849 | |
|
| 0 | 850 | | using var message = CreateDisconnectP2SVpnConnectionsRequest(resourceGroupName, p2SVpnGatewayName, request); |
| 0 | 851 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 852 | | switch (message.Response.Status) |
| | 853 | | { |
| | 854 | | case 200: |
| | 855 | | case 202: |
| 0 | 856 | | return message.Response; |
| | 857 | | default: |
| 0 | 858 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 859 | | } |
| 0 | 860 | | } |
| | 861 | |
|
| | 862 | | /// <summary> Disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified resource group. < |
| | 863 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 864 | | /// <param name="p2SVpnGatewayName"> The name of the P2S Vpn Gateway. </param> |
| | 865 | | /// <param name="request"> The parameters are supplied to disconnect p2s vpn connections. </param> |
| | 866 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 867 | | public Response DisconnectP2SVpnConnections(string resourceGroupName, string p2SVpnGatewayName, P2SVpnConnection |
| | 868 | | { |
| 0 | 869 | | if (resourceGroupName == null) |
| | 870 | | { |
| 0 | 871 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 872 | | } |
| 0 | 873 | | if (p2SVpnGatewayName == null) |
| | 874 | | { |
| 0 | 875 | | throw new ArgumentNullException(nameof(p2SVpnGatewayName)); |
| | 876 | | } |
| 0 | 877 | | if (request == null) |
| | 878 | | { |
| 0 | 879 | | throw new ArgumentNullException(nameof(request)); |
| | 880 | | } |
| | 881 | |
|
| 0 | 882 | | using var message = CreateDisconnectP2SVpnConnectionsRequest(resourceGroupName, p2SVpnGatewayName, request); |
| 0 | 883 | | _pipeline.Send(message, cancellationToken); |
| 0 | 884 | | switch (message.Response.Status) |
| | 885 | | { |
| | 886 | | case 200: |
| | 887 | | case 202: |
| 0 | 888 | | return message.Response; |
| | 889 | | default: |
| 0 | 890 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 891 | | } |
| 0 | 892 | | } |
| | 893 | |
|
| | 894 | | internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName) |
| | 895 | | { |
| 0 | 896 | | var message = _pipeline.CreateMessage(); |
| 0 | 897 | | var request = message.Request; |
| 0 | 898 | | request.Method = RequestMethod.Get; |
| 0 | 899 | | var uri = new RawRequestUriBuilder(); |
| 0 | 900 | | uri.Reset(endpoint); |
| 0 | 901 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 902 | | request.Uri = uri; |
| 0 | 903 | | return message; |
| | 904 | | } |
| | 905 | |
|
| | 906 | | /// <summary> Lists all the P2SVpnGateways in a resource group. </summary> |
| | 907 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 908 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 909 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 910 | | public async Task<Response<ListP2SVpnGatewaysResult>> ListByResourceGroupNextPageAsync(string nextLink, string r |
| | 911 | | { |
| 0 | 912 | | if (nextLink == null) |
| | 913 | | { |
| 0 | 914 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 915 | | } |
| 0 | 916 | | if (resourceGroupName == null) |
| | 917 | | { |
| 0 | 918 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 919 | | } |
| | 920 | |
|
| 0 | 921 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); |
| 0 | 922 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 923 | | switch (message.Response.Status) |
| | 924 | | { |
| | 925 | | case 200: |
| | 926 | | { |
| 0 | 927 | | ListP2SVpnGatewaysResult value = default; |
| 0 | 928 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 929 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 930 | | { |
| 0 | 931 | | value = null; |
| | 932 | | } |
| | 933 | | else |
| | 934 | | { |
| 0 | 935 | | value = ListP2SVpnGatewaysResult.DeserializeListP2SVpnGatewaysResult(document.RootElement); |
| | 936 | | } |
| 0 | 937 | | return Response.FromValue(value, message.Response); |
| | 938 | | } |
| | 939 | | default: |
| 0 | 940 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 941 | | } |
| 0 | 942 | | } |
| | 943 | |
|
| | 944 | | /// <summary> Lists all the P2SVpnGateways in a resource group. </summary> |
| | 945 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 946 | | /// <param name="resourceGroupName"> The resource group name of the P2SVpnGateway. </param> |
| | 947 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 948 | | public Response<ListP2SVpnGatewaysResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, |
| | 949 | | { |
| 0 | 950 | | if (nextLink == null) |
| | 951 | | { |
| 0 | 952 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 953 | | } |
| 0 | 954 | | if (resourceGroupName == null) |
| | 955 | | { |
| 0 | 956 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 957 | | } |
| | 958 | |
|
| 0 | 959 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName); |
| 0 | 960 | | _pipeline.Send(message, cancellationToken); |
| 0 | 961 | | switch (message.Response.Status) |
| | 962 | | { |
| | 963 | | case 200: |
| | 964 | | { |
| 0 | 965 | | ListP2SVpnGatewaysResult value = default; |
| 0 | 966 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 967 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 968 | | { |
| 0 | 969 | | value = null; |
| | 970 | | } |
| | 971 | | else |
| | 972 | | { |
| 0 | 973 | | value = ListP2SVpnGatewaysResult.DeserializeListP2SVpnGatewaysResult(document.RootElement); |
| | 974 | | } |
| 0 | 975 | | return Response.FromValue(value, message.Response); |
| | 976 | | } |
| | 977 | | default: |
| 0 | 978 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 979 | | } |
| 0 | 980 | | } |
| | 981 | |
|
| | 982 | | internal HttpMessage CreateListNextPageRequest(string nextLink) |
| | 983 | | { |
| 0 | 984 | | var message = _pipeline.CreateMessage(); |
| 0 | 985 | | var request = message.Request; |
| 0 | 986 | | request.Method = RequestMethod.Get; |
| 0 | 987 | | var uri = new RawRequestUriBuilder(); |
| 0 | 988 | | uri.Reset(endpoint); |
| 0 | 989 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 990 | | request.Uri = uri; |
| 0 | 991 | | return message; |
| | 992 | | } |
| | 993 | |
|
| | 994 | | /// <summary> Lists all the P2SVpnGateways in a subscription. </summary> |
| | 995 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 996 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 997 | | public async Task<Response<ListP2SVpnGatewaysResult>> ListNextPageAsync(string nextLink, CancellationToken cance |
| | 998 | | { |
| 0 | 999 | | if (nextLink == null) |
| | 1000 | | { |
| 0 | 1001 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1002 | | } |
| | 1003 | |
|
| 0 | 1004 | | using var message = CreateListNextPageRequest(nextLink); |
| 0 | 1005 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1006 | | switch (message.Response.Status) |
| | 1007 | | { |
| | 1008 | | case 200: |
| | 1009 | | { |
| 0 | 1010 | | ListP2SVpnGatewaysResult value = default; |
| 0 | 1011 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1012 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1013 | | { |
| 0 | 1014 | | value = null; |
| | 1015 | | } |
| | 1016 | | else |
| | 1017 | | { |
| 0 | 1018 | | value = ListP2SVpnGatewaysResult.DeserializeListP2SVpnGatewaysResult(document.RootElement); |
| | 1019 | | } |
| 0 | 1020 | | return Response.FromValue(value, message.Response); |
| | 1021 | | } |
| | 1022 | | default: |
| 0 | 1023 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1024 | | } |
| 0 | 1025 | | } |
| | 1026 | |
|
| | 1027 | | /// <summary> Lists all the P2SVpnGateways in a subscription. </summary> |
| | 1028 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1029 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1030 | | public Response<ListP2SVpnGatewaysResult> ListNextPage(string nextLink, CancellationToken cancellationToken = de |
| | 1031 | | { |
| 0 | 1032 | | if (nextLink == null) |
| | 1033 | | { |
| 0 | 1034 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1035 | | } |
| | 1036 | |
|
| 0 | 1037 | | using var message = CreateListNextPageRequest(nextLink); |
| 0 | 1038 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1039 | | switch (message.Response.Status) |
| | 1040 | | { |
| | 1041 | | case 200: |
| | 1042 | | { |
| 0 | 1043 | | ListP2SVpnGatewaysResult value = default; |
| 0 | 1044 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1045 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1046 | | { |
| 0 | 1047 | | value = null; |
| | 1048 | | } |
| | 1049 | | else |
| | 1050 | | { |
| 0 | 1051 | | value = ListP2SVpnGatewaysResult.DeserializeListP2SVpnGatewaysResult(document.RootElement); |
| | 1052 | | } |
| 0 | 1053 | | return Response.FromValue(value, message.Response); |
| | 1054 | | } |
| | 1055 | | default: |
| 0 | 1056 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1057 | | } |
| 0 | 1058 | | } |
| | 1059 | | } |
| | 1060 | | } |