| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.ResourceManager.Network.Models |
| | 12 | | { |
| | 13 | | public partial class ConnectionMonitorTestConfiguration : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("name"); |
| 0 | 19 | | writer.WriteStringValue(Name); |
| 0 | 20 | | if (TestFrequencySec != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("testFrequencySec"); |
| 0 | 23 | | writer.WriteNumberValue(TestFrequencySec.Value); |
| | 24 | | } |
| 0 | 25 | | writer.WritePropertyName("protocol"); |
| 0 | 26 | | writer.WriteStringValue(Protocol.ToString()); |
| 0 | 27 | | if (PreferredIPVersion != null) |
| | 28 | | { |
| 0 | 29 | | writer.WritePropertyName("preferredIPVersion"); |
| 0 | 30 | | writer.WriteStringValue(PreferredIPVersion.Value.ToString()); |
| | 31 | | } |
| 0 | 32 | | if (HttpConfiguration != null) |
| | 33 | | { |
| 0 | 34 | | writer.WritePropertyName("httpConfiguration"); |
| 0 | 35 | | writer.WriteObjectValue(HttpConfiguration); |
| | 36 | | } |
| 0 | 37 | | if (TcpConfiguration != null) |
| | 38 | | { |
| 0 | 39 | | writer.WritePropertyName("tcpConfiguration"); |
| 0 | 40 | | writer.WriteObjectValue(TcpConfiguration); |
| | 41 | | } |
| 0 | 42 | | if (IcmpConfiguration != null) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName("icmpConfiguration"); |
| 0 | 45 | | writer.WriteObjectValue(IcmpConfiguration); |
| | 46 | | } |
| 0 | 47 | | if (SuccessThreshold != null) |
| | 48 | | { |
| 0 | 49 | | writer.WritePropertyName("successThreshold"); |
| 0 | 50 | | writer.WriteObjectValue(SuccessThreshold); |
| | 51 | | } |
| 0 | 52 | | writer.WriteEndObject(); |
| 0 | 53 | | } |
| | 54 | |
|
| | 55 | | internal static ConnectionMonitorTestConfiguration DeserializeConnectionMonitorTestConfiguration(JsonElement ele |
| | 56 | | { |
| 0 | 57 | | string name = default; |
| 0 | 58 | | int? testFrequencySec = default; |
| 0 | 59 | | ConnectionMonitorTestConfigurationProtocol protocol = default; |
| 0 | 60 | | PreferredIPVersion? preferredIPVersion = default; |
| 0 | 61 | | ConnectionMonitorHttpConfiguration httpConfiguration = default; |
| 0 | 62 | | ConnectionMonitorTcpConfiguration tcpConfiguration = default; |
| 0 | 63 | | ConnectionMonitorIcmpConfiguration icmpConfiguration = default; |
| 0 | 64 | | ConnectionMonitorSuccessThreshold successThreshold = default; |
| 0 | 65 | | foreach (var property in element.EnumerateObject()) |
| | 66 | | { |
| 0 | 67 | | if (property.NameEquals("name")) |
| | 68 | | { |
| 0 | 69 | | name = property.Value.GetString(); |
| 0 | 70 | | continue; |
| | 71 | | } |
| 0 | 72 | | if (property.NameEquals("testFrequencySec")) |
| | 73 | | { |
| 0 | 74 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 75 | | { |
| | 76 | | continue; |
| | 77 | | } |
| 0 | 78 | | testFrequencySec = property.Value.GetInt32(); |
| 0 | 79 | | continue; |
| | 80 | | } |
| 0 | 81 | | if (property.NameEquals("protocol")) |
| | 82 | | { |
| 0 | 83 | | protocol = new ConnectionMonitorTestConfigurationProtocol(property.Value.GetString()); |
| 0 | 84 | | continue; |
| | 85 | | } |
| 0 | 86 | | if (property.NameEquals("preferredIPVersion")) |
| | 87 | | { |
| 0 | 88 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 89 | | { |
| | 90 | | continue; |
| | 91 | | } |
| 0 | 92 | | preferredIPVersion = new PreferredIPVersion(property.Value.GetString()); |
| 0 | 93 | | continue; |
| | 94 | | } |
| 0 | 95 | | if (property.NameEquals("httpConfiguration")) |
| | 96 | | { |
| 0 | 97 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 98 | | { |
| | 99 | | continue; |
| | 100 | | } |
| 0 | 101 | | httpConfiguration = ConnectionMonitorHttpConfiguration.DeserializeConnectionMonitorHttpConfiguration |
| 0 | 102 | | continue; |
| | 103 | | } |
| 0 | 104 | | if (property.NameEquals("tcpConfiguration")) |
| | 105 | | { |
| 0 | 106 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 107 | | { |
| | 108 | | continue; |
| | 109 | | } |
| 0 | 110 | | tcpConfiguration = ConnectionMonitorTcpConfiguration.DeserializeConnectionMonitorTcpConfiguration(pr |
| 0 | 111 | | continue; |
| | 112 | | } |
| 0 | 113 | | if (property.NameEquals("icmpConfiguration")) |
| | 114 | | { |
| 0 | 115 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 116 | | { |
| | 117 | | continue; |
| | 118 | | } |
| 0 | 119 | | icmpConfiguration = ConnectionMonitorIcmpConfiguration.DeserializeConnectionMonitorIcmpConfiguration |
| 0 | 120 | | continue; |
| | 121 | | } |
| 0 | 122 | | if (property.NameEquals("successThreshold")) |
| | 123 | | { |
| 0 | 124 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 125 | | { |
| | 126 | | continue; |
| | 127 | | } |
| 0 | 128 | | successThreshold = ConnectionMonitorSuccessThreshold.DeserializeConnectionMonitorSuccessThreshold(pr |
| | 129 | | continue; |
| | 130 | | } |
| | 131 | | } |
| 0 | 132 | | return new ConnectionMonitorTestConfiguration(name, testFrequencySec, protocol, preferredIPVersion, httpConf |
| | 133 | | } |
| | 134 | | } |
| | 135 | | } |