| | 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 TopologyResource |
| | 15 | | { |
| | 16 | | internal static TopologyResource DeserializeTopologyResource(JsonElement element) |
| | 17 | | { |
| 36 | 18 | | string name = default; |
| 36 | 19 | | string id = default; |
| 36 | 20 | | string location = default; |
| 36 | 21 | | IReadOnlyList<TopologyAssociation> associations = default; |
| 432 | 22 | | foreach (var property in element.EnumerateObject()) |
| | 23 | | { |
| 180 | 24 | | if (property.NameEquals("name")) |
| | 25 | | { |
| 36 | 26 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 27 | | { |
| | 28 | | continue; |
| | 29 | | } |
| 36 | 30 | | name = property.Value.GetString(); |
| 36 | 31 | | continue; |
| | 32 | | } |
| 144 | 33 | | if (property.NameEquals("id")) |
| | 34 | | { |
| 36 | 35 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 36 | | { |
| | 37 | | continue; |
| | 38 | | } |
| 36 | 39 | | id = property.Value.GetString(); |
| 36 | 40 | | continue; |
| | 41 | | } |
| 108 | 42 | | if (property.NameEquals("location")) |
| | 43 | | { |
| 36 | 44 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 45 | | { |
| | 46 | | continue; |
| | 47 | | } |
| 36 | 48 | | location = property.Value.GetString(); |
| 36 | 49 | | continue; |
| | 50 | | } |
| 72 | 51 | | if (property.NameEquals("associations")) |
| | 52 | | { |
| 36 | 53 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 54 | | { |
| | 55 | | continue; |
| | 56 | | } |
| 36 | 57 | | List<TopologyAssociation> array = new List<TopologyAssociation>(); |
| 160 | 58 | | foreach (var item in property.Value.EnumerateArray()) |
| | 59 | | { |
| 44 | 60 | | if (item.ValueKind == JsonValueKind.Null) |
| | 61 | | { |
| 0 | 62 | | array.Add(null); |
| | 63 | | } |
| | 64 | | else |
| | 65 | | { |
| 44 | 66 | | array.Add(TopologyAssociation.DeserializeTopologyAssociation(item)); |
| | 67 | | } |
| | 68 | | } |
| 36 | 69 | | associations = array; |
| | 70 | | continue; |
| | 71 | | } |
| | 72 | | } |
| 36 | 73 | | return new TopologyResource(name, id, location, associations); |
| | 74 | | } |
| | 75 | | } |
| | 76 | | } |