< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_State()-0%100%
get_Mode()-0%100%
get_RequestBodyCheck()-0%100%
get_MaxRequestBodySizeInKb()-0%100%
get_FileUploadLimitInMb()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializePolicySettings(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PolicySettings.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
 8namespace Azure.ResourceManager.Network.Models
 9{
 10    /// <summary> Defines contents of a web application firewall global configuration. </summary>
 11    public partial class PolicySettings
 12    {
 13        /// <summary> Initializes a new instance of PolicySettings. </summary>
 014        public PolicySettings()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of PolicySettings. </summary>
 19        /// <param name="state"> The state of the policy. </param>
 20        /// <param name="mode"> The mode of the policy. </param>
 21        /// <param name="requestBodyCheck"> Whether to allow WAF to check request Body. </param>
 22        /// <param name="maxRequestBodySizeInKb"> Maximum request body size in Kb for WAF. </param>
 23        /// <param name="fileUploadLimitInMb"> Maximum file upload size in Mb for WAF. </param>
 024        internal PolicySettings(WebApplicationFirewallEnabledState? state, WebApplicationFirewallMode? mode, bool? reque
 25        {
 026            State = state;
 027            Mode = mode;
 028            RequestBodyCheck = requestBodyCheck;
 029            MaxRequestBodySizeInKb = maxRequestBodySizeInKb;
 030            FileUploadLimitInMb = fileUploadLimitInMb;
 031        }
 32
 33        /// <summary> The state of the policy. </summary>
 034        public WebApplicationFirewallEnabledState? State { get; set; }
 35        /// <summary> The mode of the policy. </summary>
 036        public WebApplicationFirewallMode? Mode { get; set; }
 37        /// <summary> Whether to allow WAF to check request Body. </summary>
 038        public bool? RequestBodyCheck { get; set; }
 39        /// <summary> Maximum request body size in Kb for WAF. </summary>
 040        public int? MaxRequestBodySizeInKb { get; set; }
 41        /// <summary> Maximum file upload size in Mb for WAF. </summary>
 042        public int? FileUploadLimitInMb { get; set; }
 43    }
 44}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PolicySettings.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.ResourceManager.Network.Models
 12{
 13    public partial class PolicySettings : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (State != null)
 19            {
 020                writer.WritePropertyName("state");
 021                writer.WriteStringValue(State.Value.ToString());
 22            }
 023            if (Mode != null)
 24            {
 025                writer.WritePropertyName("mode");
 026                writer.WriteStringValue(Mode.Value.ToString());
 27            }
 028            if (RequestBodyCheck != null)
 29            {
 030                writer.WritePropertyName("requestBodyCheck");
 031                writer.WriteBooleanValue(RequestBodyCheck.Value);
 32            }
 033            if (MaxRequestBodySizeInKb != null)
 34            {
 035                writer.WritePropertyName("maxRequestBodySizeInKb");
 036                writer.WriteNumberValue(MaxRequestBodySizeInKb.Value);
 37            }
 038            if (FileUploadLimitInMb != null)
 39            {
 040                writer.WritePropertyName("fileUploadLimitInMb");
 041                writer.WriteNumberValue(FileUploadLimitInMb.Value);
 42            }
 043            writer.WriteEndObject();
 044        }
 45
 46        internal static PolicySettings DeserializePolicySettings(JsonElement element)
 47        {
 048            WebApplicationFirewallEnabledState? state = default;
 049            WebApplicationFirewallMode? mode = default;
 050            bool? requestBodyCheck = default;
 051            int? maxRequestBodySizeInKb = default;
 052            int? fileUploadLimitInMb = default;
 053            foreach (var property in element.EnumerateObject())
 54            {
 055                if (property.NameEquals("state"))
 56                {
 057                    if (property.Value.ValueKind == JsonValueKind.Null)
 58                    {
 59                        continue;
 60                    }
 061                    state = new WebApplicationFirewallEnabledState(property.Value.GetString());
 062                    continue;
 63                }
 064                if (property.NameEquals("mode"))
 65                {
 066                    if (property.Value.ValueKind == JsonValueKind.Null)
 67                    {
 68                        continue;
 69                    }
 070                    mode = new WebApplicationFirewallMode(property.Value.GetString());
 071                    continue;
 72                }
 073                if (property.NameEquals("requestBodyCheck"))
 74                {
 075                    if (property.Value.ValueKind == JsonValueKind.Null)
 76                    {
 77                        continue;
 78                    }
 079                    requestBodyCheck = property.Value.GetBoolean();
 080                    continue;
 81                }
 082                if (property.NameEquals("maxRequestBodySizeInKb"))
 83                {
 084                    if (property.Value.ValueKind == JsonValueKind.Null)
 85                    {
 86                        continue;
 87                    }
 088                    maxRequestBodySizeInKb = property.Value.GetInt32();
 089                    continue;
 90                }
 091                if (property.NameEquals("fileUploadLimitInMb"))
 92                {
 093                    if (property.Value.ValueKind == JsonValueKind.Null)
 94                    {
 95                        continue;
 96                    }
 097                    fileUploadLimitInMb = property.Value.GetInt32();
 98                    continue;
 99                }
 100            }
 0101            return new PolicySettings(state, mode, requestBodyCheck, maxRequestBodySizeInKb, fileUploadLimitInMb);
 102        }
 103    }
 104}