< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Etag()-0%100%
get_PolicySettings()-0%100%
get_CustomRules()-0%100%
get_ApplicationGateways()-0%100%
get_ProvisioningState()-0%100%
get_ResourceState()-0%100%
get_ManagedRules()-0%100%
get_HttpListeners()-0%100%
get_PathBasedRules()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeWebApplicationFirewallPolicy(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\WebApplicationFirewallPolicy.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> Defines web application firewall policy. </summary>
 13    public partial class WebApplicationFirewallPolicy : Resource
 14    {
 15        /// <summary> Initializes a new instance of WebApplicationFirewallPolicy. </summary>
 016        public WebApplicationFirewallPolicy()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of WebApplicationFirewallPolicy. </summary>
 21        /// <param name="id"> Resource ID. </param>
 22        /// <param name="name"> Resource name. </param>
 23        /// <param name="type"> Resource type. </param>
 24        /// <param name="location"> Resource location. </param>
 25        /// <param name="tags"> Resource tags. </param>
 26        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 27        /// <param name="policySettings"> The PolicySettings for policy. </param>
 28        /// <param name="customRules"> The custom rules inside the policy. </param>
 29        /// <param name="applicationGateways"> A collection of references to application gateways. </param>
 30        /// <param name="provisioningState"> The provisioning state of the web application firewall policy resource. </p
 31        /// <param name="resourceState"> Resource status of the policy. </param>
 32        /// <param name="managedRules"> Describes the managedRules structure. </param>
 33        /// <param name="httpListeners"> A collection of references to application gateway http listeners. </param>
 34        /// <param name="pathBasedRules"> A collection of references to application gateway path rules. </param>
 035        internal WebApplicationFirewallPolicy(string id, string name, string type, string location, IDictionary<string, 
 36        {
 037            Etag = etag;
 038            PolicySettings = policySettings;
 039            CustomRules = customRules;
 040            ApplicationGateways = applicationGateways;
 041            ProvisioningState = provisioningState;
 042            ResourceState = resourceState;
 043            ManagedRules = managedRules;
 044            HttpListeners = httpListeners;
 045            PathBasedRules = pathBasedRules;
 046        }
 47
 48        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 049        public string Etag { get; }
 50        /// <summary> The PolicySettings for policy. </summary>
 051        public PolicySettings PolicySettings { get; set; }
 52        /// <summary> The custom rules inside the policy. </summary>
 053        public IList<WebApplicationFirewallCustomRule> CustomRules { get; set; }
 54        /// <summary> A collection of references to application gateways. </summary>
 055        public IList<ApplicationGateway> ApplicationGateways { get; }
 56        /// <summary> The provisioning state of the web application firewall policy resource. </summary>
 057        public ProvisioningState? ProvisioningState { get; }
 58        /// <summary> Resource status of the policy. </summary>
 059        public WebApplicationFirewallPolicyResourceState? ResourceState { get; }
 60        /// <summary> Describes the managedRules structure. </summary>
 061        public ManagedRulesDefinition ManagedRules { get; set; }
 62        /// <summary> A collection of references to application gateway http listeners. </summary>
 063        public IList<SubResource> HttpListeners { get; }
 64        /// <summary> A collection of references to application gateway path rules. </summary>
 065        public IList<SubResource> PathBasedRules { get; }
 66    }
 67}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\WebApplicationFirewallPolicy.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 WebApplicationFirewallPolicy : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Etag != null)
 20            {
 021                writer.WritePropertyName("etag");
 022                writer.WriteStringValue(Etag);
 23            }
 024            if (Id != null)
 25            {
 026                writer.WritePropertyName("id");
 027                writer.WriteStringValue(Id);
 28            }
 029            if (Name != null)
 30            {
 031                writer.WritePropertyName("name");
 032                writer.WriteStringValue(Name);
 33            }
 034            if (Type != null)
 35            {
 036                writer.WritePropertyName("type");
 037                writer.WriteStringValue(Type);
 38            }
 039            if (Location != null)
 40            {
 041                writer.WritePropertyName("location");
 042                writer.WriteStringValue(Location);
 43            }
 044            if (Tags != null)
 45            {
 046                writer.WritePropertyName("tags");
 047                writer.WriteStartObject();
 048                foreach (var item in Tags)
 49                {
 050                    writer.WritePropertyName(item.Key);
 051                    writer.WriteStringValue(item.Value);
 52                }
 053                writer.WriteEndObject();
 54            }
 055            writer.WritePropertyName("properties");
 056            writer.WriteStartObject();
 057            if (PolicySettings != null)
 58            {
 059                writer.WritePropertyName("policySettings");
 060                writer.WriteObjectValue(PolicySettings);
 61            }
 062            if (CustomRules != null)
 63            {
 064                writer.WritePropertyName("customRules");
 065                writer.WriteStartArray();
 066                foreach (var item in CustomRules)
 67                {
 068                    writer.WriteObjectValue(item);
 69                }
 070                writer.WriteEndArray();
 71            }
 072            if (ApplicationGateways != null)
 73            {
 074                writer.WritePropertyName("applicationGateways");
 075                writer.WriteStartArray();
 076                foreach (var item in ApplicationGateways)
 77                {
 078                    writer.WriteObjectValue(item);
 79                }
 080                writer.WriteEndArray();
 81            }
 082            if (ProvisioningState != null)
 83            {
 084                writer.WritePropertyName("provisioningState");
 085                writer.WriteStringValue(ProvisioningState.Value.ToString());
 86            }
 087            if (ResourceState != null)
 88            {
 089                writer.WritePropertyName("resourceState");
 090                writer.WriteStringValue(ResourceState.Value.ToString());
 91            }
 092            if (ManagedRules != null)
 93            {
 094                writer.WritePropertyName("managedRules");
 095                writer.WriteObjectValue(ManagedRules);
 96            }
 097            if (HttpListeners != null)
 98            {
 099                writer.WritePropertyName("httpListeners");
 0100                writer.WriteStartArray();
 0101                foreach (var item in HttpListeners)
 102                {
 0103                    writer.WriteObjectValue(item);
 104                }
 0105                writer.WriteEndArray();
 106            }
 0107            if (PathBasedRules != null)
 108            {
 0109                writer.WritePropertyName("pathBasedRules");
 0110                writer.WriteStartArray();
 0111                foreach (var item in PathBasedRules)
 112                {
 0113                    writer.WriteObjectValue(item);
 114                }
 0115                writer.WriteEndArray();
 116            }
 0117            writer.WriteEndObject();
 0118            writer.WriteEndObject();
 0119        }
 120
 121        internal static WebApplicationFirewallPolicy DeserializeWebApplicationFirewallPolicy(JsonElement element)
 122        {
 0123            string etag = default;
 0124            string id = default;
 0125            string name = default;
 0126            string type = default;
 0127            string location = default;
 0128            IDictionary<string, string> tags = default;
 0129            PolicySettings policySettings = default;
 0130            IList<WebApplicationFirewallCustomRule> customRules = default;
 0131            IList<ApplicationGateway> applicationGateways = default;
 0132            ProvisioningState? provisioningState = default;
 0133            WebApplicationFirewallPolicyResourceState? resourceState = default;
 0134            ManagedRulesDefinition managedRules = default;
 0135            IList<SubResource> httpListeners = default;
 0136            IList<SubResource> pathBasedRules = default;
 0137            foreach (var property in element.EnumerateObject())
 138            {
 0139                if (property.NameEquals("etag"))
 140                {
 0141                    if (property.Value.ValueKind == JsonValueKind.Null)
 142                    {
 143                        continue;
 144                    }
 0145                    etag = property.Value.GetString();
 0146                    continue;
 147                }
 0148                if (property.NameEquals("id"))
 149                {
 0150                    if (property.Value.ValueKind == JsonValueKind.Null)
 151                    {
 152                        continue;
 153                    }
 0154                    id = property.Value.GetString();
 0155                    continue;
 156                }
 0157                if (property.NameEquals("name"))
 158                {
 0159                    if (property.Value.ValueKind == JsonValueKind.Null)
 160                    {
 161                        continue;
 162                    }
 0163                    name = property.Value.GetString();
 0164                    continue;
 165                }
 0166                if (property.NameEquals("type"))
 167                {
 0168                    if (property.Value.ValueKind == JsonValueKind.Null)
 169                    {
 170                        continue;
 171                    }
 0172                    type = property.Value.GetString();
 0173                    continue;
 174                }
 0175                if (property.NameEquals("location"))
 176                {
 0177                    if (property.Value.ValueKind == JsonValueKind.Null)
 178                    {
 179                        continue;
 180                    }
 0181                    location = property.Value.GetString();
 0182                    continue;
 183                }
 0184                if (property.NameEquals("tags"))
 185                {
 0186                    if (property.Value.ValueKind == JsonValueKind.Null)
 187                    {
 188                        continue;
 189                    }
 0190                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0191                    foreach (var property0 in property.Value.EnumerateObject())
 192                    {
 0193                        if (property0.Value.ValueKind == JsonValueKind.Null)
 194                        {
 0195                            dictionary.Add(property0.Name, null);
 196                        }
 197                        else
 198                        {
 0199                            dictionary.Add(property0.Name, property0.Value.GetString());
 200                        }
 201                    }
 0202                    tags = dictionary;
 0203                    continue;
 204                }
 0205                if (property.NameEquals("properties"))
 206                {
 0207                    foreach (var property0 in property.Value.EnumerateObject())
 208                    {
 0209                        if (property0.NameEquals("policySettings"))
 210                        {
 0211                            if (property0.Value.ValueKind == JsonValueKind.Null)
 212                            {
 213                                continue;
 214                            }
 0215                            policySettings = PolicySettings.DeserializePolicySettings(property0.Value);
 0216                            continue;
 217                        }
 0218                        if (property0.NameEquals("customRules"))
 219                        {
 0220                            if (property0.Value.ValueKind == JsonValueKind.Null)
 221                            {
 222                                continue;
 223                            }
 0224                            List<WebApplicationFirewallCustomRule> array = new List<WebApplicationFirewallCustomRule>();
 0225                            foreach (var item in property0.Value.EnumerateArray())
 226                            {
 0227                                if (item.ValueKind == JsonValueKind.Null)
 228                                {
 0229                                    array.Add(null);
 230                                }
 231                                else
 232                                {
 0233                                    array.Add(WebApplicationFirewallCustomRule.DeserializeWebApplicationFirewallCustomRu
 234                                }
 235                            }
 0236                            customRules = array;
 0237                            continue;
 238                        }
 0239                        if (property0.NameEquals("applicationGateways"))
 240                        {
 0241                            if (property0.Value.ValueKind == JsonValueKind.Null)
 242                            {
 243                                continue;
 244                            }
 0245                            List<ApplicationGateway> array = new List<ApplicationGateway>();
 0246                            foreach (var item in property0.Value.EnumerateArray())
 247                            {
 0248                                if (item.ValueKind == JsonValueKind.Null)
 249                                {
 0250                                    array.Add(null);
 251                                }
 252                                else
 253                                {
 0254                                    array.Add(ApplicationGateway.DeserializeApplicationGateway(item));
 255                                }
 256                            }
 0257                            applicationGateways = array;
 0258                            continue;
 259                        }
 0260                        if (property0.NameEquals("provisioningState"))
 261                        {
 0262                            if (property0.Value.ValueKind == JsonValueKind.Null)
 263                            {
 264                                continue;
 265                            }
 0266                            provisioningState = new ProvisioningState(property0.Value.GetString());
 0267                            continue;
 268                        }
 0269                        if (property0.NameEquals("resourceState"))
 270                        {
 0271                            if (property0.Value.ValueKind == JsonValueKind.Null)
 272                            {
 273                                continue;
 274                            }
 0275                            resourceState = new WebApplicationFirewallPolicyResourceState(property0.Value.GetString());
 0276                            continue;
 277                        }
 0278                        if (property0.NameEquals("managedRules"))
 279                        {
 0280                            if (property0.Value.ValueKind == JsonValueKind.Null)
 281                            {
 282                                continue;
 283                            }
 0284                            managedRules = ManagedRulesDefinition.DeserializeManagedRulesDefinition(property0.Value);
 0285                            continue;
 286                        }
 0287                        if (property0.NameEquals("httpListeners"))
 288                        {
 0289                            if (property0.Value.ValueKind == JsonValueKind.Null)
 290                            {
 291                                continue;
 292                            }
 0293                            List<SubResource> array = new List<SubResource>();
 0294                            foreach (var item in property0.Value.EnumerateArray())
 295                            {
 0296                                if (item.ValueKind == JsonValueKind.Null)
 297                                {
 0298                                    array.Add(null);
 299                                }
 300                                else
 301                                {
 0302                                    array.Add(SubResource.DeserializeSubResource(item));
 303                                }
 304                            }
 0305                            httpListeners = array;
 0306                            continue;
 307                        }
 0308                        if (property0.NameEquals("pathBasedRules"))
 309                        {
 0310                            if (property0.Value.ValueKind == JsonValueKind.Null)
 311                            {
 312                                continue;
 313                            }
 0314                            List<SubResource> array = new List<SubResource>();
 0315                            foreach (var item in property0.Value.EnumerateArray())
 316                            {
 0317                                if (item.ValueKind == JsonValueKind.Null)
 318                                {
 0319                                    array.Add(null);
 320                                }
 321                                else
 322                                {
 0323                                    array.Add(SubResource.DeserializeSubResource(item));
 324                                }
 325                            }
 0326                            pathBasedRules = array;
 327                            continue;
 328                        }
 329                    }
 330                    continue;
 331                }
 332            }
 0333            return new WebApplicationFirewallPolicy(id, name, type, location, tags, etag, policySettings, customRules, a
 334        }
 335    }
 336}