< Summary

Class:Azure.ResourceManager.Network.Models.NetworkSecurityGroup
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkSecurityGroup.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkSecurityGroup.Serialization.cs
Covered lines:148
Uncovered lines:34
Coverable lines:182
Total lines:401
Line coverage:81.3% (148 of 182)
Covered branches:97
Total branches:120
Branch coverage:80.8% (97 of 120)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Etag()-100%100%
get_SecurityRules()-100%100%
get_DefaultSecurityRules()-100%100%
get_NetworkInterfaces()-100%100%
get_Subnets()-100%100%
get_FlowLogs()-100%100%
get_ResourceGuid()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-67.19%68.42%
DeserializeNetworkSecurityGroup(...)-86.73%86.59%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkSecurityGroup.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> NetworkSecurityGroup resource. </summary>
 13    public partial class NetworkSecurityGroup : Resource
 14    {
 15        /// <summary> Initializes a new instance of NetworkSecurityGroup. </summary>
 2016        public NetworkSecurityGroup()
 17        {
 2018        }
 19
 20        /// <summary> Initializes a new instance of NetworkSecurityGroup. </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="securityRules"> A collection of security rules of the network security group. </param>
 28        /// <param name="defaultSecurityRules"> The default security rules of network security group. </param>
 29        /// <param name="networkInterfaces"> A collection of references to network interfaces. </param>
 30        /// <param name="subnets"> A collection of references to subnets. </param>
 31        /// <param name="flowLogs"> A collection of references to flow log resources. </param>
 32        /// <param name="resourceGuid"> The resource GUID property of the network security group resource. </param>
 33        /// <param name="provisioningState"> The provisioning state of the network security group resource. </param>
 27234        internal NetworkSecurityGroup(string id, string name, string type, string location, IDictionary<string, string> 
 35        {
 27236            Etag = etag;
 27237            SecurityRules = securityRules;
 27238            DefaultSecurityRules = defaultSecurityRules;
 27239            NetworkInterfaces = networkInterfaces;
 27240            Subnets = subnets;
 27241            FlowLogs = flowLogs;
 27242            ResourceGuid = resourceGuid;
 27243            ProvisioningState = provisioningState;
 27244        }
 45
 46        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 8047        public string Etag { get; }
 48        /// <summary> A collection of security rules of the network security group. </summary>
 48049        public IList<SecurityRule> SecurityRules { get; set; }
 50        /// <summary> The default security rules of network security group. </summary>
 21651        public IList<SecurityRule> DefaultSecurityRules { get; }
 52        /// <summary> A collection of references to network interfaces. </summary>
 6053        public IList<NetworkInterface> NetworkInterfaces { get; }
 54        /// <summary> A collection of references to subnets. </summary>
 5655        public IList<Subnet> Subnets { get; }
 56        /// <summary> A collection of references to flow log resources. </summary>
 5657        public IList<FlowLog> FlowLogs { get; }
 58        /// <summary> The resource GUID property of the network security group resource. </summary>
 6859        public string ResourceGuid { get; }
 60        /// <summary> The provisioning state of the network security group resource. </summary>
 8461        public ProvisioningState? ProvisioningState { get; }
 62    }
 63}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkSecurityGroup.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 NetworkSecurityGroup : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 5618            writer.WriteStartObject();
 5619            if (Etag != null)
 20            {
 821                writer.WritePropertyName("etag");
 822                writer.WriteStringValue(Etag);
 23            }
 5624            if (Id != null)
 25            {
 826                writer.WritePropertyName("id");
 827                writer.WriteStringValue(Id);
 28            }
 5629            if (Name != null)
 30            {
 831                writer.WritePropertyName("name");
 832                writer.WriteStringValue(Name);
 33            }
 5634            if (Type != null)
 35            {
 836                writer.WritePropertyName("type");
 837                writer.WriteStringValue(Type);
 38            }
 5639            if (Location != null)
 40            {
 5641                writer.WritePropertyName("location");
 5642                writer.WriteStringValue(Location);
 43            }
 5644            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            }
 5655            writer.WritePropertyName("properties");
 5656            writer.WriteStartObject();
 5657            if (SecurityRules != null)
 58            {
 4059                writer.WritePropertyName("securityRules");
 4060                writer.WriteStartArray();
 17661                foreach (var item in SecurityRules)
 62                {
 4863                    writer.WriteObjectValue(item);
 64                }
 4065                writer.WriteEndArray();
 66            }
 5667            if (DefaultSecurityRules != null)
 68            {
 869                writer.WritePropertyName("defaultSecurityRules");
 870                writer.WriteStartArray();
 11271                foreach (var item in DefaultSecurityRules)
 72                {
 4873                    writer.WriteObjectValue(item);
 74                }
 875                writer.WriteEndArray();
 76            }
 5677            if (NetworkInterfaces != null)
 78            {
 079                writer.WritePropertyName("networkInterfaces");
 080                writer.WriteStartArray();
 081                foreach (var item in NetworkInterfaces)
 82                {
 083                    writer.WriteObjectValue(item);
 84                }
 085                writer.WriteEndArray();
 86            }
 5687            if (Subnets != null)
 88            {
 089                writer.WritePropertyName("subnets");
 090                writer.WriteStartArray();
 091                foreach (var item in Subnets)
 92                {
 093                    writer.WriteObjectValue(item);
 94                }
 095                writer.WriteEndArray();
 96            }
 5697            if (FlowLogs != null)
 98            {
 099                writer.WritePropertyName("flowLogs");
 0100                writer.WriteStartArray();
 0101                foreach (var item in FlowLogs)
 102                {
 0103                    writer.WriteObjectValue(item);
 104                }
 0105                writer.WriteEndArray();
 106            }
 56107            if (ResourceGuid != null)
 108            {
 8109                writer.WritePropertyName("resourceGuid");
 8110                writer.WriteStringValue(ResourceGuid);
 111            }
 56112            if (ProvisioningState != null)
 113            {
 8114                writer.WritePropertyName("provisioningState");
 8115                writer.WriteStringValue(ProvisioningState.Value.ToString());
 116            }
 56117            writer.WriteEndObject();
 56118            writer.WriteEndObject();
 56119        }
 120
 121        internal static NetworkSecurityGroup DeserializeNetworkSecurityGroup(JsonElement element)
 122        {
 272123            string etag = default;
 272124            string id = default;
 272125            string name = default;
 272126            string type = default;
 272127            string location = default;
 272128            IDictionary<string, string> tags = default;
 272129            IList<SecurityRule> securityRules = default;
 272130            IList<SecurityRule> defaultSecurityRules = default;
 272131            IList<NetworkInterface> networkInterfaces = default;
 272132            IList<Subnet> subnets = default;
 272133            IList<FlowLog> flowLogs = default;
 272134            string resourceGuid = default;
 272135            ProvisioningState? provisioningState = default;
 3304136            foreach (var property in element.EnumerateObject())
 137            {
 1380138                if (property.NameEquals("etag"))
 139                {
 220140                    if (property.Value.ValueKind == JsonValueKind.Null)
 141                    {
 142                        continue;
 143                    }
 220144                    etag = property.Value.GetString();
 220145                    continue;
 146                }
 1160147                if (property.NameEquals("id"))
 148                {
 272149                    if (property.Value.ValueKind == JsonValueKind.Null)
 150                    {
 151                        continue;
 152                    }
 272153                    id = property.Value.GetString();
 272154                    continue;
 155                }
 888156                if (property.NameEquals("name"))
 157                {
 220158                    if (property.Value.ValueKind == JsonValueKind.Null)
 159                    {
 160                        continue;
 161                    }
 220162                    name = property.Value.GetString();
 220163                    continue;
 164                }
 668165                if (property.NameEquals("type"))
 166                {
 220167                    if (property.Value.ValueKind == JsonValueKind.Null)
 168                    {
 169                        continue;
 170                    }
 220171                    type = property.Value.GetString();
 220172                    continue;
 173                }
 448174                if (property.NameEquals("location"))
 175                {
 220176                    if (property.Value.ValueKind == JsonValueKind.Null)
 177                    {
 178                        continue;
 179                    }
 220180                    location = property.Value.GetString();
 220181                    continue;
 182                }
 228183                if (property.NameEquals("tags"))
 184                {
 8185                    if (property.Value.ValueKind == JsonValueKind.Null)
 186                    {
 187                        continue;
 188                    }
 8189                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 64190                    foreach (var property0 in property.Value.EnumerateObject())
 191                    {
 24192                        if (property0.Value.ValueKind == JsonValueKind.Null)
 193                        {
 0194                            dictionary.Add(property0.Name, null);
 195                        }
 196                        else
 197                        {
 24198                            dictionary.Add(property0.Name, property0.Value.GetString());
 199                        }
 200                    }
 8201                    tags = dictionary;
 8202                    continue;
 203                }
 220204                if (property.NameEquals("properties"))
 205                {
 2256206                    foreach (var property0 in property.Value.EnumerateObject())
 207                    {
 908208                        if (property0.NameEquals("securityRules"))
 209                        {
 220210                            if (property0.Value.ValueKind == JsonValueKind.Null)
 211                            {
 212                                continue;
 213                            }
 220214                            List<SecurityRule> array = new List<SecurityRule>();
 3272215                            foreach (var item in property0.Value.EnumerateArray())
 216                            {
 1416217                                if (item.ValueKind == JsonValueKind.Null)
 218                                {
 0219                                    array.Add(null);
 220                                }
 221                                else
 222                                {
 1416223                                    array.Add(SecurityRule.DeserializeSecurityRule(item));
 224                                }
 225                            }
 220226                            securityRules = array;
 220227                            continue;
 228                        }
 688229                        if (property0.NameEquals("defaultSecurityRules"))
 230                        {
 220231                            if (property0.Value.ValueKind == JsonValueKind.Null)
 232                            {
 233                                continue;
 234                            }
 220235                            List<SecurityRule> array = new List<SecurityRule>();
 3080236                            foreach (var item in property0.Value.EnumerateArray())
 237                            {
 1320238                                if (item.ValueKind == JsonValueKind.Null)
 239                                {
 0240                                    array.Add(null);
 241                                }
 242                                else
 243                                {
 1320244                                    array.Add(SecurityRule.DeserializeSecurityRule(item));
 245                                }
 246                            }
 220247                            defaultSecurityRules = array;
 220248                            continue;
 249                        }
 468250                        if (property0.NameEquals("networkInterfaces"))
 251                        {
 12252                            if (property0.Value.ValueKind == JsonValueKind.Null)
 253                            {
 254                                continue;
 255                            }
 12256                            List<NetworkInterface> array = new List<NetworkInterface>();
 48257                            foreach (var item in property0.Value.EnumerateArray())
 258                            {
 12259                                if (item.ValueKind == JsonValueKind.Null)
 260                                {
 0261                                    array.Add(null);
 262                                }
 263                                else
 264                                {
 12265                                    array.Add(NetworkInterface.DeserializeNetworkInterface(item));
 266                                }
 267                            }
 12268                            networkInterfaces = array;
 12269                            continue;
 270                        }
 456271                        if (property0.NameEquals("subnets"))
 272                        {
 16273                            if (property0.Value.ValueKind == JsonValueKind.Null)
 274                            {
 275                                continue;
 276                            }
 16277                            List<Subnet> array = new List<Subnet>();
 80278                            foreach (var item in property0.Value.EnumerateArray())
 279                            {
 24280                                if (item.ValueKind == JsonValueKind.Null)
 281                                {
 0282                                    array.Add(null);
 283                                }
 284                                else
 285                                {
 24286                                    array.Add(Subnet.DeserializeSubnet(item));
 287                                }
 288                            }
 16289                            subnets = array;
 16290                            continue;
 291                        }
 440292                        if (property0.NameEquals("flowLogs"))
 293                        {
 0294                            if (property0.Value.ValueKind == JsonValueKind.Null)
 295                            {
 296                                continue;
 297                            }
 0298                            List<FlowLog> array = new List<FlowLog>();
 0299                            foreach (var item in property0.Value.EnumerateArray())
 300                            {
 0301                                if (item.ValueKind == JsonValueKind.Null)
 302                                {
 0303                                    array.Add(null);
 304                                }
 305                                else
 306                                {
 0307                                    array.Add(FlowLog.DeserializeFlowLog(item));
 308                                }
 309                            }
 0310                            flowLogs = array;
 0311                            continue;
 312                        }
 440313                        if (property0.NameEquals("resourceGuid"))
 314                        {
 220315                            if (property0.Value.ValueKind == JsonValueKind.Null)
 316                            {
 317                                continue;
 318                            }
 220319                            resourceGuid = property0.Value.GetString();
 220320                            continue;
 321                        }
 220322                        if (property0.NameEquals("provisioningState"))
 323                        {
 220324                            if (property0.Value.ValueKind == JsonValueKind.Null)
 325                            {
 326                                continue;
 327                            }
 220328                            provisioningState = new ProvisioningState(property0.Value.GetString());
 329                            continue;
 330                        }
 331                    }
 332                    continue;
 333                }
 334            }
 272335            return new NetworkSecurityGroup(id, name, type, location, tags, etag, securityRules, defaultSecurityRules, n
 336        }
 337    }
 338}