| | 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 P2SVpnGateway : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Etag != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("etag"); |
| 0 | 22 | | writer.WriteStringValue(Etag); |
| | 23 | | } |
| 0 | 24 | | if (Id != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("id"); |
| 0 | 27 | | writer.WriteStringValue(Id); |
| | 28 | | } |
| 0 | 29 | | if (Name != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("name"); |
| 0 | 32 | | writer.WriteStringValue(Name); |
| | 33 | | } |
| 0 | 34 | | if (Type != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("type"); |
| 0 | 37 | | writer.WriteStringValue(Type); |
| | 38 | | } |
| 0 | 39 | | if (Location != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("location"); |
| 0 | 42 | | writer.WriteStringValue(Location); |
| | 43 | | } |
| 0 | 44 | | if (Tags != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("tags"); |
| 0 | 47 | | writer.WriteStartObject(); |
| 0 | 48 | | foreach (var item in Tags) |
| | 49 | | { |
| 0 | 50 | | writer.WritePropertyName(item.Key); |
| 0 | 51 | | writer.WriteStringValue(item.Value); |
| | 52 | | } |
| 0 | 53 | | writer.WriteEndObject(); |
| | 54 | | } |
| 0 | 55 | | writer.WritePropertyName("properties"); |
| 0 | 56 | | writer.WriteStartObject(); |
| 0 | 57 | | if (VirtualHub != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("virtualHub"); |
| 0 | 60 | | writer.WriteObjectValue(VirtualHub); |
| | 61 | | } |
| 0 | 62 | | if (P2SConnectionConfigurations != null) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("p2SConnectionConfigurations"); |
| 0 | 65 | | writer.WriteStartArray(); |
| 0 | 66 | | foreach (var item in P2SConnectionConfigurations) |
| | 67 | | { |
| 0 | 68 | | writer.WriteObjectValue(item); |
| | 69 | | } |
| 0 | 70 | | writer.WriteEndArray(); |
| | 71 | | } |
| 0 | 72 | | if (ProvisioningState != null) |
| | 73 | | { |
| 0 | 74 | | writer.WritePropertyName("provisioningState"); |
| 0 | 75 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 76 | | } |
| 0 | 77 | | if (VpnGatewayScaleUnit != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("vpnGatewayScaleUnit"); |
| 0 | 80 | | writer.WriteNumberValue(VpnGatewayScaleUnit.Value); |
| | 81 | | } |
| 0 | 82 | | if (VpnServerConfiguration != null) |
| | 83 | | { |
| 0 | 84 | | writer.WritePropertyName("vpnServerConfiguration"); |
| 0 | 85 | | writer.WriteObjectValue(VpnServerConfiguration); |
| | 86 | | } |
| 0 | 87 | | if (VpnClientConnectionHealth != null) |
| | 88 | | { |
| 0 | 89 | | writer.WritePropertyName("vpnClientConnectionHealth"); |
| 0 | 90 | | writer.WriteObjectValue(VpnClientConnectionHealth); |
| | 91 | | } |
| 0 | 92 | | writer.WriteEndObject(); |
| 0 | 93 | | writer.WriteEndObject(); |
| 0 | 94 | | } |
| | 95 | |
|
| | 96 | | internal static P2SVpnGateway DeserializeP2SVpnGateway(JsonElement element) |
| | 97 | | { |
| 0 | 98 | | string etag = default; |
| 0 | 99 | | string id = default; |
| 0 | 100 | | string name = default; |
| 0 | 101 | | string type = default; |
| 0 | 102 | | string location = default; |
| 0 | 103 | | IDictionary<string, string> tags = default; |
| 0 | 104 | | SubResource virtualHub = default; |
| 0 | 105 | | IList<P2SConnectionConfiguration> p2SConnectionConfigurations = default; |
| 0 | 106 | | ProvisioningState? provisioningState = default; |
| 0 | 107 | | int? vpnGatewayScaleUnit = default; |
| 0 | 108 | | SubResource vpnServerConfiguration = default; |
| 0 | 109 | | VpnClientConnectionHealth vpnClientConnectionHealth = default; |
| 0 | 110 | | foreach (var property in element.EnumerateObject()) |
| | 111 | | { |
| 0 | 112 | | if (property.NameEquals("etag")) |
| | 113 | | { |
| 0 | 114 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 115 | | { |
| | 116 | | continue; |
| | 117 | | } |
| 0 | 118 | | etag = property.Value.GetString(); |
| 0 | 119 | | continue; |
| | 120 | | } |
| 0 | 121 | | if (property.NameEquals("id")) |
| | 122 | | { |
| 0 | 123 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 124 | | { |
| | 125 | | continue; |
| | 126 | | } |
| 0 | 127 | | id = property.Value.GetString(); |
| 0 | 128 | | continue; |
| | 129 | | } |
| 0 | 130 | | if (property.NameEquals("name")) |
| | 131 | | { |
| 0 | 132 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 133 | | { |
| | 134 | | continue; |
| | 135 | | } |
| 0 | 136 | | name = property.Value.GetString(); |
| 0 | 137 | | continue; |
| | 138 | | } |
| 0 | 139 | | if (property.NameEquals("type")) |
| | 140 | | { |
| 0 | 141 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 142 | | { |
| | 143 | | continue; |
| | 144 | | } |
| 0 | 145 | | type = property.Value.GetString(); |
| 0 | 146 | | continue; |
| | 147 | | } |
| 0 | 148 | | if (property.NameEquals("location")) |
| | 149 | | { |
| 0 | 150 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 151 | | { |
| | 152 | | continue; |
| | 153 | | } |
| 0 | 154 | | location = property.Value.GetString(); |
| 0 | 155 | | continue; |
| | 156 | | } |
| 0 | 157 | | if (property.NameEquals("tags")) |
| | 158 | | { |
| 0 | 159 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 160 | | { |
| | 161 | | continue; |
| | 162 | | } |
| 0 | 163 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 164 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 165 | | { |
| 0 | 166 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 167 | | { |
| 0 | 168 | | dictionary.Add(property0.Name, null); |
| | 169 | | } |
| | 170 | | else |
| | 171 | | { |
| 0 | 172 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 173 | | } |
| | 174 | | } |
| 0 | 175 | | tags = dictionary; |
| 0 | 176 | | continue; |
| | 177 | | } |
| 0 | 178 | | if (property.NameEquals("properties")) |
| | 179 | | { |
| 0 | 180 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 181 | | { |
| 0 | 182 | | if (property0.NameEquals("virtualHub")) |
| | 183 | | { |
| 0 | 184 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 185 | | { |
| | 186 | | continue; |
| | 187 | | } |
| 0 | 188 | | virtualHub = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 189 | | continue; |
| | 190 | | } |
| 0 | 191 | | if (property0.NameEquals("p2SConnectionConfigurations")) |
| | 192 | | { |
| 0 | 193 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 194 | | { |
| | 195 | | continue; |
| | 196 | | } |
| 0 | 197 | | List<P2SConnectionConfiguration> array = new List<P2SConnectionConfiguration>(); |
| 0 | 198 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 199 | | { |
| 0 | 200 | | if (item.ValueKind == JsonValueKind.Null) |
| | 201 | | { |
| 0 | 202 | | array.Add(null); |
| | 203 | | } |
| | 204 | | else |
| | 205 | | { |
| 0 | 206 | | array.Add(P2SConnectionConfiguration.DeserializeP2SConnectionConfiguration(item)); |
| | 207 | | } |
| | 208 | | } |
| 0 | 209 | | p2SConnectionConfigurations = array; |
| 0 | 210 | | continue; |
| | 211 | | } |
| 0 | 212 | | if (property0.NameEquals("provisioningState")) |
| | 213 | | { |
| 0 | 214 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 215 | | { |
| | 216 | | continue; |
| | 217 | | } |
| 0 | 218 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 219 | | continue; |
| | 220 | | } |
| 0 | 221 | | if (property0.NameEquals("vpnGatewayScaleUnit")) |
| | 222 | | { |
| 0 | 223 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 224 | | { |
| | 225 | | continue; |
| | 226 | | } |
| 0 | 227 | | vpnGatewayScaleUnit = property0.Value.GetInt32(); |
| 0 | 228 | | continue; |
| | 229 | | } |
| 0 | 230 | | if (property0.NameEquals("vpnServerConfiguration")) |
| | 231 | | { |
| 0 | 232 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 233 | | { |
| | 234 | | continue; |
| | 235 | | } |
| 0 | 236 | | vpnServerConfiguration = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 237 | | continue; |
| | 238 | | } |
| 0 | 239 | | if (property0.NameEquals("vpnClientConnectionHealth")) |
| | 240 | | { |
| 0 | 241 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 242 | | { |
| | 243 | | continue; |
| | 244 | | } |
| 0 | 245 | | vpnClientConnectionHealth = VpnClientConnectionHealth.DeserializeVpnClientConnectionHealth(p |
| | 246 | | continue; |
| | 247 | | } |
| | 248 | | } |
| | 249 | | continue; |
| | 250 | | } |
| | 251 | | } |
| 0 | 252 | | return new P2SVpnGateway(id, name, type, location, tags, etag, virtualHub, p2SConnectionConfigurations, prov |
| | 253 | | } |
| | 254 | | } |
| | 255 | | } |