| | 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 PacketCaptureResultProperties : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (ProvisioningState != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("provisioningState"); |
| 0 | 22 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 23 | | } |
| 0 | 24 | | writer.WritePropertyName("target"); |
| 0 | 25 | | writer.WriteStringValue(Target); |
| 0 | 26 | | if (BytesToCapturePerPacket != null) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("bytesToCapturePerPacket"); |
| 0 | 29 | | writer.WriteNumberValue(BytesToCapturePerPacket.Value); |
| | 30 | | } |
| 0 | 31 | | if (TotalBytesPerSession != null) |
| | 32 | | { |
| 0 | 33 | | writer.WritePropertyName("totalBytesPerSession"); |
| 0 | 34 | | writer.WriteNumberValue(TotalBytesPerSession.Value); |
| | 35 | | } |
| 0 | 36 | | if (TimeLimitInSeconds != null) |
| | 37 | | { |
| 0 | 38 | | writer.WritePropertyName("timeLimitInSeconds"); |
| 0 | 39 | | writer.WriteNumberValue(TimeLimitInSeconds.Value); |
| | 40 | | } |
| 0 | 41 | | writer.WritePropertyName("storageLocation"); |
| 0 | 42 | | writer.WriteObjectValue(StorageLocation); |
| 0 | 43 | | if (Filters != null) |
| | 44 | | { |
| 0 | 45 | | writer.WritePropertyName("filters"); |
| 0 | 46 | | writer.WriteStartArray(); |
| 0 | 47 | | foreach (var item in Filters) |
| | 48 | | { |
| 0 | 49 | | writer.WriteObjectValue(item); |
| | 50 | | } |
| 0 | 51 | | writer.WriteEndArray(); |
| | 52 | | } |
| 0 | 53 | | writer.WriteEndObject(); |
| 0 | 54 | | } |
| | 55 | |
|
| | 56 | | internal static PacketCaptureResultProperties DeserializePacketCaptureResultProperties(JsonElement element) |
| | 57 | | { |
| 0 | 58 | | ProvisioningState? provisioningState = default; |
| 0 | 59 | | string target = default; |
| 0 | 60 | | int? bytesToCapturePerPacket = default; |
| 0 | 61 | | int? totalBytesPerSession = default; |
| 0 | 62 | | int? timeLimitInSeconds = default; |
| 0 | 63 | | PacketCaptureStorageLocation storageLocation = default; |
| 0 | 64 | | IList<PacketCaptureFilter> filters = default; |
| 0 | 65 | | foreach (var property in element.EnumerateObject()) |
| | 66 | | { |
| 0 | 67 | | if (property.NameEquals("provisioningState")) |
| | 68 | | { |
| 0 | 69 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 70 | | { |
| | 71 | | continue; |
| | 72 | | } |
| 0 | 73 | | provisioningState = new ProvisioningState(property.Value.GetString()); |
| 0 | 74 | | continue; |
| | 75 | | } |
| 0 | 76 | | if (property.NameEquals("target")) |
| | 77 | | { |
| 0 | 78 | | target = property.Value.GetString(); |
| 0 | 79 | | continue; |
| | 80 | | } |
| 0 | 81 | | if (property.NameEquals("bytesToCapturePerPacket")) |
| | 82 | | { |
| 0 | 83 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 84 | | { |
| | 85 | | continue; |
| | 86 | | } |
| 0 | 87 | | bytesToCapturePerPacket = property.Value.GetInt32(); |
| 0 | 88 | | continue; |
| | 89 | | } |
| 0 | 90 | | if (property.NameEquals("totalBytesPerSession")) |
| | 91 | | { |
| 0 | 92 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 93 | | { |
| | 94 | | continue; |
| | 95 | | } |
| 0 | 96 | | totalBytesPerSession = property.Value.GetInt32(); |
| 0 | 97 | | continue; |
| | 98 | | } |
| 0 | 99 | | if (property.NameEquals("timeLimitInSeconds")) |
| | 100 | | { |
| 0 | 101 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 102 | | { |
| | 103 | | continue; |
| | 104 | | } |
| 0 | 105 | | timeLimitInSeconds = property.Value.GetInt32(); |
| 0 | 106 | | continue; |
| | 107 | | } |
| 0 | 108 | | if (property.NameEquals("storageLocation")) |
| | 109 | | { |
| 0 | 110 | | storageLocation = PacketCaptureStorageLocation.DeserializePacketCaptureStorageLocation(property.Valu |
| 0 | 111 | | continue; |
| | 112 | | } |
| 0 | 113 | | if (property.NameEquals("filters")) |
| | 114 | | { |
| 0 | 115 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| | 117 | | continue; |
| | 118 | | } |
| 0 | 119 | | List<PacketCaptureFilter> array = new List<PacketCaptureFilter>(); |
| 0 | 120 | | foreach (var item in property.Value.EnumerateArray()) |
| | 121 | | { |
| 0 | 122 | | if (item.ValueKind == JsonValueKind.Null) |
| | 123 | | { |
| 0 | 124 | | array.Add(null); |
| | 125 | | } |
| | 126 | | else |
| | 127 | | { |
| 0 | 128 | | array.Add(PacketCaptureFilter.DeserializePacketCaptureFilter(item)); |
| | 129 | | } |
| | 130 | | } |
| 0 | 131 | | filters = array; |
| | 132 | | continue; |
| | 133 | | } |
| | 134 | | } |
| 0 | 135 | | return new PacketCaptureResultProperties(target, bytesToCapturePerPacket, totalBytesPerSession, timeLimitInS |
| | 136 | | } |
| | 137 | | } |
| | 138 | | } |