< Summary

Class:Azure.ResourceManager.KeyVault.Models.NetworkRuleSet
Assembly:Azure.ResourceManager.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\NetworkRuleSet.cs
C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\NetworkRuleSet.Serialization.cs
Covered lines:54
Uncovered lines:4
Coverable lines:58
Total lines:139
Line coverage:93.1% (54 of 58)
Covered branches:24
Total branches:26
Branch coverage:92.3% (24 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Bypass()-100%100%
get_DefaultAction()-100%100%
get_IpRules()-100%100%
get_VirtualNetworkRules()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-90.48%91.67%
DeserializeNetworkRuleSet(...)-91.3%92.86%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\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;
 9using Azure.Core;
 10
 11namespace Azure.ResourceManager.KeyVault.Models
 12{
 13    /// <summary> A set of rules governing the network accessibility of a vault. </summary>
 14    public partial class NetworkRuleSet
 15    {
 16        /// <summary> Initializes a new instance of NetworkRuleSet. </summary>
 2417        public NetworkRuleSet()
 18        {
 2419            IpRules = new ChangeTrackingList<IPRule>();
 2420            VirtualNetworkRules = new ChangeTrackingList<VirtualNetworkRule>();
 2421        }
 22
 23        /// <summary> Initializes a new instance of NetworkRuleSet. </summary>
 24        /// <param name="bypass"> Tells what traffic can bypass network rules. This can be &apos;AzureServices&apos; or 
 25        /// <param name="defaultAction"> The default action when no rule from ipRules and from virtualNetworkRules match
 26        /// <param name="ipRules"> The list of IP address rules. </param>
 27        /// <param name="virtualNetworkRules"> The list of virtual network rules. </param>
 7628        internal NetworkRuleSet(NetworkRuleBypassOptions? bypass, NetworkRuleAction? defaultAction, IList<IPRule> ipRule
 29        {
 7630            Bypass = bypass;
 7631            DefaultAction = defaultAction;
 7632            IpRules = ipRules;
 7633            VirtualNetworkRules = virtualNetworkRules;
 7634        }
 35
 36        /// <summary> Tells what traffic can bypass network rules. This can be &apos;AzureServices&apos; or &apos;None&a
 33237        public NetworkRuleBypassOptions? Bypass { get; set; }
 38        /// <summary> The default action when no rule from ipRules and from virtualNetworkRules match. This is only used
 33239        public NetworkRuleAction? DefaultAction { get; set; }
 40        /// <summary> The list of IP address rules. </summary>
 32841        public IList<IPRule> IpRules { get; }
 42        /// <summary> The list of virtual network rules. </summary>
 11243        public IList<VirtualNetworkRule> VirtualNetworkRules { get; }
 44    }
 45}

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\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.KeyVault.Models
 13{
 14    public partial class NetworkRuleSet : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 10418            writer.WriteStartObject();
 10419            if (Optional.IsDefined(Bypass))
 20            {
 10421                writer.WritePropertyName("bypass");
 10422                writer.WriteStringValue(Bypass.Value.ToString());
 23            }
 10424            if (Optional.IsDefined(DefaultAction))
 25            {
 10426                writer.WritePropertyName("defaultAction");
 10427                writer.WriteStringValue(DefaultAction.Value.ToString());
 28            }
 10429            if (Optional.IsCollectionDefined(IpRules))
 30            {
 10431                writer.WritePropertyName("ipRules");
 10432                writer.WriteStartArray();
 62433                foreach (var item in IpRules)
 34                {
 20835                    writer.WriteObjectValue(item);
 36                }
 10437                writer.WriteEndArray();
 38            }
 10439            if (Optional.IsCollectionDefined(VirtualNetworkRules))
 40            {
 841                writer.WritePropertyName("virtualNetworkRules");
 842                writer.WriteStartArray();
 043                foreach (var item in VirtualNetworkRules)
 44                {
 045                    writer.WriteObjectValue(item);
 46                }
 847                writer.WriteEndArray();
 48            }
 10449            writer.WriteEndObject();
 10450        }
 51
 52        internal static NetworkRuleSet DeserializeNetworkRuleSet(JsonElement element)
 53        {
 7654            Optional<NetworkRuleBypassOptions> bypass = default;
 7655            Optional<NetworkRuleAction> defaultAction = default;
 7656            Optional<IList<IPRule>> ipRules = default;
 7657            Optional<IList<VirtualNetworkRule>> virtualNetworkRules = default;
 76058            foreach (var property in element.EnumerateObject())
 59            {
 30460                if (property.NameEquals("bypass"))
 61                {
 7662                    bypass = new NetworkRuleBypassOptions(property.Value.GetString());
 7663                    continue;
 64                }
 22865                if (property.NameEquals("defaultAction"))
 66                {
 7667                    defaultAction = new NetworkRuleAction(property.Value.GetString());
 7668                    continue;
 69                }
 15270                if (property.NameEquals("ipRules"))
 71                {
 7672                    List<IPRule> array = new List<IPRule>();
 45673                    foreach (var item in property.Value.EnumerateArray())
 74                    {
 15275                        array.Add(IPRule.DeserializeIPRule(item));
 76                    }
 7677                    ipRules = array;
 7678                    continue;
 79                }
 7680                if (property.NameEquals("virtualNetworkRules"))
 81                {
 7682                    List<VirtualNetworkRule> array = new List<VirtualNetworkRule>();
 083                    foreach (var item in property.Value.EnumerateArray())
 84                    {
 085                        array.Add(VirtualNetworkRule.DeserializeVirtualNetworkRule(item));
 86                    }
 7687                    virtualNetworkRules = array;
 88                    continue;
 89                }
 90            }
 7691            return new NetworkRuleSet(Optional.ToNullable(bypass), Optional.ToNullable(defaultAction), Optional.ToList(i
 92        }
 93    }
 94}