| | 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 VirtualNetworkGateway : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 80 | 18 | | writer.WriteStartObject(); |
| 80 | 19 | | if (Etag != null) |
| | 20 | | { |
| 56 | 21 | | writer.WritePropertyName("etag"); |
| 56 | 22 | | writer.WriteStringValue(Etag); |
| | 23 | | } |
| 80 | 24 | | if (Id != null) |
| | 25 | | { |
| 56 | 26 | | writer.WritePropertyName("id"); |
| 56 | 27 | | writer.WriteStringValue(Id); |
| | 28 | | } |
| 80 | 29 | | if (Name != null) |
| | 30 | | { |
| 56 | 31 | | writer.WritePropertyName("name"); |
| 56 | 32 | | writer.WriteStringValue(Name); |
| | 33 | | } |
| 80 | 34 | | if (Type != null) |
| | 35 | | { |
| 56 | 36 | | writer.WritePropertyName("type"); |
| 56 | 37 | | writer.WriteStringValue(Type); |
| | 38 | | } |
| 80 | 39 | | if (Location != null) |
| | 40 | | { |
| 80 | 41 | | writer.WritePropertyName("location"); |
| 80 | 42 | | writer.WriteStringValue(Location); |
| | 43 | | } |
| 80 | 44 | | if (Tags != null) |
| | 45 | | { |
| 80 | 46 | | writer.WritePropertyName("tags"); |
| 80 | 47 | | writer.WriteStartObject(); |
| 320 | 48 | | foreach (var item in Tags) |
| | 49 | | { |
| 80 | 50 | | writer.WritePropertyName(item.Key); |
| 80 | 51 | | writer.WriteStringValue(item.Value); |
| | 52 | | } |
| 80 | 53 | | writer.WriteEndObject(); |
| | 54 | | } |
| 80 | 55 | | writer.WritePropertyName("properties"); |
| 80 | 56 | | writer.WriteStartObject(); |
| 80 | 57 | | if (IpConfigurations != null) |
| | 58 | | { |
| 80 | 59 | | writer.WritePropertyName("ipConfigurations"); |
| 80 | 60 | | writer.WriteStartArray(); |
| 320 | 61 | | foreach (var item in IpConfigurations) |
| | 62 | | { |
| 80 | 63 | | writer.WriteObjectValue(item); |
| | 64 | | } |
| 80 | 65 | | writer.WriteEndArray(); |
| | 66 | | } |
| 80 | 67 | | if (GatewayType != null) |
| | 68 | | { |
| 80 | 69 | | writer.WritePropertyName("gatewayType"); |
| 80 | 70 | | writer.WriteStringValue(GatewayType.Value.ToString()); |
| | 71 | | } |
| 80 | 72 | | if (VpnType != null) |
| | 73 | | { |
| 80 | 74 | | writer.WritePropertyName("vpnType"); |
| 80 | 75 | | writer.WriteStringValue(VpnType.Value.ToString()); |
| | 76 | | } |
| 80 | 77 | | if (VpnGatewayGeneration != null) |
| | 78 | | { |
| 56 | 79 | | writer.WritePropertyName("vpnGatewayGeneration"); |
| 56 | 80 | | writer.WriteStringValue(VpnGatewayGeneration.Value.ToString()); |
| | 81 | | } |
| 80 | 82 | | if (EnableBgp != null) |
| | 83 | | { |
| 80 | 84 | | writer.WritePropertyName("enableBgp"); |
| 80 | 85 | | writer.WriteBooleanValue(EnableBgp.Value); |
| | 86 | | } |
| 80 | 87 | | if (EnablePrivateIpAddress != null) |
| | 88 | | { |
| 56 | 89 | | writer.WritePropertyName("enablePrivateIpAddress"); |
| 56 | 90 | | writer.WriteBooleanValue(EnablePrivateIpAddress.Value); |
| | 91 | | } |
| 80 | 92 | | if (Active != null) |
| | 93 | | { |
| 56 | 94 | | writer.WritePropertyName("activeActive"); |
| 56 | 95 | | writer.WriteBooleanValue(Active.Value); |
| | 96 | | } |
| 80 | 97 | | if (GatewayDefaultSite != null) |
| | 98 | | { |
| 16 | 99 | | writer.WritePropertyName("gatewayDefaultSite"); |
| 16 | 100 | | writer.WriteObjectValue(GatewayDefaultSite); |
| | 101 | | } |
| 80 | 102 | | if (Sku != null) |
| | 103 | | { |
| 72 | 104 | | writer.WritePropertyName("sku"); |
| 72 | 105 | | writer.WriteObjectValue(Sku); |
| | 106 | | } |
| 80 | 107 | | if (VpnClientConfiguration != null) |
| | 108 | | { |
| 0 | 109 | | writer.WritePropertyName("vpnClientConfiguration"); |
| 0 | 110 | | writer.WriteObjectValue(VpnClientConfiguration); |
| | 111 | | } |
| 80 | 112 | | if (BgpSettings != null) |
| | 113 | | { |
| 64 | 114 | | writer.WritePropertyName("bgpSettings"); |
| 64 | 115 | | writer.WriteObjectValue(BgpSettings); |
| | 116 | | } |
| 80 | 117 | | if (CustomRoutes != null) |
| | 118 | | { |
| 0 | 119 | | writer.WritePropertyName("customRoutes"); |
| 0 | 120 | | writer.WriteObjectValue(CustomRoutes); |
| | 121 | | } |
| 80 | 122 | | if (ResourceGuid != null) |
| | 123 | | { |
| 56 | 124 | | writer.WritePropertyName("resourceGuid"); |
| 56 | 125 | | writer.WriteStringValue(ResourceGuid); |
| | 126 | | } |
| 80 | 127 | | if (ProvisioningState != null) |
| | 128 | | { |
| 56 | 129 | | writer.WritePropertyName("provisioningState"); |
| 56 | 130 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 131 | | } |
| 80 | 132 | | if (EnableDnsForwarding != null) |
| | 133 | | { |
| 0 | 134 | | writer.WritePropertyName("enableDnsForwarding"); |
| 0 | 135 | | writer.WriteBooleanValue(EnableDnsForwarding.Value); |
| | 136 | | } |
| 80 | 137 | | if (InboundDnsForwardingEndpoint != null) |
| | 138 | | { |
| 0 | 139 | | writer.WritePropertyName("inboundDnsForwardingEndpoint"); |
| 0 | 140 | | writer.WriteStringValue(InboundDnsForwardingEndpoint); |
| | 141 | | } |
| 80 | 142 | | writer.WriteEndObject(); |
| 80 | 143 | | writer.WriteEndObject(); |
| 80 | 144 | | } |
| | 145 | |
|
| | 146 | | internal static VirtualNetworkGateway DeserializeVirtualNetworkGateway(JsonElement element) |
| | 147 | | { |
| 92 | 148 | | string etag = default; |
| 92 | 149 | | string id = default; |
| 92 | 150 | | string name = default; |
| 92 | 151 | | string type = default; |
| 92 | 152 | | string location = default; |
| 92 | 153 | | IDictionary<string, string> tags = default; |
| 92 | 154 | | IList<VirtualNetworkGatewayIPConfiguration> ipConfigurations = default; |
| 92 | 155 | | VirtualNetworkGatewayType? gatewayType = default; |
| 92 | 156 | | VpnType? vpnType = default; |
| 92 | 157 | | VpnGatewayGeneration? vpnGatewayGeneration = default; |
| 92 | 158 | | bool? enableBgp = default; |
| 92 | 159 | | bool? enablePrivateIpAddress = default; |
| 92 | 160 | | bool? activeActive = default; |
| 92 | 161 | | SubResource gatewayDefaultSite = default; |
| 92 | 162 | | VirtualNetworkGatewaySku sku = default; |
| 92 | 163 | | VpnClientConfiguration vpnClientConfiguration = default; |
| 92 | 164 | | BgpSettings bgpSettings = default; |
| 92 | 165 | | AddressSpace customRoutes = default; |
| 92 | 166 | | string resourceGuid = default; |
| 92 | 167 | | ProvisioningState? provisioningState = default; |
| 92 | 168 | | bool? enableDnsForwarding = default; |
| 92 | 169 | | string inboundDnsForwardingEndpoint = default; |
| 752 | 170 | | foreach (var property in element.EnumerateObject()) |
| | 171 | | { |
| 284 | 172 | | if (property.NameEquals("etag")) |
| | 173 | | { |
| 32 | 174 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 175 | | { |
| | 176 | | continue; |
| | 177 | | } |
| 32 | 178 | | etag = property.Value.GetString(); |
| 32 | 179 | | continue; |
| | 180 | | } |
| 252 | 181 | | if (property.NameEquals("id")) |
| | 182 | | { |
| 92 | 183 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 184 | | { |
| | 185 | | continue; |
| | 186 | | } |
| 92 | 187 | | id = property.Value.GetString(); |
| 92 | 188 | | continue; |
| | 189 | | } |
| 160 | 190 | | if (property.NameEquals("name")) |
| | 191 | | { |
| 32 | 192 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 193 | | { |
| | 194 | | continue; |
| | 195 | | } |
| 32 | 196 | | name = property.Value.GetString(); |
| 32 | 197 | | continue; |
| | 198 | | } |
| 128 | 199 | | if (property.NameEquals("type")) |
| | 200 | | { |
| 32 | 201 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 202 | | { |
| | 203 | | continue; |
| | 204 | | } |
| 32 | 205 | | type = property.Value.GetString(); |
| 32 | 206 | | continue; |
| | 207 | | } |
| 96 | 208 | | if (property.NameEquals("location")) |
| | 209 | | { |
| 32 | 210 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 211 | | { |
| | 212 | | continue; |
| | 213 | | } |
| 32 | 214 | | location = property.Value.GetString(); |
| 32 | 215 | | continue; |
| | 216 | | } |
| 64 | 217 | | if (property.NameEquals("tags")) |
| | 218 | | { |
| 32 | 219 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 220 | | { |
| | 221 | | continue; |
| | 222 | | } |
| 32 | 223 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 128 | 224 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 225 | | { |
| 32 | 226 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 227 | | { |
| 0 | 228 | | dictionary.Add(property0.Name, null); |
| | 229 | | } |
| | 230 | | else |
| | 231 | | { |
| 32 | 232 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 233 | | } |
| | 234 | | } |
| 32 | 235 | | tags = dictionary; |
| 32 | 236 | | continue; |
| | 237 | | } |
| 32 | 238 | | if (property.NameEquals("properties")) |
| | 239 | | { |
| 848 | 240 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 241 | | { |
| 392 | 242 | | if (property0.NameEquals("ipConfigurations")) |
| | 243 | | { |
| 32 | 244 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 245 | | { |
| | 246 | | continue; |
| | 247 | | } |
| 32 | 248 | | List<VirtualNetworkGatewayIPConfiguration> array = new List<VirtualNetworkGatewayIPConfigura |
| 128 | 249 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 250 | | { |
| 32 | 251 | | if (item.ValueKind == JsonValueKind.Null) |
| | 252 | | { |
| 0 | 253 | | array.Add(null); |
| | 254 | | } |
| | 255 | | else |
| | 256 | | { |
| 32 | 257 | | array.Add(VirtualNetworkGatewayIPConfiguration.DeserializeVirtualNetworkGatewayIPCon |
| | 258 | | } |
| | 259 | | } |
| 32 | 260 | | ipConfigurations = array; |
| 32 | 261 | | continue; |
| | 262 | | } |
| 360 | 263 | | if (property0.NameEquals("gatewayType")) |
| | 264 | | { |
| 32 | 265 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 266 | | { |
| | 267 | | continue; |
| | 268 | | } |
| 32 | 269 | | gatewayType = new VirtualNetworkGatewayType(property0.Value.GetString()); |
| 32 | 270 | | continue; |
| | 271 | | } |
| 328 | 272 | | if (property0.NameEquals("vpnType")) |
| | 273 | | { |
| 32 | 274 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 275 | | { |
| | 276 | | continue; |
| | 277 | | } |
| 32 | 278 | | vpnType = new VpnType(property0.Value.GetString()); |
| 32 | 279 | | continue; |
| | 280 | | } |
| 296 | 281 | | if (property0.NameEquals("vpnGatewayGeneration")) |
| | 282 | | { |
| 32 | 283 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 284 | | { |
| | 285 | | continue; |
| | 286 | | } |
| 32 | 287 | | vpnGatewayGeneration = new VpnGatewayGeneration(property0.Value.GetString()); |
| 32 | 288 | | continue; |
| | 289 | | } |
| 264 | 290 | | if (property0.NameEquals("enableBgp")) |
| | 291 | | { |
| 32 | 292 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 293 | | { |
| | 294 | | continue; |
| | 295 | | } |
| 32 | 296 | | enableBgp = property0.Value.GetBoolean(); |
| 32 | 297 | | continue; |
| | 298 | | } |
| 232 | 299 | | if (property0.NameEquals("enablePrivateIpAddress")) |
| | 300 | | { |
| 32 | 301 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 302 | | { |
| | 303 | | continue; |
| | 304 | | } |
| 32 | 305 | | enablePrivateIpAddress = property0.Value.GetBoolean(); |
| 32 | 306 | | continue; |
| | 307 | | } |
| 200 | 308 | | if (property0.NameEquals("activeActive")) |
| | 309 | | { |
| 32 | 310 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 311 | | { |
| | 312 | | continue; |
| | 313 | | } |
| 32 | 314 | | activeActive = property0.Value.GetBoolean(); |
| 32 | 315 | | continue; |
| | 316 | | } |
| 168 | 317 | | if (property0.NameEquals("gatewayDefaultSite")) |
| | 318 | | { |
| 8 | 319 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 320 | | { |
| | 321 | | continue; |
| | 322 | | } |
| 8 | 323 | | gatewayDefaultSite = SubResource.DeserializeSubResource(property0.Value); |
| 8 | 324 | | continue; |
| | 325 | | } |
| 160 | 326 | | if (property0.NameEquals("sku")) |
| | 327 | | { |
| 32 | 328 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 329 | | { |
| | 330 | | continue; |
| | 331 | | } |
| 32 | 332 | | sku = VirtualNetworkGatewaySku.DeserializeVirtualNetworkGatewaySku(property0.Value); |
| 32 | 333 | | continue; |
| | 334 | | } |
| 128 | 335 | | if (property0.NameEquals("vpnClientConfiguration")) |
| | 336 | | { |
| 0 | 337 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 338 | | { |
| | 339 | | continue; |
| | 340 | | } |
| 0 | 341 | | vpnClientConfiguration = VpnClientConfiguration.DeserializeVpnClientConfiguration(property0. |
| 0 | 342 | | continue; |
| | 343 | | } |
| 128 | 344 | | if (property0.NameEquals("bgpSettings")) |
| | 345 | | { |
| 32 | 346 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 347 | | { |
| | 348 | | continue; |
| | 349 | | } |
| 32 | 350 | | bgpSettings = BgpSettings.DeserializeBgpSettings(property0.Value); |
| 32 | 351 | | continue; |
| | 352 | | } |
| 96 | 353 | | if (property0.NameEquals("customRoutes")) |
| | 354 | | { |
| 0 | 355 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 356 | | { |
| | 357 | | continue; |
| | 358 | | } |
| 0 | 359 | | customRoutes = AddressSpace.DeserializeAddressSpace(property0.Value); |
| 0 | 360 | | continue; |
| | 361 | | } |
| 96 | 362 | | if (property0.NameEquals("resourceGuid")) |
| | 363 | | { |
| 32 | 364 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 365 | | { |
| | 366 | | continue; |
| | 367 | | } |
| 32 | 368 | | resourceGuid = property0.Value.GetString(); |
| 32 | 369 | | continue; |
| | 370 | | } |
| 64 | 371 | | if (property0.NameEquals("provisioningState")) |
| | 372 | | { |
| 32 | 373 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 374 | | { |
| | 375 | | continue; |
| | 376 | | } |
| 32 | 377 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 32 | 378 | | continue; |
| | 379 | | } |
| 32 | 380 | | if (property0.NameEquals("enableDnsForwarding")) |
| | 381 | | { |
| 0 | 382 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 383 | | { |
| | 384 | | continue; |
| | 385 | | } |
| 0 | 386 | | enableDnsForwarding = property0.Value.GetBoolean(); |
| 0 | 387 | | continue; |
| | 388 | | } |
| 32 | 389 | | if (property0.NameEquals("inboundDnsForwardingEndpoint")) |
| | 390 | | { |
| 0 | 391 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 392 | | { |
| | 393 | | continue; |
| | 394 | | } |
| 0 | 395 | | inboundDnsForwardingEndpoint = property0.Value.GetString(); |
| | 396 | | continue; |
| | 397 | | } |
| | 398 | | } |
| | 399 | | continue; |
| | 400 | | } |
| | 401 | | } |
| 92 | 402 | | return new VirtualNetworkGateway(id, name, type, location, tags, etag, ipConfigurations, gatewayType, vpnTyp |
| | 403 | | } |
| | 404 | | } |
| | 405 | | } |