| | 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 ManagedRuleGroupOverride : 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.WriteObjectValue(item); |
| | 28 | | } |
| 0 | 29 | | writer.WriteEndArray(); |
| | 30 | | } |
| 0 | 31 | | writer.WriteEndObject(); |
| 0 | 32 | | } |
| | 33 | |
|
| | 34 | | internal static ManagedRuleGroupOverride DeserializeManagedRuleGroupOverride(JsonElement element) |
| | 35 | | { |
| 0 | 36 | | string ruleGroupName = default; |
| 0 | 37 | | IList<ManagedRuleOverride> 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<ManagedRuleOverride> array = new List<ManagedRuleOverride>(); |
| 0 | 52 | | foreach (var item in property.Value.EnumerateArray()) |
| | 53 | | { |
| 0 | 54 | | if (item.ValueKind == JsonValueKind.Null) |
| | 55 | | { |
| 0 | 56 | | array.Add(null); |
| | 57 | | } |
| | 58 | | else |
| | 59 | | { |
| 0 | 60 | | array.Add(ManagedRuleOverride.DeserializeManagedRuleOverride(item)); |
| | 61 | | } |
| | 62 | | } |
| 0 | 63 | | rules = array; |
| | 64 | | continue; |
| | 65 | | } |
| | 66 | | } |
| 0 | 67 | | return new ManagedRuleGroupOverride(ruleGroupName, rules); |
| | 68 | | } |
| | 69 | | } |
| | 70 | | } |