| | 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 VirtualNetworkGatewayConnectionListEntity : 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 (AuthorizationKey != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("authorizationKey"); |
| 0 | 60 | | writer.WriteStringValue(AuthorizationKey); |
| | 61 | | } |
| 0 | 62 | | writer.WritePropertyName("virtualNetworkGateway1"); |
| 0 | 63 | | writer.WriteObjectValue(VirtualNetworkGateway1); |
| 0 | 64 | | if (VirtualNetworkGateway2 != null) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("virtualNetworkGateway2"); |
| 0 | 67 | | writer.WriteObjectValue(VirtualNetworkGateway2); |
| | 68 | | } |
| 0 | 69 | | if (LocalNetworkGateway2 != null) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("localNetworkGateway2"); |
| 0 | 72 | | writer.WriteObjectValue(LocalNetworkGateway2); |
| | 73 | | } |
| 0 | 74 | | writer.WritePropertyName("connectionType"); |
| 0 | 75 | | writer.WriteStringValue(ConnectionType.ToString()); |
| 0 | 76 | | if (ConnectionProtocol != null) |
| | 77 | | { |
| 0 | 78 | | writer.WritePropertyName("connectionProtocol"); |
| 0 | 79 | | writer.WriteStringValue(ConnectionProtocol.Value.ToString()); |
| | 80 | | } |
| 0 | 81 | | if (RoutingWeight != null) |
| | 82 | | { |
| 0 | 83 | | writer.WritePropertyName("routingWeight"); |
| 0 | 84 | | writer.WriteNumberValue(RoutingWeight.Value); |
| | 85 | | } |
| 0 | 86 | | if (SharedKey != null) |
| | 87 | | { |
| 0 | 88 | | writer.WritePropertyName("sharedKey"); |
| 0 | 89 | | writer.WriteStringValue(SharedKey); |
| | 90 | | } |
| 0 | 91 | | if (ConnectionStatus != null) |
| | 92 | | { |
| 0 | 93 | | writer.WritePropertyName("connectionStatus"); |
| 0 | 94 | | writer.WriteStringValue(ConnectionStatus.Value.ToString()); |
| | 95 | | } |
| 0 | 96 | | if (TunnelConnectionStatus != null) |
| | 97 | | { |
| 0 | 98 | | writer.WritePropertyName("tunnelConnectionStatus"); |
| 0 | 99 | | writer.WriteStartArray(); |
| 0 | 100 | | foreach (var item in TunnelConnectionStatus) |
| | 101 | | { |
| 0 | 102 | | writer.WriteObjectValue(item); |
| | 103 | | } |
| 0 | 104 | | writer.WriteEndArray(); |
| | 105 | | } |
| 0 | 106 | | if (EgressBytesTransferred != null) |
| | 107 | | { |
| 0 | 108 | | writer.WritePropertyName("egressBytesTransferred"); |
| 0 | 109 | | writer.WriteNumberValue(EgressBytesTransferred.Value); |
| | 110 | | } |
| 0 | 111 | | if (IngressBytesTransferred != null) |
| | 112 | | { |
| 0 | 113 | | writer.WritePropertyName("ingressBytesTransferred"); |
| 0 | 114 | | writer.WriteNumberValue(IngressBytesTransferred.Value); |
| | 115 | | } |
| 0 | 116 | | if (Peer != null) |
| | 117 | | { |
| 0 | 118 | | writer.WritePropertyName("peer"); |
| 0 | 119 | | writer.WriteObjectValue(Peer); |
| | 120 | | } |
| 0 | 121 | | if (EnableBgp != null) |
| | 122 | | { |
| 0 | 123 | | writer.WritePropertyName("enableBgp"); |
| 0 | 124 | | writer.WriteBooleanValue(EnableBgp.Value); |
| | 125 | | } |
| 0 | 126 | | if (UsePolicyBasedTrafficSelectors != null) |
| | 127 | | { |
| 0 | 128 | | writer.WritePropertyName("usePolicyBasedTrafficSelectors"); |
| 0 | 129 | | writer.WriteBooleanValue(UsePolicyBasedTrafficSelectors.Value); |
| | 130 | | } |
| 0 | 131 | | if (IpsecPolicies != null) |
| | 132 | | { |
| 0 | 133 | | writer.WritePropertyName("ipsecPolicies"); |
| 0 | 134 | | writer.WriteStartArray(); |
| 0 | 135 | | foreach (var item in IpsecPolicies) |
| | 136 | | { |
| 0 | 137 | | writer.WriteObjectValue(item); |
| | 138 | | } |
| 0 | 139 | | writer.WriteEndArray(); |
| | 140 | | } |
| 0 | 141 | | if (TrafficSelectorPolicies != null) |
| | 142 | | { |
| 0 | 143 | | writer.WritePropertyName("trafficSelectorPolicies"); |
| 0 | 144 | | writer.WriteStartArray(); |
| 0 | 145 | | foreach (var item in TrafficSelectorPolicies) |
| | 146 | | { |
| 0 | 147 | | writer.WriteObjectValue(item); |
| | 148 | | } |
| 0 | 149 | | writer.WriteEndArray(); |
| | 150 | | } |
| 0 | 151 | | if (ResourceGuid != null) |
| | 152 | | { |
| 0 | 153 | | writer.WritePropertyName("resourceGuid"); |
| 0 | 154 | | writer.WriteStringValue(ResourceGuid); |
| | 155 | | } |
| 0 | 156 | | if (ProvisioningState != null) |
| | 157 | | { |
| 0 | 158 | | writer.WritePropertyName("provisioningState"); |
| 0 | 159 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 160 | | } |
| 0 | 161 | | if (ExpressRouteGatewayBypass != null) |
| | 162 | | { |
| 0 | 163 | | writer.WritePropertyName("expressRouteGatewayBypass"); |
| 0 | 164 | | writer.WriteBooleanValue(ExpressRouteGatewayBypass.Value); |
| | 165 | | } |
| 0 | 166 | | writer.WriteEndObject(); |
| 0 | 167 | | writer.WriteEndObject(); |
| 0 | 168 | | } |
| | 169 | |
|
| | 170 | | internal static VirtualNetworkGatewayConnectionListEntity DeserializeVirtualNetworkGatewayConnectionListEntity(J |
| | 171 | | { |
| 4 | 172 | | string etag = default; |
| 4 | 173 | | string id = default; |
| 4 | 174 | | string name = default; |
| 4 | 175 | | string type = default; |
| 4 | 176 | | string location = default; |
| 4 | 177 | | IDictionary<string, string> tags = default; |
| 4 | 178 | | string authorizationKey = default; |
| 4 | 179 | | VirtualNetworkConnectionGatewayReference virtualNetworkGateway1 = default; |
| 4 | 180 | | VirtualNetworkConnectionGatewayReference virtualNetworkGateway2 = default; |
| 4 | 181 | | VirtualNetworkConnectionGatewayReference localNetworkGateway2 = default; |
| 4 | 182 | | VirtualNetworkGatewayConnectionType connectionType = default; |
| 4 | 183 | | VirtualNetworkGatewayConnectionProtocol? connectionProtocol = default; |
| 4 | 184 | | int? routingWeight = default; |
| 4 | 185 | | string sharedKey = default; |
| 4 | 186 | | VirtualNetworkGatewayConnectionStatus? connectionStatus = default; |
| 4 | 187 | | IList<TunnelConnectionHealth> tunnelConnectionStatus = default; |
| 4 | 188 | | long? egressBytesTransferred = default; |
| 4 | 189 | | long? ingressBytesTransferred = default; |
| 4 | 190 | | SubResource peer = default; |
| 4 | 191 | | bool? enableBgp = default; |
| 4 | 192 | | bool? usePolicyBasedTrafficSelectors = default; |
| 4 | 193 | | IList<IpsecPolicy> ipsecPolicies = default; |
| 4 | 194 | | IList<TrafficSelectorPolicy> trafficSelectorPolicies = default; |
| 4 | 195 | | string resourceGuid = default; |
| 4 | 196 | | ProvisioningState? provisioningState = default; |
| 4 | 197 | | bool? expressRouteGatewayBypass = default; |
| 56 | 198 | | foreach (var property in element.EnumerateObject()) |
| | 199 | | { |
| 24 | 200 | | if (property.NameEquals("etag")) |
| | 201 | | { |
| 4 | 202 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 203 | | { |
| | 204 | | continue; |
| | 205 | | } |
| 4 | 206 | | etag = property.Value.GetString(); |
| 4 | 207 | | continue; |
| | 208 | | } |
| 20 | 209 | | if (property.NameEquals("id")) |
| | 210 | | { |
| 4 | 211 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 212 | | { |
| | 213 | | continue; |
| | 214 | | } |
| 4 | 215 | | id = property.Value.GetString(); |
| 4 | 216 | | continue; |
| | 217 | | } |
| 16 | 218 | | if (property.NameEquals("name")) |
| | 219 | | { |
| 4 | 220 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 221 | | { |
| | 222 | | continue; |
| | 223 | | } |
| 4 | 224 | | name = property.Value.GetString(); |
| 4 | 225 | | continue; |
| | 226 | | } |
| 12 | 227 | | if (property.NameEquals("type")) |
| | 228 | | { |
| 4 | 229 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 230 | | { |
| | 231 | | continue; |
| | 232 | | } |
| 4 | 233 | | type = property.Value.GetString(); |
| 4 | 234 | | continue; |
| | 235 | | } |
| 8 | 236 | | if (property.NameEquals("location")) |
| | 237 | | { |
| 4 | 238 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 239 | | { |
| | 240 | | continue; |
| | 241 | | } |
| 4 | 242 | | location = property.Value.GetString(); |
| 4 | 243 | | continue; |
| | 244 | | } |
| 4 | 245 | | if (property.NameEquals("tags")) |
| | 246 | | { |
| 0 | 247 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 248 | | { |
| | 249 | | continue; |
| | 250 | | } |
| 0 | 251 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 252 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 253 | | { |
| 0 | 254 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 255 | | { |
| 0 | 256 | | dictionary.Add(property0.Name, null); |
| | 257 | | } |
| | 258 | | else |
| | 259 | | { |
| 0 | 260 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 261 | | } |
| | 262 | | } |
| 0 | 263 | | tags = dictionary; |
| 0 | 264 | | continue; |
| | 265 | | } |
| 4 | 266 | | if (property.NameEquals("properties")) |
| | 267 | | { |
| 144 | 268 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 269 | | { |
| 68 | 270 | | if (property0.NameEquals("authorizationKey")) |
| | 271 | | { |
| 0 | 272 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 273 | | { |
| | 274 | | continue; |
| | 275 | | } |
| 0 | 276 | | authorizationKey = property0.Value.GetString(); |
| 0 | 277 | | continue; |
| | 278 | | } |
| 68 | 279 | | if (property0.NameEquals("virtualNetworkGateway1")) |
| | 280 | | { |
| 4 | 281 | | virtualNetworkGateway1 = VirtualNetworkConnectionGatewayReference.DeserializeVirtualNetworkC |
| 4 | 282 | | continue; |
| | 283 | | } |
| 64 | 284 | | if (property0.NameEquals("virtualNetworkGateway2")) |
| | 285 | | { |
| 0 | 286 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 287 | | { |
| | 288 | | continue; |
| | 289 | | } |
| 0 | 290 | | virtualNetworkGateway2 = VirtualNetworkConnectionGatewayReference.DeserializeVirtualNetworkC |
| 0 | 291 | | continue; |
| | 292 | | } |
| 64 | 293 | | if (property0.NameEquals("localNetworkGateway2")) |
| | 294 | | { |
| 4 | 295 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 296 | | { |
| | 297 | | continue; |
| | 298 | | } |
| 4 | 299 | | localNetworkGateway2 = VirtualNetworkConnectionGatewayReference.DeserializeVirtualNetworkCon |
| 4 | 300 | | continue; |
| | 301 | | } |
| 60 | 302 | | if (property0.NameEquals("connectionType")) |
| | 303 | | { |
| 4 | 304 | | connectionType = new VirtualNetworkGatewayConnectionType(property0.Value.GetString()); |
| 4 | 305 | | continue; |
| | 306 | | } |
| 56 | 307 | | if (property0.NameEquals("connectionProtocol")) |
| | 308 | | { |
| 4 | 309 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 310 | | { |
| | 311 | | continue; |
| | 312 | | } |
| 4 | 313 | | connectionProtocol = new VirtualNetworkGatewayConnectionProtocol(property0.Value.GetString() |
| 4 | 314 | | continue; |
| | 315 | | } |
| 52 | 316 | | if (property0.NameEquals("routingWeight")) |
| | 317 | | { |
| 4 | 318 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 319 | | { |
| | 320 | | continue; |
| | 321 | | } |
| 4 | 322 | | routingWeight = property0.Value.GetInt32(); |
| 4 | 323 | | continue; |
| | 324 | | } |
| 48 | 325 | | if (property0.NameEquals("sharedKey")) |
| | 326 | | { |
| 0 | 327 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 328 | | { |
| | 329 | | continue; |
| | 330 | | } |
| 0 | 331 | | sharedKey = property0.Value.GetString(); |
| 0 | 332 | | continue; |
| | 333 | | } |
| 48 | 334 | | if (property0.NameEquals("connectionStatus")) |
| | 335 | | { |
| 0 | 336 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 337 | | { |
| | 338 | | continue; |
| | 339 | | } |
| 0 | 340 | | connectionStatus = new VirtualNetworkGatewayConnectionStatus(property0.Value.GetString()); |
| 0 | 341 | | continue; |
| | 342 | | } |
| 48 | 343 | | if (property0.NameEquals("tunnelConnectionStatus")) |
| | 344 | | { |
| 0 | 345 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 346 | | { |
| | 347 | | continue; |
| | 348 | | } |
| 0 | 349 | | List<TunnelConnectionHealth> array = new List<TunnelConnectionHealth>(); |
| 0 | 350 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 351 | | { |
| 0 | 352 | | if (item.ValueKind == JsonValueKind.Null) |
| | 353 | | { |
| 0 | 354 | | array.Add(null); |
| | 355 | | } |
| | 356 | | else |
| | 357 | | { |
| 0 | 358 | | array.Add(TunnelConnectionHealth.DeserializeTunnelConnectionHealth(item)); |
| | 359 | | } |
| | 360 | | } |
| 0 | 361 | | tunnelConnectionStatus = array; |
| 0 | 362 | | continue; |
| | 363 | | } |
| 48 | 364 | | if (property0.NameEquals("egressBytesTransferred")) |
| | 365 | | { |
| 4 | 366 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 367 | | { |
| | 368 | | continue; |
| | 369 | | } |
| 4 | 370 | | egressBytesTransferred = property0.Value.GetInt64(); |
| 4 | 371 | | continue; |
| | 372 | | } |
| 44 | 373 | | if (property0.NameEquals("ingressBytesTransferred")) |
| | 374 | | { |
| 4 | 375 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 376 | | { |
| | 377 | | continue; |
| | 378 | | } |
| 4 | 379 | | ingressBytesTransferred = property0.Value.GetInt64(); |
| 4 | 380 | | continue; |
| | 381 | | } |
| 40 | 382 | | if (property0.NameEquals("peer")) |
| | 383 | | { |
| 0 | 384 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 385 | | { |
| | 386 | | continue; |
| | 387 | | } |
| 0 | 388 | | peer = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 389 | | continue; |
| | 390 | | } |
| 40 | 391 | | if (property0.NameEquals("enableBgp")) |
| | 392 | | { |
| 4 | 393 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 394 | | { |
| | 395 | | continue; |
| | 396 | | } |
| 4 | 397 | | enableBgp = property0.Value.GetBoolean(); |
| 4 | 398 | | continue; |
| | 399 | | } |
| 36 | 400 | | if (property0.NameEquals("usePolicyBasedTrafficSelectors")) |
| | 401 | | { |
| 4 | 402 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 403 | | { |
| | 404 | | continue; |
| | 405 | | } |
| 4 | 406 | | usePolicyBasedTrafficSelectors = property0.Value.GetBoolean(); |
| 4 | 407 | | continue; |
| | 408 | | } |
| 32 | 409 | | if (property0.NameEquals("ipsecPolicies")) |
| | 410 | | { |
| 4 | 411 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 412 | | { |
| | 413 | | continue; |
| | 414 | | } |
| 4 | 415 | | List<IpsecPolicy> array = new List<IpsecPolicy>(); |
| 0 | 416 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 417 | | { |
| 0 | 418 | | if (item.ValueKind == JsonValueKind.Null) |
| | 419 | | { |
| 0 | 420 | | array.Add(null); |
| | 421 | | } |
| | 422 | | else |
| | 423 | | { |
| 0 | 424 | | array.Add(IpsecPolicy.DeserializeIpsecPolicy(item)); |
| | 425 | | } |
| | 426 | | } |
| 4 | 427 | | ipsecPolicies = array; |
| 4 | 428 | | continue; |
| | 429 | | } |
| 28 | 430 | | if (property0.NameEquals("trafficSelectorPolicies")) |
| | 431 | | { |
| 4 | 432 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 433 | | { |
| | 434 | | continue; |
| | 435 | | } |
| 4 | 436 | | List<TrafficSelectorPolicy> array = new List<TrafficSelectorPolicy>(); |
| 0 | 437 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 438 | | { |
| 0 | 439 | | if (item.ValueKind == JsonValueKind.Null) |
| | 440 | | { |
| 0 | 441 | | array.Add(null); |
| | 442 | | } |
| | 443 | | else |
| | 444 | | { |
| 0 | 445 | | array.Add(TrafficSelectorPolicy.DeserializeTrafficSelectorPolicy(item)); |
| | 446 | | } |
| | 447 | | } |
| 4 | 448 | | trafficSelectorPolicies = array; |
| 4 | 449 | | continue; |
| | 450 | | } |
| 24 | 451 | | if (property0.NameEquals("resourceGuid")) |
| | 452 | | { |
| 4 | 453 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 454 | | { |
| | 455 | | continue; |
| | 456 | | } |
| 4 | 457 | | resourceGuid = property0.Value.GetString(); |
| 4 | 458 | | continue; |
| | 459 | | } |
| 20 | 460 | | if (property0.NameEquals("provisioningState")) |
| | 461 | | { |
| 4 | 462 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 463 | | { |
| | 464 | | continue; |
| | 465 | | } |
| 4 | 466 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 4 | 467 | | continue; |
| | 468 | | } |
| 16 | 469 | | if (property0.NameEquals("expressRouteGatewayBypass")) |
| | 470 | | { |
| 4 | 471 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 472 | | { |
| | 473 | | continue; |
| | 474 | | } |
| 4 | 475 | | expressRouteGatewayBypass = property0.Value.GetBoolean(); |
| | 476 | | continue; |
| | 477 | | } |
| | 478 | | } |
| | 479 | | continue; |
| | 480 | | } |
| | 481 | | } |
| 4 | 482 | | return new VirtualNetworkGatewayConnectionListEntity(id, name, type, location, tags, etag, authorizationKey, |
| | 483 | | } |
| | 484 | | } |
| | 485 | | } |