< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Action()-0%100%
get_RuleConditions()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeFirewallPolicyFilterRule(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\FirewallPolicyFilterRule.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;
 9
 10namespace Azure.ResourceManager.Network.Models
 11{
 12    /// <summary> Firewall Policy Filter Rule. </summary>
 13    public partial class FirewallPolicyFilterRule : FirewallPolicyRule
 14    {
 15        /// <summary> Initializes a new instance of FirewallPolicyFilterRule. </summary>
 016        public FirewallPolicyFilterRule()
 17        {
 018            RuleType = FirewallPolicyRuleType.FirewallPolicyFilterRule;
 019        }
 20
 21        /// <summary> Initializes a new instance of FirewallPolicyFilterRule. </summary>
 22        /// <param name="ruleType"> The type of the rule. </param>
 23        /// <param name="name"> The name of the rule. </param>
 24        /// <param name="priority"> Priority of the Firewall Policy Rule resource. </param>
 25        /// <param name="action"> The action type of a Filter rule. </param>
 26        /// <param name="ruleConditions"> Collection of rule conditions used by a rule. </param>
 027        internal FirewallPolicyFilterRule(FirewallPolicyRuleType ruleType, string name, int? priority, FirewallPolicyFil
 28        {
 029            Action = action;
 030            RuleConditions = ruleConditions;
 031            RuleType = ruleType;
 032        }
 33
 34        /// <summary> The action type of a Filter rule. </summary>
 035        public FirewallPolicyFilterRuleAction Action { get; set; }
 36        /// <summary> Collection of rule conditions used by a rule. </summary>
 037        public IList<FirewallPolicyRuleCondition> RuleConditions { get; set; }
 38    }
 39}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\FirewallPolicyFilterRule.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 FirewallPolicyFilterRule : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Action != null)
 20            {
 021                writer.WritePropertyName("action");
 022                writer.WriteObjectValue(Action);
 23            }
 024            if (RuleConditions != null)
 25            {
 026                writer.WritePropertyName("ruleConditions");
 027                writer.WriteStartArray();
 028                foreach (var item in RuleConditions)
 29                {
 030                    writer.WriteObjectValue(item);
 31                }
 032                writer.WriteEndArray();
 33            }
 034            writer.WritePropertyName("ruleType");
 035            writer.WriteStringValue(RuleType.ToString());
 036            if (Name != null)
 37            {
 038                writer.WritePropertyName("name");
 039                writer.WriteStringValue(Name);
 40            }
 041            if (Priority != null)
 42            {
 043                writer.WritePropertyName("priority");
 044                writer.WriteNumberValue(Priority.Value);
 45            }
 046            writer.WriteEndObject();
 047        }
 48
 49        internal static FirewallPolicyFilterRule DeserializeFirewallPolicyFilterRule(JsonElement element)
 50        {
 051            FirewallPolicyFilterRuleAction action = default;
 052            IList<FirewallPolicyRuleCondition> ruleConditions = default;
 053            FirewallPolicyRuleType ruleType = default;
 054            string name = default;
 055            int? priority = default;
 056            foreach (var property in element.EnumerateObject())
 57            {
 058                if (property.NameEquals("action"))
 59                {
 060                    if (property.Value.ValueKind == JsonValueKind.Null)
 61                    {
 62                        continue;
 63                    }
 064                    action = FirewallPolicyFilterRuleAction.DeserializeFirewallPolicyFilterRuleAction(property.Value);
 065                    continue;
 66                }
 067                if (property.NameEquals("ruleConditions"))
 68                {
 069                    if (property.Value.ValueKind == JsonValueKind.Null)
 70                    {
 71                        continue;
 72                    }
 073                    List<FirewallPolicyRuleCondition> array = new List<FirewallPolicyRuleCondition>();
 074                    foreach (var item in property.Value.EnumerateArray())
 75                    {
 076                        if (item.ValueKind == JsonValueKind.Null)
 77                        {
 078                            array.Add(null);
 79                        }
 80                        else
 81                        {
 082                            array.Add(FirewallPolicyRuleCondition.DeserializeFirewallPolicyRuleCondition(item));
 83                        }
 84                    }
 085                    ruleConditions = array;
 086                    continue;
 87                }
 088                if (property.NameEquals("ruleType"))
 89                {
 090                    ruleType = new FirewallPolicyRuleType(property.Value.GetString());
 091                    continue;
 92                }
 093                if (property.NameEquals("name"))
 94                {
 095                    if (property.Value.ValueKind == JsonValueKind.Null)
 96                    {
 97                        continue;
 98                    }
 099                    name = property.Value.GetString();
 0100                    continue;
 101                }
 0102                if (property.NameEquals("priority"))
 103                {
 0104                    if (property.Value.ValueKind == JsonValueKind.Null)
 105                    {
 106                        continue;
 107                    }
 0108                    priority = property.Value.GetInt32();
 109                    continue;
 110                }
 111            }
 0112            return new FirewallPolicyFilterRule(ruleType, name, priority, action, ruleConditions);
 113        }
 114    }
 115}