| | 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 ConnectionMonitorTestGroup : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("name"); |
| 0 | 20 | | writer.WriteStringValue(Name); |
| 0 | 21 | | if (Disable != null) |
| | 22 | | { |
| 0 | 23 | | writer.WritePropertyName("disable"); |
| 0 | 24 | | writer.WriteBooleanValue(Disable.Value); |
| | 25 | | } |
| 0 | 26 | | writer.WritePropertyName("testConfigurations"); |
| 0 | 27 | | writer.WriteStartArray(); |
| 0 | 28 | | foreach (var item in TestConfigurations) |
| | 29 | | { |
| 0 | 30 | | writer.WriteStringValue(item); |
| | 31 | | } |
| 0 | 32 | | writer.WriteEndArray(); |
| 0 | 33 | | writer.WritePropertyName("sources"); |
| 0 | 34 | | writer.WriteStartArray(); |
| 0 | 35 | | foreach (var item in Sources) |
| | 36 | | { |
| 0 | 37 | | writer.WriteStringValue(item); |
| | 38 | | } |
| 0 | 39 | | writer.WriteEndArray(); |
| 0 | 40 | | writer.WritePropertyName("destinations"); |
| 0 | 41 | | writer.WriteStartArray(); |
| 0 | 42 | | foreach (var item in Destinations) |
| | 43 | | { |
| 0 | 44 | | writer.WriteStringValue(item); |
| | 45 | | } |
| 0 | 46 | | writer.WriteEndArray(); |
| 0 | 47 | | writer.WriteEndObject(); |
| 0 | 48 | | } |
| | 49 | |
|
| | 50 | | internal static ConnectionMonitorTestGroup DeserializeConnectionMonitorTestGroup(JsonElement element) |
| | 51 | | { |
| 0 | 52 | | string name = default; |
| 0 | 53 | | bool? disable = default; |
| 0 | 54 | | IList<string> testConfigurations = default; |
| 0 | 55 | | IList<string> sources = default; |
| 0 | 56 | | IList<string> destinations = default; |
| 0 | 57 | | foreach (var property in element.EnumerateObject()) |
| | 58 | | { |
| 0 | 59 | | if (property.NameEquals("name")) |
| | 60 | | { |
| 0 | 61 | | name = property.Value.GetString(); |
| 0 | 62 | | continue; |
| | 63 | | } |
| 0 | 64 | | if (property.NameEquals("disable")) |
| | 65 | | { |
| 0 | 66 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 67 | | { |
| | 68 | | continue; |
| | 69 | | } |
| 0 | 70 | | disable = property.Value.GetBoolean(); |
| 0 | 71 | | continue; |
| | 72 | | } |
| 0 | 73 | | if (property.NameEquals("testConfigurations")) |
| | 74 | | { |
| 0 | 75 | | List<string> array = new List<string>(); |
| 0 | 76 | | foreach (var item in property.Value.EnumerateArray()) |
| | 77 | | { |
| 0 | 78 | | if (item.ValueKind == JsonValueKind.Null) |
| | 79 | | { |
| 0 | 80 | | array.Add(null); |
| | 81 | | } |
| | 82 | | else |
| | 83 | | { |
| 0 | 84 | | array.Add(item.GetString()); |
| | 85 | | } |
| | 86 | | } |
| 0 | 87 | | testConfigurations = array; |
| 0 | 88 | | continue; |
| | 89 | | } |
| 0 | 90 | | if (property.NameEquals("sources")) |
| | 91 | | { |
| 0 | 92 | | List<string> array = new List<string>(); |
| 0 | 93 | | foreach (var item in property.Value.EnumerateArray()) |
| | 94 | | { |
| 0 | 95 | | if (item.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| 0 | 97 | | array.Add(null); |
| | 98 | | } |
| | 99 | | else |
| | 100 | | { |
| 0 | 101 | | array.Add(item.GetString()); |
| | 102 | | } |
| | 103 | | } |
| 0 | 104 | | sources = array; |
| 0 | 105 | | continue; |
| | 106 | | } |
| 0 | 107 | | if (property.NameEquals("destinations")) |
| | 108 | | { |
| 0 | 109 | | List<string> array = new List<string>(); |
| 0 | 110 | | foreach (var item in property.Value.EnumerateArray()) |
| | 111 | | { |
| 0 | 112 | | if (item.ValueKind == JsonValueKind.Null) |
| | 113 | | { |
| 0 | 114 | | array.Add(null); |
| | 115 | | } |
| | 116 | | else |
| | 117 | | { |
| 0 | 118 | | array.Add(item.GetString()); |
| | 119 | | } |
| | 120 | | } |
| 0 | 121 | | destinations = array; |
| | 122 | | continue; |
| | 123 | | } |
| | 124 | | } |
| 0 | 125 | | return new ConnectionMonitorTestGroup(name, disable, testConfigurations, sources, destinations); |
| | 126 | | } |
| | 127 | | } |
| | 128 | | } |