| | 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.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.ResourceManager.Network.Models |
| | 13 | | { |
| | 14 | | public partial class PacketCaptureResult |
| | 15 | | { |
| | 16 | | internal static PacketCaptureResult DeserializePacketCaptureResult(JsonElement element) |
| | 17 | | { |
| 20 | 18 | | string name = default; |
| 20 | 19 | | string id = default; |
| 20 | 20 | | string etag = default; |
| 20 | 21 | | string target = default; |
| 20 | 22 | | int? bytesToCapturePerPacket = default; |
| 20 | 23 | | int? totalBytesPerSession = default; |
| 20 | 24 | | int? timeLimitInSeconds = default; |
| 20 | 25 | | PacketCaptureStorageLocation storageLocation = default; |
| 20 | 26 | | IReadOnlyList<PacketCaptureFilter> filters = default; |
| 20 | 27 | | ProvisioningState? provisioningState = default; |
| 240 | 28 | | foreach (var property in element.EnumerateObject()) |
| | 29 | | { |
| 100 | 30 | | if (property.NameEquals("name")) |
| | 31 | | { |
| 20 | 32 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 33 | | { |
| | 34 | | continue; |
| | 35 | | } |
| 20 | 36 | | name = property.Value.GetString(); |
| 20 | 37 | | continue; |
| | 38 | | } |
| 80 | 39 | | if (property.NameEquals("id")) |
| | 40 | | { |
| 20 | 41 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 42 | | { |
| | 43 | | continue; |
| | 44 | | } |
| 20 | 45 | | id = property.Value.GetString(); |
| 20 | 46 | | continue; |
| | 47 | | } |
| 60 | 48 | | if (property.NameEquals("etag")) |
| | 49 | | { |
| 20 | 50 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 51 | | { |
| | 52 | | continue; |
| | 53 | | } |
| 20 | 54 | | etag = property.Value.GetString(); |
| 20 | 55 | | continue; |
| | 56 | | } |
| 40 | 57 | | if (property.NameEquals("properties")) |
| | 58 | | { |
| 328 | 59 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 60 | | { |
| 144 | 61 | | if (property0.NameEquals("target")) |
| | 62 | | { |
| 20 | 63 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 64 | | { |
| | 65 | | continue; |
| | 66 | | } |
| 20 | 67 | | target = property0.Value.GetString(); |
| 20 | 68 | | continue; |
| | 69 | | } |
| 124 | 70 | | if (property0.NameEquals("bytesToCapturePerPacket")) |
| | 71 | | { |
| 20 | 72 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 73 | | { |
| | 74 | | continue; |
| | 75 | | } |
| 20 | 76 | | bytesToCapturePerPacket = property0.Value.GetInt32(); |
| 20 | 77 | | continue; |
| | 78 | | } |
| 104 | 79 | | if (property0.NameEquals("totalBytesPerSession")) |
| | 80 | | { |
| 20 | 81 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 82 | | { |
| | 83 | | continue; |
| | 84 | | } |
| 20 | 85 | | totalBytesPerSession = property0.Value.GetInt32(); |
| 20 | 86 | | continue; |
| | 87 | | } |
| 84 | 88 | | if (property0.NameEquals("timeLimitInSeconds")) |
| | 89 | | { |
| 20 | 90 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 91 | | { |
| | 92 | | continue; |
| | 93 | | } |
| 20 | 94 | | timeLimitInSeconds = property0.Value.GetInt32(); |
| 20 | 95 | | continue; |
| | 96 | | } |
| 64 | 97 | | if (property0.NameEquals("storageLocation")) |
| | 98 | | { |
| 20 | 99 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 100 | | { |
| | 101 | | continue; |
| | 102 | | } |
| 20 | 103 | | storageLocation = PacketCaptureStorageLocation.DeserializePacketCaptureStorageLocation(prope |
| 20 | 104 | | continue; |
| | 105 | | } |
| 44 | 106 | | if (property0.NameEquals("filters")) |
| | 107 | | { |
| 20 | 108 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 109 | | { |
| | 110 | | continue; |
| | 111 | | } |
| 20 | 112 | | List<PacketCaptureFilter> array = new List<PacketCaptureFilter>(); |
| 0 | 113 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 114 | | { |
| 0 | 115 | | if (item.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| 0 | 117 | | array.Add(null); |
| | 118 | | } |
| | 119 | | else |
| | 120 | | { |
| 0 | 121 | | array.Add(PacketCaptureFilter.DeserializePacketCaptureFilter(item)); |
| | 122 | | } |
| | 123 | | } |
| 20 | 124 | | filters = array; |
| 20 | 125 | | continue; |
| | 126 | | } |
| 24 | 127 | | if (property0.NameEquals("provisioningState")) |
| | 128 | | { |
| 20 | 129 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 130 | | { |
| | 131 | | continue; |
| | 132 | | } |
| 20 | 133 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 134 | | continue; |
| | 135 | | } |
| | 136 | | } |
| | 137 | | continue; |
| | 138 | | } |
| | 139 | | } |
| 20 | 140 | | return new PacketCaptureResult(name, id, etag, target, bytesToCapturePerPacket, totalBytesPerSession, timeLi |
| | 141 | | } |
| | 142 | | } |
| | 143 | | } |