< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_Enabled()-0%100%
get_FirewallMode()-0%100%
get_RuleSetType()-0%100%
get_RuleSetVersion()-0%100%
get_DisabledRuleGroups()-0%100%
get_RequestBodyCheck()-0%100%
get_MaxRequestBodySize()-0%100%
get_MaxRequestBodySizeInKb()-0%100%
get_FileUploadLimitInMb()-0%100%
get_Exclusions()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeApplicationGatewayWebApplicationFirewallConfiguration(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ApplicationGatewayWebApplicationFirewallConfiguration.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> Application gateway web application firewall configuration. </summary>
 14    public partial class ApplicationGatewayWebApplicationFirewallConfiguration
 15    {
 16        /// <summary> Initializes a new instance of ApplicationGatewayWebApplicationFirewallConfiguration. </summary>
 17        /// <param name="enabled"> Whether the web application firewall is enabled or not. </param>
 18        /// <param name="firewallMode"> Web application firewall mode. </param>
 19        /// <param name="ruleSetType"> The type of the web application firewall rule set. Possible values are: &apos;OWA
 20        /// <param name="ruleSetVersion"> The version of the rule set type. </param>
 021        public ApplicationGatewayWebApplicationFirewallConfiguration(bool enabled, ApplicationGatewayFirewallMode firewa
 22        {
 023            if (ruleSetType == null)
 24            {
 025                throw new ArgumentNullException(nameof(ruleSetType));
 26            }
 027            if (ruleSetVersion == null)
 28            {
 029                throw new ArgumentNullException(nameof(ruleSetVersion));
 30            }
 31
 032            Enabled = enabled;
 033            FirewallMode = firewallMode;
 034            RuleSetType = ruleSetType;
 035            RuleSetVersion = ruleSetVersion;
 036        }
 37
 38        /// <summary> Initializes a new instance of ApplicationGatewayWebApplicationFirewallConfiguration. </summary>
 39        /// <param name="enabled"> Whether the web application firewall is enabled or not. </param>
 40        /// <param name="firewallMode"> Web application firewall mode. </param>
 41        /// <param name="ruleSetType"> The type of the web application firewall rule set. Possible values are: &apos;OWA
 42        /// <param name="ruleSetVersion"> The version of the rule set type. </param>
 43        /// <param name="disabledRuleGroups"> The disabled rule groups. </param>
 44        /// <param name="requestBodyCheck"> Whether allow WAF to check request Body. </param>
 45        /// <param name="maxRequestBodySize"> Maximum request body size for WAF. </param>
 46        /// <param name="maxRequestBodySizeInKb"> Maximum request body size in Kb for WAF. </param>
 47        /// <param name="fileUploadLimitInMb"> Maximum file upload size in Mb for WAF. </param>
 48        /// <param name="exclusions"> The exclusion list. </param>
 049        internal ApplicationGatewayWebApplicationFirewallConfiguration(bool enabled, ApplicationGatewayFirewallMode fire
 50        {
 051            Enabled = enabled;
 052            FirewallMode = firewallMode;
 053            RuleSetType = ruleSetType;
 054            RuleSetVersion = ruleSetVersion;
 055            DisabledRuleGroups = disabledRuleGroups;
 056            RequestBodyCheck = requestBodyCheck;
 057            MaxRequestBodySize = maxRequestBodySize;
 058            MaxRequestBodySizeInKb = maxRequestBodySizeInKb;
 059            FileUploadLimitInMb = fileUploadLimitInMb;
 060            Exclusions = exclusions;
 061        }
 62
 63        /// <summary> Whether the web application firewall is enabled or not. </summary>
 064        public bool Enabled { get; set; }
 65        /// <summary> Web application firewall mode. </summary>
 066        public ApplicationGatewayFirewallMode FirewallMode { get; set; }
 67        /// <summary> The type of the web application firewall rule set. Possible values are: &apos;OWASP&apos;. </summa
 068        public string RuleSetType { get; set; }
 69        /// <summary> The version of the rule set type. </summary>
 070        public string RuleSetVersion { get; set; }
 71        /// <summary> The disabled rule groups. </summary>
 072        public IList<ApplicationGatewayFirewallDisabledRuleGroup> DisabledRuleGroups { get; set; }
 73        /// <summary> Whether allow WAF to check request Body. </summary>
 074        public bool? RequestBodyCheck { get; set; }
 75        /// <summary> Maximum request body size for WAF. </summary>
 076        public int? MaxRequestBodySize { get; set; }
 77        /// <summary> Maximum request body size in Kb for WAF. </summary>
 078        public int? MaxRequestBodySizeInKb { get; set; }
 79        /// <summary> Maximum file upload size in Mb for WAF. </summary>
 080        public int? FileUploadLimitInMb { get; set; }
 81        /// <summary> The exclusion list. </summary>
 082        public IList<ApplicationGatewayFirewallExclusion> Exclusions { get; set; }
 83    }
 84}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\ApplicationGatewayWebApplicationFirewallConfiguration.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 ApplicationGatewayWebApplicationFirewallConfiguration : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("enabled");
 020            writer.WriteBooleanValue(Enabled);
 021            writer.WritePropertyName("firewallMode");
 022            writer.WriteStringValue(FirewallMode.ToString());
 023            writer.WritePropertyName("ruleSetType");
 024            writer.WriteStringValue(RuleSetType);
 025            writer.WritePropertyName("ruleSetVersion");
 026            writer.WriteStringValue(RuleSetVersion);
 027            if (DisabledRuleGroups != null)
 28            {
 029                writer.WritePropertyName("disabledRuleGroups");
 030                writer.WriteStartArray();
 031                foreach (var item in DisabledRuleGroups)
 32                {
 033                    writer.WriteObjectValue(item);
 34                }
 035                writer.WriteEndArray();
 36            }
 037            if (RequestBodyCheck != null)
 38            {
 039                writer.WritePropertyName("requestBodyCheck");
 040                writer.WriteBooleanValue(RequestBodyCheck.Value);
 41            }
 042            if (MaxRequestBodySize != null)
 43            {
 044                writer.WritePropertyName("maxRequestBodySize");
 045                writer.WriteNumberValue(MaxRequestBodySize.Value);
 46            }
 047            if (MaxRequestBodySizeInKb != null)
 48            {
 049                writer.WritePropertyName("maxRequestBodySizeInKb");
 050                writer.WriteNumberValue(MaxRequestBodySizeInKb.Value);
 51            }
 052            if (FileUploadLimitInMb != null)
 53            {
 054                writer.WritePropertyName("fileUploadLimitInMb");
 055                writer.WriteNumberValue(FileUploadLimitInMb.Value);
 56            }
 057            if (Exclusions != null)
 58            {
 059                writer.WritePropertyName("exclusions");
 060                writer.WriteStartArray();
 061                foreach (var item in Exclusions)
 62                {
 063                    writer.WriteObjectValue(item);
 64                }
 065                writer.WriteEndArray();
 66            }
 067            writer.WriteEndObject();
 068        }
 69
 70        internal static ApplicationGatewayWebApplicationFirewallConfiguration DeserializeApplicationGatewayWebApplicatio
 71        {
 072            bool enabled = default;
 073            ApplicationGatewayFirewallMode firewallMode = default;
 074            string ruleSetType = default;
 075            string ruleSetVersion = default;
 076            IList<ApplicationGatewayFirewallDisabledRuleGroup> disabledRuleGroups = default;
 077            bool? requestBodyCheck = default;
 078            int? maxRequestBodySize = default;
 079            int? maxRequestBodySizeInKb = default;
 080            int? fileUploadLimitInMb = default;
 081            IList<ApplicationGatewayFirewallExclusion> exclusions = default;
 082            foreach (var property in element.EnumerateObject())
 83            {
 084                if (property.NameEquals("enabled"))
 85                {
 086                    enabled = property.Value.GetBoolean();
 087                    continue;
 88                }
 089                if (property.NameEquals("firewallMode"))
 90                {
 091                    firewallMode = new ApplicationGatewayFirewallMode(property.Value.GetString());
 092                    continue;
 93                }
 094                if (property.NameEquals("ruleSetType"))
 95                {
 096                    ruleSetType = property.Value.GetString();
 097                    continue;
 98                }
 099                if (property.NameEquals("ruleSetVersion"))
 100                {
 0101                    ruleSetVersion = property.Value.GetString();
 0102                    continue;
 103                }
 0104                if (property.NameEquals("disabledRuleGroups"))
 105                {
 0106                    if (property.Value.ValueKind == JsonValueKind.Null)
 107                    {
 108                        continue;
 109                    }
 0110                    List<ApplicationGatewayFirewallDisabledRuleGroup> array = new List<ApplicationGatewayFirewallDisable
 0111                    foreach (var item in property.Value.EnumerateArray())
 112                    {
 0113                        if (item.ValueKind == JsonValueKind.Null)
 114                        {
 0115                            array.Add(null);
 116                        }
 117                        else
 118                        {
 0119                            array.Add(ApplicationGatewayFirewallDisabledRuleGroup.DeserializeApplicationGatewayFirewallD
 120                        }
 121                    }
 0122                    disabledRuleGroups = array;
 0123                    continue;
 124                }
 0125                if (property.NameEquals("requestBodyCheck"))
 126                {
 0127                    if (property.Value.ValueKind == JsonValueKind.Null)
 128                    {
 129                        continue;
 130                    }
 0131                    requestBodyCheck = property.Value.GetBoolean();
 0132                    continue;
 133                }
 0134                if (property.NameEquals("maxRequestBodySize"))
 135                {
 0136                    if (property.Value.ValueKind == JsonValueKind.Null)
 137                    {
 138                        continue;
 139                    }
 0140                    maxRequestBodySize = property.Value.GetInt32();
 0141                    continue;
 142                }
 0143                if (property.NameEquals("maxRequestBodySizeInKb"))
 144                {
 0145                    if (property.Value.ValueKind == JsonValueKind.Null)
 146                    {
 147                        continue;
 148                    }
 0149                    maxRequestBodySizeInKb = property.Value.GetInt32();
 0150                    continue;
 151                }
 0152                if (property.NameEquals("fileUploadLimitInMb"))
 153                {
 0154                    if (property.Value.ValueKind == JsonValueKind.Null)
 155                    {
 156                        continue;
 157                    }
 0158                    fileUploadLimitInMb = property.Value.GetInt32();
 0159                    continue;
 160                }
 0161                if (property.NameEquals("exclusions"))
 162                {
 0163                    if (property.Value.ValueKind == JsonValueKind.Null)
 164                    {
 165                        continue;
 166                    }
 0167                    List<ApplicationGatewayFirewallExclusion> array = new List<ApplicationGatewayFirewallExclusion>();
 0168                    foreach (var item in property.Value.EnumerateArray())
 169                    {
 0170                        if (item.ValueKind == JsonValueKind.Null)
 171                        {
 0172                            array.Add(null);
 173                        }
 174                        else
 175                        {
 0176                            array.Add(ApplicationGatewayFirewallExclusion.DeserializeApplicationGatewayFirewallExclusion
 177                        }
 178                    }
 0179                    exclusions = array;
 180                    continue;
 181                }
 182            }
 0183            return new ApplicationGatewayWebApplicationFirewallConfiguration(enabled, firewallMode, ruleSetType, ruleSet
 184        }
 185    }
 186}