| | 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 ConnectivityHop |
| | 15 | | { |
| | 16 | | internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element) |
| | 17 | | { |
| 8 | 18 | | string type = default; |
| 8 | 19 | | string id = default; |
| 8 | 20 | | string address = default; |
| 8 | 21 | | string resourceId = default; |
| 8 | 22 | | IReadOnlyList<string> nextHopIds = default; |
| 8 | 23 | | IReadOnlyList<ConnectivityIssue> issues = default; |
| 152 | 24 | | foreach (var property in element.EnumerateObject()) |
| | 25 | | { |
| 68 | 26 | | if (property.NameEquals("type")) |
| | 27 | | { |
| 8 | 28 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 29 | | { |
| | 30 | | continue; |
| | 31 | | } |
| 8 | 32 | | type = property.Value.GetString(); |
| 8 | 33 | | continue; |
| | 34 | | } |
| 60 | 35 | | if (property.NameEquals("id")) |
| | 36 | | { |
| 8 | 37 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 38 | | { |
| | 39 | | continue; |
| | 40 | | } |
| 8 | 41 | | id = property.Value.GetString(); |
| 8 | 42 | | continue; |
| | 43 | | } |
| 52 | 44 | | if (property.NameEquals("address")) |
| | 45 | | { |
| 8 | 46 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 47 | | { |
| | 48 | | continue; |
| | 49 | | } |
| 8 | 50 | | address = property.Value.GetString(); |
| 8 | 51 | | continue; |
| | 52 | | } |
| 44 | 53 | | if (property.NameEquals("resourceId")) |
| | 54 | | { |
| 4 | 55 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 56 | | { |
| | 57 | | continue; |
| | 58 | | } |
| 4 | 59 | | resourceId = property.Value.GetString(); |
| 4 | 60 | | continue; |
| | 61 | | } |
| 40 | 62 | | if (property.NameEquals("nextHopIds")) |
| | 63 | | { |
| 8 | 64 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 65 | | { |
| | 66 | | continue; |
| | 67 | | } |
| 8 | 68 | | List<string> array = new List<string>(); |
| 24 | 69 | | foreach (var item in property.Value.EnumerateArray()) |
| | 70 | | { |
| 4 | 71 | | if (item.ValueKind == JsonValueKind.Null) |
| | 72 | | { |
| 0 | 73 | | array.Add(null); |
| | 74 | | } |
| | 75 | | else |
| | 76 | | { |
| 4 | 77 | | array.Add(item.GetString()); |
| | 78 | | } |
| | 79 | | } |
| 8 | 80 | | nextHopIds = array; |
| 8 | 81 | | continue; |
| | 82 | | } |
| 32 | 83 | | if (property.NameEquals("issues")) |
| | 84 | | { |
| 8 | 85 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 86 | | { |
| | 87 | | continue; |
| | 88 | | } |
| 8 | 89 | | List<ConnectivityIssue> array = new List<ConnectivityIssue>(); |
| 0 | 90 | | foreach (var item in property.Value.EnumerateArray()) |
| | 91 | | { |
| 0 | 92 | | if (item.ValueKind == JsonValueKind.Null) |
| | 93 | | { |
| 0 | 94 | | array.Add(null); |
| | 95 | | } |
| | 96 | | else |
| | 97 | | { |
| 0 | 98 | | array.Add(ConnectivityIssue.DeserializeConnectivityIssue(item)); |
| | 99 | | } |
| | 100 | | } |
| 8 | 101 | | issues = array; |
| | 102 | | continue; |
| | 103 | | } |
| | 104 | | } |
| 8 | 105 | | return new ConnectivityHop(type, id, address, resourceId, nextHopIds, issues); |
| | 106 | | } |
| | 107 | | } |
| | 108 | | } |