| | | 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 | | |
| | | 16 | | namespace Azure.ResourceManager.Network |
| | | 17 | | { |
| | | 18 | | /// <summary> Stops packet capture on virtual network gateway in the specified resource group. </summary> |
| | | 19 | | public partial class VirtualNetworkGatewaysStopPacketCaptureOperation : Operation<string>, IOperationSource<string> |
| | | 20 | | { |
| | | 21 | | private readonly ArmOperationHelpers<string> _operation; |
| | 0 | 22 | | internal VirtualNetworkGatewaysStopPacketCaptureOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipe |
| | | 23 | | { |
| | 0 | 24 | | _operation = new ArmOperationHelpers<string>(this, clientDiagnostics, pipeline, request, response, Operation |
| | 0 | 25 | | } |
| | | 26 | | /// <inheritdoc /> |
| | 0 | 27 | | public override string Id => _operation.Id; |
| | | 28 | | |
| | | 29 | | /// <inheritdoc /> |
| | 0 | 30 | | public override string Value => _operation.Value; |
| | | 31 | | |
| | | 32 | | /// <inheritdoc /> |
| | 0 | 33 | | public override bool HasCompleted => _operation.HasCompleted; |
| | | 34 | | |
| | | 35 | | /// <inheritdoc /> |
| | 0 | 36 | | public override bool HasValue => _operation.HasValue; |
| | | 37 | | |
| | | 38 | | /// <inheritdoc /> |
| | 0 | 39 | | public override Response GetRawResponse() => _operation.GetRawResponse(); |
| | | 40 | | |
| | | 41 | | /// <inheritdoc /> |
| | 0 | 42 | | public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus( |
| | | 43 | | |
| | | 44 | | /// <inheritdoc /> |
| | 0 | 45 | | public override ValueTask<Response> UpdateStatusAsync(CancellationToken cancellationToken = default) => _operati |
| | | 46 | | |
| | | 47 | | /// <inheritdoc /> |
| | 0 | 48 | | public override ValueTask<Response<string>> WaitForCompletionAsync(CancellationToken cancellationToken = default |
| | | 49 | | |
| | | 50 | | /// <inheritdoc /> |
| | 0 | 51 | | public override ValueTask<Response<string>> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken c |
| | | 52 | | |
| | | 53 | | string IOperationSource<string>.CreateResult(Response response, CancellationToken cancellationToken) |
| | | 54 | | { |
| | 0 | 55 | | using var document = JsonDocument.Parse(response.ContentStream); |
| | 0 | 56 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | | 57 | | { |
| | 0 | 58 | | return null; |
| | | 59 | | } |
| | | 60 | | else |
| | | 61 | | { |
| | 0 | 62 | | return document.RootElement.GetString(); |
| | | 63 | | } |
| | 0 | 64 | | } |
| | | 65 | | |
| | | 66 | | async ValueTask<string> IOperationSource<string>.CreateResultAsync(Response response, CancellationToken cancella |
| | | 67 | | { |
| | 0 | 68 | | using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).Confi |
| | 0 | 69 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | | 70 | | { |
| | 0 | 71 | | return null; |
| | | 72 | | } |
| | | 73 | | else |
| | | 74 | | { |
| | 0 | 75 | | return document.RootElement.GetString(); |
| | | 76 | | } |
| | 0 | 77 | | } |
| | | 78 | | } |
| | | 79 | | } |