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