< Summary

Class:Azure.ResourceManager.Network.Models.ManagedRuleSet
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ManagedRuleSet.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ManagedRuleSet.Serialization.cs
Covered lines:0
Uncovered lines:48
Coverable lines:48
Total lines:130
Line coverage:0% (0 of 48)
Covered branches:0
Total branches:22
Branch coverage:0% (0 of 22)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_RuleSetType()-0%100%
get_RuleSetVersion()-0%100%
get_RuleGroupOverrides()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeManagedRuleSet(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ManagedRuleSet.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10
 11namespace Azure.ResourceManager.Network.Models
 12{
 13    /// <summary> Defines a managed rule set. </summary>
 14    public partial class ManagedRuleSet
 15    {
 16        /// <summary> Initializes a new instance of ManagedRuleSet. </summary>
 17        /// <param name="ruleSetType"> Defines the rule set type to use. </param>
 18        /// <param name="ruleSetVersion"> Defines the version of the rule set to use. </param>
 019        public ManagedRuleSet(string ruleSetType, string ruleSetVersion)
 20        {
 021            if (ruleSetType == null)
 22            {
 023                throw new ArgumentNullException(nameof(ruleSetType));
 24            }
 025            if (ruleSetVersion == null)
 26            {
 027                throw new ArgumentNullException(nameof(ruleSetVersion));
 28            }
 29
 030            RuleSetType = ruleSetType;
 031            RuleSetVersion = ruleSetVersion;
 032        }
 33
 34        /// <summary> Initializes a new instance of ManagedRuleSet. </summary>
 35        /// <param name="ruleSetType"> Defines the rule set type to use. </param>
 36        /// <param name="ruleSetVersion"> Defines the version of the rule set to use. </param>
 37        /// <param name="ruleGroupOverrides"> Defines the rule group overrides to apply to the rule set. </param>
 038        internal ManagedRuleSet(string ruleSetType, string ruleSetVersion, IList<ManagedRuleGroupOverride> ruleGroupOver
 39        {
 040            RuleSetType = ruleSetType;
 041            RuleSetVersion = ruleSetVersion;
 042            RuleGroupOverrides = ruleGroupOverrides;
 043        }
 44
 45        /// <summary> Defines the rule set type to use. </summary>
 046        public string RuleSetType { get; set; }
 47        /// <summary> Defines the version of the rule set to use. </summary>
 048        public string RuleSetVersion { get; set; }
 49        /// <summary> Defines the rule group overrides to apply to the rule set. </summary>
 050        public IList<ManagedRuleGroupOverride> RuleGroupOverrides { get; set; }
 51    }
 52}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ManagedRuleSet.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Network.Models
 13{
 14    public partial class ManagedRuleSet : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("ruleSetType");
 020            writer.WriteStringValue(RuleSetType);
 021            writer.WritePropertyName("ruleSetVersion");
 022            writer.WriteStringValue(RuleSetVersion);
 023            if (RuleGroupOverrides != null)
 24            {
 025                writer.WritePropertyName("ruleGroupOverrides");
 026                writer.WriteStartArray();
 027                foreach (var item in RuleGroupOverrides)
 28                {
 029                    writer.WriteObjectValue(item);
 30                }
 031                writer.WriteEndArray();
 32            }
 033            writer.WriteEndObject();
 034        }
 35
 36        internal static ManagedRuleSet DeserializeManagedRuleSet(JsonElement element)
 37        {
 038            string ruleSetType = default;
 039            string ruleSetVersion = default;
 040            IList<ManagedRuleGroupOverride> ruleGroupOverrides = default;
 041            foreach (var property in element.EnumerateObject())
 42            {
 043                if (property.NameEquals("ruleSetType"))
 44                {
 045                    ruleSetType = property.Value.GetString();
 046                    continue;
 47                }
 048                if (property.NameEquals("ruleSetVersion"))
 49                {
 050                    ruleSetVersion = property.Value.GetString();
 051                    continue;
 52                }
 053                if (property.NameEquals("ruleGroupOverrides"))
 54                {
 055                    if (property.Value.ValueKind == JsonValueKind.Null)
 56                    {
 57                        continue;
 58                    }
 059                    List<ManagedRuleGroupOverride> array = new List<ManagedRuleGroupOverride>();
 060                    foreach (var item in property.Value.EnumerateArray())
 61                    {
 062                        if (item.ValueKind == JsonValueKind.Null)
 63                        {
 064                            array.Add(null);
 65                        }
 66                        else
 67                        {
 068                            array.Add(ManagedRuleGroupOverride.DeserializeManagedRuleGroupOverride(item));
 69                        }
 70                    }
 071                    ruleGroupOverrides = array;
 72                    continue;
 73                }
 74            }
 075            return new ManagedRuleSet(ruleSetType, ruleSetVersion, ruleGroupOverrides);
 76        }
 77    }
 78}