| | 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 ConnectionMonitorParameters : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Source != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("source"); |
| 0 | 22 | | writer.WriteObjectValue(Source); |
| | 23 | | } |
| 0 | 24 | | if (Destination != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("destination"); |
| 0 | 27 | | writer.WriteObjectValue(Destination); |
| | 28 | | } |
| 0 | 29 | | if (AutoStart != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("autoStart"); |
| 0 | 32 | | writer.WriteBooleanValue(AutoStart.Value); |
| | 33 | | } |
| 0 | 34 | | if (MonitoringIntervalInSeconds != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("monitoringIntervalInSeconds"); |
| 0 | 37 | | writer.WriteNumberValue(MonitoringIntervalInSeconds.Value); |
| | 38 | | } |
| 0 | 39 | | if (Endpoints != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("endpoints"); |
| 0 | 42 | | writer.WriteStartArray(); |
| 0 | 43 | | foreach (var item in Endpoints) |
| | 44 | | { |
| 0 | 45 | | writer.WriteObjectValue(item); |
| | 46 | | } |
| 0 | 47 | | writer.WriteEndArray(); |
| | 48 | | } |
| 0 | 49 | | if (TestConfigurations != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("testConfigurations"); |
| 0 | 52 | | writer.WriteStartArray(); |
| 0 | 53 | | foreach (var item in TestConfigurations) |
| | 54 | | { |
| 0 | 55 | | writer.WriteObjectValue(item); |
| | 56 | | } |
| 0 | 57 | | writer.WriteEndArray(); |
| | 58 | | } |
| 0 | 59 | | if (TestGroups != null) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("testGroups"); |
| 0 | 62 | | writer.WriteStartArray(); |
| 0 | 63 | | foreach (var item in TestGroups) |
| | 64 | | { |
| 0 | 65 | | writer.WriteObjectValue(item); |
| | 66 | | } |
| 0 | 67 | | writer.WriteEndArray(); |
| | 68 | | } |
| 0 | 69 | | if (Outputs != null) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("outputs"); |
| 0 | 72 | | writer.WriteStartArray(); |
| 0 | 73 | | foreach (var item in Outputs) |
| | 74 | | { |
| 0 | 75 | | writer.WriteObjectValue(item); |
| | 76 | | } |
| 0 | 77 | | writer.WriteEndArray(); |
| | 78 | | } |
| 0 | 79 | | if (Notes != null) |
| | 80 | | { |
| 0 | 81 | | writer.WritePropertyName("notes"); |
| 0 | 82 | | writer.WriteStringValue(Notes); |
| | 83 | | } |
| 0 | 84 | | writer.WriteEndObject(); |
| 0 | 85 | | } |
| | 86 | |
|
| | 87 | | internal static ConnectionMonitorParameters DeserializeConnectionMonitorParameters(JsonElement element) |
| | 88 | | { |
| 0 | 89 | | ConnectionMonitorSource source = default; |
| 0 | 90 | | ConnectionMonitorDestination destination = default; |
| 0 | 91 | | bool? autoStart = default; |
| 0 | 92 | | int? monitoringIntervalInSeconds = default; |
| 0 | 93 | | IList<ConnectionMonitorEndpoint> endpoints = default; |
| 0 | 94 | | IList<ConnectionMonitorTestConfiguration> testConfigurations = default; |
| 0 | 95 | | IList<ConnectionMonitorTestGroup> testGroups = default; |
| 0 | 96 | | IList<ConnectionMonitorOutput> outputs = default; |
| 0 | 97 | | string notes = default; |
| 0 | 98 | | foreach (var property in element.EnumerateObject()) |
| | 99 | | { |
| 0 | 100 | | if (property.NameEquals("source")) |
| | 101 | | { |
| 0 | 102 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| | 104 | | continue; |
| | 105 | | } |
| 0 | 106 | | source = ConnectionMonitorSource.DeserializeConnectionMonitorSource(property.Value); |
| 0 | 107 | | continue; |
| | 108 | | } |
| 0 | 109 | | if (property.NameEquals("destination")) |
| | 110 | | { |
| 0 | 111 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 0 | 115 | | destination = ConnectionMonitorDestination.DeserializeConnectionMonitorDestination(property.Value); |
| 0 | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | if (property.NameEquals("autoStart")) |
| | 119 | | { |
| 0 | 120 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| | 122 | | continue; |
| | 123 | | } |
| 0 | 124 | | autoStart = property.Value.GetBoolean(); |
| 0 | 125 | | continue; |
| | 126 | | } |
| 0 | 127 | | if (property.NameEquals("monitoringIntervalInSeconds")) |
| | 128 | | { |
| 0 | 129 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 130 | | { |
| | 131 | | continue; |
| | 132 | | } |
| 0 | 133 | | monitoringIntervalInSeconds = property.Value.GetInt32(); |
| 0 | 134 | | continue; |
| | 135 | | } |
| 0 | 136 | | if (property.NameEquals("endpoints")) |
| | 137 | | { |
| 0 | 138 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 139 | | { |
| | 140 | | continue; |
| | 141 | | } |
| 0 | 142 | | List<ConnectionMonitorEndpoint> array = new List<ConnectionMonitorEndpoint>(); |
| 0 | 143 | | foreach (var item in property.Value.EnumerateArray()) |
| | 144 | | { |
| 0 | 145 | | if (item.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| 0 | 147 | | array.Add(null); |
| | 148 | | } |
| | 149 | | else |
| | 150 | | { |
| 0 | 151 | | array.Add(ConnectionMonitorEndpoint.DeserializeConnectionMonitorEndpoint(item)); |
| | 152 | | } |
| | 153 | | } |
| 0 | 154 | | endpoints = array; |
| 0 | 155 | | continue; |
| | 156 | | } |
| 0 | 157 | | if (property.NameEquals("testConfigurations")) |
| | 158 | | { |
| 0 | 159 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 160 | | { |
| | 161 | | continue; |
| | 162 | | } |
| 0 | 163 | | List<ConnectionMonitorTestConfiguration> array = new List<ConnectionMonitorTestConfiguration>(); |
| 0 | 164 | | foreach (var item in property.Value.EnumerateArray()) |
| | 165 | | { |
| 0 | 166 | | if (item.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| 0 | 168 | | array.Add(null); |
| | 169 | | } |
| | 170 | | else |
| | 171 | | { |
| 0 | 172 | | array.Add(ConnectionMonitorTestConfiguration.DeserializeConnectionMonitorTestConfiguration(i |
| | 173 | | } |
| | 174 | | } |
| 0 | 175 | | testConfigurations = array; |
| 0 | 176 | | continue; |
| | 177 | | } |
| 0 | 178 | | if (property.NameEquals("testGroups")) |
| | 179 | | { |
| 0 | 180 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 181 | | { |
| | 182 | | continue; |
| | 183 | | } |
| 0 | 184 | | List<ConnectionMonitorTestGroup> array = new List<ConnectionMonitorTestGroup>(); |
| 0 | 185 | | foreach (var item in property.Value.EnumerateArray()) |
| | 186 | | { |
| 0 | 187 | | if (item.ValueKind == JsonValueKind.Null) |
| | 188 | | { |
| 0 | 189 | | array.Add(null); |
| | 190 | | } |
| | 191 | | else |
| | 192 | | { |
| 0 | 193 | | array.Add(ConnectionMonitorTestGroup.DeserializeConnectionMonitorTestGroup(item)); |
| | 194 | | } |
| | 195 | | } |
| 0 | 196 | | testGroups = array; |
| 0 | 197 | | continue; |
| | 198 | | } |
| 0 | 199 | | if (property.NameEquals("outputs")) |
| | 200 | | { |
| 0 | 201 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 202 | | { |
| | 203 | | continue; |
| | 204 | | } |
| 0 | 205 | | List<ConnectionMonitorOutput> array = new List<ConnectionMonitorOutput>(); |
| 0 | 206 | | foreach (var item in property.Value.EnumerateArray()) |
| | 207 | | { |
| 0 | 208 | | if (item.ValueKind == JsonValueKind.Null) |
| | 209 | | { |
| 0 | 210 | | array.Add(null); |
| | 211 | | } |
| | 212 | | else |
| | 213 | | { |
| 0 | 214 | | array.Add(ConnectionMonitorOutput.DeserializeConnectionMonitorOutput(item)); |
| | 215 | | } |
| | 216 | | } |
| 0 | 217 | | outputs = array; |
| 0 | 218 | | continue; |
| | 219 | | } |
| 0 | 220 | | if (property.NameEquals("notes")) |
| | 221 | | { |
| 0 | 222 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 223 | | { |
| | 224 | | continue; |
| | 225 | | } |
| 0 | 226 | | notes = property.Value.GetString(); |
| | 227 | | continue; |
| | 228 | | } |
| | 229 | | } |
| 0 | 230 | | return new ConnectionMonitorParameters(source, destination, autoStart, monitoringIntervalInSeconds, endpoint |
| | 231 | | } |
| | 232 | | } |
| | 233 | | } |