< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_Name()-0%100%
get_Etag()-0%100%
get_Priority()-0%100%
get_RuleType()-0%100%
get_MatchConditions()-0%100%
get_Action()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeWebApplicationFirewallCustomRule(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\WebApplicationFirewallCustomRule.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;
 10using System.Linq;
 11
 12namespace Azure.ResourceManager.Network.Models
 13{
 14    /// <summary> Defines contents of a web application rule. </summary>
 15    public partial class WebApplicationFirewallCustomRule
 16    {
 17        /// <summary> Initializes a new instance of WebApplicationFirewallCustomRule. </summary>
 18        /// <param name="priority"> Priority of the rule. Rules with a lower value will be evaluated before rules with a
 19        /// <param name="ruleType"> The rule type. </param>
 20        /// <param name="matchConditions"> List of match conditions. </param>
 21        /// <param name="action"> Type of Actions. </param>
 022        public WebApplicationFirewallCustomRule(int priority, WebApplicationFirewallRuleType ruleType, IEnumerable<Match
 23        {
 024            if (matchConditions == null)
 25            {
 026                throw new ArgumentNullException(nameof(matchConditions));
 27            }
 28
 029            Priority = priority;
 030            RuleType = ruleType;
 031            MatchConditions = matchConditions.ToList();
 032            Action = action;
 033        }
 34
 35        /// <summary> Initializes a new instance of WebApplicationFirewallCustomRule. </summary>
 36        /// <param name="name"> The name of the resource that is unique within a policy. This name can be used to access
 37        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 38        /// <param name="priority"> Priority of the rule. Rules with a lower value will be evaluated before rules with a
 39        /// <param name="ruleType"> The rule type. </param>
 40        /// <param name="matchConditions"> List of match conditions. </param>
 41        /// <param name="action"> Type of Actions. </param>
 042        internal WebApplicationFirewallCustomRule(string name, string etag, int priority, WebApplicationFirewallRuleType
 43        {
 044            Name = name;
 045            Etag = etag;
 046            Priority = priority;
 047            RuleType = ruleType;
 048            MatchConditions = matchConditions ?? new List<MatchCondition>();
 049            Action = action;
 050        }
 51
 52        /// <summary> The name of the resource that is unique within a policy. This name can be used to access the resou
 053        public string Name { get; set; }
 54        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 055        public string Etag { get; }
 56        /// <summary> Priority of the rule. Rules with a lower value will be evaluated before rules with a higher value.
 057        public int Priority { get; set; }
 58        /// <summary> The rule type. </summary>
 059        public WebApplicationFirewallRuleType RuleType { get; set; }
 60        /// <summary> List of match conditions. </summary>
 061        public IList<MatchCondition> MatchConditions { get; }
 62        /// <summary> Type of Actions. </summary>
 063        public WebApplicationFirewallAction Action { get; set; }
 64    }
 65}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\WebApplicationFirewallCustomRule.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 WebApplicationFirewallCustomRule : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Name != null)
 20            {
 021                writer.WritePropertyName("name");
 022                writer.WriteStringValue(Name);
 23            }
 024            if (Etag != null)
 25            {
 026                writer.WritePropertyName("etag");
 027                writer.WriteStringValue(Etag);
 28            }
 029            writer.WritePropertyName("priority");
 030            writer.WriteNumberValue(Priority);
 031            writer.WritePropertyName("ruleType");
 032            writer.WriteStringValue(RuleType.ToString());
 033            writer.WritePropertyName("matchConditions");
 034            writer.WriteStartArray();
 035            foreach (var item in MatchConditions)
 36            {
 037                writer.WriteObjectValue(item);
 38            }
 039            writer.WriteEndArray();
 040            writer.WritePropertyName("action");
 041            writer.WriteStringValue(Action.ToString());
 042            writer.WriteEndObject();
 043        }
 44
 45        internal static WebApplicationFirewallCustomRule DeserializeWebApplicationFirewallCustomRule(JsonElement element
 46        {
 047            string name = default;
 048            string etag = default;
 049            int priority = default;
 050            WebApplicationFirewallRuleType ruleType = default;
 051            IList<MatchCondition> matchConditions = default;
 052            WebApplicationFirewallAction action = default;
 053            foreach (var property in element.EnumerateObject())
 54            {
 055                if (property.NameEquals("name"))
 56                {
 057                    if (property.Value.ValueKind == JsonValueKind.Null)
 58                    {
 59                        continue;
 60                    }
 061                    name = property.Value.GetString();
 062                    continue;
 63                }
 064                if (property.NameEquals("etag"))
 65                {
 066                    if (property.Value.ValueKind == JsonValueKind.Null)
 67                    {
 68                        continue;
 69                    }
 070                    etag = property.Value.GetString();
 071                    continue;
 72                }
 073                if (property.NameEquals("priority"))
 74                {
 075                    priority = property.Value.GetInt32();
 076                    continue;
 77                }
 078                if (property.NameEquals("ruleType"))
 79                {
 080                    ruleType = new WebApplicationFirewallRuleType(property.Value.GetString());
 081                    continue;
 82                }
 083                if (property.NameEquals("matchConditions"))
 84                {
 085                    List<MatchCondition> array = new List<MatchCondition>();
 086                    foreach (var item in property.Value.EnumerateArray())
 87                    {
 088                        if (item.ValueKind == JsonValueKind.Null)
 89                        {
 090                            array.Add(null);
 91                        }
 92                        else
 93                        {
 094                            array.Add(MatchCondition.DeserializeMatchCondition(item));
 95                        }
 96                    }
 097                    matchConditions = array;
 098                    continue;
 99                }
 0100                if (property.NameEquals("action"))
 101                {
 0102                    action = new WebApplicationFirewallAction(property.Value.GetString());
 103                    continue;
 104                }
 105            }
 0106            return new WebApplicationFirewallCustomRule(name, etag, priority, ruleType, matchConditions, action);
 107        }
 108    }
 109}