| | 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 ApplicationGatewayFirewallRuleGroup : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("ruleGroupName"); |
| 0 | 20 | | writer.WriteStringValue(RuleGroupName); |
| 0 | 21 | | if (Description != null) |
| | 22 | | { |
| 0 | 23 | | writer.WritePropertyName("description"); |
| 0 | 24 | | writer.WriteStringValue(Description); |
| | 25 | | } |
| 0 | 26 | | writer.WritePropertyName("rules"); |
| 0 | 27 | | writer.WriteStartArray(); |
| 0 | 28 | | foreach (var item in Rules) |
| | 29 | | { |
| 0 | 30 | | writer.WriteObjectValue(item); |
| | 31 | | } |
| 0 | 32 | | writer.WriteEndArray(); |
| 0 | 33 | | writer.WriteEndObject(); |
| 0 | 34 | | } |
| | 35 | |
|
| | 36 | | internal static ApplicationGatewayFirewallRuleGroup DeserializeApplicationGatewayFirewallRuleGroup(JsonElement e |
| | 37 | | { |
| 0 | 38 | | string ruleGroupName = default; |
| 0 | 39 | | string description = default; |
| 0 | 40 | | IList<ApplicationGatewayFirewallRule> rules = default; |
| 0 | 41 | | foreach (var property in element.EnumerateObject()) |
| | 42 | | { |
| 0 | 43 | | if (property.NameEquals("ruleGroupName")) |
| | 44 | | { |
| 0 | 45 | | ruleGroupName = property.Value.GetString(); |
| 0 | 46 | | continue; |
| | 47 | | } |
| 0 | 48 | | if (property.NameEquals("description")) |
| | 49 | | { |
| 0 | 50 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 51 | | { |
| | 52 | | continue; |
| | 53 | | } |
| 0 | 54 | | description = property.Value.GetString(); |
| 0 | 55 | | continue; |
| | 56 | | } |
| 0 | 57 | | if (property.NameEquals("rules")) |
| | 58 | | { |
| 0 | 59 | | List<ApplicationGatewayFirewallRule> array = new List<ApplicationGatewayFirewallRule>(); |
| 0 | 60 | | foreach (var item in property.Value.EnumerateArray()) |
| | 61 | | { |
| 0 | 62 | | if (item.ValueKind == JsonValueKind.Null) |
| | 63 | | { |
| 0 | 64 | | array.Add(null); |
| | 65 | | } |
| | 66 | | else |
| | 67 | | { |
| 0 | 68 | | array.Add(ApplicationGatewayFirewallRule.DeserializeApplicationGatewayFirewallRule(item)); |
| | 69 | | } |
| | 70 | | } |
| 0 | 71 | | rules = array; |
| | 72 | | continue; |
| | 73 | | } |
| | 74 | | } |
| 0 | 75 | | return new ApplicationGatewayFirewallRuleGroup(ruleGroupName, description, rules); |
| | 76 | | } |
| | 77 | | } |
| | 78 | | } |