< Summary

Class:Azure.ResourceManager.Storage.Models.NetworkRuleSet
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\NetworkRuleSet.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\NetworkRuleSet.Serialization.cs
Covered lines:56
Uncovered lines:7
Coverable lines:63
Total lines:161
Line coverage:88.8% (56 of 63)
Covered branches:29
Total branches:34
Branch coverage:85.2% (29 of 34)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%100%
get_Bypass()-100%100%
get_VirtualNetworkRules()-100%100%
get_IpRules()-100%100%
get_DefaultAction()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-75%70%
DeserializeNetworkRuleSet(...)-93.33%91.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\NetworkRuleSet.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.Storage.Models
 11{
 12    /// <summary> Network rule set. </summary>
 13    public partial class NetworkRuleSet
 14    {
 15        /// <summary> Initializes a new instance of NetworkRuleSet. </summary>
 16        /// <param name="defaultAction"> Specifies the default action of allow or deny when no other rules match. </para
 1217        public NetworkRuleSet(DefaultAction defaultAction)
 18        {
 1219            DefaultAction = defaultAction;
 1220        }
 21
 22        /// <summary> Initializes a new instance of NetworkRuleSet. </summary>
 23        /// <param name="bypass"> Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible valu
 24        /// <param name="virtualNetworkRules"> Sets the virtual network rules. </param>
 25        /// <param name="ipRules"> Sets the IP ACL rules. </param>
 26        /// <param name="defaultAction"> Specifies the default action of allow or deny when no other rules match. </para
 83627        internal NetworkRuleSet(Bypass? bypass, IList<VirtualNetworkRule> virtualNetworkRules, IList<IPRule> ipRules, De
 28        {
 83629            Bypass = bypass;
 83630            VirtualNetworkRules = virtualNetworkRules;
 83631            IpRules = ipRules;
 83632            DefaultAction = defaultAction;
 83633        }
 34
 35        /// <summary> Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Possible values are any c
 88436        public Bypass? Bypass { get; set; }
 37        /// <summary> Sets the virtual network rules. </summary>
 86038        public IList<VirtualNetworkRule> VirtualNetworkRules { get; set; }
 39        /// <summary> Sets the IP ACL rules. </summary>
 91240        public IList<IPRule> IpRules { get; set; }
 41        /// <summary> Specifies the default action of allow or deny when no other rules match. </summary>
 87642        public DefaultAction DefaultAction { get; set; }
 43    }
 44}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\NetworkRuleSet.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.Storage.Models
 13{
 14    public partial class NetworkRuleSet : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 1618            writer.WriteStartObject();
 1619            if (Bypass != null)
 20            {
 1221                writer.WritePropertyName("bypass");
 1222                writer.WriteStringValue(Bypass.Value.ToString());
 23            }
 1624            if (VirtualNetworkRules != null)
 25            {
 026                writer.WritePropertyName("virtualNetworkRules");
 027                writer.WriteStartArray();
 028                foreach (var item in VirtualNetworkRules)
 29                {
 030                    writer.WriteObjectValue(item);
 31                }
 032                writer.WriteEndArray();
 33            }
 1634            if (IpRules != null)
 35            {
 1236                writer.WritePropertyName("ipRules");
 1237                writer.WriteStartArray();
 5638                foreach (var item in IpRules)
 39                {
 1640                    writer.WriteObjectValue(item);
 41                }
 1242                writer.WriteEndArray();
 43            }
 1644            writer.WritePropertyName("defaultAction");
 1645            writer.WriteStringValue(DefaultAction.ToSerialString());
 1646            writer.WriteEndObject();
 1647        }
 48
 49        internal static NetworkRuleSet DeserializeNetworkRuleSet(JsonElement element)
 50        {
 83651            Bypass? bypass = default;
 83652            IList<VirtualNetworkRule> virtualNetworkRules = default;
 83653            IList<IPRule> ipRules = default;
 83654            DefaultAction defaultAction = default;
 836055            foreach (var property in element.EnumerateObject())
 56            {
 334457                if (property.NameEquals("bypass"))
 58                {
 83659                    if (property.Value.ValueKind == JsonValueKind.Null)
 60                    {
 61                        continue;
 62                    }
 83663                    bypass = new Bypass(property.Value.GetString());
 83664                    continue;
 65                }
 250866                if (property.NameEquals("virtualNetworkRules"))
 67                {
 83668                    if (property.Value.ValueKind == JsonValueKind.Null)
 69                    {
 70                        continue;
 71                    }
 83672                    List<VirtualNetworkRule> array = new List<VirtualNetworkRule>();
 170473                    foreach (var item in property.Value.EnumerateArray())
 74                    {
 1675                        if (item.ValueKind == JsonValueKind.Null)
 76                        {
 077                            array.Add(null);
 78                        }
 79                        else
 80                        {
 1681                            array.Add(VirtualNetworkRule.DeserializeVirtualNetworkRule(item));
 82                        }
 83                    }
 83684                    virtualNetworkRules = array;
 83685                    continue;
 86                }
 167287                if (property.NameEquals("ipRules"))
 88                {
 83689                    if (property.Value.ValueKind == JsonValueKind.Null)
 90                    {
 91                        continue;
 92                    }
 83693                    List<IPRule> array = new List<IPRule>();
 186494                    foreach (var item in property.Value.EnumerateArray())
 95                    {
 9696                        if (item.ValueKind == JsonValueKind.Null)
 97                        {
 098                            array.Add(null);
 99                        }
 100                        else
 101                        {
 96102                            array.Add(IPRule.DeserializeIPRule(item));
 103                        }
 104                    }
 836105                    ipRules = array;
 836106                    continue;
 107                }
 836108                if (property.NameEquals("defaultAction"))
 109                {
 836110                    defaultAction = property.Value.GetString().ToDefaultAction();
 111                    continue;
 112                }
 113            }
 836114            return new NetworkRuleSet(bypass, virtualNetworkRules, ipRules, defaultAction);
 115        }
 116    }
 117}