| | 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 VirtualNetworkGatewaysRestOperations |
| | 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 VirtualNetworkGatewaysRestOperations. </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 |
| 36 | 32 | | public VirtualNetworkGatewaysRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string s |
| | 33 | | { |
| 36 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 36 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 36 | 40 | | this.subscriptionId = subscriptionId; |
| 36 | 41 | | this.endpoint = endpoint; |
| 36 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 36 | 43 | | _pipeline = pipeline; |
| 36 | 44 | | } |
| | 45 | |
|
| | 46 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string virtualNetworkGatewayName, Vir |
| | 47 | | { |
| 32 | 48 | | var message = _pipeline.CreateMessage(); |
| 32 | 49 | | var request = message.Request; |
| 32 | 50 | | request.Method = RequestMethod.Put; |
| 32 | 51 | | var uri = new RawRequestUriBuilder(); |
| 32 | 52 | | uri.Reset(endpoint); |
| 32 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 32 | 54 | | uri.AppendPath(subscriptionId, true); |
| 32 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 32 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 32 | 57 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 32 | 58 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 32 | 59 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 32 | 60 | | request.Uri = uri; |
| 32 | 61 | | request.Headers.Add("Content-Type", "application/json"); |
| 32 | 62 | | var content = new Utf8JsonRequestContent(); |
| 32 | 63 | | content.JsonWriter.WriteObjectValue(parameters); |
| 32 | 64 | | request.Content = content; |
| 32 | 65 | | return message; |
| | 66 | | } |
| | 67 | |
|
| | 68 | | /// <summary> Creates or updates a virtual network gateway in the specified resource group. </summary> |
| | 69 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 70 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 71 | | /// <param name="parameters"> Parameters supplied to create or update virtual network gateway operation. </param |
| | 72 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 73 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string virtualNetworkGatewayName, Virt |
| | 74 | | { |
| 8 | 75 | | if (resourceGroupName == null) |
| | 76 | | { |
| 0 | 77 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 78 | | } |
| 8 | 79 | | if (virtualNetworkGatewayName == null) |
| | 80 | | { |
| 0 | 81 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 82 | | } |
| 8 | 83 | | if (parameters == null) |
| | 84 | | { |
| 0 | 85 | | throw new ArgumentNullException(nameof(parameters)); |
| | 86 | | } |
| | 87 | |
|
| 8 | 88 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, virtualNetworkGatewayName, parameters); |
| 8 | 89 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 8 | 90 | | switch (message.Response.Status) |
| | 91 | | { |
| | 92 | | case 200: |
| | 93 | | case 201: |
| 8 | 94 | | return message.Response; |
| | 95 | | default: |
| 0 | 96 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 97 | | } |
| 8 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Creates or updates a virtual network gateway in the specified resource group. </summary> |
| | 101 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 102 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 103 | | /// <param name="parameters"> Parameters supplied to create or update virtual network gateway operation. </param |
| | 104 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 105 | | public Response CreateOrUpdate(string resourceGroupName, string virtualNetworkGatewayName, VirtualNetworkGateway |
| | 106 | | { |
| 8 | 107 | | if (resourceGroupName == null) |
| | 108 | | { |
| 0 | 109 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 110 | | } |
| 8 | 111 | | if (virtualNetworkGatewayName == null) |
| | 112 | | { |
| 0 | 113 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 114 | | } |
| 8 | 115 | | if (parameters == null) |
| | 116 | | { |
| 0 | 117 | | throw new ArgumentNullException(nameof(parameters)); |
| | 118 | | } |
| | 119 | |
|
| 8 | 120 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, virtualNetworkGatewayName, parameters); |
| 8 | 121 | | _pipeline.Send(message, cancellationToken); |
| 8 | 122 | | switch (message.Response.Status) |
| | 123 | | { |
| | 124 | | case 200: |
| | 125 | | case 201: |
| 8 | 126 | | return message.Response; |
| | 127 | | default: |
| 0 | 128 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 129 | | } |
| 8 | 130 | | } |
| | 131 | |
|
| | 132 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string virtualNetworkGatewayName) |
| | 133 | | { |
| 16 | 134 | | var message = _pipeline.CreateMessage(); |
| 16 | 135 | | var request = message.Request; |
| 16 | 136 | | request.Method = RequestMethod.Get; |
| 16 | 137 | | var uri = new RawRequestUriBuilder(); |
| 16 | 138 | | uri.Reset(endpoint); |
| 16 | 139 | | uri.AppendPath("/subscriptions/", false); |
| 16 | 140 | | uri.AppendPath(subscriptionId, true); |
| 16 | 141 | | uri.AppendPath("/resourceGroups/", false); |
| 16 | 142 | | uri.AppendPath(resourceGroupName, true); |
| 16 | 143 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 16 | 144 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 16 | 145 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 16 | 146 | | request.Uri = uri; |
| 16 | 147 | | return message; |
| | 148 | | } |
| | 149 | |
|
| | 150 | | /// <summary> Gets the specified virtual network gateway by resource group. </summary> |
| | 151 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 152 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 153 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 154 | | public async Task<Response<VirtualNetworkGateway>> GetAsync(string resourceGroupName, string virtualNetworkGatew |
| | 155 | | { |
| 8 | 156 | | if (resourceGroupName == null) |
| | 157 | | { |
| 0 | 158 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 159 | | } |
| 8 | 160 | | if (virtualNetworkGatewayName == null) |
| | 161 | | { |
| 0 | 162 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 163 | | } |
| | 164 | |
|
| 8 | 165 | | using var message = CreateGetRequest(resourceGroupName, virtualNetworkGatewayName); |
| 8 | 166 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 8 | 167 | | switch (message.Response.Status) |
| | 168 | | { |
| | 169 | | case 200: |
| | 170 | | { |
| 8 | 171 | | VirtualNetworkGateway value = default; |
| 8 | 172 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 8 | 173 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 174 | | { |
| 0 | 175 | | value = null; |
| | 176 | | } |
| | 177 | | else |
| | 178 | | { |
| 8 | 179 | | value = VirtualNetworkGateway.DeserializeVirtualNetworkGateway(document.RootElement); |
| | 180 | | } |
| 8 | 181 | | return Response.FromValue(value, message.Response); |
| | 182 | | } |
| | 183 | | default: |
| 0 | 184 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 185 | | } |
| 8 | 186 | | } |
| | 187 | |
|
| | 188 | | /// <summary> Gets the specified virtual network gateway by resource group. </summary> |
| | 189 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 190 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 191 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 192 | | public Response<VirtualNetworkGateway> Get(string resourceGroupName, string virtualNetworkGatewayName, Cancellat |
| | 193 | | { |
| 8 | 194 | | if (resourceGroupName == null) |
| | 195 | | { |
| 0 | 196 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 197 | | } |
| 8 | 198 | | if (virtualNetworkGatewayName == null) |
| | 199 | | { |
| 0 | 200 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 201 | | } |
| | 202 | |
|
| 8 | 203 | | using var message = CreateGetRequest(resourceGroupName, virtualNetworkGatewayName); |
| 8 | 204 | | _pipeline.Send(message, cancellationToken); |
| 8 | 205 | | switch (message.Response.Status) |
| | 206 | | { |
| | 207 | | case 200: |
| | 208 | | { |
| 8 | 209 | | VirtualNetworkGateway value = default; |
| 8 | 210 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 8 | 211 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| 0 | 213 | | value = null; |
| | 214 | | } |
| | 215 | | else |
| | 216 | | { |
| 8 | 217 | | value = VirtualNetworkGateway.DeserializeVirtualNetworkGateway(document.RootElement); |
| | 218 | | } |
| 8 | 219 | | return Response.FromValue(value, message.Response); |
| | 220 | | } |
| | 221 | | default: |
| 0 | 222 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 223 | | } |
| 8 | 224 | | } |
| | 225 | |
|
| | 226 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string virtualNetworkGatewayName) |
| | 227 | | { |
| 0 | 228 | | var message = _pipeline.CreateMessage(); |
| 0 | 229 | | var request = message.Request; |
| 0 | 230 | | request.Method = RequestMethod.Delete; |
| 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/virtualNetworkGateways/", false); |
| 0 | 238 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 239 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 240 | | request.Uri = uri; |
| 0 | 241 | | return message; |
| | 242 | | } |
| | 243 | |
|
| | 244 | | /// <summary> Deletes the specified virtual network gateway. </summary> |
| | 245 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 246 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 247 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 248 | | public async Task<Response> DeleteAsync(string resourceGroupName, string virtualNetworkGatewayName, Cancellation |
| | 249 | | { |
| 0 | 250 | | if (resourceGroupName == null) |
| | 251 | | { |
| 0 | 252 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 253 | | } |
| 0 | 254 | | if (virtualNetworkGatewayName == null) |
| | 255 | | { |
| 0 | 256 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 257 | | } |
| | 258 | |
|
| 0 | 259 | | using var message = CreateDeleteRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 260 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 261 | | switch (message.Response.Status) |
| | 262 | | { |
| | 263 | | case 200: |
| | 264 | | case 202: |
| | 265 | | case 204: |
| 0 | 266 | | return message.Response; |
| | 267 | | default: |
| 0 | 268 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 269 | | } |
| 0 | 270 | | } |
| | 271 | |
|
| | 272 | | /// <summary> Deletes the specified virtual network gateway. </summary> |
| | 273 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 274 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 275 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 276 | | public Response Delete(string resourceGroupName, string virtualNetworkGatewayName, CancellationToken cancellatio |
| | 277 | | { |
| 0 | 278 | | if (resourceGroupName == null) |
| | 279 | | { |
| 0 | 280 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 281 | | } |
| 0 | 282 | | if (virtualNetworkGatewayName == null) |
| | 283 | | { |
| 0 | 284 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 285 | | } |
| | 286 | |
|
| 0 | 287 | | using var message = CreateDeleteRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 288 | | _pipeline.Send(message, cancellationToken); |
| 0 | 289 | | switch (message.Response.Status) |
| | 290 | | { |
| | 291 | | case 200: |
| | 292 | | case 202: |
| | 293 | | case 204: |
| 0 | 294 | | return message.Response; |
| | 295 | | default: |
| 0 | 296 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 297 | | } |
| 0 | 298 | | } |
| | 299 | |
|
| | 300 | | internal HttpMessage CreateUpdateTagsRequest(string resourceGroupName, string virtualNetworkGatewayName, TagsObj |
| | 301 | | { |
| 0 | 302 | | var message = _pipeline.CreateMessage(); |
| 0 | 303 | | var request = message.Request; |
| 0 | 304 | | request.Method = RequestMethod.Patch; |
| 0 | 305 | | var uri = new RawRequestUriBuilder(); |
| 0 | 306 | | uri.Reset(endpoint); |
| 0 | 307 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 308 | | uri.AppendPath(subscriptionId, true); |
| 0 | 309 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 310 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 311 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 312 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 313 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 314 | | request.Uri = uri; |
| 0 | 315 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 316 | | var content = new Utf8JsonRequestContent(); |
| 0 | 317 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 318 | | request.Content = content; |
| 0 | 319 | | return message; |
| | 320 | | } |
| | 321 | |
|
| | 322 | | /// <summary> Updates a virtual network gateway tags. </summary> |
| | 323 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 324 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 325 | | /// <param name="parameters"> Parameters supplied to update virtual network gateway tags. </param> |
| | 326 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 327 | | public async Task<Response> UpdateTagsAsync(string resourceGroupName, string virtualNetworkGatewayName, TagsObje |
| | 328 | | { |
| 0 | 329 | | if (resourceGroupName == null) |
| | 330 | | { |
| 0 | 331 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 332 | | } |
| 0 | 333 | | if (virtualNetworkGatewayName == null) |
| | 334 | | { |
| 0 | 335 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 336 | | } |
| 0 | 337 | | if (parameters == null) |
| | 338 | | { |
| 0 | 339 | | throw new ArgumentNullException(nameof(parameters)); |
| | 340 | | } |
| | 341 | |
|
| 0 | 342 | | using var message = CreateUpdateTagsRequest(resourceGroupName, virtualNetworkGatewayName, parameters); |
| 0 | 343 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 344 | | switch (message.Response.Status) |
| | 345 | | { |
| | 346 | | case 200: |
| | 347 | | case 202: |
| 0 | 348 | | return message.Response; |
| | 349 | | default: |
| 0 | 350 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 351 | | } |
| 0 | 352 | | } |
| | 353 | |
|
| | 354 | | /// <summary> Updates a virtual network gateway tags. </summary> |
| | 355 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 356 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 357 | | /// <param name="parameters"> Parameters supplied to update virtual network gateway tags. </param> |
| | 358 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 359 | | public Response UpdateTags(string resourceGroupName, string virtualNetworkGatewayName, TagsObject parameters, Ca |
| | 360 | | { |
| 0 | 361 | | if (resourceGroupName == null) |
| | 362 | | { |
| 0 | 363 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 364 | | } |
| 0 | 365 | | if (virtualNetworkGatewayName == null) |
| | 366 | | { |
| 0 | 367 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 368 | | } |
| 0 | 369 | | if (parameters == null) |
| | 370 | | { |
| 0 | 371 | | throw new ArgumentNullException(nameof(parameters)); |
| | 372 | | } |
| | 373 | |
|
| 0 | 374 | | using var message = CreateUpdateTagsRequest(resourceGroupName, virtualNetworkGatewayName, parameters); |
| 0 | 375 | | _pipeline.Send(message, cancellationToken); |
| 0 | 376 | | switch (message.Response.Status) |
| | 377 | | { |
| | 378 | | case 200: |
| | 379 | | case 202: |
| 0 | 380 | | return message.Response; |
| | 381 | | default: |
| 0 | 382 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 383 | | } |
| 0 | 384 | | } |
| | 385 | |
|
| | 386 | | internal HttpMessage CreateListRequest(string resourceGroupName) |
| | 387 | | { |
| 0 | 388 | | var message = _pipeline.CreateMessage(); |
| 0 | 389 | | var request = message.Request; |
| 0 | 390 | | request.Method = RequestMethod.Get; |
| 0 | 391 | | var uri = new RawRequestUriBuilder(); |
| 0 | 392 | | uri.Reset(endpoint); |
| 0 | 393 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 394 | | uri.AppendPath(subscriptionId, true); |
| 0 | 395 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 396 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 397 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways", false); |
| 0 | 398 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 399 | | request.Uri = uri; |
| 0 | 400 | | return message; |
| | 401 | | } |
| | 402 | |
|
| | 403 | | /// <summary> Gets all virtual network gateways by resource group. </summary> |
| | 404 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 405 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 406 | | public async Task<Response<VirtualNetworkGatewayListResult>> ListAsync(string resourceGroupName, CancellationTok |
| | 407 | | { |
| 0 | 408 | | if (resourceGroupName == null) |
| | 409 | | { |
| 0 | 410 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 411 | | } |
| | 412 | |
|
| 0 | 413 | | using var message = CreateListRequest(resourceGroupName); |
| 0 | 414 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 415 | | switch (message.Response.Status) |
| | 416 | | { |
| | 417 | | case 200: |
| | 418 | | { |
| 0 | 419 | | VirtualNetworkGatewayListResult value = default; |
| 0 | 420 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 421 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 422 | | { |
| 0 | 423 | | value = null; |
| | 424 | | } |
| | 425 | | else |
| | 426 | | { |
| 0 | 427 | | value = VirtualNetworkGatewayListResult.DeserializeVirtualNetworkGatewayListResult(document. |
| | 428 | | } |
| 0 | 429 | | return Response.FromValue(value, message.Response); |
| | 430 | | } |
| | 431 | | default: |
| 0 | 432 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 433 | | } |
| 0 | 434 | | } |
| | 435 | |
|
| | 436 | | /// <summary> Gets all virtual network gateways by resource group. </summary> |
| | 437 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 438 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 439 | | public Response<VirtualNetworkGatewayListResult> List(string resourceGroupName, CancellationToken cancellationTo |
| | 440 | | { |
| 0 | 441 | | if (resourceGroupName == null) |
| | 442 | | { |
| 0 | 443 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 444 | | } |
| | 445 | |
|
| 0 | 446 | | using var message = CreateListRequest(resourceGroupName); |
| 0 | 447 | | _pipeline.Send(message, cancellationToken); |
| 0 | 448 | | switch (message.Response.Status) |
| | 449 | | { |
| | 450 | | case 200: |
| | 451 | | { |
| 0 | 452 | | VirtualNetworkGatewayListResult value = default; |
| 0 | 453 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 454 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 455 | | { |
| 0 | 456 | | value = null; |
| | 457 | | } |
| | 458 | | else |
| | 459 | | { |
| 0 | 460 | | value = VirtualNetworkGatewayListResult.DeserializeVirtualNetworkGatewayListResult(document. |
| | 461 | | } |
| 0 | 462 | | return Response.FromValue(value, message.Response); |
| | 463 | | } |
| | 464 | | default: |
| 0 | 465 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 466 | | } |
| 0 | 467 | | } |
| | 468 | |
|
| | 469 | | internal HttpMessage CreateListConnectionsRequest(string resourceGroupName, string virtualNetworkGatewayName) |
| | 470 | | { |
| 4 | 471 | | var message = _pipeline.CreateMessage(); |
| 4 | 472 | | var request = message.Request; |
| 4 | 473 | | request.Method = RequestMethod.Get; |
| 4 | 474 | | var uri = new RawRequestUriBuilder(); |
| 4 | 475 | | uri.Reset(endpoint); |
| 4 | 476 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 477 | | uri.AppendPath(subscriptionId, true); |
| 4 | 478 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 479 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 480 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 4 | 481 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 4 | 482 | | uri.AppendPath("/connections", false); |
| 4 | 483 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 4 | 484 | | request.Uri = uri; |
| 4 | 485 | | return message; |
| | 486 | | } |
| | 487 | |
|
| | 488 | | /// <summary> Gets all the connections in a virtual network gateway. </summary> |
| | 489 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 490 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 491 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 492 | | public async Task<Response<VirtualNetworkGatewayListConnectionsResult>> ListConnectionsAsync(string resourceGrou |
| | 493 | | { |
| 2 | 494 | | if (resourceGroupName == null) |
| | 495 | | { |
| 0 | 496 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 497 | | } |
| 2 | 498 | | if (virtualNetworkGatewayName == null) |
| | 499 | | { |
| 0 | 500 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 501 | | } |
| | 502 | |
|
| 2 | 503 | | using var message = CreateListConnectionsRequest(resourceGroupName, virtualNetworkGatewayName); |
| 2 | 504 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 505 | | switch (message.Response.Status) |
| | 506 | | { |
| | 507 | | case 200: |
| | 508 | | { |
| 2 | 509 | | VirtualNetworkGatewayListConnectionsResult value = default; |
| 2 | 510 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 511 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 512 | | { |
| 0 | 513 | | value = null; |
| | 514 | | } |
| | 515 | | else |
| | 516 | | { |
| 2 | 517 | | value = VirtualNetworkGatewayListConnectionsResult.DeserializeVirtualNetworkGatewayListConne |
| | 518 | | } |
| 2 | 519 | | return Response.FromValue(value, message.Response); |
| | 520 | | } |
| | 521 | | default: |
| 0 | 522 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 523 | | } |
| 2 | 524 | | } |
| | 525 | |
|
| | 526 | | /// <summary> Gets all the connections in a virtual network gateway. </summary> |
| | 527 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 528 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 529 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 530 | | public Response<VirtualNetworkGatewayListConnectionsResult> ListConnections(string resourceGroupName, string vir |
| | 531 | | { |
| 2 | 532 | | if (resourceGroupName == null) |
| | 533 | | { |
| 0 | 534 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 535 | | } |
| 2 | 536 | | if (virtualNetworkGatewayName == null) |
| | 537 | | { |
| 0 | 538 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 539 | | } |
| | 540 | |
|
| 2 | 541 | | using var message = CreateListConnectionsRequest(resourceGroupName, virtualNetworkGatewayName); |
| 2 | 542 | | _pipeline.Send(message, cancellationToken); |
| 2 | 543 | | switch (message.Response.Status) |
| | 544 | | { |
| | 545 | | case 200: |
| | 546 | | { |
| 2 | 547 | | VirtualNetworkGatewayListConnectionsResult value = default; |
| 2 | 548 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 549 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 550 | | { |
| 0 | 551 | | value = null; |
| | 552 | | } |
| | 553 | | else |
| | 554 | | { |
| 2 | 555 | | value = VirtualNetworkGatewayListConnectionsResult.DeserializeVirtualNetworkGatewayListConne |
| | 556 | | } |
| 2 | 557 | | return Response.FromValue(value, message.Response); |
| | 558 | | } |
| | 559 | | default: |
| 0 | 560 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 561 | | } |
| 2 | 562 | | } |
| | 563 | |
|
| | 564 | | internal HttpMessage CreateResetRequest(string resourceGroupName, string virtualNetworkGatewayName, string gatew |
| | 565 | | { |
| 0 | 566 | | var message = _pipeline.CreateMessage(); |
| 0 | 567 | | var request = message.Request; |
| 0 | 568 | | request.Method = RequestMethod.Post; |
| 0 | 569 | | var uri = new RawRequestUriBuilder(); |
| 0 | 570 | | uri.Reset(endpoint); |
| 0 | 571 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 572 | | uri.AppendPath(subscriptionId, true); |
| 0 | 573 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 574 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 575 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 576 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 577 | | uri.AppendPath("/reset", false); |
| 0 | 578 | | if (gatewayVip != null) |
| | 579 | | { |
| 0 | 580 | | uri.AppendQuery("gatewayVip", gatewayVip, true); |
| | 581 | | } |
| 0 | 582 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 583 | | request.Uri = uri; |
| 0 | 584 | | return message; |
| | 585 | | } |
| | 586 | |
|
| | 587 | | /// <summary> Resets the primary of the virtual network gateway in the specified resource group. </summary> |
| | 588 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 589 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 590 | | /// <param name="gatewayVip"> Virtual network gateway vip address supplied to the begin reset of the active-acti |
| | 591 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 592 | | public async Task<Response> ResetAsync(string resourceGroupName, string virtualNetworkGatewayName, string gatewa |
| | 593 | | { |
| 0 | 594 | | if (resourceGroupName == null) |
| | 595 | | { |
| 0 | 596 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 597 | | } |
| 0 | 598 | | if (virtualNetworkGatewayName == null) |
| | 599 | | { |
| 0 | 600 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 601 | | } |
| | 602 | |
|
| 0 | 603 | | using var message = CreateResetRequest(resourceGroupName, virtualNetworkGatewayName, gatewayVip); |
| 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> Resets the primary of the virtual network gateway in the specified resource group. </summary> |
| | 616 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 617 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 618 | | /// <param name="gatewayVip"> Virtual network gateway vip address supplied to the begin reset of the active-acti |
| | 619 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 620 | | public Response Reset(string resourceGroupName, string virtualNetworkGatewayName, string gatewayVip = null, Canc |
| | 621 | | { |
| 0 | 622 | | if (resourceGroupName == null) |
| | 623 | | { |
| 0 | 624 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 625 | | } |
| 0 | 626 | | if (virtualNetworkGatewayName == null) |
| | 627 | | { |
| 0 | 628 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 629 | | } |
| | 630 | |
|
| 0 | 631 | | using var message = CreateResetRequest(resourceGroupName, virtualNetworkGatewayName, gatewayVip); |
| 0 | 632 | | _pipeline.Send(message, cancellationToken); |
| 0 | 633 | | switch (message.Response.Status) |
| | 634 | | { |
| | 635 | | case 200: |
| | 636 | | case 202: |
| 0 | 637 | | return message.Response; |
| | 638 | | default: |
| 0 | 639 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 640 | | } |
| 0 | 641 | | } |
| | 642 | |
|
| | 643 | | internal HttpMessage CreateResetVpnClientSharedKeyRequest(string resourceGroupName, string virtualNetworkGateway |
| | 644 | | { |
| 0 | 645 | | var message = _pipeline.CreateMessage(); |
| 0 | 646 | | var request = message.Request; |
| 0 | 647 | | request.Method = RequestMethod.Post; |
| 0 | 648 | | var uri = new RawRequestUriBuilder(); |
| 0 | 649 | | uri.Reset(endpoint); |
| 0 | 650 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 651 | | uri.AppendPath(subscriptionId, true); |
| 0 | 652 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 653 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 654 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 655 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 656 | | uri.AppendPath("/resetvpnclientsharedkey", false); |
| 0 | 657 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 658 | | request.Uri = uri; |
| 0 | 659 | | return message; |
| | 660 | | } |
| | 661 | |
|
| | 662 | | /// <summary> Resets the VPN client shared key of the virtual network gateway in the specified resource group. < |
| | 663 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 664 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 665 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 666 | | public async Task<Response> ResetVpnClientSharedKeyAsync(string resourceGroupName, string virtualNetworkGatewayN |
| | 667 | | { |
| 0 | 668 | | if (resourceGroupName == null) |
| | 669 | | { |
| 0 | 670 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 671 | | } |
| 0 | 672 | | if (virtualNetworkGatewayName == null) |
| | 673 | | { |
| 0 | 674 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 675 | | } |
| | 676 | |
|
| 0 | 677 | | using var message = CreateResetVpnClientSharedKeyRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 678 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 679 | | switch (message.Response.Status) |
| | 680 | | { |
| | 681 | | case 200: |
| | 682 | | case 202: |
| 0 | 683 | | return message.Response; |
| | 684 | | default: |
| 0 | 685 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 686 | | } |
| 0 | 687 | | } |
| | 688 | |
|
| | 689 | | /// <summary> Resets the VPN client shared key of the virtual network gateway in the specified resource group. < |
| | 690 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 691 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 692 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 693 | | public Response ResetVpnClientSharedKey(string resourceGroupName, string virtualNetworkGatewayName, Cancellation |
| | 694 | | { |
| 0 | 695 | | if (resourceGroupName == null) |
| | 696 | | { |
| 0 | 697 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 698 | | } |
| 0 | 699 | | if (virtualNetworkGatewayName == null) |
| | 700 | | { |
| 0 | 701 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 702 | | } |
| | 703 | |
|
| 0 | 704 | | using var message = CreateResetVpnClientSharedKeyRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 705 | | _pipeline.Send(message, cancellationToken); |
| 0 | 706 | | switch (message.Response.Status) |
| | 707 | | { |
| | 708 | | case 200: |
| | 709 | | case 202: |
| 0 | 710 | | return message.Response; |
| | 711 | | default: |
| 0 | 712 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 713 | | } |
| 0 | 714 | | } |
| | 715 | |
|
| | 716 | | internal HttpMessage CreateGeneratevpnclientpackageRequest(string resourceGroupName, string virtualNetworkGatewa |
| | 717 | | { |
| 0 | 718 | | var message = _pipeline.CreateMessage(); |
| 0 | 719 | | var request = message.Request; |
| 0 | 720 | | request.Method = RequestMethod.Post; |
| 0 | 721 | | var uri = new RawRequestUriBuilder(); |
| 0 | 722 | | uri.Reset(endpoint); |
| 0 | 723 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 724 | | uri.AppendPath(subscriptionId, true); |
| 0 | 725 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 726 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 727 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 728 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 729 | | uri.AppendPath("/generatevpnclientpackage", false); |
| 0 | 730 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 731 | | request.Uri = uri; |
| 0 | 732 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 733 | | var content = new Utf8JsonRequestContent(); |
| 0 | 734 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 735 | | request.Content = content; |
| 0 | 736 | | return message; |
| | 737 | | } |
| | 738 | |
|
| | 739 | | /// <summary> Generates VPN client package for P2S client of the virtual network gateway in the specified resour |
| | 740 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 741 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 742 | | /// <param name="parameters"> Parameters supplied to the generate virtual network gateway VPN client package ope |
| | 743 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 744 | | public async Task<Response> GeneratevpnclientpackageAsync(string resourceGroupName, string virtualNetworkGateway |
| | 745 | | { |
| 0 | 746 | | if (resourceGroupName == null) |
| | 747 | | { |
| 0 | 748 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 749 | | } |
| 0 | 750 | | if (virtualNetworkGatewayName == null) |
| | 751 | | { |
| 0 | 752 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 753 | | } |
| 0 | 754 | | if (parameters == null) |
| | 755 | | { |
| 0 | 756 | | throw new ArgumentNullException(nameof(parameters)); |
| | 757 | | } |
| | 758 | |
|
| 0 | 759 | | using var message = CreateGeneratevpnclientpackageRequest(resourceGroupName, virtualNetworkGatewayName, para |
| 0 | 760 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 761 | | switch (message.Response.Status) |
| | 762 | | { |
| | 763 | | case 200: |
| | 764 | | case 202: |
| 0 | 765 | | return message.Response; |
| | 766 | | default: |
| 0 | 767 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 768 | | } |
| 0 | 769 | | } |
| | 770 | |
|
| | 771 | | /// <summary> Generates VPN client package for P2S client of the virtual network gateway in the specified resour |
| | 772 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 773 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 774 | | /// <param name="parameters"> Parameters supplied to the generate virtual network gateway VPN client package ope |
| | 775 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 776 | | public Response Generatevpnclientpackage(string resourceGroupName, string virtualNetworkGatewayName, VpnClientPa |
| | 777 | | { |
| 0 | 778 | | if (resourceGroupName == null) |
| | 779 | | { |
| 0 | 780 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 781 | | } |
| 0 | 782 | | if (virtualNetworkGatewayName == null) |
| | 783 | | { |
| 0 | 784 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 785 | | } |
| 0 | 786 | | if (parameters == null) |
| | 787 | | { |
| 0 | 788 | | throw new ArgumentNullException(nameof(parameters)); |
| | 789 | | } |
| | 790 | |
|
| 0 | 791 | | using var message = CreateGeneratevpnclientpackageRequest(resourceGroupName, virtualNetworkGatewayName, para |
| 0 | 792 | | _pipeline.Send(message, cancellationToken); |
| 0 | 793 | | switch (message.Response.Status) |
| | 794 | | { |
| | 795 | | case 200: |
| | 796 | | case 202: |
| 0 | 797 | | return message.Response; |
| | 798 | | default: |
| 0 | 799 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 800 | | } |
| 0 | 801 | | } |
| | 802 | |
|
| | 803 | | internal HttpMessage CreateGenerateVpnProfileRequest(string resourceGroupName, string virtualNetworkGatewayName, |
| | 804 | | { |
| 0 | 805 | | var message = _pipeline.CreateMessage(); |
| 0 | 806 | | var request = message.Request; |
| 0 | 807 | | request.Method = RequestMethod.Post; |
| 0 | 808 | | var uri = new RawRequestUriBuilder(); |
| 0 | 809 | | uri.Reset(endpoint); |
| 0 | 810 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 811 | | uri.AppendPath(subscriptionId, true); |
| 0 | 812 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 813 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 814 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 815 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 816 | | uri.AppendPath("/generatevpnprofile", false); |
| 0 | 817 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 818 | | request.Uri = uri; |
| 0 | 819 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 820 | | var content = new Utf8JsonRequestContent(); |
| 0 | 821 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 822 | | request.Content = content; |
| 0 | 823 | | return message; |
| | 824 | | } |
| | 825 | |
|
| | 826 | | /// <summary> Generates VPN profile for P2S client of the virtual network gateway in the specified resource grou |
| | 827 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 828 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 829 | | /// <param name="parameters"> Parameters supplied to the generate virtual network gateway VPN client package ope |
| | 830 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 831 | | public async Task<Response> GenerateVpnProfileAsync(string resourceGroupName, string virtualNetworkGatewayName, |
| | 832 | | { |
| 0 | 833 | | if (resourceGroupName == null) |
| | 834 | | { |
| 0 | 835 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 836 | | } |
| 0 | 837 | | if (virtualNetworkGatewayName == null) |
| | 838 | | { |
| 0 | 839 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 840 | | } |
| 0 | 841 | | if (parameters == null) |
| | 842 | | { |
| 0 | 843 | | throw new ArgumentNullException(nameof(parameters)); |
| | 844 | | } |
| | 845 | |
|
| 0 | 846 | | using var message = CreateGenerateVpnProfileRequest(resourceGroupName, virtualNetworkGatewayName, parameters |
| 0 | 847 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 848 | | switch (message.Response.Status) |
| | 849 | | { |
| | 850 | | case 200: |
| | 851 | | case 202: |
| 0 | 852 | | return message.Response; |
| | 853 | | default: |
| 0 | 854 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 855 | | } |
| 0 | 856 | | } |
| | 857 | |
|
| | 858 | | /// <summary> Generates VPN profile for P2S client of the virtual network gateway in the specified resource grou |
| | 859 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 860 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 861 | | /// <param name="parameters"> Parameters supplied to the generate virtual network gateway VPN client package ope |
| | 862 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 863 | | public Response GenerateVpnProfile(string resourceGroupName, string virtualNetworkGatewayName, VpnClientParamete |
| | 864 | | { |
| 0 | 865 | | if (resourceGroupName == null) |
| | 866 | | { |
| 0 | 867 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 868 | | } |
| 0 | 869 | | if (virtualNetworkGatewayName == null) |
| | 870 | | { |
| 0 | 871 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 872 | | } |
| 0 | 873 | | if (parameters == null) |
| | 874 | | { |
| 0 | 875 | | throw new ArgumentNullException(nameof(parameters)); |
| | 876 | | } |
| | 877 | |
|
| 0 | 878 | | using var message = CreateGenerateVpnProfileRequest(resourceGroupName, virtualNetworkGatewayName, parameters |
| 0 | 879 | | _pipeline.Send(message, cancellationToken); |
| 0 | 880 | | switch (message.Response.Status) |
| | 881 | | { |
| | 882 | | case 200: |
| | 883 | | case 202: |
| 0 | 884 | | return message.Response; |
| | 885 | | default: |
| 0 | 886 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 887 | | } |
| 0 | 888 | | } |
| | 889 | |
|
| | 890 | | internal HttpMessage CreateGetVpnProfilePackageUrlRequest(string resourceGroupName, string virtualNetworkGateway |
| | 891 | | { |
| 0 | 892 | | var message = _pipeline.CreateMessage(); |
| 0 | 893 | | var request = message.Request; |
| 0 | 894 | | request.Method = RequestMethod.Post; |
| 0 | 895 | | var uri = new RawRequestUriBuilder(); |
| 0 | 896 | | uri.Reset(endpoint); |
| 0 | 897 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 898 | | uri.AppendPath(subscriptionId, true); |
| 0 | 899 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 900 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 901 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 902 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 903 | | uri.AppendPath("/getvpnprofilepackageurl", false); |
| 0 | 904 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 905 | | request.Uri = uri; |
| 0 | 906 | | return message; |
| | 907 | | } |
| | 908 | |
|
| | 909 | | /// <summary> Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified reso |
| | 910 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 911 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 912 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 913 | | public async Task<Response> GetVpnProfilePackageUrlAsync(string resourceGroupName, string virtualNetworkGatewayN |
| | 914 | | { |
| 0 | 915 | | if (resourceGroupName == null) |
| | 916 | | { |
| 0 | 917 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 918 | | } |
| 0 | 919 | | if (virtualNetworkGatewayName == null) |
| | 920 | | { |
| 0 | 921 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 922 | | } |
| | 923 | |
|
| 0 | 924 | | using var message = CreateGetVpnProfilePackageUrlRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 925 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 926 | | switch (message.Response.Status) |
| | 927 | | { |
| | 928 | | case 200: |
| | 929 | | case 202: |
| 0 | 930 | | return message.Response; |
| | 931 | | default: |
| 0 | 932 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 933 | | } |
| 0 | 934 | | } |
| | 935 | |
|
| | 936 | | /// <summary> Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified reso |
| | 937 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 938 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 939 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 940 | | public Response GetVpnProfilePackageUrl(string resourceGroupName, string virtualNetworkGatewayName, Cancellation |
| | 941 | | { |
| 0 | 942 | | if (resourceGroupName == null) |
| | 943 | | { |
| 0 | 944 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 945 | | } |
| 0 | 946 | | if (virtualNetworkGatewayName == null) |
| | 947 | | { |
| 0 | 948 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 949 | | } |
| | 950 | |
|
| 0 | 951 | | using var message = CreateGetVpnProfilePackageUrlRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 952 | | _pipeline.Send(message, cancellationToken); |
| 0 | 953 | | switch (message.Response.Status) |
| | 954 | | { |
| | 955 | | case 200: |
| | 956 | | case 202: |
| 0 | 957 | | return message.Response; |
| | 958 | | default: |
| 0 | 959 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 960 | | } |
| 0 | 961 | | } |
| | 962 | |
|
| | 963 | | internal HttpMessage CreateGetBgpPeerStatusRequest(string resourceGroupName, string virtualNetworkGatewayName, s |
| | 964 | | { |
| 0 | 965 | | var message = _pipeline.CreateMessage(); |
| 0 | 966 | | var request = message.Request; |
| 0 | 967 | | request.Method = RequestMethod.Post; |
| 0 | 968 | | var uri = new RawRequestUriBuilder(); |
| 0 | 969 | | uri.Reset(endpoint); |
| 0 | 970 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 971 | | uri.AppendPath(subscriptionId, true); |
| 0 | 972 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 973 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 974 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 975 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 976 | | uri.AppendPath("/getBgpPeerStatus", false); |
| 0 | 977 | | if (peer != null) |
| | 978 | | { |
| 0 | 979 | | uri.AppendQuery("peer", peer, true); |
| | 980 | | } |
| 0 | 981 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 982 | | request.Uri = uri; |
| 0 | 983 | | return message; |
| | 984 | | } |
| | 985 | |
|
| | 986 | | /// <summary> The GetBgpPeerStatus operation retrieves the status of all BGP peers. </summary> |
| | 987 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 988 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 989 | | /// <param name="peer"> The IP address of the peer to retrieve the status of. </param> |
| | 990 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 991 | | public async Task<Response> GetBgpPeerStatusAsync(string resourceGroupName, string virtualNetworkGatewayName, st |
| | 992 | | { |
| 0 | 993 | | if (resourceGroupName == null) |
| | 994 | | { |
| 0 | 995 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 996 | | } |
| 0 | 997 | | if (virtualNetworkGatewayName == null) |
| | 998 | | { |
| 0 | 999 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1000 | | } |
| | 1001 | |
|
| 0 | 1002 | | using var message = CreateGetBgpPeerStatusRequest(resourceGroupName, virtualNetworkGatewayName, peer); |
| 0 | 1003 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1004 | | switch (message.Response.Status) |
| | 1005 | | { |
| | 1006 | | case 200: |
| | 1007 | | case 202: |
| 0 | 1008 | | return message.Response; |
| | 1009 | | default: |
| 0 | 1010 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1011 | | } |
| 0 | 1012 | | } |
| | 1013 | |
|
| | 1014 | | /// <summary> The GetBgpPeerStatus operation retrieves the status of all BGP peers. </summary> |
| | 1015 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1016 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1017 | | /// <param name="peer"> The IP address of the peer to retrieve the status of. </param> |
| | 1018 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1019 | | public Response GetBgpPeerStatus(string resourceGroupName, string virtualNetworkGatewayName, string peer = null, |
| | 1020 | | { |
| 0 | 1021 | | if (resourceGroupName == null) |
| | 1022 | | { |
| 0 | 1023 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1024 | | } |
| 0 | 1025 | | if (virtualNetworkGatewayName == null) |
| | 1026 | | { |
| 0 | 1027 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1028 | | } |
| | 1029 | |
|
| 0 | 1030 | | using var message = CreateGetBgpPeerStatusRequest(resourceGroupName, virtualNetworkGatewayName, peer); |
| 0 | 1031 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1032 | | switch (message.Response.Status) |
| | 1033 | | { |
| | 1034 | | case 200: |
| | 1035 | | case 202: |
| 0 | 1036 | | return message.Response; |
| | 1037 | | default: |
| 0 | 1038 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1039 | | } |
| 0 | 1040 | | } |
| | 1041 | |
|
| | 1042 | | internal HttpMessage CreateSupportedVpnDevicesRequest(string resourceGroupName, string virtualNetworkGatewayName |
| | 1043 | | { |
| 0 | 1044 | | var message = _pipeline.CreateMessage(); |
| 0 | 1045 | | var request = message.Request; |
| 0 | 1046 | | request.Method = RequestMethod.Post; |
| 0 | 1047 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1048 | | uri.Reset(endpoint); |
| 0 | 1049 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1050 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1051 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1052 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1053 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 1054 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 1055 | | uri.AppendPath("/supportedvpndevices", false); |
| 0 | 1056 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 1057 | | request.Uri = uri; |
| 0 | 1058 | | return message; |
| | 1059 | | } |
| | 1060 | |
|
| | 1061 | | /// <summary> Gets a xml format representation for supported vpn devices. </summary> |
| | 1062 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1063 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1064 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1065 | | public async Task<Response<string>> SupportedVpnDevicesAsync(string resourceGroupName, string virtualNetworkGate |
| | 1066 | | { |
| 0 | 1067 | | if (resourceGroupName == null) |
| | 1068 | | { |
| 0 | 1069 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1070 | | } |
| 0 | 1071 | | if (virtualNetworkGatewayName == null) |
| | 1072 | | { |
| 0 | 1073 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1074 | | } |
| | 1075 | |
|
| 0 | 1076 | | using var message = CreateSupportedVpnDevicesRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 1077 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1078 | | switch (message.Response.Status) |
| | 1079 | | { |
| | 1080 | | case 200: |
| | 1081 | | { |
| 0 | 1082 | | string value = default; |
| 0 | 1083 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1084 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1085 | | { |
| 0 | 1086 | | value = null; |
| | 1087 | | } |
| | 1088 | | else |
| | 1089 | | { |
| 0 | 1090 | | value = document.RootElement.GetString(); |
| | 1091 | | } |
| 0 | 1092 | | return Response.FromValue(value, message.Response); |
| | 1093 | | } |
| | 1094 | | default: |
| 0 | 1095 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1096 | | } |
| 0 | 1097 | | } |
| | 1098 | |
|
| | 1099 | | /// <summary> Gets a xml format representation for supported vpn devices. </summary> |
| | 1100 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1101 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1102 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1103 | | public Response<string> SupportedVpnDevices(string resourceGroupName, string virtualNetworkGatewayName, Cancella |
| | 1104 | | { |
| 0 | 1105 | | if (resourceGroupName == null) |
| | 1106 | | { |
| 0 | 1107 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1108 | | } |
| 0 | 1109 | | if (virtualNetworkGatewayName == null) |
| | 1110 | | { |
| 0 | 1111 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1112 | | } |
| | 1113 | |
|
| 0 | 1114 | | using var message = CreateSupportedVpnDevicesRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 1115 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1116 | | switch (message.Response.Status) |
| | 1117 | | { |
| | 1118 | | case 200: |
| | 1119 | | { |
| 0 | 1120 | | string value = default; |
| 0 | 1121 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1122 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1123 | | { |
| 0 | 1124 | | value = null; |
| | 1125 | | } |
| | 1126 | | else |
| | 1127 | | { |
| 0 | 1128 | | value = document.RootElement.GetString(); |
| | 1129 | | } |
| 0 | 1130 | | return Response.FromValue(value, message.Response); |
| | 1131 | | } |
| | 1132 | | default: |
| 0 | 1133 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1134 | | } |
| 0 | 1135 | | } |
| | 1136 | |
|
| | 1137 | | internal HttpMessage CreateGetLearnedRoutesRequest(string resourceGroupName, string virtualNetworkGatewayName) |
| | 1138 | | { |
| 0 | 1139 | | var message = _pipeline.CreateMessage(); |
| 0 | 1140 | | var request = message.Request; |
| 0 | 1141 | | request.Method = RequestMethod.Post; |
| 0 | 1142 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1143 | | uri.Reset(endpoint); |
| 0 | 1144 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1145 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1146 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1147 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1148 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 1149 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 1150 | | uri.AppendPath("/getLearnedRoutes", false); |
| 0 | 1151 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 1152 | | request.Uri = uri; |
| 0 | 1153 | | return message; |
| | 1154 | | } |
| | 1155 | |
|
| | 1156 | | /// <summary> This operation retrieves a list of routes the virtual network gateway has learned, including route |
| | 1157 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1158 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1159 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1160 | | public async Task<Response> GetLearnedRoutesAsync(string resourceGroupName, string virtualNetworkGatewayName, Ca |
| | 1161 | | { |
| 0 | 1162 | | if (resourceGroupName == null) |
| | 1163 | | { |
| 0 | 1164 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1165 | | } |
| 0 | 1166 | | if (virtualNetworkGatewayName == null) |
| | 1167 | | { |
| 0 | 1168 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1169 | | } |
| | 1170 | |
|
| 0 | 1171 | | using var message = CreateGetLearnedRoutesRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 1172 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1173 | | switch (message.Response.Status) |
| | 1174 | | { |
| | 1175 | | case 200: |
| | 1176 | | case 202: |
| 0 | 1177 | | return message.Response; |
| | 1178 | | default: |
| 0 | 1179 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1180 | | } |
| 0 | 1181 | | } |
| | 1182 | |
|
| | 1183 | | /// <summary> This operation retrieves a list of routes the virtual network gateway has learned, including route |
| | 1184 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1185 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1186 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1187 | | public Response GetLearnedRoutes(string resourceGroupName, string virtualNetworkGatewayName, CancellationToken c |
| | 1188 | | { |
| 0 | 1189 | | if (resourceGroupName == null) |
| | 1190 | | { |
| 0 | 1191 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1192 | | } |
| 0 | 1193 | | if (virtualNetworkGatewayName == null) |
| | 1194 | | { |
| 0 | 1195 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1196 | | } |
| | 1197 | |
|
| 0 | 1198 | | using var message = CreateGetLearnedRoutesRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 1199 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1200 | | switch (message.Response.Status) |
| | 1201 | | { |
| | 1202 | | case 200: |
| | 1203 | | case 202: |
| 0 | 1204 | | return message.Response; |
| | 1205 | | default: |
| 0 | 1206 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1207 | | } |
| 0 | 1208 | | } |
| | 1209 | |
|
| | 1210 | | internal HttpMessage CreateGetAdvertisedRoutesRequest(string resourceGroupName, string virtualNetworkGatewayName |
| | 1211 | | { |
| 0 | 1212 | | var message = _pipeline.CreateMessage(); |
| 0 | 1213 | | var request = message.Request; |
| 0 | 1214 | | request.Method = RequestMethod.Post; |
| 0 | 1215 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1216 | | uri.Reset(endpoint); |
| 0 | 1217 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1218 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1219 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1220 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1221 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 1222 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 1223 | | uri.AppendPath("/getAdvertisedRoutes", false); |
| 0 | 1224 | | uri.AppendQuery("peer", peer, true); |
| 0 | 1225 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 1226 | | request.Uri = uri; |
| 0 | 1227 | | return message; |
| | 1228 | | } |
| | 1229 | |
|
| | 1230 | | /// <summary> This operation retrieves a list of routes the virtual network gateway is advertising to the specif |
| | 1231 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1232 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1233 | | /// <param name="peer"> The IP address of the peer. </param> |
| | 1234 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1235 | | public async Task<Response> GetAdvertisedRoutesAsync(string resourceGroupName, string virtualNetworkGatewayName, |
| | 1236 | | { |
| 0 | 1237 | | if (resourceGroupName == null) |
| | 1238 | | { |
| 0 | 1239 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1240 | | } |
| 0 | 1241 | | if (virtualNetworkGatewayName == null) |
| | 1242 | | { |
| 0 | 1243 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1244 | | } |
| 0 | 1245 | | if (peer == null) |
| | 1246 | | { |
| 0 | 1247 | | throw new ArgumentNullException(nameof(peer)); |
| | 1248 | | } |
| | 1249 | |
|
| 0 | 1250 | | using var message = CreateGetAdvertisedRoutesRequest(resourceGroupName, virtualNetworkGatewayName, peer); |
| 0 | 1251 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1252 | | switch (message.Response.Status) |
| | 1253 | | { |
| | 1254 | | case 200: |
| | 1255 | | case 202: |
| 0 | 1256 | | return message.Response; |
| | 1257 | | default: |
| 0 | 1258 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1259 | | } |
| 0 | 1260 | | } |
| | 1261 | |
|
| | 1262 | | /// <summary> This operation retrieves a list of routes the virtual network gateway is advertising to the specif |
| | 1263 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1264 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1265 | | /// <param name="peer"> The IP address of the peer. </param> |
| | 1266 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1267 | | public Response GetAdvertisedRoutes(string resourceGroupName, string virtualNetworkGatewayName, string peer, Can |
| | 1268 | | { |
| 0 | 1269 | | if (resourceGroupName == null) |
| | 1270 | | { |
| 0 | 1271 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1272 | | } |
| 0 | 1273 | | if (virtualNetworkGatewayName == null) |
| | 1274 | | { |
| 0 | 1275 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1276 | | } |
| 0 | 1277 | | if (peer == null) |
| | 1278 | | { |
| 0 | 1279 | | throw new ArgumentNullException(nameof(peer)); |
| | 1280 | | } |
| | 1281 | |
|
| 0 | 1282 | | using var message = CreateGetAdvertisedRoutesRequest(resourceGroupName, virtualNetworkGatewayName, peer); |
| 0 | 1283 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1284 | | switch (message.Response.Status) |
| | 1285 | | { |
| | 1286 | | case 200: |
| | 1287 | | case 202: |
| 0 | 1288 | | return message.Response; |
| | 1289 | | default: |
| 0 | 1290 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1291 | | } |
| 0 | 1292 | | } |
| | 1293 | |
|
| | 1294 | | internal HttpMessage CreateSetVpnclientIpsecParametersRequest(string resourceGroupName, string virtualNetworkGat |
| | 1295 | | { |
| 0 | 1296 | | var message = _pipeline.CreateMessage(); |
| 0 | 1297 | | var request = message.Request; |
| 0 | 1298 | | request.Method = RequestMethod.Post; |
| 0 | 1299 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1300 | | uri.Reset(endpoint); |
| 0 | 1301 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1302 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1303 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1304 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1305 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 1306 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 1307 | | uri.AppendPath("/setvpnclientipsecparameters", false); |
| 0 | 1308 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 1309 | | request.Uri = uri; |
| 0 | 1310 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 1311 | | var content = new Utf8JsonRequestContent(); |
| 0 | 1312 | | content.JsonWriter.WriteObjectValue(vpnclientIpsecParams); |
| 0 | 1313 | | request.Content = content; |
| 0 | 1314 | | return message; |
| | 1315 | | } |
| | 1316 | |
|
| | 1317 | | /// <summary> The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtu |
| | 1318 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1319 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1320 | | /// <param name="vpnclientIpsecParams"> Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtu |
| | 1321 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1322 | | public async Task<Response> SetVpnclientIpsecParametersAsync(string resourceGroupName, string virtualNetworkGate |
| | 1323 | | { |
| 0 | 1324 | | if (resourceGroupName == null) |
| | 1325 | | { |
| 0 | 1326 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1327 | | } |
| 0 | 1328 | | if (virtualNetworkGatewayName == null) |
| | 1329 | | { |
| 0 | 1330 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1331 | | } |
| 0 | 1332 | | if (vpnclientIpsecParams == null) |
| | 1333 | | { |
| 0 | 1334 | | throw new ArgumentNullException(nameof(vpnclientIpsecParams)); |
| | 1335 | | } |
| | 1336 | |
|
| 0 | 1337 | | using var message = CreateSetVpnclientIpsecParametersRequest(resourceGroupName, virtualNetworkGatewayName, v |
| 0 | 1338 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1339 | | switch (message.Response.Status) |
| | 1340 | | { |
| | 1341 | | case 200: |
| | 1342 | | case 202: |
| 0 | 1343 | | return message.Response; |
| | 1344 | | default: |
| 0 | 1345 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1346 | | } |
| 0 | 1347 | | } |
| | 1348 | |
|
| | 1349 | | /// <summary> The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtu |
| | 1350 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1351 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1352 | | /// <param name="vpnclientIpsecParams"> Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtu |
| | 1353 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1354 | | public Response SetVpnclientIpsecParameters(string resourceGroupName, string virtualNetworkGatewayName, VpnClien |
| | 1355 | | { |
| 0 | 1356 | | if (resourceGroupName == null) |
| | 1357 | | { |
| 0 | 1358 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1359 | | } |
| 0 | 1360 | | if (virtualNetworkGatewayName == null) |
| | 1361 | | { |
| 0 | 1362 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1363 | | } |
| 0 | 1364 | | if (vpnclientIpsecParams == null) |
| | 1365 | | { |
| 0 | 1366 | | throw new ArgumentNullException(nameof(vpnclientIpsecParams)); |
| | 1367 | | } |
| | 1368 | |
|
| 0 | 1369 | | using var message = CreateSetVpnclientIpsecParametersRequest(resourceGroupName, virtualNetworkGatewayName, v |
| 0 | 1370 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1371 | | switch (message.Response.Status) |
| | 1372 | | { |
| | 1373 | | case 200: |
| | 1374 | | case 202: |
| 0 | 1375 | | return message.Response; |
| | 1376 | | default: |
| 0 | 1377 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1378 | | } |
| 0 | 1379 | | } |
| | 1380 | |
|
| | 1381 | | internal HttpMessage CreateGetVpnclientIpsecParametersRequest(string resourceGroupName, string virtualNetworkGat |
| | 1382 | | { |
| 0 | 1383 | | var message = _pipeline.CreateMessage(); |
| 0 | 1384 | | var request = message.Request; |
| 0 | 1385 | | request.Method = RequestMethod.Post; |
| 0 | 1386 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1387 | | uri.Reset(endpoint); |
| 0 | 1388 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1389 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1390 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1391 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1392 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 1393 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 1394 | | uri.AppendPath("/getvpnclientipsecparameters", false); |
| 0 | 1395 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 1396 | | request.Uri = uri; |
| 0 | 1397 | | return message; |
| | 1398 | | } |
| | 1399 | |
|
| | 1400 | | /// <summary> The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec policy |
| | 1401 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1402 | | /// <param name="virtualNetworkGatewayName"> The virtual network gateway name. </param> |
| | 1403 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1404 | | public async Task<Response> GetVpnclientIpsecParametersAsync(string resourceGroupName, string virtualNetworkGate |
| | 1405 | | { |
| 0 | 1406 | | if (resourceGroupName == null) |
| | 1407 | | { |
| 0 | 1408 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1409 | | } |
| 0 | 1410 | | if (virtualNetworkGatewayName == null) |
| | 1411 | | { |
| 0 | 1412 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1413 | | } |
| | 1414 | |
|
| 0 | 1415 | | using var message = CreateGetVpnclientIpsecParametersRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 1416 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1417 | | switch (message.Response.Status) |
| | 1418 | | { |
| | 1419 | | case 200: |
| 0 | 1420 | | return message.Response; |
| | 1421 | | default: |
| 0 | 1422 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1423 | | } |
| 0 | 1424 | | } |
| | 1425 | |
|
| | 1426 | | /// <summary> The Get VpnclientIpsecParameters operation retrieves information about the vpnclient ipsec policy |
| | 1427 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1428 | | /// <param name="virtualNetworkGatewayName"> The virtual network gateway name. </param> |
| | 1429 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1430 | | public Response GetVpnclientIpsecParameters(string resourceGroupName, string virtualNetworkGatewayName, Cancella |
| | 1431 | | { |
| 0 | 1432 | | if (resourceGroupName == null) |
| | 1433 | | { |
| 0 | 1434 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1435 | | } |
| 0 | 1436 | | if (virtualNetworkGatewayName == null) |
| | 1437 | | { |
| 0 | 1438 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1439 | | } |
| | 1440 | |
|
| 0 | 1441 | | using var message = CreateGetVpnclientIpsecParametersRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 1442 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1443 | | switch (message.Response.Status) |
| | 1444 | | { |
| | 1445 | | case 200: |
| 0 | 1446 | | return message.Response; |
| | 1447 | | default: |
| 0 | 1448 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1449 | | } |
| 0 | 1450 | | } |
| | 1451 | |
|
| | 1452 | | internal HttpMessage CreateVpnDeviceConfigurationScriptRequest(string resourceGroupName, string virtualNetworkGa |
| | 1453 | | { |
| 0 | 1454 | | var message = _pipeline.CreateMessage(); |
| 0 | 1455 | | var request = message.Request; |
| 0 | 1456 | | request.Method = RequestMethod.Post; |
| 0 | 1457 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1458 | | uri.Reset(endpoint); |
| 0 | 1459 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1460 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1461 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1462 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1463 | | uri.AppendPath("/providers/Microsoft.Network/connections/", false); |
| 0 | 1464 | | uri.AppendPath(virtualNetworkGatewayConnectionName, true); |
| 0 | 1465 | | uri.AppendPath("/vpndeviceconfigurationscript", false); |
| 0 | 1466 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 1467 | | request.Uri = uri; |
| 0 | 1468 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 1469 | | var content = new Utf8JsonRequestContent(); |
| 0 | 1470 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 1471 | | request.Content = content; |
| 0 | 1472 | | return message; |
| | 1473 | | } |
| | 1474 | |
|
| | 1475 | | /// <summary> Gets a xml format representation for vpn device configuration script. </summary> |
| | 1476 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1477 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection for wh |
| | 1478 | | /// <param name="parameters"> Parameters supplied to the generate vpn device script operation. </param> |
| | 1479 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1480 | | public async Task<Response<string>> VpnDeviceConfigurationScriptAsync(string resourceGroupName, string virtualNe |
| | 1481 | | { |
| 0 | 1482 | | if (resourceGroupName == null) |
| | 1483 | | { |
| 0 | 1484 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1485 | | } |
| 0 | 1486 | | if (virtualNetworkGatewayConnectionName == null) |
| | 1487 | | { |
| 0 | 1488 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 1489 | | } |
| 0 | 1490 | | if (parameters == null) |
| | 1491 | | { |
| 0 | 1492 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1493 | | } |
| | 1494 | |
|
| 0 | 1495 | | using var message = CreateVpnDeviceConfigurationScriptRequest(resourceGroupName, virtualNetworkGatewayConnec |
| 0 | 1496 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1497 | | switch (message.Response.Status) |
| | 1498 | | { |
| | 1499 | | case 200: |
| | 1500 | | { |
| 0 | 1501 | | string value = default; |
| 0 | 1502 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1503 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1504 | | { |
| 0 | 1505 | | value = null; |
| | 1506 | | } |
| | 1507 | | else |
| | 1508 | | { |
| 0 | 1509 | | value = document.RootElement.GetString(); |
| | 1510 | | } |
| 0 | 1511 | | return Response.FromValue(value, message.Response); |
| | 1512 | | } |
| | 1513 | | default: |
| 0 | 1514 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1515 | | } |
| 0 | 1516 | | } |
| | 1517 | |
|
| | 1518 | | /// <summary> Gets a xml format representation for vpn device configuration script. </summary> |
| | 1519 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1520 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection for wh |
| | 1521 | | /// <param name="parameters"> Parameters supplied to the generate vpn device script operation. </param> |
| | 1522 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1523 | | public Response<string> VpnDeviceConfigurationScript(string resourceGroupName, string virtualNetworkGatewayConne |
| | 1524 | | { |
| 0 | 1525 | | if (resourceGroupName == null) |
| | 1526 | | { |
| 0 | 1527 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1528 | | } |
| 0 | 1529 | | if (virtualNetworkGatewayConnectionName == null) |
| | 1530 | | { |
| 0 | 1531 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 1532 | | } |
| 0 | 1533 | | if (parameters == null) |
| | 1534 | | { |
| 0 | 1535 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1536 | | } |
| | 1537 | |
|
| 0 | 1538 | | using var message = CreateVpnDeviceConfigurationScriptRequest(resourceGroupName, virtualNetworkGatewayConnec |
| 0 | 1539 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1540 | | switch (message.Response.Status) |
| | 1541 | | { |
| | 1542 | | case 200: |
| | 1543 | | { |
| 0 | 1544 | | string value = default; |
| 0 | 1545 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1546 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1547 | | { |
| 0 | 1548 | | value = null; |
| | 1549 | | } |
| | 1550 | | else |
| | 1551 | | { |
| 0 | 1552 | | value = document.RootElement.GetString(); |
| | 1553 | | } |
| 0 | 1554 | | return Response.FromValue(value, message.Response); |
| | 1555 | | } |
| | 1556 | | default: |
| 0 | 1557 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1558 | | } |
| 0 | 1559 | | } |
| | 1560 | |
|
| | 1561 | | internal HttpMessage CreateStartPacketCaptureRequest(string resourceGroupName, string virtualNetworkGatewayName, |
| | 1562 | | { |
| 0 | 1563 | | var message = _pipeline.CreateMessage(); |
| 0 | 1564 | | var request = message.Request; |
| 0 | 1565 | | request.Method = RequestMethod.Post; |
| 0 | 1566 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1567 | | uri.Reset(endpoint); |
| 0 | 1568 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1569 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1570 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1571 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1572 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 1573 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 1574 | | uri.AppendPath("/startPacketCapture", false); |
| 0 | 1575 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 1576 | | request.Uri = uri; |
| 0 | 1577 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 1578 | | if (parameters != null) |
| | 1579 | | { |
| 0 | 1580 | | var content = new Utf8JsonRequestContent(); |
| 0 | 1581 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 1582 | | request.Content = content; |
| | 1583 | | } |
| 0 | 1584 | | return message; |
| | 1585 | | } |
| | 1586 | |
|
| | 1587 | | /// <summary> Starts packet capture on virtual network gateway in the specified resource group. </summary> |
| | 1588 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1589 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1590 | | /// <param name="parameters"> Virtual network gateway packet capture parameters supplied to start packet capture |
| | 1591 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1592 | | public async Task<Response> StartPacketCaptureAsync(string resourceGroupName, string virtualNetworkGatewayName, |
| | 1593 | | { |
| 0 | 1594 | | if (resourceGroupName == null) |
| | 1595 | | { |
| 0 | 1596 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1597 | | } |
| 0 | 1598 | | if (virtualNetworkGatewayName == null) |
| | 1599 | | { |
| 0 | 1600 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1601 | | } |
| | 1602 | |
|
| 0 | 1603 | | using var message = CreateStartPacketCaptureRequest(resourceGroupName, virtualNetworkGatewayName, parameters |
| 0 | 1604 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1605 | | switch (message.Response.Status) |
| | 1606 | | { |
| | 1607 | | case 200: |
| | 1608 | | case 202: |
| 0 | 1609 | | return message.Response; |
| | 1610 | | default: |
| 0 | 1611 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1612 | | } |
| 0 | 1613 | | } |
| | 1614 | |
|
| | 1615 | | /// <summary> Starts packet capture on virtual network gateway in the specified resource group. </summary> |
| | 1616 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1617 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1618 | | /// <param name="parameters"> Virtual network gateway packet capture parameters supplied to start packet capture |
| | 1619 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1620 | | public Response StartPacketCapture(string resourceGroupName, string virtualNetworkGatewayName, VpnPacketCaptureS |
| | 1621 | | { |
| 0 | 1622 | | if (resourceGroupName == null) |
| | 1623 | | { |
| 0 | 1624 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1625 | | } |
| 0 | 1626 | | if (virtualNetworkGatewayName == null) |
| | 1627 | | { |
| 0 | 1628 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1629 | | } |
| | 1630 | |
|
| 0 | 1631 | | using var message = CreateStartPacketCaptureRequest(resourceGroupName, virtualNetworkGatewayName, parameters |
| 0 | 1632 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1633 | | switch (message.Response.Status) |
| | 1634 | | { |
| | 1635 | | case 200: |
| | 1636 | | case 202: |
| 0 | 1637 | | return message.Response; |
| | 1638 | | default: |
| 0 | 1639 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1640 | | } |
| 0 | 1641 | | } |
| | 1642 | |
|
| | 1643 | | internal HttpMessage CreateStopPacketCaptureRequest(string resourceGroupName, string virtualNetworkGatewayName, |
| | 1644 | | { |
| 0 | 1645 | | var message = _pipeline.CreateMessage(); |
| 0 | 1646 | | var request = message.Request; |
| 0 | 1647 | | request.Method = RequestMethod.Post; |
| 0 | 1648 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1649 | | uri.Reset(endpoint); |
| 0 | 1650 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1651 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1652 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1653 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1654 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 1655 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 1656 | | uri.AppendPath("/stopPacketCapture", false); |
| 0 | 1657 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 1658 | | request.Uri = uri; |
| 0 | 1659 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 1660 | | var content = new Utf8JsonRequestContent(); |
| 0 | 1661 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 1662 | | request.Content = content; |
| 0 | 1663 | | return message; |
| | 1664 | | } |
| | 1665 | |
|
| | 1666 | | /// <summary> Stops packet capture on virtual network gateway in the specified resource group. </summary> |
| | 1667 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1668 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1669 | | /// <param name="parameters"> Virtual network gateway packet capture parameters supplied to stop packet capture |
| | 1670 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1671 | | public async Task<Response> StopPacketCaptureAsync(string resourceGroupName, string virtualNetworkGatewayName, V |
| | 1672 | | { |
| 0 | 1673 | | if (resourceGroupName == null) |
| | 1674 | | { |
| 0 | 1675 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1676 | | } |
| 0 | 1677 | | if (virtualNetworkGatewayName == null) |
| | 1678 | | { |
| 0 | 1679 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1680 | | } |
| 0 | 1681 | | if (parameters == null) |
| | 1682 | | { |
| 0 | 1683 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1684 | | } |
| | 1685 | |
|
| 0 | 1686 | | using var message = CreateStopPacketCaptureRequest(resourceGroupName, virtualNetworkGatewayName, parameters) |
| 0 | 1687 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1688 | | switch (message.Response.Status) |
| | 1689 | | { |
| | 1690 | | case 200: |
| | 1691 | | case 202: |
| 0 | 1692 | | return message.Response; |
| | 1693 | | default: |
| 0 | 1694 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1695 | | } |
| 0 | 1696 | | } |
| | 1697 | |
|
| | 1698 | | /// <summary> Stops packet capture on virtual network gateway in the specified resource group. </summary> |
| | 1699 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1700 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1701 | | /// <param name="parameters"> Virtual network gateway packet capture parameters supplied to stop packet capture |
| | 1702 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1703 | | public Response StopPacketCapture(string resourceGroupName, string virtualNetworkGatewayName, VpnPacketCaptureSt |
| | 1704 | | { |
| 0 | 1705 | | if (resourceGroupName == null) |
| | 1706 | | { |
| 0 | 1707 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1708 | | } |
| 0 | 1709 | | if (virtualNetworkGatewayName == null) |
| | 1710 | | { |
| 0 | 1711 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1712 | | } |
| 0 | 1713 | | if (parameters == null) |
| | 1714 | | { |
| 0 | 1715 | | throw new ArgumentNullException(nameof(parameters)); |
| | 1716 | | } |
| | 1717 | |
|
| 0 | 1718 | | using var message = CreateStopPacketCaptureRequest(resourceGroupName, virtualNetworkGatewayName, parameters) |
| 0 | 1719 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1720 | | switch (message.Response.Status) |
| | 1721 | | { |
| | 1722 | | case 200: |
| | 1723 | | case 202: |
| 0 | 1724 | | return message.Response; |
| | 1725 | | default: |
| 0 | 1726 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1727 | | } |
| 0 | 1728 | | } |
| | 1729 | |
|
| | 1730 | | internal HttpMessage CreateGetVpnclientConnectionHealthRequest(string resourceGroupName, string virtualNetworkGa |
| | 1731 | | { |
| 0 | 1732 | | var message = _pipeline.CreateMessage(); |
| 0 | 1733 | | var request = message.Request; |
| 0 | 1734 | | request.Method = RequestMethod.Post; |
| 0 | 1735 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1736 | | uri.Reset(endpoint); |
| 0 | 1737 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1738 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1739 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1740 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1741 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 1742 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 1743 | | uri.AppendPath("/getVpnClientConnectionHealth", false); |
| 0 | 1744 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 1745 | | request.Uri = uri; |
| 0 | 1746 | | return message; |
| | 1747 | | } |
| | 1748 | |
|
| | 1749 | | /// <summary> Get VPN client connection health detail per P2S client connection of the virtual network gateway i |
| | 1750 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1751 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1752 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1753 | | public async Task<Response> GetVpnclientConnectionHealthAsync(string resourceGroupName, string virtualNetworkGat |
| | 1754 | | { |
| 0 | 1755 | | if (resourceGroupName == null) |
| | 1756 | | { |
| 0 | 1757 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1758 | | } |
| 0 | 1759 | | if (virtualNetworkGatewayName == null) |
| | 1760 | | { |
| 0 | 1761 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1762 | | } |
| | 1763 | |
|
| 0 | 1764 | | using var message = CreateGetVpnclientConnectionHealthRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 1765 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1766 | | switch (message.Response.Status) |
| | 1767 | | { |
| | 1768 | | case 200: |
| | 1769 | | case 202: |
| 0 | 1770 | | return message.Response; |
| | 1771 | | default: |
| 0 | 1772 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1773 | | } |
| 0 | 1774 | | } |
| | 1775 | |
|
| | 1776 | | /// <summary> Get VPN client connection health detail per P2S client connection of the virtual network gateway i |
| | 1777 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1778 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1779 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1780 | | public Response GetVpnclientConnectionHealth(string resourceGroupName, string virtualNetworkGatewayName, Cancell |
| | 1781 | | { |
| 0 | 1782 | | if (resourceGroupName == null) |
| | 1783 | | { |
| 0 | 1784 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1785 | | } |
| 0 | 1786 | | if (virtualNetworkGatewayName == null) |
| | 1787 | | { |
| 0 | 1788 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1789 | | } |
| | 1790 | |
|
| 0 | 1791 | | using var message = CreateGetVpnclientConnectionHealthRequest(resourceGroupName, virtualNetworkGatewayName); |
| 0 | 1792 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1793 | | switch (message.Response.Status) |
| | 1794 | | { |
| | 1795 | | case 200: |
| | 1796 | | case 202: |
| 0 | 1797 | | return message.Response; |
| | 1798 | | default: |
| 0 | 1799 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1800 | | } |
| 0 | 1801 | | } |
| | 1802 | |
|
| | 1803 | | internal HttpMessage CreateDisconnectVirtualNetworkGatewayVpnConnectionsRequest(string resourceGroupName, string |
| | 1804 | | { |
| 0 | 1805 | | var message = _pipeline.CreateMessage(); |
| 0 | 1806 | | var request0 = message.Request; |
| 0 | 1807 | | request0.Method = RequestMethod.Post; |
| 0 | 1808 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1809 | | uri.Reset(endpoint); |
| 0 | 1810 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 1811 | | uri.AppendPath(subscriptionId, true); |
| 0 | 1812 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 1813 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 1814 | | uri.AppendPath("/providers/Microsoft.Network/virtualNetworkGateways/", false); |
| 0 | 1815 | | uri.AppendPath(virtualNetworkGatewayName, true); |
| 0 | 1816 | | uri.AppendPath("/disconnectVirtualNetworkGatewayVpnConnections", false); |
| 0 | 1817 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 1818 | | request0.Uri = uri; |
| 0 | 1819 | | request0.Headers.Add("Content-Type", "application/json"); |
| 0 | 1820 | | var content = new Utf8JsonRequestContent(); |
| 0 | 1821 | | content.JsonWriter.WriteObjectValue(request); |
| 0 | 1822 | | request0.Content = content; |
| 0 | 1823 | | return message; |
| | 1824 | | } |
| | 1825 | |
|
| | 1826 | | /// <summary> Disconnect vpn connections of virtual network gateway in the specified resource group. </summary> |
| | 1827 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1828 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1829 | | /// <param name="request"> The parameters are supplied to disconnect vpn connections. </param> |
| | 1830 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1831 | | public async Task<Response> DisconnectVirtualNetworkGatewayVpnConnectionsAsync(string resourceGroupName, string |
| | 1832 | | { |
| 0 | 1833 | | if (resourceGroupName == null) |
| | 1834 | | { |
| 0 | 1835 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1836 | | } |
| 0 | 1837 | | if (virtualNetworkGatewayName == null) |
| | 1838 | | { |
| 0 | 1839 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1840 | | } |
| 0 | 1841 | | if (request == null) |
| | 1842 | | { |
| 0 | 1843 | | throw new ArgumentNullException(nameof(request)); |
| | 1844 | | } |
| | 1845 | |
|
| 0 | 1846 | | using var message = CreateDisconnectVirtualNetworkGatewayVpnConnectionsRequest(resourceGroupName, virtualNet |
| 0 | 1847 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1848 | | switch (message.Response.Status) |
| | 1849 | | { |
| | 1850 | | case 200: |
| | 1851 | | case 202: |
| 0 | 1852 | | return message.Response; |
| | 1853 | | default: |
| 0 | 1854 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1855 | | } |
| 0 | 1856 | | } |
| | 1857 | |
|
| | 1858 | | /// <summary> Disconnect vpn connections of virtual network gateway in the specified resource group. </summary> |
| | 1859 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1860 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1861 | | /// <param name="request"> The parameters are supplied to disconnect vpn connections. </param> |
| | 1862 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1863 | | public Response DisconnectVirtualNetworkGatewayVpnConnections(string resourceGroupName, string virtualNetworkGat |
| | 1864 | | { |
| 0 | 1865 | | if (resourceGroupName == null) |
| | 1866 | | { |
| 0 | 1867 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1868 | | } |
| 0 | 1869 | | if (virtualNetworkGatewayName == null) |
| | 1870 | | { |
| 0 | 1871 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 1872 | | } |
| 0 | 1873 | | if (request == null) |
| | 1874 | | { |
| 0 | 1875 | | throw new ArgumentNullException(nameof(request)); |
| | 1876 | | } |
| | 1877 | |
|
| 0 | 1878 | | using var message = CreateDisconnectVirtualNetworkGatewayVpnConnectionsRequest(resourceGroupName, virtualNet |
| 0 | 1879 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1880 | | switch (message.Response.Status) |
| | 1881 | | { |
| | 1882 | | case 200: |
| | 1883 | | case 202: |
| 0 | 1884 | | return message.Response; |
| | 1885 | | default: |
| 0 | 1886 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1887 | | } |
| 0 | 1888 | | } |
| | 1889 | |
|
| | 1890 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName) |
| | 1891 | | { |
| 0 | 1892 | | var message = _pipeline.CreateMessage(); |
| 0 | 1893 | | var request = message.Request; |
| 0 | 1894 | | request.Method = RequestMethod.Get; |
| 0 | 1895 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1896 | | uri.Reset(endpoint); |
| 0 | 1897 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 1898 | | request.Uri = uri; |
| 0 | 1899 | | return message; |
| | 1900 | | } |
| | 1901 | |
|
| | 1902 | | /// <summary> Gets all virtual network gateways by resource group. </summary> |
| | 1903 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1904 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1905 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1906 | | public async Task<Response<VirtualNetworkGatewayListResult>> ListNextPageAsync(string nextLink, string resourceG |
| | 1907 | | { |
| 0 | 1908 | | if (nextLink == null) |
| | 1909 | | { |
| 0 | 1910 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1911 | | } |
| 0 | 1912 | | if (resourceGroupName == null) |
| | 1913 | | { |
| 0 | 1914 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1915 | | } |
| | 1916 | |
|
| 0 | 1917 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName); |
| 0 | 1918 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1919 | | switch (message.Response.Status) |
| | 1920 | | { |
| | 1921 | | case 200: |
| | 1922 | | { |
| 0 | 1923 | | VirtualNetworkGatewayListResult value = default; |
| 0 | 1924 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1925 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1926 | | { |
| 0 | 1927 | | value = null; |
| | 1928 | | } |
| | 1929 | | else |
| | 1930 | | { |
| 0 | 1931 | | value = VirtualNetworkGatewayListResult.DeserializeVirtualNetworkGatewayListResult(document. |
| | 1932 | | } |
| 0 | 1933 | | return Response.FromValue(value, message.Response); |
| | 1934 | | } |
| | 1935 | | default: |
| 0 | 1936 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1937 | | } |
| 0 | 1938 | | } |
| | 1939 | |
|
| | 1940 | | /// <summary> Gets all virtual network gateways by resource group. </summary> |
| | 1941 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1942 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1943 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1944 | | public Response<VirtualNetworkGatewayListResult> ListNextPage(string nextLink, string resourceGroupName, Cancell |
| | 1945 | | { |
| 0 | 1946 | | if (nextLink == null) |
| | 1947 | | { |
| 0 | 1948 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1949 | | } |
| 0 | 1950 | | if (resourceGroupName == null) |
| | 1951 | | { |
| 0 | 1952 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1953 | | } |
| | 1954 | |
|
| 0 | 1955 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName); |
| 0 | 1956 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1957 | | switch (message.Response.Status) |
| | 1958 | | { |
| | 1959 | | case 200: |
| | 1960 | | { |
| 0 | 1961 | | VirtualNetworkGatewayListResult value = default; |
| 0 | 1962 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1963 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 1964 | | { |
| 0 | 1965 | | value = null; |
| | 1966 | | } |
| | 1967 | | else |
| | 1968 | | { |
| 0 | 1969 | | value = VirtualNetworkGatewayListResult.DeserializeVirtualNetworkGatewayListResult(document. |
| | 1970 | | } |
| 0 | 1971 | | return Response.FromValue(value, message.Response); |
| | 1972 | | } |
| | 1973 | | default: |
| 0 | 1974 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1975 | | } |
| 0 | 1976 | | } |
| | 1977 | |
|
| | 1978 | | internal HttpMessage CreateListConnectionsNextPageRequest(string nextLink, string resourceGroupName, string virt |
| | 1979 | | { |
| 0 | 1980 | | var message = _pipeline.CreateMessage(); |
| 0 | 1981 | | var request = message.Request; |
| 0 | 1982 | | request.Method = RequestMethod.Get; |
| 0 | 1983 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1984 | | uri.Reset(endpoint); |
| 0 | 1985 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 1986 | | request.Uri = uri; |
| 0 | 1987 | | return message; |
| | 1988 | | } |
| | 1989 | |
|
| | 1990 | | /// <summary> Gets all the connections in a virtual network gateway. </summary> |
| | 1991 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1992 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 1993 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 1994 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1995 | | public async Task<Response<VirtualNetworkGatewayListConnectionsResult>> ListConnectionsNextPageAsync(string next |
| | 1996 | | { |
| 0 | 1997 | | if (nextLink == null) |
| | 1998 | | { |
| 0 | 1999 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2000 | | } |
| 0 | 2001 | | if (resourceGroupName == null) |
| | 2002 | | { |
| 0 | 2003 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2004 | | } |
| 0 | 2005 | | if (virtualNetworkGatewayName == null) |
| | 2006 | | { |
| 0 | 2007 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 2008 | | } |
| | 2009 | |
|
| 0 | 2010 | | using var message = CreateListConnectionsNextPageRequest(nextLink, resourceGroupName, virtualNetworkGatewayN |
| 0 | 2011 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 2012 | | switch (message.Response.Status) |
| | 2013 | | { |
| | 2014 | | case 200: |
| | 2015 | | { |
| 0 | 2016 | | VirtualNetworkGatewayListConnectionsResult value = default; |
| 0 | 2017 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 2018 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2019 | | { |
| 0 | 2020 | | value = null; |
| | 2021 | | } |
| | 2022 | | else |
| | 2023 | | { |
| 0 | 2024 | | value = VirtualNetworkGatewayListConnectionsResult.DeserializeVirtualNetworkGatewayListConne |
| | 2025 | | } |
| 0 | 2026 | | return Response.FromValue(value, message.Response); |
| | 2027 | | } |
| | 2028 | | default: |
| 0 | 2029 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 2030 | | } |
| 0 | 2031 | | } |
| | 2032 | |
|
| | 2033 | | /// <summary> Gets all the connections in a virtual network gateway. </summary> |
| | 2034 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 2035 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 2036 | | /// <param name="virtualNetworkGatewayName"> The name of the virtual network gateway. </param> |
| | 2037 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 2038 | | public Response<VirtualNetworkGatewayListConnectionsResult> ListConnectionsNextPage(string nextLink, string reso |
| | 2039 | | { |
| 0 | 2040 | | if (nextLink == null) |
| | 2041 | | { |
| 0 | 2042 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 2043 | | } |
| 0 | 2044 | | if (resourceGroupName == null) |
| | 2045 | | { |
| 0 | 2046 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 2047 | | } |
| 0 | 2048 | | if (virtualNetworkGatewayName == null) |
| | 2049 | | { |
| 0 | 2050 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayName)); |
| | 2051 | | } |
| | 2052 | |
|
| 0 | 2053 | | using var message = CreateListConnectionsNextPageRequest(nextLink, resourceGroupName, virtualNetworkGatewayN |
| 0 | 2054 | | _pipeline.Send(message, cancellationToken); |
| 0 | 2055 | | switch (message.Response.Status) |
| | 2056 | | { |
| | 2057 | | case 200: |
| | 2058 | | { |
| 0 | 2059 | | VirtualNetworkGatewayListConnectionsResult value = default; |
| 0 | 2060 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 2061 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 2062 | | { |
| 0 | 2063 | | value = null; |
| | 2064 | | } |
| | 2065 | | else |
| | 2066 | | { |
| 0 | 2067 | | value = VirtualNetworkGatewayListConnectionsResult.DeserializeVirtualNetworkGatewayListConne |
| | 2068 | | } |
| 0 | 2069 | | return Response.FromValue(value, message.Response); |
| | 2070 | | } |
| | 2071 | | default: |
| 0 | 2072 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 2073 | | } |
| 0 | 2074 | | } |
| | 2075 | | } |
| | 2076 | | } |