| | 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 SubnetAssociation |
| | 15 | | { |
| | 16 | | internal static SubnetAssociation DeserializeSubnetAssociation(JsonElement element) |
| | 17 | | { |
| 0 | 18 | | string id = default; |
| 0 | 19 | | IReadOnlyList<SecurityRule> securityRules = default; |
| 0 | 20 | | foreach (var property in element.EnumerateObject()) |
| | 21 | | { |
| 0 | 22 | | if (property.NameEquals("id")) |
| | 23 | | { |
| 0 | 24 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 25 | | { |
| | 26 | | continue; |
| | 27 | | } |
| 0 | 28 | | id = property.Value.GetString(); |
| 0 | 29 | | continue; |
| | 30 | | } |
| 0 | 31 | | if (property.NameEquals("securityRules")) |
| | 32 | | { |
| 0 | 33 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 34 | | { |
| | 35 | | continue; |
| | 36 | | } |
| 0 | 37 | | List<SecurityRule> array = new List<SecurityRule>(); |
| 0 | 38 | | foreach (var item in property.Value.EnumerateArray()) |
| | 39 | | { |
| 0 | 40 | | if (item.ValueKind == JsonValueKind.Null) |
| | 41 | | { |
| 0 | 42 | | array.Add(null); |
| | 43 | | } |
| | 44 | | else |
| | 45 | | { |
| 0 | 46 | | array.Add(SecurityRule.DeserializeSecurityRule(item)); |
| | 47 | | } |
| | 48 | | } |
| 0 | 49 | | securityRules = array; |
| | 50 | | continue; |
| | 51 | | } |
| | 52 | | } |
| 0 | 53 | | return new SubnetAssociation(id, securityRules); |
| | 54 | | } |
| | 55 | | } |
| | 56 | | } |