| | 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 ApplicationGatewayFirewallDisabledRuleGroup : 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 (Rules != null) |
| | 22 | | { |
| 0 | 23 | | writer.WritePropertyName("rules"); |
| 0 | 24 | | writer.WriteStartArray(); |
| 0 | 25 | | foreach (var item in Rules) |
| | 26 | | { |
| 0 | 27 | | writer.WriteNumberValue(item); |
| | 28 | | } |
| 0 | 29 | | writer.WriteEndArray(); |
| | 30 | | } |
| 0 | 31 | | writer.WriteEndObject(); |
| 0 | 32 | | } |
| | 33 | |
|
| | 34 | | internal static ApplicationGatewayFirewallDisabledRuleGroup DeserializeApplicationGatewayFirewallDisabledRuleGro |
| | 35 | | { |
| 0 | 36 | | string ruleGroupName = default; |
| 0 | 37 | | IList<int> rules = default; |
| 0 | 38 | | foreach (var property in element.EnumerateObject()) |
| | 39 | | { |
| 0 | 40 | | if (property.NameEquals("ruleGroupName")) |
| | 41 | | { |
| 0 | 42 | | ruleGroupName = property.Value.GetString(); |
| 0 | 43 | | continue; |
| | 44 | | } |
| 0 | 45 | | if (property.NameEquals("rules")) |
| | 46 | | { |
| 0 | 47 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 48 | | { |
| | 49 | | continue; |
| | 50 | | } |
| 0 | 51 | | List<int> array = new List<int>(); |
| 0 | 52 | | foreach (var item in property.Value.EnumerateArray()) |
| | 53 | | { |
| 0 | 54 | | array.Add(item.GetInt32()); |
| | 55 | | } |
| 0 | 56 | | rules = array; |
| | 57 | | continue; |
| | 58 | | } |
| | 59 | | } |
| 0 | 60 | | return new ApplicationGatewayFirewallDisabledRuleGroup(ruleGroupName, rules); |
| | 61 | | } |
| | 62 | | } |
| | 63 | | } |