| | 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 ExpressRouteCircuitPeeringConfig : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (AdvertisedPublicPrefixes != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("advertisedPublicPrefixes"); |
| 0 | 22 | | writer.WriteStartArray(); |
| 0 | 23 | | foreach (var item in AdvertisedPublicPrefixes) |
| | 24 | | { |
| 0 | 25 | | writer.WriteStringValue(item); |
| | 26 | | } |
| 0 | 27 | | writer.WriteEndArray(); |
| | 28 | | } |
| 0 | 29 | | if (AdvertisedCommunities != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("advertisedCommunities"); |
| 0 | 32 | | writer.WriteStartArray(); |
| 0 | 33 | | foreach (var item in AdvertisedCommunities) |
| | 34 | | { |
| 0 | 35 | | writer.WriteStringValue(item); |
| | 36 | | } |
| 0 | 37 | | writer.WriteEndArray(); |
| | 38 | | } |
| 0 | 39 | | if (AdvertisedPublicPrefixesState != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("advertisedPublicPrefixesState"); |
| 0 | 42 | | writer.WriteStringValue(AdvertisedPublicPrefixesState.Value.ToString()); |
| | 43 | | } |
| 0 | 44 | | if (LegacyMode != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("legacyMode"); |
| 0 | 47 | | writer.WriteNumberValue(LegacyMode.Value); |
| | 48 | | } |
| 0 | 49 | | if (CustomerASN != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("customerASN"); |
| 0 | 52 | | writer.WriteNumberValue(CustomerASN.Value); |
| | 53 | | } |
| 0 | 54 | | if (RoutingRegistryName != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("routingRegistryName"); |
| 0 | 57 | | writer.WriteStringValue(RoutingRegistryName); |
| | 58 | | } |
| 0 | 59 | | writer.WriteEndObject(); |
| 0 | 60 | | } |
| | 61 | |
|
| | 62 | | internal static ExpressRouteCircuitPeeringConfig DeserializeExpressRouteCircuitPeeringConfig(JsonElement element |
| | 63 | | { |
| 0 | 64 | | IList<string> advertisedPublicPrefixes = default; |
| 0 | 65 | | IList<string> advertisedCommunities = default; |
| 0 | 66 | | ExpressRouteCircuitPeeringAdvertisedPublicPrefixState? advertisedPublicPrefixesState = default; |
| 0 | 67 | | int? legacyMode = default; |
| 0 | 68 | | int? customerASN = default; |
| 0 | 69 | | string routingRegistryName = default; |
| 0 | 70 | | foreach (var property in element.EnumerateObject()) |
| | 71 | | { |
| 0 | 72 | | if (property.NameEquals("advertisedPublicPrefixes")) |
| | 73 | | { |
| 0 | 74 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 75 | | { |
| | 76 | | continue; |
| | 77 | | } |
| 0 | 78 | | List<string> array = new List<string>(); |
| 0 | 79 | | foreach (var item in property.Value.EnumerateArray()) |
| | 80 | | { |
| 0 | 81 | | if (item.ValueKind == JsonValueKind.Null) |
| | 82 | | { |
| 0 | 83 | | array.Add(null); |
| | 84 | | } |
| | 85 | | else |
| | 86 | | { |
| 0 | 87 | | array.Add(item.GetString()); |
| | 88 | | } |
| | 89 | | } |
| 0 | 90 | | advertisedPublicPrefixes = array; |
| 0 | 91 | | continue; |
| | 92 | | } |
| 0 | 93 | | if (property.NameEquals("advertisedCommunities")) |
| | 94 | | { |
| 0 | 95 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| | 97 | | continue; |
| | 98 | | } |
| 0 | 99 | | List<string> array = new List<string>(); |
| 0 | 100 | | foreach (var item in property.Value.EnumerateArray()) |
| | 101 | | { |
| 0 | 102 | | if (item.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| 0 | 104 | | array.Add(null); |
| | 105 | | } |
| | 106 | | else |
| | 107 | | { |
| 0 | 108 | | array.Add(item.GetString()); |
| | 109 | | } |
| | 110 | | } |
| 0 | 111 | | advertisedCommunities = array; |
| 0 | 112 | | continue; |
| | 113 | | } |
| 0 | 114 | | if (property.NameEquals("advertisedPublicPrefixesState")) |
| | 115 | | { |
| 0 | 116 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 117 | | { |
| | 118 | | continue; |
| | 119 | | } |
| 0 | 120 | | advertisedPublicPrefixesState = new ExpressRouteCircuitPeeringAdvertisedPublicPrefixState(property.V |
| 0 | 121 | | continue; |
| | 122 | | } |
| 0 | 123 | | if (property.NameEquals("legacyMode")) |
| | 124 | | { |
| 0 | 125 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 126 | | { |
| | 127 | | continue; |
| | 128 | | } |
| 0 | 129 | | legacyMode = property.Value.GetInt32(); |
| 0 | 130 | | continue; |
| | 131 | | } |
| 0 | 132 | | if (property.NameEquals("customerASN")) |
| | 133 | | { |
| 0 | 134 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 135 | | { |
| | 136 | | continue; |
| | 137 | | } |
| 0 | 138 | | customerASN = property.Value.GetInt32(); |
| 0 | 139 | | continue; |
| | 140 | | } |
| 0 | 141 | | if (property.NameEquals("routingRegistryName")) |
| | 142 | | { |
| 0 | 143 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 144 | | { |
| | 145 | | continue; |
| | 146 | | } |
| 0 | 147 | | routingRegistryName = property.Value.GetString(); |
| | 148 | | continue; |
| | 149 | | } |
| | 150 | | } |
| 0 | 151 | | return new ExpressRouteCircuitPeeringConfig(advertisedPublicPrefixes, advertisedCommunities, advertisedPubli |
| | 152 | | } |
| | 153 | | } |
| | 154 | | } |