| | 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 VirtualNetworkGatewayConnectionsRestOperations |
| | 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 VirtualNetworkGatewayConnectionsRestOperations. </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 |
| 84 | 32 | | public VirtualNetworkGatewayConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline |
| | 33 | | { |
| 84 | 34 | | if (subscriptionId == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 37 | | } |
| 84 | 38 | | endpoint ??= new Uri("https://management.azure.com"); |
| | 39 | |
|
| 84 | 40 | | this.subscriptionId = subscriptionId; |
| 84 | 41 | | this.endpoint = endpoint; |
| 84 | 42 | | _clientDiagnostics = clientDiagnostics; |
| 84 | 43 | | _pipeline = pipeline; |
| 84 | 44 | | } |
| | 45 | |
|
| | 46 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string virtualNetworkGatewayConnectio |
| | 47 | | { |
| 48 | 48 | | var message = _pipeline.CreateMessage(); |
| 48 | 49 | | var request = message.Request; |
| 48 | 50 | | request.Method = RequestMethod.Put; |
| 48 | 51 | | var uri = new RawRequestUriBuilder(); |
| 48 | 52 | | uri.Reset(endpoint); |
| 48 | 53 | | uri.AppendPath("/subscriptions/", false); |
| 48 | 54 | | uri.AppendPath(subscriptionId, true); |
| 48 | 55 | | uri.AppendPath("/resourceGroups/", false); |
| 48 | 56 | | uri.AppendPath(resourceGroupName, true); |
| 48 | 57 | | uri.AppendPath("/providers/Microsoft.Network/connections/", false); |
| 48 | 58 | | uri.AppendPath(virtualNetworkGatewayConnectionName, true); |
| 48 | 59 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 48 | 60 | | request.Uri = uri; |
| 48 | 61 | | request.Headers.Add("Content-Type", "application/json"); |
| 48 | 62 | | var content = new Utf8JsonRequestContent(); |
| 48 | 63 | | content.JsonWriter.WriteObjectValue(parameters); |
| 48 | 64 | | request.Content = content; |
| 48 | 65 | | return message; |
| | 66 | | } |
| | 67 | |
|
| | 68 | | /// <summary> Creates or updates a virtual network gateway connection in the specified resource group. </summary |
| | 69 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 70 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection. </par |
| | 71 | | /// <param name="parameters"> Parameters supplied to the create or update virtual network gateway connection ope |
| | 72 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 73 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string virtualNetworkGatewayConnection |
| | 74 | | { |
| 12 | 75 | | if (resourceGroupName == null) |
| | 76 | | { |
| 0 | 77 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 78 | | } |
| 12 | 79 | | if (virtualNetworkGatewayConnectionName == null) |
| | 80 | | { |
| 0 | 81 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 82 | | } |
| 12 | 83 | | if (parameters == null) |
| | 84 | | { |
| 0 | 85 | | throw new ArgumentNullException(nameof(parameters)); |
| | 86 | | } |
| | 87 | |
|
| 12 | 88 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, virtualNetworkGatewayConnectionName, para |
| 12 | 89 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 12 | 90 | | switch (message.Response.Status) |
| | 91 | | { |
| | 92 | | case 200: |
| | 93 | | case 201: |
| 12 | 94 | | return message.Response; |
| | 95 | | default: |
| 0 | 96 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 97 | | } |
| 12 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Creates or updates a virtual network gateway connection in the specified resource group. </summary |
| | 101 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 102 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection. </par |
| | 103 | | /// <param name="parameters"> Parameters supplied to the create or update virtual network gateway connection ope |
| | 104 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 105 | | public Response CreateOrUpdate(string resourceGroupName, string virtualNetworkGatewayConnectionName, VirtualNetw |
| | 106 | | { |
| 12 | 107 | | if (resourceGroupName == null) |
| | 108 | | { |
| 0 | 109 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 110 | | } |
| 12 | 111 | | if (virtualNetworkGatewayConnectionName == null) |
| | 112 | | { |
| 0 | 113 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 114 | | } |
| 12 | 115 | | if (parameters == null) |
| | 116 | | { |
| 0 | 117 | | throw new ArgumentNullException(nameof(parameters)); |
| | 118 | | } |
| | 119 | |
|
| 12 | 120 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, virtualNetworkGatewayConnectionName, para |
| 12 | 121 | | _pipeline.Send(message, cancellationToken); |
| 12 | 122 | | switch (message.Response.Status) |
| | 123 | | { |
| | 124 | | case 200: |
| | 125 | | case 201: |
| 12 | 126 | | return message.Response; |
| | 127 | | default: |
| 0 | 128 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 129 | | } |
| 12 | 130 | | } |
| | 131 | |
|
| | 132 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string virtualNetworkGatewayConnectionName) |
| | 133 | | { |
| 24 | 134 | | var message = _pipeline.CreateMessage(); |
| 24 | 135 | | var request = message.Request; |
| 24 | 136 | | request.Method = RequestMethod.Get; |
| 24 | 137 | | var uri = new RawRequestUriBuilder(); |
| 24 | 138 | | uri.Reset(endpoint); |
| 24 | 139 | | uri.AppendPath("/subscriptions/", false); |
| 24 | 140 | | uri.AppendPath(subscriptionId, true); |
| 24 | 141 | | uri.AppendPath("/resourceGroups/", false); |
| 24 | 142 | | uri.AppendPath(resourceGroupName, true); |
| 24 | 143 | | uri.AppendPath("/providers/Microsoft.Network/connections/", false); |
| 24 | 144 | | uri.AppendPath(virtualNetworkGatewayConnectionName, true); |
| 24 | 145 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 24 | 146 | | request.Uri = uri; |
| 24 | 147 | | return message; |
| | 148 | | } |
| | 149 | |
|
| | 150 | | /// <summary> Gets the specified virtual network gateway connection by resource group. </summary> |
| | 151 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 152 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection. </par |
| | 153 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 154 | | public async Task<Response<VirtualNetworkGatewayConnection>> GetAsync(string resourceGroupName, string virtualNe |
| | 155 | | { |
| 12 | 156 | | if (resourceGroupName == null) |
| | 157 | | { |
| 0 | 158 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 159 | | } |
| 12 | 160 | | if (virtualNetworkGatewayConnectionName == null) |
| | 161 | | { |
| 0 | 162 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 163 | | } |
| | 164 | |
|
| 12 | 165 | | using var message = CreateGetRequest(resourceGroupName, virtualNetworkGatewayConnectionName); |
| 12 | 166 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 12 | 167 | | switch (message.Response.Status) |
| | 168 | | { |
| | 169 | | case 200: |
| | 170 | | { |
| 12 | 171 | | VirtualNetworkGatewayConnection value = default; |
| 12 | 172 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 12 | 173 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 174 | | { |
| 0 | 175 | | value = null; |
| | 176 | | } |
| | 177 | | else |
| | 178 | | { |
| 12 | 179 | | value = VirtualNetworkGatewayConnection.DeserializeVirtualNetworkGatewayConnection(document. |
| | 180 | | } |
| 12 | 181 | | return Response.FromValue(value, message.Response); |
| | 182 | | } |
| | 183 | | default: |
| 0 | 184 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 185 | | } |
| 12 | 186 | | } |
| | 187 | |
|
| | 188 | | /// <summary> Gets the specified virtual network gateway connection by resource group. </summary> |
| | 189 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 190 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection. </par |
| | 191 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 192 | | public Response<VirtualNetworkGatewayConnection> Get(string resourceGroupName, string virtualNetworkGatewayConne |
| | 193 | | { |
| 12 | 194 | | if (resourceGroupName == null) |
| | 195 | | { |
| 0 | 196 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 197 | | } |
| 12 | 198 | | if (virtualNetworkGatewayConnectionName == null) |
| | 199 | | { |
| 0 | 200 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 201 | | } |
| | 202 | |
|
| 12 | 203 | | using var message = CreateGetRequest(resourceGroupName, virtualNetworkGatewayConnectionName); |
| 12 | 204 | | _pipeline.Send(message, cancellationToken); |
| 12 | 205 | | switch (message.Response.Status) |
| | 206 | | { |
| | 207 | | case 200: |
| | 208 | | { |
| 12 | 209 | | VirtualNetworkGatewayConnection value = default; |
| 12 | 210 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 12 | 211 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| 0 | 213 | | value = null; |
| | 214 | | } |
| | 215 | | else |
| | 216 | | { |
| 12 | 217 | | value = VirtualNetworkGatewayConnection.DeserializeVirtualNetworkGatewayConnection(document. |
| | 218 | | } |
| 12 | 219 | | return Response.FromValue(value, message.Response); |
| | 220 | | } |
| | 221 | | default: |
| 0 | 222 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 223 | | } |
| 12 | 224 | | } |
| | 225 | |
|
| | 226 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string virtualNetworkGatewayConnectionName) |
| | 227 | | { |
| 24 | 228 | | var message = _pipeline.CreateMessage(); |
| 24 | 229 | | var request = message.Request; |
| 24 | 230 | | request.Method = RequestMethod.Delete; |
| 24 | 231 | | var uri = new RawRequestUriBuilder(); |
| 24 | 232 | | uri.Reset(endpoint); |
| 24 | 233 | | uri.AppendPath("/subscriptions/", false); |
| 24 | 234 | | uri.AppendPath(subscriptionId, true); |
| 24 | 235 | | uri.AppendPath("/resourceGroups/", false); |
| 24 | 236 | | uri.AppendPath(resourceGroupName, true); |
| 24 | 237 | | uri.AppendPath("/providers/Microsoft.Network/connections/", false); |
| 24 | 238 | | uri.AppendPath(virtualNetworkGatewayConnectionName, true); |
| 24 | 239 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 24 | 240 | | request.Uri = uri; |
| 24 | 241 | | return message; |
| | 242 | | } |
| | 243 | |
|
| | 244 | | /// <summary> Deletes the specified virtual network Gateway connection. </summary> |
| | 245 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 246 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection. </par |
| | 247 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 248 | | public async Task<Response> DeleteAsync(string resourceGroupName, string virtualNetworkGatewayConnectionName, Ca |
| | 249 | | { |
| 6 | 250 | | if (resourceGroupName == null) |
| | 251 | | { |
| 0 | 252 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 253 | | } |
| 6 | 254 | | if (virtualNetworkGatewayConnectionName == null) |
| | 255 | | { |
| 0 | 256 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 257 | | } |
| | 258 | |
|
| 6 | 259 | | using var message = CreateDeleteRequest(resourceGroupName, virtualNetworkGatewayConnectionName); |
| 6 | 260 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 6 | 261 | | switch (message.Response.Status) |
| | 262 | | { |
| | 263 | | case 200: |
| | 264 | | case 202: |
| | 265 | | case 204: |
| 6 | 266 | | return message.Response; |
| | 267 | | default: |
| 0 | 268 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 269 | | } |
| 6 | 270 | | } |
| | 271 | |
|
| | 272 | | /// <summary> Deletes the specified virtual network Gateway connection. </summary> |
| | 273 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 274 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection. </par |
| | 275 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 276 | | public Response Delete(string resourceGroupName, string virtualNetworkGatewayConnectionName, CancellationToken c |
| | 277 | | { |
| 6 | 278 | | if (resourceGroupName == null) |
| | 279 | | { |
| 0 | 280 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 281 | | } |
| 6 | 282 | | if (virtualNetworkGatewayConnectionName == null) |
| | 283 | | { |
| 0 | 284 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 285 | | } |
| | 286 | |
|
| 6 | 287 | | using var message = CreateDeleteRequest(resourceGroupName, virtualNetworkGatewayConnectionName); |
| 6 | 288 | | _pipeline.Send(message, cancellationToken); |
| 6 | 289 | | switch (message.Response.Status) |
| | 290 | | { |
| | 291 | | case 200: |
| | 292 | | case 202: |
| | 293 | | case 204: |
| 6 | 294 | | return message.Response; |
| | 295 | | default: |
| 0 | 296 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 297 | | } |
| 6 | 298 | | } |
| | 299 | |
|
| | 300 | | internal HttpMessage CreateUpdateTagsRequest(string resourceGroupName, string virtualNetworkGatewayConnectionNam |
| | 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/connections/", false); |
| 0 | 312 | | uri.AppendPath(virtualNetworkGatewayConnectionName, 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 connection tags. </summary> |
| | 323 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 324 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection. </par |
| | 325 | | /// <param name="parameters"> Parameters supplied to update virtual network gateway connection tags. </param> |
| | 326 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 327 | | public async Task<Response> UpdateTagsAsync(string resourceGroupName, string virtualNetworkGatewayConnectionName |
| | 328 | | { |
| 0 | 329 | | if (resourceGroupName == null) |
| | 330 | | { |
| 0 | 331 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 332 | | } |
| 0 | 333 | | if (virtualNetworkGatewayConnectionName == null) |
| | 334 | | { |
| 0 | 335 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 336 | | } |
| 0 | 337 | | if (parameters == null) |
| | 338 | | { |
| 0 | 339 | | throw new ArgumentNullException(nameof(parameters)); |
| | 340 | | } |
| | 341 | |
|
| 0 | 342 | | using var message = CreateUpdateTagsRequest(resourceGroupName, virtualNetworkGatewayConnectionName, paramete |
| 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 connection tags. </summary> |
| | 355 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 356 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection. </par |
| | 357 | | /// <param name="parameters"> Parameters supplied to update virtual network gateway connection tags. </param> |
| | 358 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 359 | | public Response UpdateTags(string resourceGroupName, string virtualNetworkGatewayConnectionName, TagsObject para |
| | 360 | | { |
| 0 | 361 | | if (resourceGroupName == null) |
| | 362 | | { |
| 0 | 363 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 364 | | } |
| 0 | 365 | | if (virtualNetworkGatewayConnectionName == null) |
| | 366 | | { |
| 0 | 367 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 368 | | } |
| 0 | 369 | | if (parameters == null) |
| | 370 | | { |
| 0 | 371 | | throw new ArgumentNullException(nameof(parameters)); |
| | 372 | | } |
| | 373 | |
|
| 0 | 374 | | using var message = CreateUpdateTagsRequest(resourceGroupName, virtualNetworkGatewayConnectionName, paramete |
| 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 CreateSetSharedKeyRequest(string resourceGroupName, string virtualNetworkGatewayConnectionN |
| | 387 | | { |
| 0 | 388 | | var message = _pipeline.CreateMessage(); |
| 0 | 389 | | var request = message.Request; |
| 0 | 390 | | request.Method = RequestMethod.Put; |
| 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/connections/", false); |
| 0 | 398 | | uri.AppendPath(virtualNetworkGatewayConnectionName, true); |
| 0 | 399 | | uri.AppendPath("/sharedkey", false); |
| 0 | 400 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 401 | | request.Uri = uri; |
| 0 | 402 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 403 | | var content = new Utf8JsonRequestContent(); |
| 0 | 404 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 405 | | request.Content = content; |
| 0 | 406 | | return message; |
| | 407 | | } |
| | 408 | |
|
| | 409 | | /// <summary> The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connec |
| | 410 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 411 | | /// <param name="virtualNetworkGatewayConnectionName"> The virtual network gateway connection name. </param> |
| | 412 | | /// <param name="parameters"> Parameters supplied to the Begin Set Virtual Network Gateway connection Shared key |
| | 413 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 414 | | public async Task<Response> SetSharedKeyAsync(string resourceGroupName, string virtualNetworkGatewayConnectionNa |
| | 415 | | { |
| 0 | 416 | | if (resourceGroupName == null) |
| | 417 | | { |
| 0 | 418 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 419 | | } |
| 0 | 420 | | if (virtualNetworkGatewayConnectionName == null) |
| | 421 | | { |
| 0 | 422 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 423 | | } |
| 0 | 424 | | if (parameters == null) |
| | 425 | | { |
| 0 | 426 | | throw new ArgumentNullException(nameof(parameters)); |
| | 427 | | } |
| | 428 | |
|
| 0 | 429 | | using var message = CreateSetSharedKeyRequest(resourceGroupName, virtualNetworkGatewayConnectionName, parame |
| 0 | 430 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 431 | | switch (message.Response.Status) |
| | 432 | | { |
| | 433 | | case 200: |
| | 434 | | case 201: |
| 0 | 435 | | return message.Response; |
| | 436 | | default: |
| 0 | 437 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 438 | | } |
| 0 | 439 | | } |
| | 440 | |
|
| | 441 | | /// <summary> The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connec |
| | 442 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 443 | | /// <param name="virtualNetworkGatewayConnectionName"> The virtual network gateway connection name. </param> |
| | 444 | | /// <param name="parameters"> Parameters supplied to the Begin Set Virtual Network Gateway connection Shared key |
| | 445 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 446 | | public Response SetSharedKey(string resourceGroupName, string virtualNetworkGatewayConnectionName, ConnectionSha |
| | 447 | | { |
| 0 | 448 | | if (resourceGroupName == null) |
| | 449 | | { |
| 0 | 450 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 451 | | } |
| 0 | 452 | | if (virtualNetworkGatewayConnectionName == null) |
| | 453 | | { |
| 0 | 454 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 455 | | } |
| 0 | 456 | | if (parameters == null) |
| | 457 | | { |
| 0 | 458 | | throw new ArgumentNullException(nameof(parameters)); |
| | 459 | | } |
| | 460 | |
|
| 0 | 461 | | using var message = CreateSetSharedKeyRequest(resourceGroupName, virtualNetworkGatewayConnectionName, parame |
| 0 | 462 | | _pipeline.Send(message, cancellationToken); |
| 0 | 463 | | switch (message.Response.Status) |
| | 464 | | { |
| | 465 | | case 200: |
| | 466 | | case 201: |
| 0 | 467 | | return message.Response; |
| | 468 | | default: |
| 0 | 469 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 470 | | } |
| 0 | 471 | | } |
| | 472 | |
|
| | 473 | | internal HttpMessage CreateGetSharedKeyRequest(string resourceGroupName, string virtualNetworkGatewayConnectionN |
| | 474 | | { |
| 0 | 475 | | var message = _pipeline.CreateMessage(); |
| 0 | 476 | | var request = message.Request; |
| 0 | 477 | | request.Method = RequestMethod.Get; |
| 0 | 478 | | var uri = new RawRequestUriBuilder(); |
| 0 | 479 | | uri.Reset(endpoint); |
| 0 | 480 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 481 | | uri.AppendPath(subscriptionId, true); |
| 0 | 482 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 483 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 484 | | uri.AppendPath("/providers/Microsoft.Network/connections/", false); |
| 0 | 485 | | uri.AppendPath(virtualNetworkGatewayConnectionName, true); |
| 0 | 486 | | uri.AppendPath("/sharedkey", false); |
| 0 | 487 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 488 | | request.Uri = uri; |
| 0 | 489 | | return message; |
| | 490 | | } |
| | 491 | |
|
| | 492 | | /// <summary> The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the specifi |
| | 493 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 494 | | /// <param name="virtualNetworkGatewayConnectionName"> The virtual network gateway connection shared key name. < |
| | 495 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 496 | | public async Task<Response<ConnectionSharedKey>> GetSharedKeyAsync(string resourceGroupName, string virtualNetwo |
| | 497 | | { |
| 0 | 498 | | if (resourceGroupName == null) |
| | 499 | | { |
| 0 | 500 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 501 | | } |
| 0 | 502 | | if (virtualNetworkGatewayConnectionName == null) |
| | 503 | | { |
| 0 | 504 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 505 | | } |
| | 506 | |
|
| 0 | 507 | | using var message = CreateGetSharedKeyRequest(resourceGroupName, virtualNetworkGatewayConnectionName); |
| 0 | 508 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 509 | | switch (message.Response.Status) |
| | 510 | | { |
| | 511 | | case 200: |
| | 512 | | { |
| 0 | 513 | | ConnectionSharedKey value = default; |
| 0 | 514 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 515 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 516 | | { |
| 0 | 517 | | value = null; |
| | 518 | | } |
| | 519 | | else |
| | 520 | | { |
| 0 | 521 | | value = ConnectionSharedKey.DeserializeConnectionSharedKey(document.RootElement); |
| | 522 | | } |
| 0 | 523 | | return Response.FromValue(value, message.Response); |
| | 524 | | } |
| | 525 | | default: |
| 0 | 526 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 527 | | } |
| 0 | 528 | | } |
| | 529 | |
|
| | 530 | | /// <summary> The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the specifi |
| | 531 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 532 | | /// <param name="virtualNetworkGatewayConnectionName"> The virtual network gateway connection shared key name. < |
| | 533 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 534 | | public Response<ConnectionSharedKey> GetSharedKey(string resourceGroupName, string virtualNetworkGatewayConnecti |
| | 535 | | { |
| 0 | 536 | | if (resourceGroupName == null) |
| | 537 | | { |
| 0 | 538 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 539 | | } |
| 0 | 540 | | if (virtualNetworkGatewayConnectionName == null) |
| | 541 | | { |
| 0 | 542 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 543 | | } |
| | 544 | |
|
| 0 | 545 | | using var message = CreateGetSharedKeyRequest(resourceGroupName, virtualNetworkGatewayConnectionName); |
| 0 | 546 | | _pipeline.Send(message, cancellationToken); |
| 0 | 547 | | switch (message.Response.Status) |
| | 548 | | { |
| | 549 | | case 200: |
| | 550 | | { |
| 0 | 551 | | ConnectionSharedKey value = default; |
| 0 | 552 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 553 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 554 | | { |
| 0 | 555 | | value = null; |
| | 556 | | } |
| | 557 | | else |
| | 558 | | { |
| 0 | 559 | | value = ConnectionSharedKey.DeserializeConnectionSharedKey(document.RootElement); |
| | 560 | | } |
| 0 | 561 | | return Response.FromValue(value, message.Response); |
| | 562 | | } |
| | 563 | | default: |
| 0 | 564 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 565 | | } |
| 0 | 566 | | } |
| | 567 | |
|
| | 568 | | internal HttpMessage CreateListRequest(string resourceGroupName) |
| | 569 | | { |
| 24 | 570 | | var message = _pipeline.CreateMessage(); |
| 24 | 571 | | var request = message.Request; |
| 24 | 572 | | request.Method = RequestMethod.Get; |
| 24 | 573 | | var uri = new RawRequestUriBuilder(); |
| 24 | 574 | | uri.Reset(endpoint); |
| 24 | 575 | | uri.AppendPath("/subscriptions/", false); |
| 24 | 576 | | uri.AppendPath(subscriptionId, true); |
| 24 | 577 | | uri.AppendPath("/resourceGroups/", false); |
| 24 | 578 | | uri.AppendPath(resourceGroupName, true); |
| 24 | 579 | | uri.AppendPath("/providers/Microsoft.Network/connections", false); |
| 24 | 580 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 24 | 581 | | request.Uri = uri; |
| 24 | 582 | | return message; |
| | 583 | | } |
| | 584 | |
|
| | 585 | | /// <summary> The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways con |
| | 586 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 587 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 588 | | public async Task<Response<VirtualNetworkGatewayConnectionListResult>> ListAsync(string resourceGroupName, Cance |
| | 589 | | { |
| 12 | 590 | | if (resourceGroupName == null) |
| | 591 | | { |
| 0 | 592 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 593 | | } |
| | 594 | |
|
| 12 | 595 | | using var message = CreateListRequest(resourceGroupName); |
| 12 | 596 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 12 | 597 | | switch (message.Response.Status) |
| | 598 | | { |
| | 599 | | case 200: |
| | 600 | | { |
| 12 | 601 | | VirtualNetworkGatewayConnectionListResult value = default; |
| 12 | 602 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 12 | 603 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 604 | | { |
| 0 | 605 | | value = null; |
| | 606 | | } |
| | 607 | | else |
| | 608 | | { |
| 12 | 609 | | value = VirtualNetworkGatewayConnectionListResult.DeserializeVirtualNetworkGatewayConnection |
| | 610 | | } |
| 12 | 611 | | return Response.FromValue(value, message.Response); |
| | 612 | | } |
| | 613 | | default: |
| 0 | 614 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 615 | | } |
| 12 | 616 | | } |
| | 617 | |
|
| | 618 | | /// <summary> The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways con |
| | 619 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 620 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 621 | | public Response<VirtualNetworkGatewayConnectionListResult> List(string resourceGroupName, CancellationToken canc |
| | 622 | | { |
| 12 | 623 | | if (resourceGroupName == null) |
| | 624 | | { |
| 0 | 625 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 626 | | } |
| | 627 | |
|
| 12 | 628 | | using var message = CreateListRequest(resourceGroupName); |
| 12 | 629 | | _pipeline.Send(message, cancellationToken); |
| 12 | 630 | | switch (message.Response.Status) |
| | 631 | | { |
| | 632 | | case 200: |
| | 633 | | { |
| 12 | 634 | | VirtualNetworkGatewayConnectionListResult value = default; |
| 12 | 635 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 12 | 636 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 637 | | { |
| 0 | 638 | | value = null; |
| | 639 | | } |
| | 640 | | else |
| | 641 | | { |
| 12 | 642 | | value = VirtualNetworkGatewayConnectionListResult.DeserializeVirtualNetworkGatewayConnection |
| | 643 | | } |
| 12 | 644 | | return Response.FromValue(value, message.Response); |
| | 645 | | } |
| | 646 | | default: |
| 0 | 647 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 648 | | } |
| 12 | 649 | | } |
| | 650 | |
|
| | 651 | | internal HttpMessage CreateResetSharedKeyRequest(string resourceGroupName, string virtualNetworkGatewayConnectio |
| | 652 | | { |
| 0 | 653 | | var message = _pipeline.CreateMessage(); |
| 0 | 654 | | var request = message.Request; |
| 0 | 655 | | request.Method = RequestMethod.Post; |
| 0 | 656 | | var uri = new RawRequestUriBuilder(); |
| 0 | 657 | | uri.Reset(endpoint); |
| 0 | 658 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 659 | | uri.AppendPath(subscriptionId, true); |
| 0 | 660 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 661 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 662 | | uri.AppendPath("/providers/Microsoft.Network/connections/", false); |
| 0 | 663 | | uri.AppendPath(virtualNetworkGatewayConnectionName, true); |
| 0 | 664 | | uri.AppendPath("/sharedkey/reset", false); |
| 0 | 665 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 666 | | request.Uri = uri; |
| 0 | 667 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 668 | | var content = new Utf8JsonRequestContent(); |
| 0 | 669 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 670 | | request.Content = content; |
| 0 | 671 | | return message; |
| | 672 | | } |
| | 673 | |
|
| | 674 | | /// <summary> The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway con |
| | 675 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 676 | | /// <param name="virtualNetworkGatewayConnectionName"> The virtual network gateway connection reset shared key N |
| | 677 | | /// <param name="parameters"> Parameters supplied to the begin reset virtual network gateway connection shared k |
| | 678 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 679 | | public async Task<Response> ResetSharedKeyAsync(string resourceGroupName, string virtualNetworkGatewayConnection |
| | 680 | | { |
| 0 | 681 | | if (resourceGroupName == null) |
| | 682 | | { |
| 0 | 683 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 684 | | } |
| 0 | 685 | | if (virtualNetworkGatewayConnectionName == null) |
| | 686 | | { |
| 0 | 687 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 688 | | } |
| 0 | 689 | | if (parameters == null) |
| | 690 | | { |
| 0 | 691 | | throw new ArgumentNullException(nameof(parameters)); |
| | 692 | | } |
| | 693 | |
|
| 0 | 694 | | using var message = CreateResetSharedKeyRequest(resourceGroupName, virtualNetworkGatewayConnectionName, para |
| 0 | 695 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 696 | | switch (message.Response.Status) |
| | 697 | | { |
| | 698 | | case 200: |
| | 699 | | case 202: |
| 0 | 700 | | return message.Response; |
| | 701 | | default: |
| 0 | 702 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 703 | | } |
| 0 | 704 | | } |
| | 705 | |
|
| | 706 | | /// <summary> The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway con |
| | 707 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 708 | | /// <param name="virtualNetworkGatewayConnectionName"> The virtual network gateway connection reset shared key N |
| | 709 | | /// <param name="parameters"> Parameters supplied to the begin reset virtual network gateway connection shared k |
| | 710 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 711 | | public Response ResetSharedKey(string resourceGroupName, string virtualNetworkGatewayConnectionName, ConnectionR |
| | 712 | | { |
| 0 | 713 | | if (resourceGroupName == null) |
| | 714 | | { |
| 0 | 715 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 716 | | } |
| 0 | 717 | | if (virtualNetworkGatewayConnectionName == null) |
| | 718 | | { |
| 0 | 719 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 720 | | } |
| 0 | 721 | | if (parameters == null) |
| | 722 | | { |
| 0 | 723 | | throw new ArgumentNullException(nameof(parameters)); |
| | 724 | | } |
| | 725 | |
|
| 0 | 726 | | using var message = CreateResetSharedKeyRequest(resourceGroupName, virtualNetworkGatewayConnectionName, para |
| 0 | 727 | | _pipeline.Send(message, cancellationToken); |
| 0 | 728 | | switch (message.Response.Status) |
| | 729 | | { |
| | 730 | | case 200: |
| | 731 | | case 202: |
| 0 | 732 | | return message.Response; |
| | 733 | | default: |
| 0 | 734 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 735 | | } |
| 0 | 736 | | } |
| | 737 | |
|
| | 738 | | internal HttpMessage CreateStartPacketCaptureRequest(string resourceGroupName, string virtualNetworkGatewayConne |
| | 739 | | { |
| 0 | 740 | | var message = _pipeline.CreateMessage(); |
| 0 | 741 | | var request = message.Request; |
| 0 | 742 | | request.Method = RequestMethod.Post; |
| 0 | 743 | | var uri = new RawRequestUriBuilder(); |
| 0 | 744 | | uri.Reset(endpoint); |
| 0 | 745 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 746 | | uri.AppendPath(subscriptionId, true); |
| 0 | 747 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 748 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 749 | | uri.AppendPath("/providers/Microsoft.Network/connections/", false); |
| 0 | 750 | | uri.AppendPath(virtualNetworkGatewayConnectionName, true); |
| 0 | 751 | | uri.AppendPath("/startPacketCapture", false); |
| 0 | 752 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 753 | | request.Uri = uri; |
| 0 | 754 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 755 | | if (parameters != null) |
| | 756 | | { |
| 0 | 757 | | var content = new Utf8JsonRequestContent(); |
| 0 | 758 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 759 | | request.Content = content; |
| | 760 | | } |
| 0 | 761 | | return message; |
| | 762 | | } |
| | 763 | |
|
| | 764 | | /// <summary> Starts packet capture on virtual network gateway connection in the specified resource group. </sum |
| | 765 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 766 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection. </par |
| | 767 | | /// <param name="parameters"> Virtual network gateway packet capture parameters supplied to start packet capture |
| | 768 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 769 | | public async Task<Response> StartPacketCaptureAsync(string resourceGroupName, string virtualNetworkGatewayConnec |
| | 770 | | { |
| 0 | 771 | | if (resourceGroupName == null) |
| | 772 | | { |
| 0 | 773 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 774 | | } |
| 0 | 775 | | if (virtualNetworkGatewayConnectionName == null) |
| | 776 | | { |
| 0 | 777 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 778 | | } |
| | 779 | |
|
| 0 | 780 | | using var message = CreateStartPacketCaptureRequest(resourceGroupName, virtualNetworkGatewayConnectionName, |
| 0 | 781 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 782 | | switch (message.Response.Status) |
| | 783 | | { |
| | 784 | | case 200: |
| | 785 | | case 202: |
| 0 | 786 | | return message.Response; |
| | 787 | | default: |
| 0 | 788 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 789 | | } |
| 0 | 790 | | } |
| | 791 | |
|
| | 792 | | /// <summary> Starts packet capture on virtual network gateway connection in the specified resource group. </sum |
| | 793 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 794 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway connection. </par |
| | 795 | | /// <param name="parameters"> Virtual network gateway packet capture parameters supplied to start packet capture |
| | 796 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 797 | | public Response StartPacketCapture(string resourceGroupName, string virtualNetworkGatewayConnectionName, VpnPack |
| | 798 | | { |
| 0 | 799 | | if (resourceGroupName == null) |
| | 800 | | { |
| 0 | 801 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 802 | | } |
| 0 | 803 | | if (virtualNetworkGatewayConnectionName == null) |
| | 804 | | { |
| 0 | 805 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 806 | | } |
| | 807 | |
|
| 0 | 808 | | using var message = CreateStartPacketCaptureRequest(resourceGroupName, virtualNetworkGatewayConnectionName, |
| 0 | 809 | | _pipeline.Send(message, cancellationToken); |
| 0 | 810 | | switch (message.Response.Status) |
| | 811 | | { |
| | 812 | | case 200: |
| | 813 | | case 202: |
| 0 | 814 | | return message.Response; |
| | 815 | | default: |
| 0 | 816 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 817 | | } |
| 0 | 818 | | } |
| | 819 | |
|
| | 820 | | internal HttpMessage CreateStopPacketCaptureRequest(string resourceGroupName, string virtualNetworkGatewayConnec |
| | 821 | | { |
| 0 | 822 | | var message = _pipeline.CreateMessage(); |
| 0 | 823 | | var request = message.Request; |
| 0 | 824 | | request.Method = RequestMethod.Post; |
| 0 | 825 | | var uri = new RawRequestUriBuilder(); |
| 0 | 826 | | uri.Reset(endpoint); |
| 0 | 827 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 828 | | uri.AppendPath(subscriptionId, true); |
| 0 | 829 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 830 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 831 | | uri.AppendPath("/providers/Microsoft.Network/connections/", false); |
| 0 | 832 | | uri.AppendPath(virtualNetworkGatewayConnectionName, true); |
| 0 | 833 | | uri.AppendPath("/stopPacketCapture", false); |
| 0 | 834 | | uri.AppendQuery("api-version", "2020-04-01", true); |
| 0 | 835 | | request.Uri = uri; |
| 0 | 836 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 837 | | var content = new Utf8JsonRequestContent(); |
| 0 | 838 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 839 | | request.Content = content; |
| 0 | 840 | | return message; |
| | 841 | | } |
| | 842 | |
|
| | 843 | | /// <summary> Stops packet capture on virtual network gateway connection in the specified resource group. </summ |
| | 844 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 845 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway Connection. </par |
| | 846 | | /// <param name="parameters"> Virtual network gateway packet capture parameters supplied to stop packet capture |
| | 847 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 848 | | public async Task<Response> StopPacketCaptureAsync(string resourceGroupName, string virtualNetworkGatewayConnect |
| | 849 | | { |
| 0 | 850 | | if (resourceGroupName == null) |
| | 851 | | { |
| 0 | 852 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 853 | | } |
| 0 | 854 | | if (virtualNetworkGatewayConnectionName == null) |
| | 855 | | { |
| 0 | 856 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 857 | | } |
| 0 | 858 | | if (parameters == null) |
| | 859 | | { |
| 0 | 860 | | throw new ArgumentNullException(nameof(parameters)); |
| | 861 | | } |
| | 862 | |
|
| 0 | 863 | | using var message = CreateStopPacketCaptureRequest(resourceGroupName, virtualNetworkGatewayConnectionName, p |
| 0 | 864 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 865 | | switch (message.Response.Status) |
| | 866 | | { |
| | 867 | | case 200: |
| | 868 | | case 202: |
| 0 | 869 | | return message.Response; |
| | 870 | | default: |
| 0 | 871 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 872 | | } |
| 0 | 873 | | } |
| | 874 | |
|
| | 875 | | /// <summary> Stops packet capture on virtual network gateway connection in the specified resource group. </summ |
| | 876 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 877 | | /// <param name="virtualNetworkGatewayConnectionName"> The name of the virtual network gateway Connection. </par |
| | 878 | | /// <param name="parameters"> Virtual network gateway packet capture parameters supplied to stop packet capture |
| | 879 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 880 | | public Response StopPacketCapture(string resourceGroupName, string virtualNetworkGatewayConnectionName, VpnPacke |
| | 881 | | { |
| 0 | 882 | | if (resourceGroupName == null) |
| | 883 | | { |
| 0 | 884 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 885 | | } |
| 0 | 886 | | if (virtualNetworkGatewayConnectionName == null) |
| | 887 | | { |
| 0 | 888 | | throw new ArgumentNullException(nameof(virtualNetworkGatewayConnectionName)); |
| | 889 | | } |
| 0 | 890 | | if (parameters == null) |
| | 891 | | { |
| 0 | 892 | | throw new ArgumentNullException(nameof(parameters)); |
| | 893 | | } |
| | 894 | |
|
| 0 | 895 | | using var message = CreateStopPacketCaptureRequest(resourceGroupName, virtualNetworkGatewayConnectionName, p |
| 0 | 896 | | _pipeline.Send(message, cancellationToken); |
| 0 | 897 | | switch (message.Response.Status) |
| | 898 | | { |
| | 899 | | case 200: |
| | 900 | | case 202: |
| 0 | 901 | | return message.Response; |
| | 902 | | default: |
| 0 | 903 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 904 | | } |
| 0 | 905 | | } |
| | 906 | |
|
| | 907 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName) |
| | 908 | | { |
| 0 | 909 | | var message = _pipeline.CreateMessage(); |
| 0 | 910 | | var request = message.Request; |
| 0 | 911 | | request.Method = RequestMethod.Get; |
| 0 | 912 | | var uri = new RawRequestUriBuilder(); |
| 0 | 913 | | uri.Reset(endpoint); |
| 0 | 914 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 915 | | request.Uri = uri; |
| 0 | 916 | | return message; |
| | 917 | | } |
| | 918 | |
|
| | 919 | | /// <summary> The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways con |
| | 920 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 921 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 922 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 923 | | public async Task<Response<VirtualNetworkGatewayConnectionListResult>> ListNextPageAsync(string nextLink, string |
| | 924 | | { |
| 0 | 925 | | if (nextLink == null) |
| | 926 | | { |
| 0 | 927 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 928 | | } |
| 0 | 929 | | if (resourceGroupName == null) |
| | 930 | | { |
| 0 | 931 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 932 | | } |
| | 933 | |
|
| 0 | 934 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName); |
| 0 | 935 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 936 | | switch (message.Response.Status) |
| | 937 | | { |
| | 938 | | case 200: |
| | 939 | | { |
| 0 | 940 | | VirtualNetworkGatewayConnectionListResult value = default; |
| 0 | 941 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 942 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 943 | | { |
| 0 | 944 | | value = null; |
| | 945 | | } |
| | 946 | | else |
| | 947 | | { |
| 0 | 948 | | value = VirtualNetworkGatewayConnectionListResult.DeserializeVirtualNetworkGatewayConnection |
| | 949 | | } |
| 0 | 950 | | return Response.FromValue(value, message.Response); |
| | 951 | | } |
| | 952 | | default: |
| 0 | 953 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 954 | | } |
| 0 | 955 | | } |
| | 956 | |
|
| | 957 | | /// <summary> The List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways con |
| | 958 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 959 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 960 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 961 | | public Response<VirtualNetworkGatewayConnectionListResult> ListNextPage(string nextLink, string resourceGroupNam |
| | 962 | | { |
| 0 | 963 | | if (nextLink == null) |
| | 964 | | { |
| 0 | 965 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 966 | | } |
| 0 | 967 | | if (resourceGroupName == null) |
| | 968 | | { |
| 0 | 969 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 970 | | } |
| | 971 | |
|
| 0 | 972 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName); |
| 0 | 973 | | _pipeline.Send(message, cancellationToken); |
| 0 | 974 | | switch (message.Response.Status) |
| | 975 | | { |
| | 976 | | case 200: |
| | 977 | | { |
| 0 | 978 | | VirtualNetworkGatewayConnectionListResult value = default; |
| 0 | 979 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 980 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 981 | | { |
| 0 | 982 | | value = null; |
| | 983 | | } |
| | 984 | | else |
| | 985 | | { |
| 0 | 986 | | value = VirtualNetworkGatewayConnectionListResult.DeserializeVirtualNetworkGatewayConnection |
| | 987 | | } |
| 0 | 988 | | return Response.FromValue(value, message.Response); |
| | 989 | | } |
| | 990 | | default: |
| 0 | 991 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 992 | | } |
| 0 | 993 | | } |
| | 994 | | } |
| | 995 | | } |