| | 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 IPConfigurationBgpPeeringAddress : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 56 | 18 | | writer.WriteStartObject(); |
| 56 | 19 | | if (IpconfigurationId != null) |
| | 20 | | { |
| 56 | 21 | | writer.WritePropertyName("ipconfigurationId"); |
| 56 | 22 | | writer.WriteStringValue(IpconfigurationId); |
| | 23 | | } |
| 56 | 24 | | if (DefaultBgpIpAddresses != null) |
| | 25 | | { |
| 56 | 26 | | writer.WritePropertyName("defaultBgpIpAddresses"); |
| 56 | 27 | | writer.WriteStartArray(); |
| 224 | 28 | | foreach (var item in DefaultBgpIpAddresses) |
| | 29 | | { |
| 56 | 30 | | writer.WriteStringValue(item); |
| | 31 | | } |
| 56 | 32 | | writer.WriteEndArray(); |
| | 33 | | } |
| 56 | 34 | | if (CustomBgpIpAddresses != null) |
| | 35 | | { |
| 56 | 36 | | writer.WritePropertyName("customBgpIpAddresses"); |
| 56 | 37 | | writer.WriteStartArray(); |
| 0 | 38 | | foreach (var item in CustomBgpIpAddresses) |
| | 39 | | { |
| 0 | 40 | | writer.WriteStringValue(item); |
| | 41 | | } |
| 56 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 56 | 44 | | if (TunnelIpAddresses != null) |
| | 45 | | { |
| 56 | 46 | | writer.WritePropertyName("tunnelIpAddresses"); |
| 56 | 47 | | writer.WriteStartArray(); |
| 224 | 48 | | foreach (var item in TunnelIpAddresses) |
| | 49 | | { |
| 56 | 50 | | writer.WriteStringValue(item); |
| | 51 | | } |
| 56 | 52 | | writer.WriteEndArray(); |
| | 53 | | } |
| 56 | 54 | | writer.WriteEndObject(); |
| 56 | 55 | | } |
| | 56 | |
|
| | 57 | | internal static IPConfigurationBgpPeeringAddress DeserializeIPConfigurationBgpPeeringAddress(JsonElement element |
| | 58 | | { |
| 32 | 59 | | string ipconfigurationId = default; |
| 32 | 60 | | IList<string> defaultBgpIpAddresses = default; |
| 32 | 61 | | IList<string> customBgpIpAddresses = default; |
| 32 | 62 | | IList<string> tunnelIpAddresses = default; |
| 320 | 63 | | foreach (var property in element.EnumerateObject()) |
| | 64 | | { |
| 128 | 65 | | if (property.NameEquals("ipconfigurationId")) |
| | 66 | | { |
| 32 | 67 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 68 | | { |
| | 69 | | continue; |
| | 70 | | } |
| 32 | 71 | | ipconfigurationId = property.Value.GetString(); |
| 32 | 72 | | continue; |
| | 73 | | } |
| 96 | 74 | | if (property.NameEquals("defaultBgpIpAddresses")) |
| | 75 | | { |
| 32 | 76 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 77 | | { |
| | 78 | | continue; |
| | 79 | | } |
| 32 | 80 | | List<string> array = new List<string>(); |
| 128 | 81 | | foreach (var item in property.Value.EnumerateArray()) |
| | 82 | | { |
| 32 | 83 | | if (item.ValueKind == JsonValueKind.Null) |
| | 84 | | { |
| 0 | 85 | | array.Add(null); |
| | 86 | | } |
| | 87 | | else |
| | 88 | | { |
| 32 | 89 | | array.Add(item.GetString()); |
| | 90 | | } |
| | 91 | | } |
| 32 | 92 | | defaultBgpIpAddresses = array; |
| 32 | 93 | | continue; |
| | 94 | | } |
| 64 | 95 | | if (property.NameEquals("customBgpIpAddresses")) |
| | 96 | | { |
| 32 | 97 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| | 99 | | continue; |
| | 100 | | } |
| 32 | 101 | | List<string> array = new List<string>(); |
| 0 | 102 | | foreach (var item in property.Value.EnumerateArray()) |
| | 103 | | { |
| 0 | 104 | | if (item.ValueKind == JsonValueKind.Null) |
| | 105 | | { |
| 0 | 106 | | array.Add(null); |
| | 107 | | } |
| | 108 | | else |
| | 109 | | { |
| 0 | 110 | | array.Add(item.GetString()); |
| | 111 | | } |
| | 112 | | } |
| 32 | 113 | | customBgpIpAddresses = array; |
| 32 | 114 | | continue; |
| | 115 | | } |
| 32 | 116 | | if (property.NameEquals("tunnelIpAddresses")) |
| | 117 | | { |
| 32 | 118 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 119 | | { |
| | 120 | | continue; |
| | 121 | | } |
| 32 | 122 | | List<string> array = new List<string>(); |
| 128 | 123 | | foreach (var item in property.Value.EnumerateArray()) |
| | 124 | | { |
| 32 | 125 | | if (item.ValueKind == JsonValueKind.Null) |
| | 126 | | { |
| 0 | 127 | | array.Add(null); |
| | 128 | | } |
| | 129 | | else |
| | 130 | | { |
| 32 | 131 | | array.Add(item.GetString()); |
| | 132 | | } |
| | 133 | | } |
| 32 | 134 | | tunnelIpAddresses = array; |
| | 135 | | continue; |
| | 136 | | } |
| | 137 | | } |
| 32 | 138 | | return new IPConfigurationBgpPeeringAddress(ipconfigurationId, defaultBgpIpAddresses, customBgpIpAddresses, |
| | 139 | | } |
| | 140 | | } |
| | 141 | | } |