< Summary

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

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_TerminateTLS()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeNatRuleCondition(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NatRuleCondition.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 nat. </summary>
 13    public partial class NatRuleCondition : FirewallPolicyRuleCondition
 14    {
 15        /// <summary> Initializes a new instance of NatRuleCondition. </summary>
 016        public NatRuleCondition()
 17        {
 018            RuleConditionType = FirewallPolicyRuleConditionType.NatRuleCondition;
 019        }
 20
 21        /// <summary> Initializes a new instance of NatRuleCondition. </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="terminateTLS"> Terminate TLS connections for this rule. </param>
 031        internal NatRuleCondition(string name, string description, FirewallPolicyRuleConditionType ruleConditionType, IL
 32        {
 033            IpProtocols = ipProtocols;
 034            SourceAddresses = sourceAddresses;
 035            DestinationAddresses = destinationAddresses;
 036            DestinationPorts = destinationPorts;
 037            SourceIpGroups = sourceIpGroups;
 038            TerminateTLS = terminateTLS;
 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> Terminate TLS connections for this rule. </summary>
 053        public bool? TerminateTLS { get; set; }
 54    }
 55}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NatRuleCondition.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 NatRuleCondition : 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 (TerminateTLS != null)
 70            {
 071                writer.WritePropertyName("terminateTLS");
 072                writer.WriteBooleanValue(TerminateTLS.Value);
 73            }
 074            if (Name != null)
 75            {
 076                writer.WritePropertyName("name");
 077                writer.WriteStringValue(Name);
 78            }
 079            if (Description != null)
 80            {
 081                writer.WritePropertyName("description");
 082                writer.WriteStringValue(Description);
 83            }
 084            writer.WritePropertyName("ruleConditionType");
 085            writer.WriteStringValue(RuleConditionType.ToString());
 086            writer.WriteEndObject();
 087        }
 88
 89        internal static NatRuleCondition DeserializeNatRuleCondition(JsonElement element)
 90        {
 091            IList<FirewallPolicyRuleConditionNetworkProtocol> ipProtocols = default;
 092            IList<string> sourceAddresses = default;
 093            IList<string> destinationAddresses = default;
 094            IList<string> destinationPorts = default;
 095            IList<string> sourceIpGroups = default;
 096            bool? terminateTLS = default;
 097            string name = default;
 098            string description = default;
 099            FirewallPolicyRuleConditionType ruleConditionType = default;
 0100            foreach (var property in element.EnumerateObject())
 101            {
 0102                if (property.NameEquals("ipProtocols"))
 103                {
 0104                    if (property.Value.ValueKind == JsonValueKind.Null)
 105                    {
 106                        continue;
 107                    }
 0108                    List<FirewallPolicyRuleConditionNetworkProtocol> array = new List<FirewallPolicyRuleConditionNetwork
 0109                    foreach (var item in property.Value.EnumerateArray())
 110                    {
 0111                        array.Add(new FirewallPolicyRuleConditionNetworkProtocol(item.GetString()));
 112                    }
 0113                    ipProtocols = array;
 0114                    continue;
 115                }
 0116                if (property.NameEquals("sourceAddresses"))
 117                {
 0118                    if (property.Value.ValueKind == JsonValueKind.Null)
 119                    {
 120                        continue;
 121                    }
 0122                    List<string> array = new List<string>();
 0123                    foreach (var item in property.Value.EnumerateArray())
 124                    {
 0125                        if (item.ValueKind == JsonValueKind.Null)
 126                        {
 0127                            array.Add(null);
 128                        }
 129                        else
 130                        {
 0131                            array.Add(item.GetString());
 132                        }
 133                    }
 0134                    sourceAddresses = array;
 0135                    continue;
 136                }
 0137                if (property.NameEquals("destinationAddresses"))
 138                {
 0139                    if (property.Value.ValueKind == JsonValueKind.Null)
 140                    {
 141                        continue;
 142                    }
 0143                    List<string> array = new List<string>();
 0144                    foreach (var item in property.Value.EnumerateArray())
 145                    {
 0146                        if (item.ValueKind == JsonValueKind.Null)
 147                        {
 0148                            array.Add(null);
 149                        }
 150                        else
 151                        {
 0152                            array.Add(item.GetString());
 153                        }
 154                    }
 0155                    destinationAddresses = array;
 0156                    continue;
 157                }
 0158                if (property.NameEquals("destinationPorts"))
 159                {
 0160                    if (property.Value.ValueKind == JsonValueKind.Null)
 161                    {
 162                        continue;
 163                    }
 0164                    List<string> array = new List<string>();
 0165                    foreach (var item in property.Value.EnumerateArray())
 166                    {
 0167                        if (item.ValueKind == JsonValueKind.Null)
 168                        {
 0169                            array.Add(null);
 170                        }
 171                        else
 172                        {
 0173                            array.Add(item.GetString());
 174                        }
 175                    }
 0176                    destinationPorts = array;
 0177                    continue;
 178                }
 0179                if (property.NameEquals("sourceIpGroups"))
 180                {
 0181                    if (property.Value.ValueKind == JsonValueKind.Null)
 182                    {
 183                        continue;
 184                    }
 0185                    List<string> array = new List<string>();
 0186                    foreach (var item in property.Value.EnumerateArray())
 187                    {
 0188                        if (item.ValueKind == JsonValueKind.Null)
 189                        {
 0190                            array.Add(null);
 191                        }
 192                        else
 193                        {
 0194                            array.Add(item.GetString());
 195                        }
 196                    }
 0197                    sourceIpGroups = array;
 0198                    continue;
 199                }
 0200                if (property.NameEquals("terminateTLS"))
 201                {
 0202                    if (property.Value.ValueKind == JsonValueKind.Null)
 203                    {
 204                        continue;
 205                    }
 0206                    terminateTLS = property.Value.GetBoolean();
 0207                    continue;
 208                }
 0209                if (property.NameEquals("name"))
 210                {
 0211                    if (property.Value.ValueKind == JsonValueKind.Null)
 212                    {
 213                        continue;
 214                    }
 0215                    name = property.Value.GetString();
 0216                    continue;
 217                }
 0218                if (property.NameEquals("description"))
 219                {
 0220                    if (property.Value.ValueKind == JsonValueKind.Null)
 221                    {
 222                        continue;
 223                    }
 0224                    description = property.Value.GetString();
 0225                    continue;
 226                }
 0227                if (property.NameEquals("ruleConditionType"))
 228                {
 0229                    ruleConditionType = new FirewallPolicyRuleConditionType(property.Value.GetString());
 230                    continue;
 231                }
 232            }
 0233            return new NatRuleCondition(name, description, ruleConditionType, ipProtocols, sourceAddresses, destinationA
 234        }
 235    }
 236}