< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Action()-0%100%
get_TranslatedAddress()-0%100%
get_TranslatedPort()-0%100%
get_RuleCondition()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeFirewallPolicyNatRule(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\FirewallPolicyNatRule.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
 8namespace Azure.ResourceManager.Network.Models
 9{
 10    /// <summary> Firewall Policy NAT Rule. </summary>
 11    public partial class FirewallPolicyNatRule : FirewallPolicyRule
 12    {
 13        /// <summary> Initializes a new instance of FirewallPolicyNatRule. </summary>
 014        public FirewallPolicyNatRule()
 15        {
 016            RuleType = FirewallPolicyRuleType.FirewallPolicyNatRule;
 017        }
 18
 19        /// <summary> Initializes a new instance of FirewallPolicyNatRule. </summary>
 20        /// <param name="ruleType"> The type of the rule. </param>
 21        /// <param name="name"> The name of the rule. </param>
 22        /// <param name="priority"> Priority of the Firewall Policy Rule resource. </param>
 23        /// <param name="action"> The action type of a Nat rule. </param>
 24        /// <param name="translatedAddress"> The translated address for this NAT rule. </param>
 25        /// <param name="translatedPort"> The translated port for this NAT rule. </param>
 26        /// <param name="ruleCondition"> The match conditions for incoming traffic. </param>
 027        internal FirewallPolicyNatRule(FirewallPolicyRuleType ruleType, string name, int? priority, FirewallPolicyNatRul
 28        {
 029            Action = action;
 030            TranslatedAddress = translatedAddress;
 031            TranslatedPort = translatedPort;
 032            RuleCondition = ruleCondition;
 033            RuleType = ruleType;
 034        }
 35
 36        /// <summary> The action type of a Nat rule. </summary>
 037        public FirewallPolicyNatRuleAction Action { get; set; }
 38        /// <summary> The translated address for this NAT rule. </summary>
 039        public string TranslatedAddress { get; set; }
 40        /// <summary> The translated port for this NAT rule. </summary>
 041        public string TranslatedPort { get; set; }
 42        /// <summary> The match conditions for incoming traffic. </summary>
 043        public FirewallPolicyRuleCondition RuleCondition { get; set; }
 44    }
 45}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\FirewallPolicyNatRule.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.ResourceManager.Network.Models
 12{
 13    public partial class FirewallPolicyNatRule : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (Action != null)
 19            {
 020                writer.WritePropertyName("action");
 021                writer.WriteObjectValue(Action);
 22            }
 023            if (TranslatedAddress != null)
 24            {
 025                writer.WritePropertyName("translatedAddress");
 026                writer.WriteStringValue(TranslatedAddress);
 27            }
 028            if (TranslatedPort != null)
 29            {
 030                writer.WritePropertyName("translatedPort");
 031                writer.WriteStringValue(TranslatedPort);
 32            }
 033            if (RuleCondition != null)
 34            {
 035                writer.WritePropertyName("ruleCondition");
 036                writer.WriteObjectValue(RuleCondition);
 37            }
 038            writer.WritePropertyName("ruleType");
 039            writer.WriteStringValue(RuleType.ToString());
 040            if (Name != null)
 41            {
 042                writer.WritePropertyName("name");
 043                writer.WriteStringValue(Name);
 44            }
 045            if (Priority != null)
 46            {
 047                writer.WritePropertyName("priority");
 048                writer.WriteNumberValue(Priority.Value);
 49            }
 050            writer.WriteEndObject();
 051        }
 52
 53        internal static FirewallPolicyNatRule DeserializeFirewallPolicyNatRule(JsonElement element)
 54        {
 055            FirewallPolicyNatRuleAction action = default;
 056            string translatedAddress = default;
 057            string translatedPort = default;
 058            FirewallPolicyRuleCondition ruleCondition = default;
 059            FirewallPolicyRuleType ruleType = default;
 060            string name = default;
 061            int? priority = default;
 062            foreach (var property in element.EnumerateObject())
 63            {
 064                if (property.NameEquals("action"))
 65                {
 066                    if (property.Value.ValueKind == JsonValueKind.Null)
 67                    {
 68                        continue;
 69                    }
 070                    action = FirewallPolicyNatRuleAction.DeserializeFirewallPolicyNatRuleAction(property.Value);
 071                    continue;
 72                }
 073                if (property.NameEquals("translatedAddress"))
 74                {
 075                    if (property.Value.ValueKind == JsonValueKind.Null)
 76                    {
 77                        continue;
 78                    }
 079                    translatedAddress = property.Value.GetString();
 080                    continue;
 81                }
 082                if (property.NameEquals("translatedPort"))
 83                {
 084                    if (property.Value.ValueKind == JsonValueKind.Null)
 85                    {
 86                        continue;
 87                    }
 088                    translatedPort = property.Value.GetString();
 089                    continue;
 90                }
 091                if (property.NameEquals("ruleCondition"))
 92                {
 093                    if (property.Value.ValueKind == JsonValueKind.Null)
 94                    {
 95                        continue;
 96                    }
 097                    ruleCondition = FirewallPolicyRuleCondition.DeserializeFirewallPolicyRuleCondition(property.Value);
 098                    continue;
 99                }
 0100                if (property.NameEquals("ruleType"))
 101                {
 0102                    ruleType = new FirewallPolicyRuleType(property.Value.GetString());
 0103                    continue;
 104                }
 0105                if (property.NameEquals("name"))
 106                {
 0107                    if (property.Value.ValueKind == JsonValueKind.Null)
 108                    {
 109                        continue;
 110                    }
 0111                    name = property.Value.GetString();
 0112                    continue;
 113                }
 0114                if (property.NameEquals("priority"))
 115                {
 0116                    if (property.Value.ValueKind == JsonValueKind.Null)
 117                    {
 118                        continue;
 119                    }
 0120                    priority = property.Value.GetInt32();
 121                    continue;
 122                }
 123            }
 0124            return new FirewallPolicyNatRule(ruleType, name, priority, action, translatedAddress, translatedPort, ruleCo
 125        }
 126    }
 127}