| | 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 ConnectionMonitorResultProperties : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 0 | 19 | | writer.WriteStartObject(); |
| 0 | 20 | | if (ProvisioningState != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("provisioningState"); |
| 0 | 23 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 24 | | } |
| 0 | 25 | | if (StartTime != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("startTime"); |
| 0 | 28 | | writer.WriteStringValue(StartTime.Value, "O"); |
| | 29 | | } |
| 0 | 30 | | if (MonitoringStatus != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("monitoringStatus"); |
| 0 | 33 | | writer.WriteStringValue(MonitoringStatus); |
| | 34 | | } |
| 0 | 35 | | if (ConnectionMonitorType != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("connectionMonitorType"); |
| 0 | 38 | | writer.WriteStringValue(ConnectionMonitorType.Value.ToString()); |
| | 39 | | } |
| 0 | 40 | | if (Source != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("source"); |
| 0 | 43 | | writer.WriteObjectValue(Source); |
| | 44 | | } |
| 0 | 45 | | if (Destination != null) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName("destination"); |
| 0 | 48 | | writer.WriteObjectValue(Destination); |
| | 49 | | } |
| 0 | 50 | | if (AutoStart != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("autoStart"); |
| 0 | 53 | | writer.WriteBooleanValue(AutoStart.Value); |
| | 54 | | } |
| 0 | 55 | | if (MonitoringIntervalInSeconds != null) |
| | 56 | | { |
| 0 | 57 | | writer.WritePropertyName("monitoringIntervalInSeconds"); |
| 0 | 58 | | writer.WriteNumberValue(MonitoringIntervalInSeconds.Value); |
| | 59 | | } |
| 0 | 60 | | if (Endpoints != null) |
| | 61 | | { |
| 0 | 62 | | writer.WritePropertyName("endpoints"); |
| 0 | 63 | | writer.WriteStartArray(); |
| 0 | 64 | | foreach (var item in Endpoints) |
| | 65 | | { |
| 0 | 66 | | writer.WriteObjectValue(item); |
| | 67 | | } |
| 0 | 68 | | writer.WriteEndArray(); |
| | 69 | | } |
| 0 | 70 | | if (TestConfigurations != null) |
| | 71 | | { |
| 0 | 72 | | writer.WritePropertyName("testConfigurations"); |
| 0 | 73 | | writer.WriteStartArray(); |
| 0 | 74 | | foreach (var item in TestConfigurations) |
| | 75 | | { |
| 0 | 76 | | writer.WriteObjectValue(item); |
| | 77 | | } |
| 0 | 78 | | writer.WriteEndArray(); |
| | 79 | | } |
| 0 | 80 | | if (TestGroups != null) |
| | 81 | | { |
| 0 | 82 | | writer.WritePropertyName("testGroups"); |
| 0 | 83 | | writer.WriteStartArray(); |
| 0 | 84 | | foreach (var item in TestGroups) |
| | 85 | | { |
| 0 | 86 | | writer.WriteObjectValue(item); |
| | 87 | | } |
| 0 | 88 | | writer.WriteEndArray(); |
| | 89 | | } |
| 0 | 90 | | if (Outputs != null) |
| | 91 | | { |
| 0 | 92 | | writer.WritePropertyName("outputs"); |
| 0 | 93 | | writer.WriteStartArray(); |
| 0 | 94 | | foreach (var item in Outputs) |
| | 95 | | { |
| 0 | 96 | | writer.WriteObjectValue(item); |
| | 97 | | } |
| 0 | 98 | | writer.WriteEndArray(); |
| | 99 | | } |
| 0 | 100 | | if (Notes != null) |
| | 101 | | { |
| 0 | 102 | | writer.WritePropertyName("notes"); |
| 0 | 103 | | writer.WriteStringValue(Notes); |
| | 104 | | } |
| 0 | 105 | | writer.WriteEndObject(); |
| 0 | 106 | | } |
| | 107 | |
|
| | 108 | | internal static ConnectionMonitorResultProperties DeserializeConnectionMonitorResultProperties(JsonElement eleme |
| | 109 | | { |
| 0 | 110 | | ProvisioningState? provisioningState = default; |
| 0 | 111 | | DateTimeOffset? startTime = default; |
| 0 | 112 | | string monitoringStatus = default; |
| 0 | 113 | | ConnectionMonitorType? connectionMonitorType = default; |
| 0 | 114 | | ConnectionMonitorSource source = default; |
| 0 | 115 | | ConnectionMonitorDestination destination = default; |
| 0 | 116 | | bool? autoStart = default; |
| 0 | 117 | | int? monitoringIntervalInSeconds = default; |
| 0 | 118 | | IList<ConnectionMonitorEndpoint> endpoints = default; |
| 0 | 119 | | IList<ConnectionMonitorTestConfiguration> testConfigurations = default; |
| 0 | 120 | | IList<ConnectionMonitorTestGroup> testGroups = default; |
| 0 | 121 | | IList<ConnectionMonitorOutput> outputs = default; |
| 0 | 122 | | string notes = default; |
| 0 | 123 | | foreach (var property in element.EnumerateObject()) |
| | 124 | | { |
| 0 | 125 | | if (property.NameEquals("provisioningState")) |
| | 126 | | { |
| 0 | 127 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 128 | | { |
| | 129 | | continue; |
| | 130 | | } |
| 0 | 131 | | provisioningState = new ProvisioningState(property.Value.GetString()); |
| 0 | 132 | | continue; |
| | 133 | | } |
| 0 | 134 | | if (property.NameEquals("startTime")) |
| | 135 | | { |
| 0 | 136 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 137 | | { |
| | 138 | | continue; |
| | 139 | | } |
| 0 | 140 | | startTime = property.Value.GetDateTimeOffset("O"); |
| 0 | 141 | | continue; |
| | 142 | | } |
| 0 | 143 | | if (property.NameEquals("monitoringStatus")) |
| | 144 | | { |
| 0 | 145 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 146 | | { |
| | 147 | | continue; |
| | 148 | | } |
| 0 | 149 | | monitoringStatus = property.Value.GetString(); |
| 0 | 150 | | continue; |
| | 151 | | } |
| 0 | 152 | | if (property.NameEquals("connectionMonitorType")) |
| | 153 | | { |
| 0 | 154 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 155 | | { |
| | 156 | | continue; |
| | 157 | | } |
| 0 | 158 | | connectionMonitorType = new ConnectionMonitorType(property.Value.GetString()); |
| 0 | 159 | | continue; |
| | 160 | | } |
| 0 | 161 | | if (property.NameEquals("source")) |
| | 162 | | { |
| 0 | 163 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 164 | | { |
| | 165 | | continue; |
| | 166 | | } |
| 0 | 167 | | source = ConnectionMonitorSource.DeserializeConnectionMonitorSource(property.Value); |
| 0 | 168 | | continue; |
| | 169 | | } |
| 0 | 170 | | if (property.NameEquals("destination")) |
| | 171 | | { |
| 0 | 172 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 173 | | { |
| | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | destination = ConnectionMonitorDestination.DeserializeConnectionMonitorDestination(property.Value); |
| 0 | 177 | | continue; |
| | 178 | | } |
| 0 | 179 | | if (property.NameEquals("autoStart")) |
| | 180 | | { |
| 0 | 181 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 182 | | { |
| | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | autoStart = property.Value.GetBoolean(); |
| 0 | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | if (property.NameEquals("monitoringIntervalInSeconds")) |
| | 189 | | { |
| 0 | 190 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 191 | | { |
| | 192 | | continue; |
| | 193 | | } |
| 0 | 194 | | monitoringIntervalInSeconds = property.Value.GetInt32(); |
| 0 | 195 | | continue; |
| | 196 | | } |
| 0 | 197 | | if (property.NameEquals("endpoints")) |
| | 198 | | { |
| 0 | 199 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 200 | | { |
| | 201 | | continue; |
| | 202 | | } |
| 0 | 203 | | List<ConnectionMonitorEndpoint> array = new List<ConnectionMonitorEndpoint>(); |
| 0 | 204 | | foreach (var item in property.Value.EnumerateArray()) |
| | 205 | | { |
| 0 | 206 | | if (item.ValueKind == JsonValueKind.Null) |
| | 207 | | { |
| 0 | 208 | | array.Add(null); |
| | 209 | | } |
| | 210 | | else |
| | 211 | | { |
| 0 | 212 | | array.Add(ConnectionMonitorEndpoint.DeserializeConnectionMonitorEndpoint(item)); |
| | 213 | | } |
| | 214 | | } |
| 0 | 215 | | endpoints = array; |
| 0 | 216 | | continue; |
| | 217 | | } |
| 0 | 218 | | if (property.NameEquals("testConfigurations")) |
| | 219 | | { |
| 0 | 220 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 221 | | { |
| | 222 | | continue; |
| | 223 | | } |
| 0 | 224 | | List<ConnectionMonitorTestConfiguration> array = new List<ConnectionMonitorTestConfiguration>(); |
| 0 | 225 | | foreach (var item in property.Value.EnumerateArray()) |
| | 226 | | { |
| 0 | 227 | | if (item.ValueKind == JsonValueKind.Null) |
| | 228 | | { |
| 0 | 229 | | array.Add(null); |
| | 230 | | } |
| | 231 | | else |
| | 232 | | { |
| 0 | 233 | | array.Add(ConnectionMonitorTestConfiguration.DeserializeConnectionMonitorTestConfiguration(i |
| | 234 | | } |
| | 235 | | } |
| 0 | 236 | | testConfigurations = array; |
| 0 | 237 | | continue; |
| | 238 | | } |
| 0 | 239 | | if (property.NameEquals("testGroups")) |
| | 240 | | { |
| 0 | 241 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 242 | | { |
| | 243 | | continue; |
| | 244 | | } |
| 0 | 245 | | List<ConnectionMonitorTestGroup> array = new List<ConnectionMonitorTestGroup>(); |
| 0 | 246 | | foreach (var item in property.Value.EnumerateArray()) |
| | 247 | | { |
| 0 | 248 | | if (item.ValueKind == JsonValueKind.Null) |
| | 249 | | { |
| 0 | 250 | | array.Add(null); |
| | 251 | | } |
| | 252 | | else |
| | 253 | | { |
| 0 | 254 | | array.Add(ConnectionMonitorTestGroup.DeserializeConnectionMonitorTestGroup(item)); |
| | 255 | | } |
| | 256 | | } |
| 0 | 257 | | testGroups = array; |
| 0 | 258 | | continue; |
| | 259 | | } |
| 0 | 260 | | if (property.NameEquals("outputs")) |
| | 261 | | { |
| 0 | 262 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 263 | | { |
| | 264 | | continue; |
| | 265 | | } |
| 0 | 266 | | List<ConnectionMonitorOutput> array = new List<ConnectionMonitorOutput>(); |
| 0 | 267 | | foreach (var item in property.Value.EnumerateArray()) |
| | 268 | | { |
| 0 | 269 | | if (item.ValueKind == JsonValueKind.Null) |
| | 270 | | { |
| 0 | 271 | | array.Add(null); |
| | 272 | | } |
| | 273 | | else |
| | 274 | | { |
| 0 | 275 | | array.Add(ConnectionMonitorOutput.DeserializeConnectionMonitorOutput(item)); |
| | 276 | | } |
| | 277 | | } |
| 0 | 278 | | outputs = array; |
| 0 | 279 | | continue; |
| | 280 | | } |
| 0 | 281 | | if (property.NameEquals("notes")) |
| | 282 | | { |
| 0 | 283 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 284 | | { |
| | 285 | | continue; |
| | 286 | | } |
| 0 | 287 | | notes = property.Value.GetString(); |
| | 288 | | continue; |
| | 289 | | } |
| | 290 | | } |
| 0 | 291 | | return new ConnectionMonitorResultProperties(source, destination, autoStart, monitoringIntervalInSeconds, en |
| | 292 | | } |
| | 293 | | } |
| | 294 | | } |