| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.ResourceManager.Network.Models |
| | 12 | | { |
| | 13 | | public partial class ExpressRouteCrossConnectionPeering : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | if (Name != null) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("name"); |
| 0 | 21 | | writer.WriteStringValue(Name); |
| | 22 | | } |
| 0 | 23 | | if (Etag != null) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("etag"); |
| 0 | 26 | | writer.WriteStringValue(Etag); |
| | 27 | | } |
| 0 | 28 | | if (Id != null) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName("id"); |
| 0 | 31 | | writer.WriteStringValue(Id); |
| | 32 | | } |
| 0 | 33 | | writer.WritePropertyName("properties"); |
| 0 | 34 | | writer.WriteStartObject(); |
| 0 | 35 | | if (PeeringType != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("peeringType"); |
| 0 | 38 | | writer.WriteStringValue(PeeringType.Value.ToString()); |
| | 39 | | } |
| 0 | 40 | | if (State != null) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("state"); |
| 0 | 43 | | writer.WriteStringValue(State.Value.ToString()); |
| | 44 | | } |
| 0 | 45 | | if (AzureASN != null) |
| | 46 | | { |
| 0 | 47 | | writer.WritePropertyName("azureASN"); |
| 0 | 48 | | writer.WriteNumberValue(AzureASN.Value); |
| | 49 | | } |
| 0 | 50 | | if (PeerASN != null) |
| | 51 | | { |
| 0 | 52 | | writer.WritePropertyName("peerASN"); |
| 0 | 53 | | writer.WriteNumberValue(PeerASN.Value); |
| | 54 | | } |
| 0 | 55 | | if (PrimaryPeerAddressPrefix != null) |
| | 56 | | { |
| 0 | 57 | | writer.WritePropertyName("primaryPeerAddressPrefix"); |
| 0 | 58 | | writer.WriteStringValue(PrimaryPeerAddressPrefix); |
| | 59 | | } |
| 0 | 60 | | if (SecondaryPeerAddressPrefix != null) |
| | 61 | | { |
| 0 | 62 | | writer.WritePropertyName("secondaryPeerAddressPrefix"); |
| 0 | 63 | | writer.WriteStringValue(SecondaryPeerAddressPrefix); |
| | 64 | | } |
| 0 | 65 | | if (PrimaryAzurePort != null) |
| | 66 | | { |
| 0 | 67 | | writer.WritePropertyName("primaryAzurePort"); |
| 0 | 68 | | writer.WriteStringValue(PrimaryAzurePort); |
| | 69 | | } |
| 0 | 70 | | if (SecondaryAzurePort != null) |
| | 71 | | { |
| 0 | 72 | | writer.WritePropertyName("secondaryAzurePort"); |
| 0 | 73 | | writer.WriteStringValue(SecondaryAzurePort); |
| | 74 | | } |
| 0 | 75 | | if (SharedKey != null) |
| | 76 | | { |
| 0 | 77 | | writer.WritePropertyName("sharedKey"); |
| 0 | 78 | | writer.WriteStringValue(SharedKey); |
| | 79 | | } |
| 0 | 80 | | if (VlanId != null) |
| | 81 | | { |
| 0 | 82 | | writer.WritePropertyName("vlanId"); |
| 0 | 83 | | writer.WriteNumberValue(VlanId.Value); |
| | 84 | | } |
| 0 | 85 | | if (MicrosoftPeeringConfig != null) |
| | 86 | | { |
| 0 | 87 | | writer.WritePropertyName("microsoftPeeringConfig"); |
| 0 | 88 | | writer.WriteObjectValue(MicrosoftPeeringConfig); |
| | 89 | | } |
| 0 | 90 | | if (ProvisioningState != null) |
| | 91 | | { |
| 0 | 92 | | writer.WritePropertyName("provisioningState"); |
| 0 | 93 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 94 | | } |
| 0 | 95 | | if (GatewayManagerEtag != null) |
| | 96 | | { |
| 0 | 97 | | writer.WritePropertyName("gatewayManagerEtag"); |
| 0 | 98 | | writer.WriteStringValue(GatewayManagerEtag); |
| | 99 | | } |
| 0 | 100 | | if (LastModifiedBy != null) |
| | 101 | | { |
| 0 | 102 | | writer.WritePropertyName("lastModifiedBy"); |
| 0 | 103 | | writer.WriteStringValue(LastModifiedBy); |
| | 104 | | } |
| 0 | 105 | | if (Ipv6PeeringConfig != null) |
| | 106 | | { |
| 0 | 107 | | writer.WritePropertyName("ipv6PeeringConfig"); |
| 0 | 108 | | writer.WriteObjectValue(Ipv6PeeringConfig); |
| | 109 | | } |
| 0 | 110 | | writer.WriteEndObject(); |
| 0 | 111 | | writer.WriteEndObject(); |
| 0 | 112 | | } |
| | 113 | |
|
| | 114 | | internal static ExpressRouteCrossConnectionPeering DeserializeExpressRouteCrossConnectionPeering(JsonElement ele |
| | 115 | | { |
| 0 | 116 | | string name = default; |
| 0 | 117 | | string etag = default; |
| 0 | 118 | | string id = default; |
| 0 | 119 | | ExpressRoutePeeringType? peeringType = default; |
| 0 | 120 | | ExpressRoutePeeringState? state = default; |
| 0 | 121 | | int? azureASN = default; |
| 0 | 122 | | long? peerASN = default; |
| 0 | 123 | | string primaryPeerAddressPrefix = default; |
| 0 | 124 | | string secondaryPeerAddressPrefix = default; |
| 0 | 125 | | string primaryAzurePort = default; |
| 0 | 126 | | string secondaryAzurePort = default; |
| 0 | 127 | | string sharedKey = default; |
| 0 | 128 | | int? vlanId = default; |
| 0 | 129 | | ExpressRouteCircuitPeeringConfig microsoftPeeringConfig = default; |
| 0 | 130 | | ProvisioningState? provisioningState = default; |
| 0 | 131 | | string gatewayManagerEtag = default; |
| 0 | 132 | | string lastModifiedBy = default; |
| 0 | 133 | | Ipv6ExpressRouteCircuitPeeringConfig ipv6PeeringConfig = default; |
| 0 | 134 | | foreach (var property in element.EnumerateObject()) |
| | 135 | | { |
| 0 | 136 | | if (property.NameEquals("name")) |
| | 137 | | { |
| 0 | 138 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 139 | | { |
| | 140 | | continue; |
| | 141 | | } |
| 0 | 142 | | name = property.Value.GetString(); |
| 0 | 143 | | continue; |
| | 144 | | } |
| 0 | 145 | | if (property.NameEquals("etag")) |
| | 146 | | { |
| 0 | 147 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 148 | | { |
| | 149 | | continue; |
| | 150 | | } |
| 0 | 151 | | etag = property.Value.GetString(); |
| 0 | 152 | | continue; |
| | 153 | | } |
| 0 | 154 | | if (property.NameEquals("id")) |
| | 155 | | { |
| 0 | 156 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 157 | | { |
| | 158 | | continue; |
| | 159 | | } |
| 0 | 160 | | id = property.Value.GetString(); |
| 0 | 161 | | continue; |
| | 162 | | } |
| 0 | 163 | | if (property.NameEquals("properties")) |
| | 164 | | { |
| 0 | 165 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 166 | | { |
| 0 | 167 | | if (property0.NameEquals("peeringType")) |
| | 168 | | { |
| 0 | 169 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 170 | | { |
| | 171 | | continue; |
| | 172 | | } |
| 0 | 173 | | peeringType = new ExpressRoutePeeringType(property0.Value.GetString()); |
| 0 | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | if (property0.NameEquals("state")) |
| | 177 | | { |
| 0 | 178 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 179 | | { |
| | 180 | | continue; |
| | 181 | | } |
| 0 | 182 | | state = new ExpressRoutePeeringState(property0.Value.GetString()); |
| 0 | 183 | | continue; |
| | 184 | | } |
| 0 | 185 | | if (property0.NameEquals("azureASN")) |
| | 186 | | { |
| 0 | 187 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 188 | | { |
| | 189 | | continue; |
| | 190 | | } |
| 0 | 191 | | azureASN = property0.Value.GetInt32(); |
| 0 | 192 | | continue; |
| | 193 | | } |
| 0 | 194 | | if (property0.NameEquals("peerASN")) |
| | 195 | | { |
| 0 | 196 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 197 | | { |
| | 198 | | continue; |
| | 199 | | } |
| 0 | 200 | | peerASN = property0.Value.GetInt64(); |
| 0 | 201 | | continue; |
| | 202 | | } |
| 0 | 203 | | if (property0.NameEquals("primaryPeerAddressPrefix")) |
| | 204 | | { |
| 0 | 205 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 206 | | { |
| | 207 | | continue; |
| | 208 | | } |
| 0 | 209 | | primaryPeerAddressPrefix = property0.Value.GetString(); |
| 0 | 210 | | continue; |
| | 211 | | } |
| 0 | 212 | | if (property0.NameEquals("secondaryPeerAddressPrefix")) |
| | 213 | | { |
| 0 | 214 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 215 | | { |
| | 216 | | continue; |
| | 217 | | } |
| 0 | 218 | | secondaryPeerAddressPrefix = property0.Value.GetString(); |
| 0 | 219 | | continue; |
| | 220 | | } |
| 0 | 221 | | if (property0.NameEquals("primaryAzurePort")) |
| | 222 | | { |
| 0 | 223 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 224 | | { |
| | 225 | | continue; |
| | 226 | | } |
| 0 | 227 | | primaryAzurePort = property0.Value.GetString(); |
| 0 | 228 | | continue; |
| | 229 | | } |
| 0 | 230 | | if (property0.NameEquals("secondaryAzurePort")) |
| | 231 | | { |
| 0 | 232 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 233 | | { |
| | 234 | | continue; |
| | 235 | | } |
| 0 | 236 | | secondaryAzurePort = property0.Value.GetString(); |
| 0 | 237 | | continue; |
| | 238 | | } |
| 0 | 239 | | if (property0.NameEquals("sharedKey")) |
| | 240 | | { |
| 0 | 241 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 242 | | { |
| | 243 | | continue; |
| | 244 | | } |
| 0 | 245 | | sharedKey = property0.Value.GetString(); |
| 0 | 246 | | continue; |
| | 247 | | } |
| 0 | 248 | | if (property0.NameEquals("vlanId")) |
| | 249 | | { |
| 0 | 250 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 251 | | { |
| | 252 | | continue; |
| | 253 | | } |
| 0 | 254 | | vlanId = property0.Value.GetInt32(); |
| 0 | 255 | | continue; |
| | 256 | | } |
| 0 | 257 | | if (property0.NameEquals("microsoftPeeringConfig")) |
| | 258 | | { |
| 0 | 259 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 260 | | { |
| | 261 | | continue; |
| | 262 | | } |
| 0 | 263 | | microsoftPeeringConfig = ExpressRouteCircuitPeeringConfig.DeserializeExpressRouteCircuitPeer |
| 0 | 264 | | continue; |
| | 265 | | } |
| 0 | 266 | | if (property0.NameEquals("provisioningState")) |
| | 267 | | { |
| 0 | 268 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 269 | | { |
| | 270 | | continue; |
| | 271 | | } |
| 0 | 272 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 273 | | continue; |
| | 274 | | } |
| 0 | 275 | | if (property0.NameEquals("gatewayManagerEtag")) |
| | 276 | | { |
| 0 | 277 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 278 | | { |
| | 279 | | continue; |
| | 280 | | } |
| 0 | 281 | | gatewayManagerEtag = property0.Value.GetString(); |
| 0 | 282 | | continue; |
| | 283 | | } |
| 0 | 284 | | if (property0.NameEquals("lastModifiedBy")) |
| | 285 | | { |
| 0 | 286 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 287 | | { |
| | 288 | | continue; |
| | 289 | | } |
| 0 | 290 | | lastModifiedBy = property0.Value.GetString(); |
| 0 | 291 | | continue; |
| | 292 | | } |
| 0 | 293 | | if (property0.NameEquals("ipv6PeeringConfig")) |
| | 294 | | { |
| 0 | 295 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 296 | | { |
| | 297 | | continue; |
| | 298 | | } |
| 0 | 299 | | ipv6PeeringConfig = Ipv6ExpressRouteCircuitPeeringConfig.DeserializeIpv6ExpressRouteCircuitP |
| | 300 | | continue; |
| | 301 | | } |
| | 302 | | } |
| | 303 | | continue; |
| | 304 | | } |
| | 305 | | } |
| 0 | 306 | | return new ExpressRouteCrossConnectionPeering(id, name, etag, peeringType, state, azureASN, peerASN, primary |
| | 307 | | } |
| | 308 | | } |
| | 309 | | } |