| | 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 AzureFirewall : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | if (Zones != null) |
| | 20 | | { |
| 0 | 21 | | writer.WritePropertyName("zones"); |
| 0 | 22 | | writer.WriteStartArray(); |
| 0 | 23 | | foreach (var item in Zones) |
| | 24 | | { |
| 0 | 25 | | writer.WriteStringValue(item); |
| | 26 | | } |
| 0 | 27 | | writer.WriteEndArray(); |
| | 28 | | } |
| 0 | 29 | | if (Etag != null) |
| | 30 | | { |
| 0 | 31 | | writer.WritePropertyName("etag"); |
| 0 | 32 | | writer.WriteStringValue(Etag); |
| | 33 | | } |
| 0 | 34 | | if (Id != null) |
| | 35 | | { |
| 0 | 36 | | writer.WritePropertyName("id"); |
| 0 | 37 | | writer.WriteStringValue(Id); |
| | 38 | | } |
| 0 | 39 | | if (Name != null) |
| | 40 | | { |
| 0 | 41 | | writer.WritePropertyName("name"); |
| 0 | 42 | | writer.WriteStringValue(Name); |
| | 43 | | } |
| 0 | 44 | | if (Type != null) |
| | 45 | | { |
| 0 | 46 | | writer.WritePropertyName("type"); |
| 0 | 47 | | writer.WriteStringValue(Type); |
| | 48 | | } |
| 0 | 49 | | if (Location != null) |
| | 50 | | { |
| 0 | 51 | | writer.WritePropertyName("location"); |
| 0 | 52 | | writer.WriteStringValue(Location); |
| | 53 | | } |
| 0 | 54 | | if (Tags != null) |
| | 55 | | { |
| 0 | 56 | | writer.WritePropertyName("tags"); |
| 0 | 57 | | writer.WriteStartObject(); |
| 0 | 58 | | foreach (var item in Tags) |
| | 59 | | { |
| 0 | 60 | | writer.WritePropertyName(item.Key); |
| 0 | 61 | | writer.WriteStringValue(item.Value); |
| | 62 | | } |
| 0 | 63 | | writer.WriteEndObject(); |
| | 64 | | } |
| 0 | 65 | | writer.WritePropertyName("properties"); |
| 0 | 66 | | writer.WriteStartObject(); |
| 0 | 67 | | if (ApplicationRuleCollections != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("applicationRuleCollections"); |
| 0 | 70 | | writer.WriteStartArray(); |
| 0 | 71 | | foreach (var item in ApplicationRuleCollections) |
| | 72 | | { |
| 0 | 73 | | writer.WriteObjectValue(item); |
| | 74 | | } |
| 0 | 75 | | writer.WriteEndArray(); |
| | 76 | | } |
| 0 | 77 | | if (NatRuleCollections != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("natRuleCollections"); |
| 0 | 80 | | writer.WriteStartArray(); |
| 0 | 81 | | foreach (var item in NatRuleCollections) |
| | 82 | | { |
| 0 | 83 | | writer.WriteObjectValue(item); |
| | 84 | | } |
| 0 | 85 | | writer.WriteEndArray(); |
| | 86 | | } |
| 0 | 87 | | if (NetworkRuleCollections != null) |
| | 88 | | { |
| 0 | 89 | | writer.WritePropertyName("networkRuleCollections"); |
| 0 | 90 | | writer.WriteStartArray(); |
| 0 | 91 | | foreach (var item in NetworkRuleCollections) |
| | 92 | | { |
| 0 | 93 | | writer.WriteObjectValue(item); |
| | 94 | | } |
| 0 | 95 | | writer.WriteEndArray(); |
| | 96 | | } |
| 0 | 97 | | if (IpConfigurations != null) |
| | 98 | | { |
| 0 | 99 | | writer.WritePropertyName("ipConfigurations"); |
| 0 | 100 | | writer.WriteStartArray(); |
| 0 | 101 | | foreach (var item in IpConfigurations) |
| | 102 | | { |
| 0 | 103 | | writer.WriteObjectValue(item); |
| | 104 | | } |
| 0 | 105 | | writer.WriteEndArray(); |
| | 106 | | } |
| 0 | 107 | | if (ManagementIpConfiguration != null) |
| | 108 | | { |
| 0 | 109 | | writer.WritePropertyName("managementIpConfiguration"); |
| 0 | 110 | | writer.WriteObjectValue(ManagementIpConfiguration); |
| | 111 | | } |
| 0 | 112 | | if (ProvisioningState != null) |
| | 113 | | { |
| 0 | 114 | | writer.WritePropertyName("provisioningState"); |
| 0 | 115 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 116 | | } |
| 0 | 117 | | if (ThreatIntelMode != null) |
| | 118 | | { |
| 0 | 119 | | writer.WritePropertyName("threatIntelMode"); |
| 0 | 120 | | writer.WriteStringValue(ThreatIntelMode.Value.ToString()); |
| | 121 | | } |
| 0 | 122 | | if (VirtualHub != null) |
| | 123 | | { |
| 0 | 124 | | writer.WritePropertyName("virtualHub"); |
| 0 | 125 | | writer.WriteObjectValue(VirtualHub); |
| | 126 | | } |
| 0 | 127 | | if (FirewallPolicy != null) |
| | 128 | | { |
| 0 | 129 | | writer.WritePropertyName("firewallPolicy"); |
| 0 | 130 | | writer.WriteObjectValue(FirewallPolicy); |
| | 131 | | } |
| 0 | 132 | | if (HubIpAddresses != null) |
| | 133 | | { |
| 0 | 134 | | writer.WritePropertyName("hubIpAddresses"); |
| 0 | 135 | | writer.WriteObjectValue(HubIpAddresses); |
| | 136 | | } |
| 0 | 137 | | if (IpGroups != null) |
| | 138 | | { |
| 0 | 139 | | writer.WritePropertyName("ipGroups"); |
| 0 | 140 | | writer.WriteStartArray(); |
| 0 | 141 | | foreach (var item in IpGroups) |
| | 142 | | { |
| 0 | 143 | | writer.WriteObjectValue(item); |
| | 144 | | } |
| 0 | 145 | | writer.WriteEndArray(); |
| | 146 | | } |
| 0 | 147 | | if (Sku != null) |
| | 148 | | { |
| 0 | 149 | | writer.WritePropertyName("sku"); |
| 0 | 150 | | writer.WriteObjectValue(Sku); |
| | 151 | | } |
| 0 | 152 | | if (AdditionalProperties != null) |
| | 153 | | { |
| 0 | 154 | | writer.WritePropertyName("additionalProperties"); |
| 0 | 155 | | writer.WriteStartObject(); |
| 0 | 156 | | foreach (var item in AdditionalProperties) |
| | 157 | | { |
| 0 | 158 | | writer.WritePropertyName(item.Key); |
| 0 | 159 | | writer.WriteStringValue(item.Value); |
| | 160 | | } |
| 0 | 161 | | writer.WriteEndObject(); |
| | 162 | | } |
| 0 | 163 | | writer.WriteEndObject(); |
| 0 | 164 | | writer.WriteEndObject(); |
| 0 | 165 | | } |
| | 166 | |
|
| | 167 | | internal static AzureFirewall DeserializeAzureFirewall(JsonElement element) |
| | 168 | | { |
| 0 | 169 | | IList<string> zones = default; |
| 0 | 170 | | string etag = default; |
| 0 | 171 | | string id = default; |
| 0 | 172 | | string name = default; |
| 0 | 173 | | string type = default; |
| 0 | 174 | | string location = default; |
| 0 | 175 | | IDictionary<string, string> tags = default; |
| 0 | 176 | | IList<AzureFirewallApplicationRuleCollection> applicationRuleCollections = default; |
| 0 | 177 | | IList<AzureFirewallNatRuleCollection> natRuleCollections = default; |
| 0 | 178 | | IList<AzureFirewallNetworkRuleCollection> networkRuleCollections = default; |
| 0 | 179 | | IList<AzureFirewallIPConfiguration> ipConfigurations = default; |
| 0 | 180 | | AzureFirewallIPConfiguration managementIpConfiguration = default; |
| 0 | 181 | | ProvisioningState? provisioningState = default; |
| 0 | 182 | | AzureFirewallThreatIntelMode? threatIntelMode = default; |
| 0 | 183 | | SubResource virtualHub = default; |
| 0 | 184 | | SubResource firewallPolicy = default; |
| 0 | 185 | | HubIPAddresses hubIpAddresses = default; |
| 0 | 186 | | IList<AzureFirewallIpGroups> ipGroups = default; |
| 0 | 187 | | AzureFirewallSku sku = default; |
| 0 | 188 | | IDictionary<string, string> additionalProperties = default; |
| 0 | 189 | | foreach (var property in element.EnumerateObject()) |
| | 190 | | { |
| 0 | 191 | | if (property.NameEquals("zones")) |
| | 192 | | { |
| 0 | 193 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 194 | | { |
| | 195 | | continue; |
| | 196 | | } |
| 0 | 197 | | List<string> array = new List<string>(); |
| 0 | 198 | | foreach (var item in property.Value.EnumerateArray()) |
| | 199 | | { |
| 0 | 200 | | if (item.ValueKind == JsonValueKind.Null) |
| | 201 | | { |
| 0 | 202 | | array.Add(null); |
| | 203 | | } |
| | 204 | | else |
| | 205 | | { |
| 0 | 206 | | array.Add(item.GetString()); |
| | 207 | | } |
| | 208 | | } |
| 0 | 209 | | zones = array; |
| 0 | 210 | | continue; |
| | 211 | | } |
| 0 | 212 | | if (property.NameEquals("etag")) |
| | 213 | | { |
| 0 | 214 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 215 | | { |
| | 216 | | continue; |
| | 217 | | } |
| 0 | 218 | | etag = property.Value.GetString(); |
| 0 | 219 | | continue; |
| | 220 | | } |
| 0 | 221 | | if (property.NameEquals("id")) |
| | 222 | | { |
| 0 | 223 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 224 | | { |
| | 225 | | continue; |
| | 226 | | } |
| 0 | 227 | | id = property.Value.GetString(); |
| 0 | 228 | | continue; |
| | 229 | | } |
| 0 | 230 | | if (property.NameEquals("name")) |
| | 231 | | { |
| 0 | 232 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 233 | | { |
| | 234 | | continue; |
| | 235 | | } |
| 0 | 236 | | name = property.Value.GetString(); |
| 0 | 237 | | continue; |
| | 238 | | } |
| 0 | 239 | | if (property.NameEquals("type")) |
| | 240 | | { |
| 0 | 241 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 242 | | { |
| | 243 | | continue; |
| | 244 | | } |
| 0 | 245 | | type = property.Value.GetString(); |
| 0 | 246 | | continue; |
| | 247 | | } |
| 0 | 248 | | if (property.NameEquals("location")) |
| | 249 | | { |
| 0 | 250 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 251 | | { |
| | 252 | | continue; |
| | 253 | | } |
| 0 | 254 | | location = property.Value.GetString(); |
| 0 | 255 | | continue; |
| | 256 | | } |
| 0 | 257 | | if (property.NameEquals("tags")) |
| | 258 | | { |
| 0 | 259 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 260 | | { |
| | 261 | | continue; |
| | 262 | | } |
| 0 | 263 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 264 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 265 | | { |
| 0 | 266 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 267 | | { |
| 0 | 268 | | dictionary.Add(property0.Name, null); |
| | 269 | | } |
| | 270 | | else |
| | 271 | | { |
| 0 | 272 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 273 | | } |
| | 274 | | } |
| 0 | 275 | | tags = dictionary; |
| 0 | 276 | | continue; |
| | 277 | | } |
| 0 | 278 | | if (property.NameEquals("properties")) |
| | 279 | | { |
| 0 | 280 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 281 | | { |
| 0 | 282 | | if (property0.NameEquals("applicationRuleCollections")) |
| | 283 | | { |
| 0 | 284 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 285 | | { |
| | 286 | | continue; |
| | 287 | | } |
| 0 | 288 | | List<AzureFirewallApplicationRuleCollection> array = new List<AzureFirewallApplicationRuleCo |
| 0 | 289 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 290 | | { |
| 0 | 291 | | if (item.ValueKind == JsonValueKind.Null) |
| | 292 | | { |
| 0 | 293 | | array.Add(null); |
| | 294 | | } |
| | 295 | | else |
| | 296 | | { |
| 0 | 297 | | array.Add(AzureFirewallApplicationRuleCollection.DeserializeAzureFirewallApplication |
| | 298 | | } |
| | 299 | | } |
| 0 | 300 | | applicationRuleCollections = array; |
| 0 | 301 | | continue; |
| | 302 | | } |
| 0 | 303 | | if (property0.NameEquals("natRuleCollections")) |
| | 304 | | { |
| 0 | 305 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 306 | | { |
| | 307 | | continue; |
| | 308 | | } |
| 0 | 309 | | List<AzureFirewallNatRuleCollection> array = new List<AzureFirewallNatRuleCollection>(); |
| 0 | 310 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 311 | | { |
| 0 | 312 | | if (item.ValueKind == JsonValueKind.Null) |
| | 313 | | { |
| 0 | 314 | | array.Add(null); |
| | 315 | | } |
| | 316 | | else |
| | 317 | | { |
| 0 | 318 | | array.Add(AzureFirewallNatRuleCollection.DeserializeAzureFirewallNatRuleCollection(i |
| | 319 | | } |
| | 320 | | } |
| 0 | 321 | | natRuleCollections = array; |
| 0 | 322 | | continue; |
| | 323 | | } |
| 0 | 324 | | if (property0.NameEquals("networkRuleCollections")) |
| | 325 | | { |
| 0 | 326 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 327 | | { |
| | 328 | | continue; |
| | 329 | | } |
| 0 | 330 | | List<AzureFirewallNetworkRuleCollection> array = new List<AzureFirewallNetworkRuleCollection |
| 0 | 331 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 332 | | { |
| 0 | 333 | | if (item.ValueKind == JsonValueKind.Null) |
| | 334 | | { |
| 0 | 335 | | array.Add(null); |
| | 336 | | } |
| | 337 | | else |
| | 338 | | { |
| 0 | 339 | | array.Add(AzureFirewallNetworkRuleCollection.DeserializeAzureFirewallNetworkRuleColl |
| | 340 | | } |
| | 341 | | } |
| 0 | 342 | | networkRuleCollections = array; |
| 0 | 343 | | continue; |
| | 344 | | } |
| 0 | 345 | | if (property0.NameEquals("ipConfigurations")) |
| | 346 | | { |
| 0 | 347 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 348 | | { |
| | 349 | | continue; |
| | 350 | | } |
| 0 | 351 | | List<AzureFirewallIPConfiguration> array = new List<AzureFirewallIPConfiguration>(); |
| 0 | 352 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 353 | | { |
| 0 | 354 | | if (item.ValueKind == JsonValueKind.Null) |
| | 355 | | { |
| 0 | 356 | | array.Add(null); |
| | 357 | | } |
| | 358 | | else |
| | 359 | | { |
| 0 | 360 | | array.Add(AzureFirewallIPConfiguration.DeserializeAzureFirewallIPConfiguration(item) |
| | 361 | | } |
| | 362 | | } |
| 0 | 363 | | ipConfigurations = array; |
| 0 | 364 | | continue; |
| | 365 | | } |
| 0 | 366 | | if (property0.NameEquals("managementIpConfiguration")) |
| | 367 | | { |
| 0 | 368 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 369 | | { |
| | 370 | | continue; |
| | 371 | | } |
| 0 | 372 | | managementIpConfiguration = AzureFirewallIPConfiguration.DeserializeAzureFirewallIPConfigura |
| 0 | 373 | | continue; |
| | 374 | | } |
| 0 | 375 | | if (property0.NameEquals("provisioningState")) |
| | 376 | | { |
| 0 | 377 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 378 | | { |
| | 379 | | continue; |
| | 380 | | } |
| 0 | 381 | | provisioningState = new ProvisioningState(property0.Value.GetString()); |
| 0 | 382 | | continue; |
| | 383 | | } |
| 0 | 384 | | if (property0.NameEquals("threatIntelMode")) |
| | 385 | | { |
| 0 | 386 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 387 | | { |
| | 388 | | continue; |
| | 389 | | } |
| 0 | 390 | | threatIntelMode = new AzureFirewallThreatIntelMode(property0.Value.GetString()); |
| 0 | 391 | | continue; |
| | 392 | | } |
| 0 | 393 | | if (property0.NameEquals("virtualHub")) |
| | 394 | | { |
| 0 | 395 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 396 | | { |
| | 397 | | continue; |
| | 398 | | } |
| 0 | 399 | | virtualHub = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 400 | | continue; |
| | 401 | | } |
| 0 | 402 | | if (property0.NameEquals("firewallPolicy")) |
| | 403 | | { |
| 0 | 404 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 405 | | { |
| | 406 | | continue; |
| | 407 | | } |
| 0 | 408 | | firewallPolicy = SubResource.DeserializeSubResource(property0.Value); |
| 0 | 409 | | continue; |
| | 410 | | } |
| 0 | 411 | | if (property0.NameEquals("hubIpAddresses")) |
| | 412 | | { |
| 0 | 413 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 414 | | { |
| | 415 | | continue; |
| | 416 | | } |
| 0 | 417 | | hubIpAddresses = HubIPAddresses.DeserializeHubIPAddresses(property0.Value); |
| 0 | 418 | | continue; |
| | 419 | | } |
| 0 | 420 | | if (property0.NameEquals("ipGroups")) |
| | 421 | | { |
| 0 | 422 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 423 | | { |
| | 424 | | continue; |
| | 425 | | } |
| 0 | 426 | | List<AzureFirewallIpGroups> array = new List<AzureFirewallIpGroups>(); |
| 0 | 427 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 428 | | { |
| 0 | 429 | | if (item.ValueKind == JsonValueKind.Null) |
| | 430 | | { |
| 0 | 431 | | array.Add(null); |
| | 432 | | } |
| | 433 | | else |
| | 434 | | { |
| 0 | 435 | | array.Add(AzureFirewallIpGroups.DeserializeAzureFirewallIpGroups(item)); |
| | 436 | | } |
| | 437 | | } |
| 0 | 438 | | ipGroups = array; |
| 0 | 439 | | continue; |
| | 440 | | } |
| 0 | 441 | | if (property0.NameEquals("sku")) |
| | 442 | | { |
| 0 | 443 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 444 | | { |
| | 445 | | continue; |
| | 446 | | } |
| 0 | 447 | | sku = AzureFirewallSku.DeserializeAzureFirewallSku(property0.Value); |
| 0 | 448 | | continue; |
| | 449 | | } |
| 0 | 450 | | if (property0.NameEquals("additionalProperties")) |
| | 451 | | { |
| 0 | 452 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 453 | | { |
| | 454 | | continue; |
| | 455 | | } |
| 0 | 456 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 457 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 458 | | { |
| 0 | 459 | | if (property1.Value.ValueKind == JsonValueKind.Null) |
| | 460 | | { |
| 0 | 461 | | dictionary.Add(property1.Name, null); |
| | 462 | | } |
| | 463 | | else |
| | 464 | | { |
| 0 | 465 | | dictionary.Add(property1.Name, property1.Value.GetString()); |
| | 466 | | } |
| | 467 | | } |
| 0 | 468 | | additionalProperties = dictionary; |
| | 469 | | continue; |
| | 470 | | } |
| | 471 | | } |
| | 472 | | continue; |
| | 473 | | } |
| | 474 | | } |
| 0 | 475 | | return new AzureFirewall(id, name, type, location, tags, zones, etag, applicationRuleCollections, natRuleCol |
| | 476 | | } |
| | 477 | | } |
| | 478 | | } |