| | 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 BgpSettings : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 80 | 18 | | writer.WriteStartObject(); |
| 80 | 19 | | if (Asn != null) |
| | 20 | | { |
| 80 | 21 | | writer.WritePropertyName("asn"); |
| 80 | 22 | | writer.WriteNumberValue(Asn.Value); |
| | 23 | | } |
| 80 | 24 | | if (BgpPeeringAddress != null) |
| | 25 | | { |
| 72 | 26 | | writer.WritePropertyName("bgpPeeringAddress"); |
| 72 | 27 | | writer.WriteStringValue(BgpPeeringAddress); |
| | 28 | | } |
| 80 | 29 | | if (PeerWeight != null) |
| | 30 | | { |
| 80 | 31 | | writer.WritePropertyName("peerWeight"); |
| 80 | 32 | | writer.WriteNumberValue(PeerWeight.Value); |
| | 33 | | } |
| 80 | 34 | | if (BgpPeeringAddresses != null) |
| | 35 | | { |
| 56 | 36 | | writer.WritePropertyName("bgpPeeringAddresses"); |
| 56 | 37 | | writer.WriteStartArray(); |
| 224 | 38 | | foreach (var item in BgpPeeringAddresses) |
| | 39 | | { |
| 56 | 40 | | writer.WriteObjectValue(item); |
| | 41 | | } |
| 56 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 80 | 44 | | writer.WriteEndObject(); |
| 80 | 45 | | } |
| | 46 | |
|
| | 47 | | internal static BgpSettings DeserializeBgpSettings(JsonElement element) |
| | 48 | | { |
| 40 | 49 | | long? asn = default; |
| 40 | 50 | | string bgpPeeringAddress = default; |
| 40 | 51 | | int? peerWeight = default; |
| 40 | 52 | | IList<IPConfigurationBgpPeeringAddress> bgpPeeringAddresses = default; |
| 384 | 53 | | foreach (var property in element.EnumerateObject()) |
| | 54 | | { |
| 152 | 55 | | if (property.NameEquals("asn")) |
| | 56 | | { |
| 40 | 57 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 58 | | { |
| | 59 | | continue; |
| | 60 | | } |
| 40 | 61 | | asn = property.Value.GetInt64(); |
| 40 | 62 | | continue; |
| | 63 | | } |
| 112 | 64 | | if (property.NameEquals("bgpPeeringAddress")) |
| | 65 | | { |
| 40 | 66 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 67 | | { |
| | 68 | | continue; |
| | 69 | | } |
| 40 | 70 | | bgpPeeringAddress = property.Value.GetString(); |
| 40 | 71 | | continue; |
| | 72 | | } |
| 72 | 73 | | if (property.NameEquals("peerWeight")) |
| | 74 | | { |
| 40 | 75 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 76 | | { |
| | 77 | | continue; |
| | 78 | | } |
| 40 | 79 | | peerWeight = property.Value.GetInt32(); |
| 40 | 80 | | continue; |
| | 81 | | } |
| 32 | 82 | | if (property.NameEquals("bgpPeeringAddresses")) |
| | 83 | | { |
| 32 | 84 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 85 | | { |
| | 86 | | continue; |
| | 87 | | } |
| 32 | 88 | | List<IPConfigurationBgpPeeringAddress> array = new List<IPConfigurationBgpPeeringAddress>(); |
| 128 | 89 | | foreach (var item in property.Value.EnumerateArray()) |
| | 90 | | { |
| 32 | 91 | | if (item.ValueKind == JsonValueKind.Null) |
| | 92 | | { |
| 0 | 93 | | array.Add(null); |
| | 94 | | } |
| | 95 | | else |
| | 96 | | { |
| 32 | 97 | | array.Add(IPConfigurationBgpPeeringAddress.DeserializeIPConfigurationBgpPeeringAddress(item) |
| | 98 | | } |
| | 99 | | } |
| 32 | 100 | | bgpPeeringAddresses = array; |
| | 101 | | continue; |
| | 102 | | } |
| | 103 | | } |
| 40 | 104 | | return new BgpSettings(asn, bgpPeeringAddress, peerWeight, bgpPeeringAddresses); |
| | 105 | | } |
| | 106 | | } |
| | 107 | | } |