| | 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 LoadBalancer : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 104 | 18 | | writer.WriteStartObject(); |
| 104 | 19 | | if (Sku != null) |
| | 20 | | { |
| 16 | 21 | | writer.WritePropertyName("sku"); |
| 16 | 22 | | writer.WriteObjectValue(Sku); |
| | 23 | | } |
| 104 | 24 | | if (Etag != null) |
| | 25 | | { |
| 16 | 26 | | writer.WritePropertyName("etag"); |
| 16 | 27 | | writer.WriteStringValue(Etag); |
| | 28 | | } |
| 104 | 29 | | if (Id != null) |
| | 30 | | { |
| 16 | 31 | | writer.WritePropertyName("id"); |
| 16 | 32 | | writer.WriteStringValue(Id); |
| | 33 | | } |
| 104 | 34 | | if (Name != null) |
| | 35 | | { |
| 16 | 36 | | writer.WritePropertyName("name"); |
| 16 | 37 | | writer.WriteStringValue(Name); |
| | 38 | | } |
| 104 | 39 | | if (Type != null) |
| | 40 | | { |
| 16 | 41 | | writer.WritePropertyName("type"); |
| 16 | 42 | | writer.WriteStringValue(Type); |
| | 43 | | } |
| 104 | 44 | | if (Location != null) |
| | 45 | | { |
| 104 | 46 | | writer.WritePropertyName("location"); |
| 104 | 47 | | writer.WriteStringValue(Location); |
| | 48 | | } |
| 104 | 49 | | if (Tags != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("tags"); |
| 0 | 52 | | writer.WriteStartObject(); |
| 0 | 53 | | foreach (var item in Tags) |
| | 54 | | { |
| 0 | 55 | | writer.WritePropertyName(item.Key); |
| 0 | 56 | | writer.WriteStringValue(item.Value); |
| | 57 | | } |
| 0 | 58 | | writer.WriteEndObject(); |
| | 59 | | } |
| 104 | 60 | | writer.WritePropertyName("properties"); |
| 104 | 61 | | writer.WriteStartObject(); |
| 104 | 62 | | if (FrontendIPConfigurations != null) |
| | 63 | | { |
| 96 | 64 | | writer.WritePropertyName("frontendIPConfigurations"); |
| 96 | 65 | | writer.WriteStartArray(); |
| 384 | 66 | | foreach (var item in FrontendIPConfigurations) |
| | 67 | | { |
| 96 | 68 | | writer.WriteObjectValue(item); |
| | 69 | | } |
| 96 | 70 | | writer.WriteEndArray(); |
| | 71 | | } |
| 104 | 72 | | if (BackendAddressPools != null) |
| | 73 | | { |
| 88 | 74 | | writer.WritePropertyName("backendAddressPools"); |
| 88 | 75 | | writer.WriteStartArray(); |
| 336 | 76 | | foreach (var item in BackendAddressPools) |
| | 77 | | { |
| 80 | 78 | | writer.WriteObjectValue(item); |
| | 79 | | } |
| 88 | 80 | | writer.WriteEndArray(); |
| | 81 | | } |
| 104 | 82 | | if (LoadBalancingRules != null) |
| | 83 | | { |
| 88 | 84 | | writer.WritePropertyName("loadBalancingRules"); |
| 88 | 85 | | writer.WriteStartArray(); |
| 336 | 86 | | foreach (var item in LoadBalancingRules) |
| | 87 | | { |
| 80 | 88 | | writer.WriteObjectValue(item); |
| | 89 | | } |
| 88 | 90 | | writer.WriteEndArray(); |
| | 91 | | } |
| 104 | 92 | | if (Probes != null) |
| | 93 | | { |
| 80 | 94 | | writer.WritePropertyName("probes"); |
| 80 | 95 | | writer.WriteStartArray(); |
| 304 | 96 | | foreach (var item in Probes) |
| | 97 | | { |
| 72 | 98 | | writer.WriteObjectValue(item); |
| | 99 | | } |
| 80 | 100 | | writer.WriteEndArray(); |
| | 101 | | } |
| 104 | 102 | | if (InboundNatRules != null) |
| | 103 | | { |
| 80 | 104 | | writer.WritePropertyName("inboundNatRules"); |
| 80 | 105 | | writer.WriteStartArray(); |
| 416 | 106 | | foreach (var item in InboundNatRules) |
| | 107 | | { |
| 128 | 108 | | writer.WriteObjectValue(item); |
| | 109 | | } |
| 80 | 110 | | writer.WriteEndArray(); |
| | 111 | | } |
| 104 | 112 | | if (InboundNatPools != null) |
| | 113 | | { |
| 24 | 114 | | writer.WritePropertyName("inboundNatPools"); |
| 24 | 115 | | writer.WriteStartArray(); |
| 96 | 116 | | foreach (var item in InboundNatPools) |
| | 117 | | { |
| 24 | 118 | | writer.WriteObjectValue(item); |
| | 119 | | } |
| 24 | 120 | | writer.WriteEndArray(); |
| | 121 | | } |
| 104 | 122 | | if (OutboundRules != null) |
| | 123 | | { |
| 0 | 124 | | writer.WritePropertyName("outboundRules"); |
| 0 | 125 | | writer.WriteStartArray(); |
| 0 | 126 | | foreach (var item in OutboundRules) |
| | 127 | | { |
| 0 | 128 | | writer.WriteObjectValue(item); |
| | 129 | | } |
| 0 | 130 | | writer.WriteEndArray(); |
| | 131 | | } |
| 104 | 132 | | if (ResourceGuid != null) |
| | 133 | | { |
| 16 | 134 | | writer.WritePropertyName("resourceGuid"); |
| 16 | 135 | | writer.WriteStringValue(ResourceGuid); |
| | 136 | | } |
| 104 | 137 | | if (ProvisioningState != null) |
| | 138 | | { |
| 16 | 139 | | writer.WritePropertyName("provisioningState"); |
| 16 | 140 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 141 | | } |
| 104 | 142 | | writer.WriteEndObject(); |
| 104 | 143 | | writer.WriteEndObject(); |
| 104 | 144 | | } |
| | 145 | |
|
| | 146 | | internal static LoadBalancer DeserializeLoadBalancer(JsonElement element) |
| | 147 | | { |
| 120 | 148 | | LoadBalancerSku sku = default; |
| 120 | 149 | | string etag = default; |
| 120 | 150 | | string id = default; |
| 120 | 151 | | string name = default; |
| 120 | 152 | | string type = default; |
| 120 | 153 | | string location = default; |
| 120 | 154 | | IDictionary<string, string> tags = default; |
| 120 | 155 | | IList<FrontendIPConfiguration> frontendIPConfigurations = default; |
| 120 | 156 | | IList<BackendAddressPool> backendAddressPools = default; |
| 120 | 157 | | IList<LoadBalancingRule> loadBalancingRules = default; |
| 120 | 158 | | IList<Probe> probes = default; |
| 120 | 159 | | IList<InboundNatRule> inboundNatRules = default; |
| 120 | 160 | | IList<InboundNatPool> inboundNatPools = default; |
| 120 | 161 | | IList<OutboundRule> outboundRules = default; |
| 120 | 162 | | string resourceGuid = default; |
| 120 | 163 | | ProvisioningState? provisioningState = default; |
| 1920 | 164 | | foreach (var property in element.EnumerateObject()) |
| | 165 | | { |
| 840 | 166 | | if (property.NameEquals("sku")) |
| | 167 | | { |
| 120 | 168 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 169 | | { |
| | 170 | | continue; |
| | 171 | | } |
| 120 | 172 | | sku = LoadBalancerSku.DeserializeLoadBalancerSku(property.Value); |
| 120 | 173 | | continue; |
| | 174 | | } |
| 720 | 175 | | if (property.NameEquals("etag")) |
| | 176 | | { |
| 120 | 177 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 178 | | { |
| | 179 | | continue; |
| | 180 | | } |
| 120 | 181 | | etag = property.Value.GetString(); |
| 120 | 182 | | continue; |
| | 183 | | } |
| 600 | 184 | | if (property.NameEquals("id")) |
| | 185 | | { |
| 120 | 186 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 187 | | { |
| | 188 | | continue; |
| | 189 | | } |
| 120 | 190 | | id = property.Value.GetString(); |
| 120 | 191 | | continue; |
| | 192 | | } |
| 480 | 193 | | if (property.NameEquals("name")) |
| | 194 | | { |
| 120 | 195 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 196 | | { |
| | 197 | | continue; |
| | 198 | | } |
| 120 | 199 | | name = property.Value.GetString(); |
| 120 | 200 | | continue; |
| | 201 | | } |
| 360 | 202 | | if (property.NameEquals("type")) |
| | 203 | | { |
| 120 | 204 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 205 | | { |
| | 206 | | continue; |
| | 207 | | } |
| 120 | 208 | | type = property.Value.GetString(); |
| 120 | 209 | | continue; |
| | 210 | | } |
| 240 | 211 | | if (property.NameEquals("location")) |
| | 212 | | { |
| 120 | 213 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 214 | | { |
| | 215 | | continue; |
| | 216 | | } |
| 120 | 217 | | location = property.Value.GetString(); |
| 120 | 218 | | continue; |
| | 219 | | } |
| 120 | 220 | | if (property.NameEquals("tags")) |
| | 221 | | { |
| 0 | 222 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 223 | | { |
| | 224 | | continue; |
| | 225 | | } |
| 0 | 226 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 227 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 228 | | { |
| 0 | 229 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 230 | | { |
| 0 | 231 | | dictionary.Add(property0.Name, null); |
| | 232 | | } |
| | 233 | | else |
| | 234 | | { |
| 0 | 235 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 236 | | } |
| | 237 | | } |
| 0 | 238 | | tags = dictionary; |
| 0 | 239 | | continue; |
| | 240 | | } |
| 120 | 241 | | if (property.NameEquals("properties")) |
| | 242 | | { |
| 2160 | 243 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 244 | | { |
| 960 | 245 | | if (property0.NameEquals("frontendIPConfigurations")) |
| | 246 | | { |
| 120 | 247 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 248 | | { |
| | 249 | | continue; |
| | 250 | | } |
| 120 | 251 | | List<FrontendIPConfiguration> array = new List<FrontendIPConfiguration>(); |
| 464 | 252 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 253 | | { |
| 112 | 254 | | if (item.ValueKind == JsonValueKind.Null) |
| | 255 | | { |
| 0 | 256 | | array.Add(null); |
| | 257 | | } |
| | 258 | | else |
| | 259 | | { |
| 112 | 260 | | array.Add(FrontendIPConfiguration.DeserializeFrontendIPConfiguration(item)); |
| | 261 | | } |
| | 262 | | } |
| 120 | 263 | | frontendIPConfigurations = array; |
| 120 | 264 | | continue; |
| | 265 | | } |
| 840 | 266 | | if (property0.NameEquals("backendAddressPools")) |
| | 267 | | { |
| 120 | 268 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 269 | | { |
| | 270 | | continue; |
| | 271 | | } |
| 120 | 272 | | List<BackendAddressPool> array = new List<BackendAddressPool>(); |
| 456 | 273 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 274 | | { |
| 108 | 275 | | if (item.ValueKind == JsonValueKind.Null) |
| | 276 | | { |
| 0 | 277 | | array.Add(null); |
| | 278 | | } |
| | 279 | | else |
| | 280 | | { |
| 108 | 281 | | array.Add(BackendAddressPool.DeserializeBackendAddressPool(item)); |
| | 282 | | } |
| | 283 | | } |
| 120 | 284 | | backendAddressPools = array; |
| 120 | 285 | | continue; |
| | 286 | | } |
| 720 | 287 | | if (property0.NameEquals("loadBalancingRules")) |
| | 288 | | { |
| 120 | 289 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 290 | | { |
| | 291 | | continue; |
| | 292 | | } |
| 120 | 293 | | List<LoadBalancingRule> array = new List<LoadBalancingRule>(); |
| 456 | 294 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 295 | | { |
| 108 | 296 | | if (item.ValueKind == JsonValueKind.Null) |
| | 297 | | { |
| 0 | 298 | | array.Add(null); |
| | 299 | | } |
| | 300 | | else |
| | 301 | | { |
| 108 | 302 | | array.Add(LoadBalancingRule.DeserializeLoadBalancingRule(item)); |
| | 303 | | } |
| | 304 | | } |
| 120 | 305 | | loadBalancingRules = array; |
| 120 | 306 | | continue; |
| | 307 | | } |
| 600 | 308 | | if (property0.NameEquals("probes")) |
| | 309 | | { |
| 120 | 310 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 311 | | { |
| | 312 | | continue; |
| | 313 | | } |
| 120 | 314 | | List<Probe> array = new List<Probe>(); |
| 448 | 315 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 316 | | { |
| 104 | 317 | | if (item.ValueKind == JsonValueKind.Null) |
| | 318 | | { |
| 0 | 319 | | array.Add(null); |
| | 320 | | } |
| | 321 | | else |
| | 322 | | { |
| 104 | 323 | | array.Add(Probe.DeserializeProbe(item)); |
| | 324 | | } |
| | 325 | | } |
| 120 | 326 | | probes = array; |
| 120 | 327 | | continue; |
| | 328 | | } |
| 480 | 329 | | if (property0.NameEquals("inboundNatRules")) |
| | 330 | | { |
| 120 | 331 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 332 | | { |
| | 333 | | continue; |
| | 334 | | } |
| 120 | 335 | | List<InboundNatRule> array = new List<InboundNatRule>(); |
| 624 | 336 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 337 | | { |
| 192 | 338 | | if (item.ValueKind == JsonValueKind.Null) |
| | 339 | | { |
| 0 | 340 | | array.Add(null); |
| | 341 | | } |
| | 342 | | else |
| | 343 | | { |
| 192 | 344 | | array.Add(InboundNatRule.DeserializeInboundNatRule(item)); |
| | 345 | | } |
| | 346 | | } |
| 120 | 347 | | inboundNatRules = array; |
| 120 | 348 | | continue; |
| | 349 | | } |
| 360 | 350 | | if (property0.NameEquals("inboundNatPools")) |
| | 351 | | { |
| 120 | 352 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 353 | | { |
| | 354 | | continue; |
| | 355 | | } |
| 120 | 356 | | List<InboundNatPool> array = new List<InboundNatPool>(); |
| 248 | 357 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 358 | | { |
| 4 | 359 | | if (item.ValueKind == JsonValueKind.Null) |
| | 360 | | { |
| 0 | 361 | | array.Add(null); |
| | 362 | | } |
| | 363 | | else |
| | 364 | | { |
| 4 | 365 | | array.Add(InboundNatPool.DeserializeInboundNatPool(item)); |
| | 366 | | } |
| | 367 | | } |
| 120 | 368 | | inboundNatPools = array; |
| 120 | 369 | | continue; |
| | 370 | | } |
| 240 | 371 | | if (property0.NameEquals("outboundRules")) |
| | 372 | | { |
| 0 | 373 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 374 | | { |
| | 375 | | continue; |
| | 376 | | } |
| 0 | 377 | | List<OutboundRule> array = new List<OutboundRule>(); |
| 0 | 378 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 379 | | { |
| 0 | 380 | | if (item.ValueKind == JsonValueKind.Null) |
| | 381 | | { |
| 0 | 382 | | array.Add(null); |
| | 383 | | } |
| | 384 | | else |
| | 385 | | { |
| 0 | 386 | | array.Add(OutboundRule.DeserializeOutboundRule(item)); |
| | 387 | | } |
| | 388 | | } |
| 0 | 389 | | outboundRules = array; |
| 0 | 390 | | continue; |
| | 391 | | } |
| 240 | 392 | | if (property0.NameEquals("resourceGuid")) |
| | 393 | | { |
| 120 | 394 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 395 | | { |
| | 396 | | continue; |
| | 397 | | } |
| 120 | 398 | | resourceGuid = property0.Value.GetString(); |
| 120 | 399 | | continue; |
| | 400 | | } |
| 120 | 401 | | if (property0.NameEquals("provisioningState")) |
| | 402 | | { |
| 120 | 403 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 404 | | { |
| | 405 | | continue; |
| | 406 | | } |
| 120 | 407 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| | 408 | | continue; |
| | 409 | | } |
| | 410 | | } |
| | 411 | | continue; |
| | 412 | | } |
| | 413 | | } |
| 120 | 414 | | return new LoadBalancer(id, name, type, location, tags, sku, etag, frontendIPConfigurations, backendAddressP |
| | 415 | | } |
| | 416 | | } |
| | 417 | | } |