< Summary

Class:Azure.ResourceManager.EventHubs.Models.NetworkRuleSet
Assembly:Azure.ResourceManager.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\NetworkRuleSet.cs
C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\NetworkRuleSet.Serialization.cs
Covered lines:75
Uncovered lines:8
Coverable lines:83
Total lines:205
Line coverage:90.3% (75 of 83)
Covered branches:49
Total branches:54
Branch coverage:90.7% (49 of 54)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_DefaultAction()-100%100%
get_VirtualNetworkRules()-100%100%
get_IpRules()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-80%81.25%
DeserializeNetworkRuleSet(...)-95.35%94.74%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\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.EventHubs.Models
 11{
 12    /// <summary> Description of topic resource. </summary>
 13    public partial class NetworkRuleSet : Resource
 14    {
 15        /// <summary> Initializes a new instance of NetworkRuleSet. </summary>
 816        public NetworkRuleSet()
 17        {
 818        }
 19
 20        /// <summary> Initializes a new instance of NetworkRuleSet. </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="defaultAction"> Default Action for Network Rule Set. </param>
 25        /// <param name="virtualNetworkRules"> List VirtualNetwork Rules. </param>
 26        /// <param name="ipRules"> List of IpRules. </param>
 1627        internal NetworkRuleSet(string id, string name, string type, DefaultAction? defaultAction, IList<NWRuleSetVirtua
 28        {
 1629            DefaultAction = defaultAction;
 1630            VirtualNetworkRules = virtualNetworkRules;
 1631            IpRules = ipRules;
 1632        }
 33
 34        /// <summary> Default Action for Network Rule Set. </summary>
 4035        public DefaultAction? DefaultAction { get; set; }
 36        /// <summary> List VirtualNetwork Rules. </summary>
 3237        public IList<NWRuleSetVirtualNetworkRules> VirtualNetworkRules { get; set; }
 38        /// <summary> List of IpRules. </summary>
 3239        public IList<NWRuleSetIpRules> IpRules { get; set; }
 40    }
 41}

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\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.EventHubs.Models
 13{
 14    public partial class NetworkRuleSet : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 818            writer.WriteStartObject();
 819            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 824            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 829            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 834            writer.WritePropertyName("properties");
 835            writer.WriteStartObject();
 836            if (DefaultAction != null)
 37            {
 838                writer.WritePropertyName("defaultAction");
 839                writer.WriteStringValue(DefaultAction.Value.ToString());
 40            }
 841            if (VirtualNetworkRules != null)
 42            {
 443                writer.WritePropertyName("virtualNetworkRules");
 444                writer.WriteStartArray();
 3245                foreach (var item in VirtualNetworkRules)
 46                {
 1247                    writer.WriteObjectValue(item);
 48                }
 449                writer.WriteEndArray();
 50            }
 851            if (IpRules != null)
 52            {
 453                writer.WritePropertyName("ipRules");
 454                writer.WriteStartArray();
 4855                foreach (var item in IpRules)
 56                {
 2057                    writer.WriteObjectValue(item);
 58                }
 459                writer.WriteEndArray();
 60            }
 861            writer.WriteEndObject();
 862            writer.WriteEndObject();
 863        }
 64
 65        internal static NetworkRuleSet DeserializeNetworkRuleSet(JsonElement element)
 66        {
 1667            string id = default;
 1668            string name = default;
 1669            string type = default;
 1670            DefaultAction? defaultAction = default;
 1671            IList<NWRuleSetVirtualNetworkRules> virtualNetworkRules = default;
 1672            IList<NWRuleSetIpRules> ipRules = default;
 19273            foreach (var property in element.EnumerateObject())
 74            {
 8075                if (property.NameEquals("id"))
 76                {
 1677                    if (property.Value.ValueKind == JsonValueKind.Null)
 78                    {
 79                        continue;
 80                    }
 1681                    id = property.Value.GetString();
 1682                    continue;
 83                }
 6484                if (property.NameEquals("name"))
 85                {
 1686                    if (property.Value.ValueKind == JsonValueKind.Null)
 87                    {
 88                        continue;
 89                    }
 1690                    name = property.Value.GetString();
 1691                    continue;
 92                }
 4893                if (property.NameEquals("type"))
 94                {
 1695                    if (property.Value.ValueKind == JsonValueKind.Null)
 96                    {
 97                        continue;
 98                    }
 1699                    type = property.Value.GetString();
 16100                    continue;
 101                }
 32102                if (property.NameEquals("properties"))
 103                {
 128104                    foreach (var property0 in property.Value.EnumerateObject())
 105                    {
 48106                        if (property0.NameEquals("defaultAction"))
 107                        {
 16108                            if (property0.Value.ValueKind == JsonValueKind.Null)
 109                            {
 110                                continue;
 111                            }
 16112                            defaultAction = new DefaultAction(property0.Value.GetString());
 16113                            continue;
 114                        }
 32115                        if (property0.NameEquals("virtualNetworkRules"))
 116                        {
 16117                            if (property0.Value.ValueKind == JsonValueKind.Null)
 118                            {
 119                                continue;
 120                            }
 16121                            List<NWRuleSetVirtualNetworkRules> array = new List<NWRuleSetVirtualNetworkRules>();
 80122                            foreach (var item in property0.Value.EnumerateArray())
 123                            {
 24124                                if (item.ValueKind == JsonValueKind.Null)
 125                                {
 0126                                    array.Add(null);
 127                                }
 128                                else
 129                                {
 24130                                    array.Add(NWRuleSetVirtualNetworkRules.DeserializeNWRuleSetVirtualNetworkRules(item)
 131                                }
 132                            }
 16133                            virtualNetworkRules = array;
 16134                            continue;
 135                        }
 16136                        if (property0.NameEquals("ipRules"))
 137                        {
 16138                            if (property0.Value.ValueKind == JsonValueKind.Null)
 139                            {
 140                                continue;
 141                            }
 16142                            List<NWRuleSetIpRules> array = new List<NWRuleSetIpRules>();
 112143                            foreach (var item in property0.Value.EnumerateArray())
 144                            {
 40145                                if (item.ValueKind == JsonValueKind.Null)
 146                                {
 0147                                    array.Add(null);
 148                                }
 149                                else
 150                                {
 40151                                    array.Add(NWRuleSetIpRules.DeserializeNWRuleSetIpRules(item));
 152                                }
 153                            }
 16154                            ipRules = array;
 155                            continue;
 156                        }
 157                    }
 158                    continue;
 159                }
 160            }
 16161            return new NetworkRuleSet(id, name, type, defaultAction, virtualNetworkRules, ipRules);
 162        }
 163    }
 164}