< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_IpProtocols()-0%100%
get_SourceAddresses()-0%100%
get_DestinationAddresses()-0%100%
get_DestinationPorts()-0%100%
get_SourceIpGroups()-0%100%
get_DestinationIpGroups()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeNetworkRuleCondition(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkRuleCondition.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> Rule condition of type network. </summary>
 13    public partial class NetworkRuleCondition : FirewallPolicyRuleCondition
 14    {
 15        /// <summary> Initializes a new instance of NetworkRuleCondition. </summary>
 016        public NetworkRuleCondition()
 17        {
 018            RuleConditionType = FirewallPolicyRuleConditionType.NetworkRuleCondition;
 019        }
 20
 21        /// <summary> Initializes a new instance of NetworkRuleCondition. </summary>
 22        /// <param name="name"> Name of the rule condition. </param>
 23        /// <param name="description"> Description of the rule condition. </param>
 24        /// <param name="ruleConditionType"> Rule Condition Type. </param>
 25        /// <param name="ipProtocols"> Array of FirewallPolicyRuleConditionNetworkProtocols. </param>
 26        /// <param name="sourceAddresses"> List of source IP addresses for this rule. </param>
 27        /// <param name="destinationAddresses"> List of destination IP addresses or Service Tags. </param>
 28        /// <param name="destinationPorts"> List of destination ports. </param>
 29        /// <param name="sourceIpGroups"> List of source IpGroups for this rule. </param>
 30        /// <param name="destinationIpGroups"> List of destination IpGroups for this rule. </param>
 031        internal NetworkRuleCondition(string name, string description, FirewallPolicyRuleConditionType ruleConditionType
 32        {
 033            IpProtocols = ipProtocols;
 034            SourceAddresses = sourceAddresses;
 035            DestinationAddresses = destinationAddresses;
 036            DestinationPorts = destinationPorts;
 037            SourceIpGroups = sourceIpGroups;
 038            DestinationIpGroups = destinationIpGroups;
 039            RuleConditionType = ruleConditionType;
 040        }
 41
 42        /// <summary> Array of FirewallPolicyRuleConditionNetworkProtocols. </summary>
 043        public IList<FirewallPolicyRuleConditionNetworkProtocol> IpProtocols { get; set; }
 44        /// <summary> List of source IP addresses for this rule. </summary>
 045        public IList<string> SourceAddresses { get; set; }
 46        /// <summary> List of destination IP addresses or Service Tags. </summary>
 047        public IList<string> DestinationAddresses { get; set; }
 48        /// <summary> List of destination ports. </summary>
 049        public IList<string> DestinationPorts { get; set; }
 50        /// <summary> List of source IpGroups for this rule. </summary>
 051        public IList<string> SourceIpGroups { get; set; }
 52        /// <summary> List of destination IpGroups for this rule. </summary>
 053        public IList<string> DestinationIpGroups { get; set; }
 54    }
 55}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkRuleCondition.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 NetworkRuleCondition : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (IpProtocols != null)
 20            {
 021                writer.WritePropertyName("ipProtocols");
 022                writer.WriteStartArray();
 023                foreach (var item in IpProtocols)
 24                {
 025                    writer.WriteStringValue(item.ToString());
 26                }
 027                writer.WriteEndArray();
 28            }
 029            if (SourceAddresses != null)
 30            {
 031                writer.WritePropertyName("sourceAddresses");
 032                writer.WriteStartArray();
 033                foreach (var item in SourceAddresses)
 34                {
 035                    writer.WriteStringValue(item);
 36                }
 037                writer.WriteEndArray();
 38            }
 039            if (DestinationAddresses != null)
 40            {
 041                writer.WritePropertyName("destinationAddresses");
 042                writer.WriteStartArray();
 043                foreach (var item in DestinationAddresses)
 44                {
 045                    writer.WriteStringValue(item);
 46                }
 047                writer.WriteEndArray();
 48            }
 049            if (DestinationPorts != null)
 50            {
 051                writer.WritePropertyName("destinationPorts");
 052                writer.WriteStartArray();
 053                foreach (var item in DestinationPorts)
 54                {
 055                    writer.WriteStringValue(item);
 56                }
 057                writer.WriteEndArray();
 58            }
 059            if (SourceIpGroups != null)
 60            {
 061                writer.WritePropertyName("sourceIpGroups");
 062                writer.WriteStartArray();
 063                foreach (var item in SourceIpGroups)
 64                {
 065                    writer.WriteStringValue(item);
 66                }
 067                writer.WriteEndArray();
 68            }
 069            if (DestinationIpGroups != null)
 70            {
 071                writer.WritePropertyName("destinationIpGroups");
 072                writer.WriteStartArray();
 073                foreach (var item in DestinationIpGroups)
 74                {
 075                    writer.WriteStringValue(item);
 76                }
 077                writer.WriteEndArray();
 78            }
 079            if (Name != null)
 80            {
 081                writer.WritePropertyName("name");
 082                writer.WriteStringValue(Name);
 83            }
 084            if (Description != null)
 85            {
 086                writer.WritePropertyName("description");
 087                writer.WriteStringValue(Description);
 88            }
 089            writer.WritePropertyName("ruleConditionType");
 090            writer.WriteStringValue(RuleConditionType.ToString());
 091            writer.WriteEndObject();
 092        }
 93
 94        internal static NetworkRuleCondition DeserializeNetworkRuleCondition(JsonElement element)
 95        {
 096            IList<FirewallPolicyRuleConditionNetworkProtocol> ipProtocols = default;
 097            IList<string> sourceAddresses = default;
 098            IList<string> destinationAddresses = default;
 099            IList<string> destinationPorts = default;
 0100            IList<string> sourceIpGroups = default;
 0101            IList<string> destinationIpGroups = default;
 0102            string name = default;
 0103            string description = default;
 0104            FirewallPolicyRuleConditionType ruleConditionType = default;
 0105            foreach (var property in element.EnumerateObject())
 106            {
 0107                if (property.NameEquals("ipProtocols"))
 108                {
 0109                    if (property.Value.ValueKind == JsonValueKind.Null)
 110                    {
 111                        continue;
 112                    }
 0113                    List<FirewallPolicyRuleConditionNetworkProtocol> array = new List<FirewallPolicyRuleConditionNetwork
 0114                    foreach (var item in property.Value.EnumerateArray())
 115                    {
 0116                        array.Add(new FirewallPolicyRuleConditionNetworkProtocol(item.GetString()));
 117                    }
 0118                    ipProtocols = array;
 0119                    continue;
 120                }
 0121                if (property.NameEquals("sourceAddresses"))
 122                {
 0123                    if (property.Value.ValueKind == JsonValueKind.Null)
 124                    {
 125                        continue;
 126                    }
 0127                    List<string> array = new List<string>();
 0128                    foreach (var item in property.Value.EnumerateArray())
 129                    {
 0130                        if (item.ValueKind == JsonValueKind.Null)
 131                        {
 0132                            array.Add(null);
 133                        }
 134                        else
 135                        {
 0136                            array.Add(item.GetString());
 137                        }
 138                    }
 0139                    sourceAddresses = array;
 0140                    continue;
 141                }
 0142                if (property.NameEquals("destinationAddresses"))
 143                {
 0144                    if (property.Value.ValueKind == JsonValueKind.Null)
 145                    {
 146                        continue;
 147                    }
 0148                    List<string> array = new List<string>();
 0149                    foreach (var item in property.Value.EnumerateArray())
 150                    {
 0151                        if (item.ValueKind == JsonValueKind.Null)
 152                        {
 0153                            array.Add(null);
 154                        }
 155                        else
 156                        {
 0157                            array.Add(item.GetString());
 158                        }
 159                    }
 0160                    destinationAddresses = array;
 0161                    continue;
 162                }
 0163                if (property.NameEquals("destinationPorts"))
 164                {
 0165                    if (property.Value.ValueKind == JsonValueKind.Null)
 166                    {
 167                        continue;
 168                    }
 0169                    List<string> array = new List<string>();
 0170                    foreach (var item in property.Value.EnumerateArray())
 171                    {
 0172                        if (item.ValueKind == JsonValueKind.Null)
 173                        {
 0174                            array.Add(null);
 175                        }
 176                        else
 177                        {
 0178                            array.Add(item.GetString());
 179                        }
 180                    }
 0181                    destinationPorts = array;
 0182                    continue;
 183                }
 0184                if (property.NameEquals("sourceIpGroups"))
 185                {
 0186                    if (property.Value.ValueKind == JsonValueKind.Null)
 187                    {
 188                        continue;
 189                    }
 0190                    List<string> array = new List<string>();
 0191                    foreach (var item in property.Value.EnumerateArray())
 192                    {
 0193                        if (item.ValueKind == JsonValueKind.Null)
 194                        {
 0195                            array.Add(null);
 196                        }
 197                        else
 198                        {
 0199                            array.Add(item.GetString());
 200                        }
 201                    }
 0202                    sourceIpGroups = array;
 0203                    continue;
 204                }
 0205                if (property.NameEquals("destinationIpGroups"))
 206                {
 0207                    if (property.Value.ValueKind == JsonValueKind.Null)
 208                    {
 209                        continue;
 210                    }
 0211                    List<string> array = new List<string>();
 0212                    foreach (var item in property.Value.EnumerateArray())
 213                    {
 0214                        if (item.ValueKind == JsonValueKind.Null)
 215                        {
 0216                            array.Add(null);
 217                        }
 218                        else
 219                        {
 0220                            array.Add(item.GetString());
 221                        }
 222                    }
 0223                    destinationIpGroups = array;
 0224                    continue;
 225                }
 0226                if (property.NameEquals("name"))
 227                {
 0228                    if (property.Value.ValueKind == JsonValueKind.Null)
 229                    {
 230                        continue;
 231                    }
 0232                    name = property.Value.GetString();
 0233                    continue;
 234                }
 0235                if (property.NameEquals("description"))
 236                {
 0237                    if (property.Value.ValueKind == JsonValueKind.Null)
 238                    {
 239                        continue;
 240                    }
 0241                    description = property.Value.GetString();
 0242                    continue;
 243                }
 0244                if (property.NameEquals("ruleConditionType"))
 245                {
 0246                    ruleConditionType = new FirewallPolicyRuleConditionType(property.Value.GetString());
 247                    continue;
 248                }
 249            }
 0250            return new NetworkRuleCondition(name, description, ruleConditionType, ipProtocols, sourceAddresses, destinat
 251        }
 252    }
 253}