| | 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.Collections.Generic; |
| | 10 | | using System.Text.Json; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.ResourceManager.Network.Models |
| | 14 | | { |
| | 15 | | public partial class PacketCaptureQueryStatusResult |
| | 16 | | { |
| | 17 | | internal static PacketCaptureQueryStatusResult DeserializePacketCaptureQueryStatusResult(JsonElement element) |
| | 18 | | { |
| 8 | 19 | | string name = default; |
| 8 | 20 | | string id = default; |
| 8 | 21 | | DateTimeOffset? captureStartTime = default; |
| 8 | 22 | | PcStatus? packetCaptureStatus = default; |
| 8 | 23 | | string stopReason = default; |
| 8 | 24 | | IReadOnlyList<PcError> packetCaptureError = default; |
| 104 | 25 | | foreach (var property in element.EnumerateObject()) |
| | 26 | | { |
| 44 | 27 | | if (property.NameEquals("name")) |
| | 28 | | { |
| 8 | 29 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 30 | | { |
| | 31 | | continue; |
| | 32 | | } |
| 8 | 33 | | name = property.Value.GetString(); |
| 8 | 34 | | continue; |
| | 35 | | } |
| 36 | 36 | | if (property.NameEquals("id")) |
| | 37 | | { |
| 8 | 38 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 39 | | { |
| | 40 | | continue; |
| | 41 | | } |
| 8 | 42 | | id = property.Value.GetString(); |
| 8 | 43 | | continue; |
| | 44 | | } |
| 28 | 45 | | if (property.NameEquals("captureStartTime")) |
| | 46 | | { |
| 8 | 47 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 48 | | { |
| | 49 | | continue; |
| | 50 | | } |
| 8 | 51 | | captureStartTime = property.Value.GetDateTimeOffset("O"); |
| 8 | 52 | | continue; |
| | 53 | | } |
| 20 | 54 | | if (property.NameEquals("packetCaptureStatus")) |
| | 55 | | { |
| 8 | 56 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 57 | | { |
| | 58 | | continue; |
| | 59 | | } |
| 8 | 60 | | packetCaptureStatus = new PcStatus(property.Value.GetString()); |
| 8 | 61 | | continue; |
| | 62 | | } |
| 12 | 63 | | if (property.NameEquals("stopReason")) |
| | 64 | | { |
| 4 | 65 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 66 | | { |
| | 67 | | continue; |
| | 68 | | } |
| 4 | 69 | | stopReason = property.Value.GetString(); |
| 4 | 70 | | continue; |
| | 71 | | } |
| 8 | 72 | | if (property.NameEquals("packetCaptureError")) |
| | 73 | | { |
| 8 | 74 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 75 | | { |
| | 76 | | continue; |
| | 77 | | } |
| 8 | 78 | | List<PcError> array = new List<PcError>(); |
| 0 | 79 | | foreach (var item in property.Value.EnumerateArray()) |
| | 80 | | { |
| 0 | 81 | | array.Add(new PcError(item.GetString())); |
| | 82 | | } |
| 8 | 83 | | packetCaptureError = array; |
| | 84 | | continue; |
| | 85 | | } |
| | 86 | | } |
| 8 | 87 | | return new PacketCaptureQueryStatusResult(name, id, captureStartTime, packetCaptureStatus, stopReason, packe |
| | 88 | | } |
| | 89 | | } |
| | 90 | | } |