| | 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; |
| | 9 | | using System.Collections.Generic; |
| | 10 | | using System.Text.Json; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.ResourceManager.Network.Models |
| | 14 | | { |
| | 15 | | public partial class Topology |
| | 16 | | { |
| | 17 | | internal static Topology DeserializeTopology(JsonElement element) |
| | 18 | | { |
| 4 | 19 | | string id = default; |
| 4 | 20 | | DateTimeOffset? createdDateTime = default; |
| 4 | 21 | | DateTimeOffset? lastModified = default; |
| 4 | 22 | | IReadOnlyList<TopologyResource> resources = default; |
| 40 | 23 | | foreach (var property in element.EnumerateObject()) |
| | 24 | | { |
| 16 | 25 | | if (property.NameEquals("id")) |
| | 26 | | { |
| 4 | 27 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 28 | | { |
| | 29 | | continue; |
| | 30 | | } |
| 4 | 31 | | id = property.Value.GetString(); |
| 4 | 32 | | continue; |
| | 33 | | } |
| 12 | 34 | | if (property.NameEquals("createdDateTime")) |
| | 35 | | { |
| 4 | 36 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 37 | | { |
| | 38 | | continue; |
| | 39 | | } |
| 4 | 40 | | createdDateTime = property.Value.GetDateTimeOffset("O"); |
| 4 | 41 | | continue; |
| | 42 | | } |
| 8 | 43 | | if (property.NameEquals("lastModified")) |
| | 44 | | { |
| 4 | 45 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 46 | | { |
| | 47 | | continue; |
| | 48 | | } |
| 4 | 49 | | lastModified = property.Value.GetDateTimeOffset("O"); |
| 4 | 50 | | continue; |
| | 51 | | } |
| 4 | 52 | | if (property.NameEquals("resources")) |
| | 53 | | { |
| 4 | 54 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| | 56 | | continue; |
| | 57 | | } |
| 4 | 58 | | List<TopologyResource> array = new List<TopologyResource>(); |
| 80 | 59 | | foreach (var item in property.Value.EnumerateArray()) |
| | 60 | | { |
| 36 | 61 | | if (item.ValueKind == JsonValueKind.Null) |
| | 62 | | { |
| 0 | 63 | | array.Add(null); |
| | 64 | | } |
| | 65 | | else |
| | 66 | | { |
| 36 | 67 | | array.Add(TopologyResource.DeserializeTopologyResource(item)); |
| | 68 | | } |
| | 69 | | } |
| 4 | 70 | | resources = array; |
| | 71 | | continue; |
| | 72 | | } |
| | 73 | | } |
| 4 | 74 | | return new Topology(id, createdDateTime, lastModified, resources); |
| | 75 | | } |
| | 76 | | } |
| | 77 | | } |