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