| | 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 BackendAddressPool : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 112 | 18 | | writer.WriteStartObject(); |
| 112 | 19 | | if (Name != null) |
| | 20 | | { |
| 112 | 21 | | writer.WritePropertyName("name"); |
| 112 | 22 | | writer.WriteStringValue(Name); |
| | 23 | | } |
| 112 | 24 | | if (Etag != null) |
| | 25 | | { |
| 40 | 26 | | writer.WritePropertyName("etag"); |
| 40 | 27 | | writer.WriteStringValue(Etag); |
| | 28 | | } |
| 112 | 29 | | if (Type != null) |
| | 30 | | { |
| 40 | 31 | | writer.WritePropertyName("type"); |
| 40 | 32 | | writer.WriteStringValue(Type); |
| | 33 | | } |
| 112 | 34 | | if (Id != null) |
| | 35 | | { |
| 40 | 36 | | writer.WritePropertyName("id"); |
| 40 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 112 | 39 | | writer.WritePropertyName("properties"); |
| 112 | 40 | | writer.WriteStartObject(); |
| 112 | 41 | | if (BackendIPConfigurations != null) |
| | 42 | | { |
| 0 | 43 | | writer.WritePropertyName("backendIPConfigurations"); |
| 0 | 44 | | writer.WriteStartArray(); |
| 0 | 45 | | foreach (var item in BackendIPConfigurations) |
| | 46 | | { |
| 0 | 47 | | writer.WriteObjectValue(item); |
| | 48 | | } |
| 0 | 49 | | writer.WriteEndArray(); |
| | 50 | | } |
| 112 | 51 | | if (LoadBalancerBackendAddresses != null) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName("loadBalancerBackendAddresses"); |
| 0 | 54 | | writer.WriteStartArray(); |
| 0 | 55 | | foreach (var item in LoadBalancerBackendAddresses) |
| | 56 | | { |
| 0 | 57 | | writer.WriteObjectValue(item); |
| | 58 | | } |
| 0 | 59 | | writer.WriteEndArray(); |
| | 60 | | } |
| 112 | 61 | | if (LoadBalancingRules != null) |
| | 62 | | { |
| 40 | 63 | | writer.WritePropertyName("loadBalancingRules"); |
| 40 | 64 | | writer.WriteStartArray(); |
| 160 | 65 | | foreach (var item in LoadBalancingRules) |
| | 66 | | { |
| 40 | 67 | | writer.WriteObjectValue(item); |
| | 68 | | } |
| 40 | 69 | | writer.WriteEndArray(); |
| | 70 | | } |
| 112 | 71 | | if (OutboundRule != null) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("outboundRule"); |
| 0 | 74 | | writer.WriteObjectValue(OutboundRule); |
| | 75 | | } |
| 112 | 76 | | if (OutboundRules != null) |
| | 77 | | { |
| 0 | 78 | | writer.WritePropertyName("outboundRules"); |
| 0 | 79 | | writer.WriteStartArray(); |
| 0 | 80 | | foreach (var item in OutboundRules) |
| | 81 | | { |
| 0 | 82 | | writer.WriteObjectValue(item); |
| | 83 | | } |
| 0 | 84 | | writer.WriteEndArray(); |
| | 85 | | } |
| 112 | 86 | | if (ProvisioningState != null) |
| | 87 | | { |
| 40 | 88 | | writer.WritePropertyName("provisioningState"); |
| 40 | 89 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 90 | | } |
| 112 | 91 | | writer.WriteEndObject(); |
| 112 | 92 | | writer.WriteEndObject(); |
| 112 | 93 | | } |
| | 94 | |
|
| | 95 | | internal static BackendAddressPool DeserializeBackendAddressPool(JsonElement element) |
| | 96 | | { |
| 196 | 97 | | string name = default; |
| 196 | 98 | | string etag = default; |
| 196 | 99 | | string type = default; |
| 196 | 100 | | string id = default; |
| 196 | 101 | | IList<NetworkInterfaceIPConfiguration> backendIPConfigurations = default; |
| 196 | 102 | | IList<LoadBalancerBackendAddress> loadBalancerBackendAddresses = default; |
| 196 | 103 | | IList<SubResource> loadBalancingRules = default; |
| 196 | 104 | | SubResource outboundRule = default; |
| 196 | 105 | | IList<SubResource> outboundRules = default; |
| 196 | 106 | | ProvisioningState? provisioningState = default; |
| 1712 | 107 | | foreach (var property in element.EnumerateObject()) |
| | 108 | | { |
| 660 | 109 | | if (property.NameEquals("name")) |
| | 110 | | { |
| 116 | 111 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 116 | 115 | | name = property.Value.GetString(); |
| 116 | 116 | | continue; |
| | 117 | | } |
| 544 | 118 | | if (property.NameEquals("etag")) |
| | 119 | | { |
| 116 | 120 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| | 122 | | continue; |
| | 123 | | } |
| 116 | 124 | | etag = property.Value.GetString(); |
| 116 | 125 | | continue; |
| | 126 | | } |
| 428 | 127 | | if (property.NameEquals("type")) |
| | 128 | | { |
| 116 | 129 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 130 | | { |
| | 131 | | continue; |
| | 132 | | } |
| 116 | 133 | | type = property.Value.GetString(); |
| 116 | 134 | | continue; |
| | 135 | | } |
| 312 | 136 | | if (property.NameEquals("id")) |
| | 137 | | { |
| 196 | 138 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 139 | | { |
| | 140 | | continue; |
| | 141 | | } |
| 196 | 142 | | id = property.Value.GetString(); |
| 196 | 143 | | continue; |
| | 144 | | } |
| 116 | 145 | | if (property.NameEquals("properties")) |
| | 146 | | { |
| 728 | 147 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 148 | | { |
| 248 | 149 | | if (property0.NameEquals("backendIPConfigurations")) |
| | 150 | | { |
| 16 | 151 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 152 | | { |
| | 153 | | continue; |
| | 154 | | } |
| 16 | 155 | | List<NetworkInterfaceIPConfiguration> array = new List<NetworkInterfaceIPConfiguration>(); |
| 96 | 156 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 157 | | { |
| 32 | 158 | | if (item.ValueKind == JsonValueKind.Null) |
| | 159 | | { |
| 0 | 160 | | array.Add(null); |
| | 161 | | } |
| | 162 | | else |
| | 163 | | { |
| 32 | 164 | | array.Add(NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration |
| | 165 | | } |
| | 166 | | } |
| 16 | 167 | | backendIPConfigurations = array; |
| 16 | 168 | | continue; |
| | 169 | | } |
| 232 | 170 | | if (property0.NameEquals("loadBalancerBackendAddresses")) |
| | 171 | | { |
| 0 | 172 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 173 | | { |
| | 174 | | continue; |
| | 175 | | } |
| 0 | 176 | | List<LoadBalancerBackendAddress> array = new List<LoadBalancerBackendAddress>(); |
| 0 | 177 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 178 | | { |
| 0 | 179 | | if (item.ValueKind == JsonValueKind.Null) |
| | 180 | | { |
| 0 | 181 | | array.Add(null); |
| | 182 | | } |
| | 183 | | else |
| | 184 | | { |
| 0 | 185 | | array.Add(LoadBalancerBackendAddress.DeserializeLoadBalancerBackendAddress(item)); |
| | 186 | | } |
| | 187 | | } |
| 0 | 188 | | loadBalancerBackendAddresses = array; |
| 0 | 189 | | continue; |
| | 190 | | } |
| 232 | 191 | | if (property0.NameEquals("loadBalancingRules")) |
| | 192 | | { |
| 116 | 193 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 194 | | { |
| | 195 | | continue; |
| | 196 | | } |
| 116 | 197 | | List<SubResource> array = new List<SubResource>(); |
| 464 | 198 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 199 | | { |
| 116 | 200 | | if (item.ValueKind == JsonValueKind.Null) |
| | 201 | | { |
| 0 | 202 | | array.Add(null); |
| | 203 | | } |
| | 204 | | else |
| | 205 | | { |
| 116 | 206 | | array.Add(DeserializeSubResource(item)); |
| | 207 | | } |
| | 208 | | } |
| 116 | 209 | | loadBalancingRules = array; |
| 116 | 210 | | continue; |
| | 211 | | } |
| 116 | 212 | | if (property0.NameEquals("outboundRule")) |
| | 213 | | { |
| 0 | 214 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 215 | | { |
| | 216 | | continue; |
| | 217 | | } |
| 0 | 218 | | outboundRule = DeserializeSubResource(property0.Value); |
| 0 | 219 | | continue; |
| | 220 | | } |
| 116 | 221 | | if (property0.NameEquals("outboundRules")) |
| | 222 | | { |
| 0 | 223 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 224 | | { |
| | 225 | | continue; |
| | 226 | | } |
| 0 | 227 | | List<SubResource> array = new List<SubResource>(); |
| 0 | 228 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 229 | | { |
| 0 | 230 | | if (item.ValueKind == JsonValueKind.Null) |
| | 231 | | { |
| 0 | 232 | | array.Add(null); |
| | 233 | | } |
| | 234 | | else |
| | 235 | | { |
| 0 | 236 | | array.Add(DeserializeSubResource(item)); |
| | 237 | | } |
| | 238 | | } |
| 0 | 239 | | outboundRules = array; |
| 0 | 240 | | continue; |
| | 241 | | } |
| 116 | 242 | | if (property0.NameEquals("provisioningState")) |
| | 243 | | { |
| 116 | 244 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 245 | | { |
| | 246 | | continue; |
| | 247 | | } |
| 116 | 248 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 249 | | continue; |
| | 250 | | } |
| | 251 | | } |
| | 252 | | continue; |
| | 253 | | } |
| | 254 | | } |
| 196 | 255 | | return new BackendAddressPool(id, name, etag, type, backendIPConfigurations, loadBalancerBackendAddresses, l |
| | 256 | | } |
| | 257 | | } |
| | 258 | | } |