| | | 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 ConnectivityIssue |
| | | 15 | | { |
| | | 16 | | internal static ConnectivityIssue DeserializeConnectivityIssue(JsonElement element) |
| | | 17 | | { |
| | 0 | 18 | | Origin? origin = default; |
| | 0 | 19 | | Severity? severity = default; |
| | 0 | 20 | | IssueType? type = default; |
| | 0 | 21 | | IReadOnlyList<IDictionary<string, string>> context = default; |
| | 0 | 22 | | foreach (var property in element.EnumerateObject()) |
| | | 23 | | { |
| | 0 | 24 | | if (property.NameEquals("origin")) |
| | | 25 | | { |
| | 0 | 26 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 27 | | { |
| | | 28 | | continue; |
| | | 29 | | } |
| | 0 | 30 | | origin = new Origin(property.Value.GetString()); |
| | 0 | 31 | | continue; |
| | | 32 | | } |
| | 0 | 33 | | if (property.NameEquals("severity")) |
| | | 34 | | { |
| | 0 | 35 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 36 | | { |
| | | 37 | | continue; |
| | | 38 | | } |
| | 0 | 39 | | severity = new Severity(property.Value.GetString()); |
| | 0 | 40 | | continue; |
| | | 41 | | } |
| | 0 | 42 | | if (property.NameEquals("type")) |
| | | 43 | | { |
| | 0 | 44 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 45 | | { |
| | | 46 | | continue; |
| | | 47 | | } |
| | 0 | 48 | | type = new IssueType(property.Value.GetString()); |
| | 0 | 49 | | continue; |
| | | 50 | | } |
| | 0 | 51 | | if (property.NameEquals("context")) |
| | | 52 | | { |
| | 0 | 53 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | | 54 | | { |
| | | 55 | | continue; |
| | | 56 | | } |
| | 0 | 57 | | List<IDictionary<string, string>> array = new List<IDictionary<string, string>>(); |
| | 0 | 58 | | foreach (var item in property.Value.EnumerateArray()) |
| | | 59 | | { |
| | 0 | 60 | | if (item.ValueKind == JsonValueKind.Null) |
| | | 61 | | { |
| | 0 | 62 | | array.Add(null); |
| | | 63 | | } |
| | | 64 | | else |
| | | 65 | | { |
| | 0 | 66 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| | 0 | 67 | | foreach (var property0 in item.EnumerateObject()) |
| | | 68 | | { |
| | 0 | 69 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | | 70 | | { |
| | 0 | 71 | | dictionary.Add(property0.Name, null); |
| | | 72 | | } |
| | | 73 | | else |
| | | 74 | | { |
| | 0 | 75 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | | 76 | | } |
| | | 77 | | } |
| | 0 | 78 | | array.Add(dictionary); |
| | | 79 | | } |
| | | 80 | | } |
| | 0 | 81 | | context = array; |
| | | 82 | | continue; |
| | | 83 | | } |
| | | 84 | | } |
| | 0 | 85 | | return new ConnectivityIssue(origin, severity, type, context); |
| | | 86 | | } |
| | | 87 | | } |
| | | 88 | | } |