< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Name()-0%100%
get_Description()-0%100%
get_SourceAddresses()-0%100%
get_DestinationAddresses()-0%100%
get_DestinationPorts()-0%100%
get_Protocols()-0%100%
get_TranslatedAddress()-0%100%
get_TranslatedPort()-0%100%
get_TranslatedFqdn()-0%100%
get_SourceIpGroups()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeAzureFirewallNatRule(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\AzureFirewallNatRule.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> Properties of a NAT rule. </summary>
 13    public partial class AzureFirewallNatRule
 14    {
 15        /// <summary> Initializes a new instance of AzureFirewallNatRule. </summary>
 016        public AzureFirewallNatRule()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of AzureFirewallNatRule. </summary>
 21        /// <param name="name"> Name of the NAT rule. </param>
 22        /// <param name="description"> Description of the rule. </param>
 23        /// <param name="sourceAddresses"> List of source IP addresses for this rule. </param>
 24        /// <param name="destinationAddresses"> List of destination IP addresses for this rule. Supports IP ranges, pref
 25        /// <param name="destinationPorts"> List of destination ports. </param>
 26        /// <param name="protocols"> Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. </param>
 27        /// <param name="translatedAddress"> The translated address for this NAT rule. </param>
 28        /// <param name="translatedPort"> The translated port for this NAT rule. </param>
 29        /// <param name="translatedFqdn"> The translated FQDN for this NAT rule. </param>
 30        /// <param name="sourceIpGroups"> List of source IpGroups for this rule. </param>
 031        internal AzureFirewallNatRule(string name, string description, IList<string> sourceAddresses, IList<string> dest
 32        {
 033            Name = name;
 034            Description = description;
 035            SourceAddresses = sourceAddresses;
 036            DestinationAddresses = destinationAddresses;
 037            DestinationPorts = destinationPorts;
 038            Protocols = protocols;
 039            TranslatedAddress = translatedAddress;
 040            TranslatedPort = translatedPort;
 041            TranslatedFqdn = translatedFqdn;
 042            SourceIpGroups = sourceIpGroups;
 043        }
 44
 45        /// <summary> Name of the NAT rule. </summary>
 046        public string Name { get; set; }
 47        /// <summary> Description of the rule. </summary>
 048        public string Description { get; set; }
 49        /// <summary> List of source IP addresses for this rule. </summary>
 050        public IList<string> SourceAddresses { get; set; }
 51        /// <summary> List of destination IP addresses for this rule. Supports IP ranges, prefixes, and service tags. </
 052        public IList<string> DestinationAddresses { get; set; }
 53        /// <summary> List of destination ports. </summary>
 054        public IList<string> DestinationPorts { get; set; }
 55        /// <summary> Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. </summary>
 056        public IList<AzureFirewallNetworkRuleProtocol> Protocols { get; set; }
 57        /// <summary> The translated address for this NAT rule. </summary>
 058        public string TranslatedAddress { get; set; }
 59        /// <summary> The translated port for this NAT rule. </summary>
 060        public string TranslatedPort { get; set; }
 61        /// <summary> The translated FQDN for this NAT rule. </summary>
 062        public string TranslatedFqdn { get; set; }
 63        /// <summary> List of source IpGroups for this rule. </summary>
 064        public IList<string> SourceIpGroups { get; set; }
 65    }
 66}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\AzureFirewallNatRule.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 AzureFirewallNatRule : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Name != null)
 20            {
 021                writer.WritePropertyName("name");
 022                writer.WriteStringValue(Name);
 23            }
 024            if (Description != null)
 25            {
 026                writer.WritePropertyName("description");
 027                writer.WriteStringValue(Description);
 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 (Protocols != null)
 60            {
 061                writer.WritePropertyName("protocols");
 062                writer.WriteStartArray();
 063                foreach (var item in Protocols)
 64                {
 065                    writer.WriteStringValue(item.ToString());
 66                }
 067                writer.WriteEndArray();
 68            }
 069            if (TranslatedAddress != null)
 70            {
 071                writer.WritePropertyName("translatedAddress");
 072                writer.WriteStringValue(TranslatedAddress);
 73            }
 074            if (TranslatedPort != null)
 75            {
 076                writer.WritePropertyName("translatedPort");
 077                writer.WriteStringValue(TranslatedPort);
 78            }
 079            if (TranslatedFqdn != null)
 80            {
 081                writer.WritePropertyName("translatedFqdn");
 082                writer.WriteStringValue(TranslatedFqdn);
 83            }
 084            if (SourceIpGroups != null)
 85            {
 086                writer.WritePropertyName("sourceIpGroups");
 087                writer.WriteStartArray();
 088                foreach (var item in SourceIpGroups)
 89                {
 090                    writer.WriteStringValue(item);
 91                }
 092                writer.WriteEndArray();
 93            }
 094            writer.WriteEndObject();
 095        }
 96
 97        internal static AzureFirewallNatRule DeserializeAzureFirewallNatRule(JsonElement element)
 98        {
 099            string name = default;
 0100            string description = default;
 0101            IList<string> sourceAddresses = default;
 0102            IList<string> destinationAddresses = default;
 0103            IList<string> destinationPorts = default;
 0104            IList<AzureFirewallNetworkRuleProtocol> protocols = default;
 0105            string translatedAddress = default;
 0106            string translatedPort = default;
 0107            string translatedFqdn = default;
 0108            IList<string> sourceIpGroups = default;
 0109            foreach (var property in element.EnumerateObject())
 110            {
 0111                if (property.NameEquals("name"))
 112                {
 0113                    if (property.Value.ValueKind == JsonValueKind.Null)
 114                    {
 115                        continue;
 116                    }
 0117                    name = property.Value.GetString();
 0118                    continue;
 119                }
 0120                if (property.NameEquals("description"))
 121                {
 0122                    if (property.Value.ValueKind == JsonValueKind.Null)
 123                    {
 124                        continue;
 125                    }
 0126                    description = property.Value.GetString();
 0127                    continue;
 128                }
 0129                if (property.NameEquals("sourceAddresses"))
 130                {
 0131                    if (property.Value.ValueKind == JsonValueKind.Null)
 132                    {
 133                        continue;
 134                    }
 0135                    List<string> array = new List<string>();
 0136                    foreach (var item in property.Value.EnumerateArray())
 137                    {
 0138                        if (item.ValueKind == JsonValueKind.Null)
 139                        {
 0140                            array.Add(null);
 141                        }
 142                        else
 143                        {
 0144                            array.Add(item.GetString());
 145                        }
 146                    }
 0147                    sourceAddresses = array;
 0148                    continue;
 149                }
 0150                if (property.NameEquals("destinationAddresses"))
 151                {
 0152                    if (property.Value.ValueKind == JsonValueKind.Null)
 153                    {
 154                        continue;
 155                    }
 0156                    List<string> array = new List<string>();
 0157                    foreach (var item in property.Value.EnumerateArray())
 158                    {
 0159                        if (item.ValueKind == JsonValueKind.Null)
 160                        {
 0161                            array.Add(null);
 162                        }
 163                        else
 164                        {
 0165                            array.Add(item.GetString());
 166                        }
 167                    }
 0168                    destinationAddresses = array;
 0169                    continue;
 170                }
 0171                if (property.NameEquals("destinationPorts"))
 172                {
 0173                    if (property.Value.ValueKind == JsonValueKind.Null)
 174                    {
 175                        continue;
 176                    }
 0177                    List<string> array = new List<string>();
 0178                    foreach (var item in property.Value.EnumerateArray())
 179                    {
 0180                        if (item.ValueKind == JsonValueKind.Null)
 181                        {
 0182                            array.Add(null);
 183                        }
 184                        else
 185                        {
 0186                            array.Add(item.GetString());
 187                        }
 188                    }
 0189                    destinationPorts = array;
 0190                    continue;
 191                }
 0192                if (property.NameEquals("protocols"))
 193                {
 0194                    if (property.Value.ValueKind == JsonValueKind.Null)
 195                    {
 196                        continue;
 197                    }
 0198                    List<AzureFirewallNetworkRuleProtocol> array = new List<AzureFirewallNetworkRuleProtocol>();
 0199                    foreach (var item in property.Value.EnumerateArray())
 200                    {
 0201                        array.Add(new AzureFirewallNetworkRuleProtocol(item.GetString()));
 202                    }
 0203                    protocols = array;
 0204                    continue;
 205                }
 0206                if (property.NameEquals("translatedAddress"))
 207                {
 0208                    if (property.Value.ValueKind == JsonValueKind.Null)
 209                    {
 210                        continue;
 211                    }
 0212                    translatedAddress = property.Value.GetString();
 0213                    continue;
 214                }
 0215                if (property.NameEquals("translatedPort"))
 216                {
 0217                    if (property.Value.ValueKind == JsonValueKind.Null)
 218                    {
 219                        continue;
 220                    }
 0221                    translatedPort = property.Value.GetString();
 0222                    continue;
 223                }
 0224                if (property.NameEquals("translatedFqdn"))
 225                {
 0226                    if (property.Value.ValueKind == JsonValueKind.Null)
 227                    {
 228                        continue;
 229                    }
 0230                    translatedFqdn = property.Value.GetString();
 0231                    continue;
 232                }
 0233                if (property.NameEquals("sourceIpGroups"))
 234                {
 0235                    if (property.Value.ValueKind == JsonValueKind.Null)
 236                    {
 237                        continue;
 238                    }
 0239                    List<string> array = new List<string>();
 0240                    foreach (var item in property.Value.EnumerateArray())
 241                    {
 0242                        if (item.ValueKind == JsonValueKind.Null)
 243                        {
 0244                            array.Add(null);
 245                        }
 246                        else
 247                        {
 0248                            array.Add(item.GetString());
 249                        }
 250                    }
 0251                    sourceIpGroups = array;
 252                    continue;
 253                }
 254            }
 0255            return new AzureFirewallNatRule(name, description, sourceAddresses, destinationAddresses, destinationPorts, 
 256        }
 257    }
 258}