| | 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 ExpressRouteCircuitPeering : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Name != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("name"); |
| 0 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 0 | 24 | | if (Etag != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("etag"); |
| 0 | 27 | | writer.WriteStringValue(Etag); |
| | 28 | | } |
| 0 | 29 | | if (Type != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("type"); |
| 0 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 0 | 34 | | if (Id != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("id"); |
| 0 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 0 | 39 | | writer.WritePropertyName("properties"); |
| 0 | 40 | | writer.WriteStartObject(); |
| 0 | 41 | | if (PeeringType != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("peeringType"); |
| 0 | 44 | | writer.WriteStringValue(PeeringType.Value.ToString()); |
| | 45 | | } |
| 0 | 46 | | if (State != null) |
| | 47 | | { |
| 0 | 48 | | writer.WritePropertyName("state"); |
| 0 | 49 | | writer.WriteStringValue(State.Value.ToString()); |
| | 50 | | } |
| 0 | 51 | | if (AzureASN != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("azureASN"); |
| 0 | 54 | | writer.WriteNumberValue(AzureASN.Value); |
| | 55 | | } |
| 0 | 56 | | if (PeerASN != null) |
| | 57 | | { |
| 0 | 58 | | writer.WritePropertyName("peerASN"); |
| 0 | 59 | | writer.WriteNumberValue(PeerASN.Value); |
| | 60 | | } |
| 0 | 61 | | if (PrimaryPeerAddressPrefix != null) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("primaryPeerAddressPrefix"); |
| 0 | 64 | | writer.WriteStringValue(PrimaryPeerAddressPrefix); |
| | 65 | | } |
| 0 | 66 | | if (SecondaryPeerAddressPrefix != null) |
| | 67 | | { |
| 0 | 68 | | writer.WritePropertyName("secondaryPeerAddressPrefix"); |
| 0 | 69 | | writer.WriteStringValue(SecondaryPeerAddressPrefix); |
| | 70 | | } |
| 0 | 71 | | if (PrimaryAzurePort != null) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("primaryAzurePort"); |
| 0 | 74 | | writer.WriteStringValue(PrimaryAzurePort); |
| | 75 | | } |
| 0 | 76 | | if (SecondaryAzurePort != null) |
| | 77 | | { |
| 0 | 78 | | writer.WritePropertyName("secondaryAzurePort"); |
| 0 | 79 | | writer.WriteStringValue(SecondaryAzurePort); |
| | 80 | | } |
| 0 | 81 | | if (SharedKey != null) |
| | 82 | | { |
| 0 | 83 | | writer.WritePropertyName("sharedKey"); |
| 0 | 84 | | writer.WriteStringValue(SharedKey); |
| | 85 | | } |
| 0 | 86 | | if (VlanId != null) |
| | 87 | | { |
| 0 | 88 | | writer.WritePropertyName("vlanId"); |
| 0 | 89 | | writer.WriteNumberValue(VlanId.Value); |
| | 90 | | } |
| 0 | 91 | | if (MicrosoftPeeringConfig != null) |
| | 92 | | { |
| 0 | 93 | | writer.WritePropertyName("microsoftPeeringConfig"); |
| 0 | 94 | | writer.WriteObjectValue(MicrosoftPeeringConfig); |
| | 95 | | } |
| 0 | 96 | | if (Stats != null) |
| | 97 | | { |
| 0 | 98 | | writer.WritePropertyName("stats"); |
| 0 | 99 | | writer.WriteObjectValue(Stats); |
| | 100 | | } |
| 0 | 101 | | if (ProvisioningState != null) |
| | 102 | | { |
| 0 | 103 | | writer.WritePropertyName("provisioningState"); |
| 0 | 104 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 105 | | } |
| 0 | 106 | | if (GatewayManagerEtag != null) |
| | 107 | | { |
| 0 | 108 | | writer.WritePropertyName("gatewayManagerEtag"); |
| 0 | 109 | | writer.WriteStringValue(GatewayManagerEtag); |
| | 110 | | } |
| 0 | 111 | | if (LastModifiedBy != null) |
| | 112 | | { |
| 0 | 113 | | writer.WritePropertyName("lastModifiedBy"); |
| 0 | 114 | | writer.WriteStringValue(LastModifiedBy); |
| | 115 | | } |
| 0 | 116 | | if (RouteFilter != null) |
| | 117 | | { |
| 0 | 118 | | writer.WritePropertyName("routeFilter"); |
| 0 | 119 | | writer.WriteObjectValue(RouteFilter); |
| | 120 | | } |
| 0 | 121 | | if (Ipv6PeeringConfig != null) |
| | 122 | | { |
| 0 | 123 | | writer.WritePropertyName("ipv6PeeringConfig"); |
| 0 | 124 | | writer.WriteObjectValue(Ipv6PeeringConfig); |
| | 125 | | } |
| 0 | 126 | | if (ExpressRouteConnection != null) |
| | 127 | | { |
| 0 | 128 | | writer.WritePropertyName("expressRouteConnection"); |
| 0 | 129 | | writer.WriteObjectValue(ExpressRouteConnection); |
| | 130 | | } |
| 0 | 131 | | if (Connections != null) |
| | 132 | | { |
| 0 | 133 | | writer.WritePropertyName("connections"); |
| 0 | 134 | | writer.WriteStartArray(); |
| 0 | 135 | | foreach (var item in Connections) |
| | 136 | | { |
| 0 | 137 | | writer.WriteObjectValue(item); |
| | 138 | | } |
| 0 | 139 | | writer.WriteEndArray(); |
| | 140 | | } |
| 0 | 141 | | if (PeeredConnections != null) |
| | 142 | | { |
| 0 | 143 | | writer.WritePropertyName("peeredConnections"); |
| 0 | 144 | | writer.WriteStartArray(); |
| 0 | 145 | | foreach (var item in PeeredConnections) |
| | 146 | | { |
| 0 | 147 | | writer.WriteObjectValue(item); |
| | 148 | | } |
| 0 | 149 | | writer.WriteEndArray(); |
| | 150 | | } |
| 0 | 151 | | writer.WriteEndObject(); |
| 0 | 152 | | writer.WriteEndObject(); |
| 0 | 153 | | } |
| | 154 | |
|
| | 155 | | internal static ExpressRouteCircuitPeering DeserializeExpressRouteCircuitPeering(JsonElement element) |
| | 156 | | { |
| 0 | 157 | | string name = default; |
| 0 | 158 | | string etag = default; |
| 0 | 159 | | string type = default; |
| 0 | 160 | | string id = default; |
| 0 | 161 | | ExpressRoutePeeringType? peeringType = default; |
| 0 | 162 | | ExpressRoutePeeringState? state = default; |
| 0 | 163 | | int? azureASN = default; |
| 0 | 164 | | long? peerASN = default; |
| 0 | 165 | | string primaryPeerAddressPrefix = default; |
| 0 | 166 | | string secondaryPeerAddressPrefix = default; |
| 0 | 167 | | string primaryAzurePort = default; |
| 0 | 168 | | string secondaryAzurePort = default; |
| 0 | 169 | | string sharedKey = default; |
| 0 | 170 | | int? vlanId = default; |
| 0 | 171 | | ExpressRouteCircuitPeeringConfig microsoftPeeringConfig = default; |
| 0 | 172 | | ExpressRouteCircuitStats stats = default; |
| 0 | 173 | | ProvisioningState? provisioningState = default; |
| 0 | 174 | | string gatewayManagerEtag = default; |
| 0 | 175 | | string lastModifiedBy = default; |
| 0 | 176 | | SubResource routeFilter = default; |
| 0 | 177 | | Ipv6ExpressRouteCircuitPeeringConfig ipv6PeeringConfig = default; |
| 0 | 178 | | ExpressRouteConnectionId expressRouteConnection = default; |
| 0 | 179 | | IList<ExpressRouteCircuitConnection> connections = default; |
| 0 | 180 | | IList<PeerExpressRouteCircuitConnection> peeredConnections = default; |
| 0 | 181 | | foreach (var property in element.EnumerateObject()) |
| | 182 | | { |
| 0 | 183 | | if (property.NameEquals("name")) |
| | 184 | | { |
| 0 | 185 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 186 | | { |
| | 187 | | continue; |
| | 188 | | } |
| 0 | 189 | | name = property.Value.GetString(); |
| 0 | 190 | | continue; |
| | 191 | | } |
| 0 | 192 | | if (property.NameEquals("etag")) |
| | 193 | | { |
| 0 | 194 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 195 | | { |
| | 196 | | continue; |
| | 197 | | } |
| 0 | 198 | | etag = property.Value.GetString(); |
| 0 | 199 | | continue; |
| | 200 | | } |
| 0 | 201 | | if (property.NameEquals("type")) |
| | 202 | | { |
| 0 | 203 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 204 | | { |
| | 205 | | continue; |
| | 206 | | } |
| 0 | 207 | | type = property.Value.GetString(); |
| 0 | 208 | | continue; |
| | 209 | | } |
| 0 | 210 | | if (property.NameEquals("id")) |
| | 211 | | { |
| 0 | 212 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 213 | | { |
| | 214 | | continue; |
| | 215 | | } |
| 0 | 216 | | id = property.Value.GetString(); |
| 0 | 217 | | continue; |
| | 218 | | } |
| 0 | 219 | | if (property.NameEquals("properties")) |
| | 220 | | { |
| 0 | 221 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 222 | | { |
| 0 | 223 | | if (property0.NameEquals("peeringType")) |
| | 224 | | { |
| 0 | 225 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 226 | | { |
| | 227 | | continue; |
| | 228 | | } |
| 0 | 229 | | peeringType = new ExpressRoutePeeringType(property0.Value.GetString()); |
| 0 | 230 | | continue; |
| | 231 | | } |
| 0 | 232 | | if (property0.NameEquals("state")) |
| | 233 | | { |
| 0 | 234 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 235 | | { |
| | 236 | | continue; |
| | 237 | | } |
| 0 | 238 | | state = new ExpressRoutePeeringState(property0.Value.GetString()); |
| 0 | 239 | | continue; |
| | 240 | | } |
| 0 | 241 | | if (property0.NameEquals("azureASN")) |
| | 242 | | { |
| 0 | 243 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 244 | | { |
| | 245 | | continue; |
| | 246 | | } |
| 0 | 247 | | azureASN = property0.Value.GetInt32(); |
| 0 | 248 | | continue; |
| | 249 | | } |
| 0 | 250 | | if (property0.NameEquals("peerASN")) |
| | 251 | | { |
| 0 | 252 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 253 | | { |
| | 254 | | continue; |
| | 255 | | } |
| 0 | 256 | | peerASN = property0.Value.GetInt64(); |
| 0 | 257 | | continue; |
| | 258 | | } |
| 0 | 259 | | if (property0.NameEquals("primaryPeerAddressPrefix")) |
| | 260 | | { |
| 0 | 261 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 262 | | { |
| | 263 | | continue; |
| | 264 | | } |
| 0 | 265 | | primaryPeerAddressPrefix = property0.Value.GetString(); |
| 0 | 266 | | continue; |
| | 267 | | } |
| 0 | 268 | | if (property0.NameEquals("secondaryPeerAddressPrefix")) |
| | 269 | | { |
| 0 | 270 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 271 | | { |
| | 272 | | continue; |
| | 273 | | } |
| 0 | 274 | | secondaryPeerAddressPrefix = property0.Value.GetString(); |
| 0 | 275 | | continue; |
| | 276 | | } |
| 0 | 277 | | if (property0.NameEquals("primaryAzurePort")) |
| | 278 | | { |
| 0 | 279 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 280 | | { |
| | 281 | | continue; |
| | 282 | | } |
| 0 | 283 | | primaryAzurePort = property0.Value.GetString(); |
| 0 | 284 | | continue; |
| | 285 | | } |
| 0 | 286 | | if (property0.NameEquals("secondaryAzurePort")) |
| | 287 | | { |
| 0 | 288 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 289 | | { |
| | 290 | | continue; |
| | 291 | | } |
| 0 | 292 | | secondaryAzurePort = property0.Value.GetString(); |
| 0 | 293 | | continue; |
| | 294 | | } |
| 0 | 295 | | if (property0.NameEquals("sharedKey")) |
| | 296 | | { |
| 0 | 297 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 298 | | { |
| | 299 | | continue; |
| | 300 | | } |
| 0 | 301 | | sharedKey = property0.Value.GetString(); |
| 0 | 302 | | continue; |
| | 303 | | } |
| 0 | 304 | | if (property0.NameEquals("vlanId")) |
| | 305 | | { |
| 0 | 306 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 307 | | { |
| | 308 | | continue; |
| | 309 | | } |
| 0 | 310 | | vlanId = property0.Value.GetInt32(); |
| 0 | 311 | | continue; |
| | 312 | | } |
| 0 | 313 | | if (property0.NameEquals("microsoftPeeringConfig")) |
| | 314 | | { |
| 0 | 315 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 316 | | { |
| | 317 | | continue; |
| | 318 | | } |
| 0 | 319 | | microsoftPeeringConfig = ExpressRouteCircuitPeeringConfig.DeserializeExpressRouteCircuitPeer |
| 0 | 320 | | continue; |
| | 321 | | } |
| 0 | 322 | | if (property0.NameEquals("stats")) |
| | 323 | | { |
| 0 | 324 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 325 | | { |
| | 326 | | continue; |
| | 327 | | } |
| 0 | 328 | | stats = ExpressRouteCircuitStats.DeserializeExpressRouteCircuitStats(property0.Value); |
| 0 | 329 | | continue; |
| | 330 | | } |
| 0 | 331 | | if (property0.NameEquals("provisioningState")) |
| | 332 | | { |
| 0 | 333 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 334 | | { |
| | 335 | | continue; |
| | 336 | | } |
| 0 | 337 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 338 | | continue; |
| | 339 | | } |
| 0 | 340 | | if (property0.NameEquals("gatewayManagerEtag")) |
| | 341 | | { |
| 0 | 342 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 343 | | { |
| | 344 | | continue; |
| | 345 | | } |
| 0 | 346 | | gatewayManagerEtag = property0.Value.GetString(); |
| 0 | 347 | | continue; |
| | 348 | | } |
| 0 | 349 | | if (property0.NameEquals("lastModifiedBy")) |
| | 350 | | { |
| 0 | 351 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 352 | | { |
| | 353 | | continue; |
| | 354 | | } |
| 0 | 355 | | lastModifiedBy = property0.Value.GetString(); |
| 0 | 356 | | continue; |
| | 357 | | } |
| 0 | 358 | | if (property0.NameEquals("routeFilter")) |
| | 359 | | { |
| 0 | 360 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 361 | | { |
| | 362 | | continue; |
| | 363 | | } |
| 0 | 364 | | routeFilter = DeserializeSubResource(property0.Value); |
| 0 | 365 | | continue; |
| | 366 | | } |
| 0 | 367 | | if (property0.NameEquals("ipv6PeeringConfig")) |
| | 368 | | { |
| 0 | 369 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 370 | | { |
| | 371 | | continue; |
| | 372 | | } |
| 0 | 373 | | ipv6PeeringConfig = Ipv6ExpressRouteCircuitPeeringConfig.DeserializeIpv6ExpressRouteCircuitP |
| 0 | 374 | | continue; |
| | 375 | | } |
| 0 | 376 | | if (property0.NameEquals("expressRouteConnection")) |
| | 377 | | { |
| 0 | 378 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 379 | | { |
| | 380 | | continue; |
| | 381 | | } |
| 0 | 382 | | expressRouteConnection = ExpressRouteConnectionId.DeserializeExpressRouteConnectionId(proper |
| 0 | 383 | | continue; |
| | 384 | | } |
| 0 | 385 | | if (property0.NameEquals("connections")) |
| | 386 | | { |
| 0 | 387 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 388 | | { |
| | 389 | | continue; |
| | 390 | | } |
| 0 | 391 | | List<ExpressRouteCircuitConnection> array = new List<ExpressRouteCircuitConnection>(); |
| 0 | 392 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 393 | | { |
| 0 | 394 | | if (item.ValueKind == JsonValueKind.Null) |
| | 395 | | { |
| 0 | 396 | | array.Add(null); |
| | 397 | | } |
| | 398 | | else |
| | 399 | | { |
| 0 | 400 | | array.Add(ExpressRouteCircuitConnection.DeserializeExpressRouteCircuitConnection(ite |
| | 401 | | } |
| | 402 | | } |
| 0 | 403 | | connections = array; |
| 0 | 404 | | continue; |
| | 405 | | } |
| 0 | 406 | | if (property0.NameEquals("peeredConnections")) |
| | 407 | | { |
| 0 | 408 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 409 | | { |
| | 410 | | continue; |
| | 411 | | } |
| 0 | 412 | | List<PeerExpressRouteCircuitConnection> array = new List<PeerExpressRouteCircuitConnection>( |
| 0 | 413 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 414 | | { |
| 0 | 415 | | if (item.ValueKind == JsonValueKind.Null) |
| | 416 | | { |
| 0 | 417 | | array.Add(null); |
| | 418 | | } |
| | 419 | | else |
| | 420 | | { |
| 0 | 421 | | array.Add(PeerExpressRouteCircuitConnection.DeserializePeerExpressRouteCircuitConnec |
| | 422 | | } |
| | 423 | | } |
| 0 | 424 | | peeredConnections = array; |
| | 425 | | continue; |
| | 426 | | } |
| | 427 | | } |
| | 428 | | continue; |
| | 429 | | } |
| | 430 | | } |
| 0 | 431 | | return new ExpressRouteCircuitPeering(id, name, etag, type, peeringType, state, azureASN, peerASN, primaryPe |
| | 432 | | } |
| | 433 | | } |
| | 434 | | } |