| | 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 VpnClientConnectionHealth : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (TotalIngressBytesTransferred != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("totalIngressBytesTransferred"); |
| 0 | 22 | | writer.WriteNumberValue(TotalIngressBytesTransferred.Value); |
| | 23 | | } |
| 0 | 24 | | if (TotalEgressBytesTransferred != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("totalEgressBytesTransferred"); |
| 0 | 27 | | writer.WriteNumberValue(TotalEgressBytesTransferred.Value); |
| | 28 | | } |
| 0 | 29 | | if (VpnClientConnectionsCount != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("vpnClientConnectionsCount"); |
| 0 | 32 | | writer.WriteNumberValue(VpnClientConnectionsCount.Value); |
| | 33 | | } |
| 0 | 34 | | if (AllocatedIpAddresses != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("allocatedIpAddresses"); |
| 0 | 37 | | writer.WriteStartArray(); |
| 0 | 38 | | foreach (var item in AllocatedIpAddresses) |
| | 39 | | { |
| 0 | 40 | | writer.WriteStringValue(item); |
| | 41 | | } |
| 0 | 42 | | writer.WriteEndArray(); |
| | 43 | | } |
| 0 | 44 | | writer.WriteEndObject(); |
| 0 | 45 | | } |
| | 46 | |
|
| | 47 | | internal static VpnClientConnectionHealth DeserializeVpnClientConnectionHealth(JsonElement element) |
| | 48 | | { |
| 0 | 49 | | long? totalIngressBytesTransferred = default; |
| 0 | 50 | | long? totalEgressBytesTransferred = default; |
| 0 | 51 | | int? vpnClientConnectionsCount = default; |
| 0 | 52 | | IList<string> allocatedIpAddresses = default; |
| 0 | 53 | | foreach (var property in element.EnumerateObject()) |
| | 54 | | { |
| 0 | 55 | | if (property.NameEquals("totalIngressBytesTransferred")) |
| | 56 | | { |
| 0 | 57 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 58 | | { |
| | 59 | | continue; |
| | 60 | | } |
| 0 | 61 | | totalIngressBytesTransferred = property.Value.GetInt64(); |
| 0 | 62 | | continue; |
| | 63 | | } |
| 0 | 64 | | if (property.NameEquals("totalEgressBytesTransferred")) |
| | 65 | | { |
| 0 | 66 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 67 | | { |
| | 68 | | continue; |
| | 69 | | } |
| 0 | 70 | | totalEgressBytesTransferred = property.Value.GetInt64(); |
| 0 | 71 | | continue; |
| | 72 | | } |
| 0 | 73 | | if (property.NameEquals("vpnClientConnectionsCount")) |
| | 74 | | { |
| 0 | 75 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 76 | | { |
| | 77 | | continue; |
| | 78 | | } |
| 0 | 79 | | vpnClientConnectionsCount = property.Value.GetInt32(); |
| 0 | 80 | | continue; |
| | 81 | | } |
| 0 | 82 | | if (property.NameEquals("allocatedIpAddresses")) |
| | 83 | | { |
| 0 | 84 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 85 | | { |
| | 86 | | continue; |
| | 87 | | } |
| 0 | 88 | | List<string> array = new List<string>(); |
| 0 | 89 | | foreach (var item in property.Value.EnumerateArray()) |
| | 90 | | { |
| 0 | 91 | | if (item.ValueKind == JsonValueKind.Null) |
| | 92 | | { |
| 0 | 93 | | array.Add(null); |
| | 94 | | } |
| | 95 | | else |
| | 96 | | { |
| 0 | 97 | | array.Add(item.GetString()); |
| | 98 | | } |
| | 99 | | } |
| 0 | 100 | | allocatedIpAddresses = array; |
| | 101 | | continue; |
| | 102 | | } |
| | 103 | | } |
| 0 | 104 | | return new VpnClientConnectionHealth(totalIngressBytesTransferred, totalEgressBytesTransferred, vpnClientCon |
| | 105 | | } |
| | 106 | | } |
| | 107 | | } |