< Summary

Class:Azure.ResourceManager.Network.Models.InboundNatRule
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\InboundNatRule.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\InboundNatRule.Serialization.cs
Covered lines:139
Uncovered lines:2
Coverable lines:141
Total lines:307
Line coverage:98.5% (139 of 141)
Covered branches:83
Total branches:84
Branch coverage:98.8% (83 of 84)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Name()-100%100%
get_Etag()-100%100%
get_Type()-100%100%
get_FrontendIPConfiguration()-100%100%
get_BackendIPConfiguration()-100%100%
get_Protocol()-100%100%
get_FrontendPort()-100%100%
get_BackendPort()-100%100%
get_IdleTimeoutInMinutes()-100%100%
get_EnableFloatingIP()-100%100%
get_EnableTcpReset()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-95.56%96.15%
DeserializeInboundNatRule(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\InboundNatRule.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> Inbound NAT rule of the load balancer. </summary>
 11    public partial class InboundNatRule : SubResource
 12    {
 13        /// <summary> Initializes a new instance of InboundNatRule. </summary>
 5214        public InboundNatRule()
 15        {
 5216        }
 17
 18        /// <summary> Initializes a new instance of InboundNatRule. </summary>
 19        /// <param name="id"> Resource ID. </param>
 20        /// <param name="name"> The name of the resource that is unique within the set of inbound NAT rules used by the 
 21        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 22        /// <param name="type"> Type of the resource. </param>
 23        /// <param name="frontendIPConfiguration"> A reference to frontend IP addresses. </param>
 24        /// <param name="backendIPConfiguration"> A reference to a private IP address defined on a network interface of 
 25        /// <param name="protocol"> The reference to the transport protocol used by the load balancing rule. </param>
 26        /// <param name="frontendPort"> The port for the external endpoint. Port numbers for each rule must be unique wi
 27        /// <param name="backendPort"> The port used for the internal endpoint. Acceptable values range from 1 to 65535.
 28        /// <param name="idleTimeoutInMinutes"> The timeout for the TCP idle connection. The value can be set between 4 
 29        /// <param name="enableFloatingIP"> Configures a virtual machine&apos;s endpoint for the floating IP capability 
 30        /// <param name="enableTcpReset"> Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connect
 31        /// <param name="provisioningState"> The provisioning state of the inbound NAT rule resource. </param>
 29232        internal InboundNatRule(string id, string name, string etag, string type, SubResource frontendIPConfiguration, N
 33        {
 29234            Name = name;
 29235            Etag = etag;
 29236            Type = type;
 29237            FrontendIPConfiguration = frontendIPConfiguration;
 29238            BackendIPConfiguration = backendIPConfiguration;
 29239            Protocol = protocol;
 29240            FrontendPort = frontendPort;
 29241            BackendPort = backendPort;
 29242            IdleTimeoutInMinutes = idleTimeoutInMinutes;
 29243            EnableFloatingIP = enableFloatingIP;
 29244            EnableTcpReset = enableTcpReset;
 29245            ProvisioningState = provisioningState;
 29246        }
 47
 48        /// <summary> The name of the resource that is unique within the set of inbound NAT rules used by the load balan
 70449        public string Name { get; set; }
 50        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 20051        public string Etag { get; }
 52        /// <summary> Type of the resource. </summary>
 20053        public string Type { get; }
 54        /// <summary> A reference to frontend IP addresses. </summary>
 68055        public SubResource FrontendIPConfiguration { get; set; }
 56        /// <summary> A reference to a private IP address defined on a network interface of a VM. Traffic sent to the fr
 21657        public NetworkInterfaceIPConfiguration BackendIPConfiguration { get; }
 58        /// <summary> The reference to the transport protocol used by the load balancing rule. </summary>
 70459        public TransportProtocol? Protocol { get; set; }
 60        /// <summary> The port for the external endpoint. Port numbers for each rule must be unique within the Load Bala
 72061        public int? FrontendPort { get; set; }
 62        /// <summary> The port used for the internal endpoint. Acceptable values range from 1 to 65535. </summary>
 68863        public int? BackendPort { get; set; }
 64        /// <summary> The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The defaul
 62065        public int? IdleTimeoutInMinutes { get; set; }
 66        /// <summary> Configures a virtual machine&apos;s endpoint for the floating IP capability required to configure 
 68867        public bool? EnableFloatingIP { get; set; }
 68        /// <summary> Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. Thi
 49269        public bool? EnableTcpReset { get; set; }
 70        /// <summary> The provisioning state of the inbound NAT rule resource. </summary>
 23271        public ProvisioningState? ProvisioningState { get; }
 72    }
 73}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\InboundNatRule.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 InboundNatRule : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 16817            writer.WriteStartObject();
 16818            if (Name != null)
 19            {
 16020                writer.WritePropertyName("name");
 16021                writer.WriteStringValue(Name);
 22            }
 16823            if (Etag != null)
 24            {
 3225                writer.WritePropertyName("etag");
 3226                writer.WriteStringValue(Etag);
 27            }
 16828            if (Type != null)
 29            {
 3230                writer.WritePropertyName("type");
 3231                writer.WriteStringValue(Type);
 32            }
 16833            if (Id != null)
 34            {
 3235                writer.WritePropertyName("id");
 3236                writer.WriteStringValue(Id);
 37            }
 16838            writer.WritePropertyName("properties");
 16839            writer.WriteStartObject();
 16840            if (FrontendIPConfiguration != null)
 41            {
 16842                writer.WritePropertyName("frontendIPConfiguration");
 16843                writer.WriteObjectValue(FrontendIPConfiguration);
 44            }
 16845            if (BackendIPConfiguration != null)
 46            {
 047                writer.WritePropertyName("backendIPConfiguration");
 048                writer.WriteObjectValue(BackendIPConfiguration);
 49            }
 16850            if (Protocol != null)
 51            {
 16852                writer.WritePropertyName("protocol");
 16853                writer.WriteStringValue(Protocol.Value.ToString());
 54            }
 16855            if (FrontendPort != null)
 56            {
 16857                writer.WritePropertyName("frontendPort");
 16858                writer.WriteNumberValue(FrontendPort.Value);
 59            }
 16860            if (BackendPort != null)
 61            {
 16862                writer.WritePropertyName("backendPort");
 16863                writer.WriteNumberValue(BackendPort.Value);
 64            }
 16865            if (IdleTimeoutInMinutes != null)
 66            {
 10467                writer.WritePropertyName("idleTimeoutInMinutes");
 10468                writer.WriteNumberValue(IdleTimeoutInMinutes.Value);
 69            }
 16870            if (EnableFloatingIP != null)
 71            {
 16872                writer.WritePropertyName("enableFloatingIP");
 16873                writer.WriteBooleanValue(EnableFloatingIP.Value);
 74            }
 16875            if (EnableTcpReset != null)
 76            {
 3277                writer.WritePropertyName("enableTcpReset");
 3278                writer.WriteBooleanValue(EnableTcpReset.Value);
 79            }
 16880            if (ProvisioningState != null)
 81            {
 3282                writer.WritePropertyName("provisioningState");
 3283                writer.WriteStringValue(ProvisioningState.Value.ToString());
 84            }
 16885            writer.WriteEndObject();
 16886            writer.WriteEndObject();
 16887        }
 88
 89        internal static InboundNatRule DeserializeInboundNatRule(JsonElement element)
 90        {
 29291            string name = default;
 29292            string etag = default;
 29293            string type = default;
 29294            string id = default;
 29295            SubResource frontendIPConfiguration = default;
 29296            NetworkInterfaceIPConfiguration backendIPConfiguration = default;
 29297            TransportProtocol? protocol = default;
 29298            int? frontendPort = default;
 29299            int? backendPort = default;
 292100            int? idleTimeoutInMinutes = default;
 292101            bool? enableFloatingIP = default;
 292102            bool? enableTcpReset = default;
 292103            ProvisioningState? provisioningState = default;
 2864104            foreach (var property in element.EnumerateObject())
 105            {
 1140106                if (property.NameEquals("name"))
 107                {
 212108                    if (property.Value.ValueKind == JsonValueKind.Null)
 109                    {
 110                        continue;
 111                    }
 212112                    name = property.Value.GetString();
 212113                    continue;
 114                }
 928115                if (property.NameEquals("etag"))
 116                {
 212117                    if (property.Value.ValueKind == JsonValueKind.Null)
 118                    {
 119                        continue;
 120                    }
 212121                    etag = property.Value.GetString();
 212122                    continue;
 123                }
 716124                if (property.NameEquals("type"))
 125                {
 212126                    if (property.Value.ValueKind == JsonValueKind.Null)
 127                    {
 128                        continue;
 129                    }
 212130                    type = property.Value.GetString();
 212131                    continue;
 132                }
 504133                if (property.NameEquals("id"))
 134                {
 292135                    if (property.Value.ValueKind == JsonValueKind.Null)
 136                    {
 137                        continue;
 138                    }
 292139                    id = property.Value.GetString();
 292140                    continue;
 141                }
 212142                if (property.NameEquals("properties"))
 143                {
 4728144                    foreach (var property0 in property.Value.EnumerateObject())
 145                    {
 2152146                        if (property0.NameEquals("frontendIPConfiguration"))
 147                        {
 212148                            if (property0.Value.ValueKind == JsonValueKind.Null)
 149                            {
 150                                continue;
 151                            }
 212152                            frontendIPConfiguration = DeserializeSubResource(property0.Value);
 212153                            continue;
 154                        }
 1940155                        if (property0.NameEquals("backendIPConfiguration"))
 156                        {
 32157                            if (property0.Value.ValueKind == JsonValueKind.Null)
 158                            {
 159                                continue;
 160                            }
 32161                            backendIPConfiguration = NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfig
 32162                            continue;
 163                        }
 1908164                        if (property0.NameEquals("protocol"))
 165                        {
 212166                            if (property0.Value.ValueKind == JsonValueKind.Null)
 167                            {
 168                                continue;
 169                            }
 212170                            protocol = new TransportProtocol(property0.Value.GetString());
 212171                            continue;
 172                        }
 1696173                        if (property0.NameEquals("frontendPort"))
 174                        {
 212175                            if (property0.Value.ValueKind == JsonValueKind.Null)
 176                            {
 177                                continue;
 178                            }
 212179                            frontendPort = property0.Value.GetInt32();
 212180                            continue;
 181                        }
 1484182                        if (property0.NameEquals("backendPort"))
 183                        {
 212184                            if (property0.Value.ValueKind == JsonValueKind.Null)
 185                            {
 186                                continue;
 187                            }
 212188                            backendPort = property0.Value.GetInt32();
 212189                            continue;
 190                        }
 1272191                        if (property0.NameEquals("idleTimeoutInMinutes"))
 192                        {
 212193                            if (property0.Value.ValueKind == JsonValueKind.Null)
 194                            {
 195                                continue;
 196                            }
 212197                            idleTimeoutInMinutes = property0.Value.GetInt32();
 212198                            continue;
 199                        }
 1060200                        if (property0.NameEquals("enableFloatingIP"))
 201                        {
 212202                            if (property0.Value.ValueKind == JsonValueKind.Null)
 203                            {
 204                                continue;
 205                            }
 212206                            enableFloatingIP = property0.Value.GetBoolean();
 212207                            continue;
 208                        }
 848209                        if (property0.NameEquals("enableTcpReset"))
 210                        {
 212211                            if (property0.Value.ValueKind == JsonValueKind.Null)
 212                            {
 213                                continue;
 214                            }
 212215                            enableTcpReset = property0.Value.GetBoolean();
 212216                            continue;
 217                        }
 636218                        if (property0.NameEquals("provisioningState"))
 219                        {
 212220                            if (property0.Value.ValueKind == JsonValueKind.Null)
 221                            {
 222                                continue;
 223                            }
 212224                            provisioningState = new ProvisioningState(property0.Value.GetString());
 225                            continue;
 226                        }
 227                    }
 228                    continue;
 229                }
 230            }
 292231            return new InboundNatRule(id, name, etag, type, frontendIPConfiguration, backendIPConfiguration, protocol, f
 232        }
 233    }
 234}