< Summary

Class:Azure.ResourceManager.Network.Models.LoadBalancingRule
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\LoadBalancingRule.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\LoadBalancingRule.Serialization.cs
Covered lines:166
Uncovered lines:5
Coverable lines:171
Total lines:364
Line coverage:97% (166 of 171)
Covered branches:99
Total branches:102
Branch coverage:97% (99 of 102)

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_BackendAddressPool()-100%100%
get_Probe()-100%100%
get_Protocol()-100%100%
get_LoadDistribution()-100%100%
get_FrontendPort()-100%100%
get_BackendPort()-100%100%
get_IdleTimeoutInMinutes()-100%100%
get_EnableFloatingIP()-100%100%
get_EnableTcpReset()-100%100%
get_DisableOutboundSnat()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-96.3%96.88%
DeserializeLoadBalancingRule(...)-96.39%97.14%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\LoadBalancingRule.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> A load balancing rule for a load balancer. </summary>
 11    public partial class LoadBalancingRule : SubResource
 12    {
 13        /// <summary> Initializes a new instance of LoadBalancingRule. </summary>
 2814        public LoadBalancingRule()
 15        {
 2816        }
 17
 18        /// <summary> Initializes a new instance of LoadBalancingRule. </summary>
 19        /// <param name="id"> Resource ID. </param>
 20        /// <param name="name"> The name of the resource that is unique within the set of load balancing rules used by t
 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="backendAddressPool"> A reference to a pool of DIPs. Inbound traffic is randomly load balanced a
 25        /// <param name="probe"> The reference to the load balancer probe used by the load balancing rule. </param>
 26        /// <param name="protocol"> The reference to the transport protocol used by the load balancing rule. </param>
 27        /// <param name="loadDistribution"> The load distribution policy for this rule. </param>
 28        /// <param name="frontendPort"> The port for the external endpoint. Port numbers for each rule must be unique wi
 29        /// <param name="backendPort"> The port used for internal connections on the endpoint. Acceptable values are bet
 30        /// <param name="idleTimeoutInMinutes"> The timeout for the TCP idle connection. The value can be set between 4 
 31        /// <param name="enableFloatingIP"> Configures a virtual machine&apos;s endpoint for the floating IP capability 
 32        /// <param name="enableTcpReset"> Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connect
 33        /// <param name="disableOutboundSnat"> Configures SNAT for the VMs in the backend pool to use the publicIP addre
 34        /// <param name="provisioningState"> The provisioning state of the load balancing rule resource. </param>
 11635        internal LoadBalancingRule(string id, string name, string etag, string type, SubResource frontendIPConfiguration
 36        {
 11637            Name = name;
 11638            Etag = etag;
 11639            Type = type;
 11640            FrontendIPConfiguration = frontendIPConfiguration;
 11641            BackendAddressPool = backendAddressPool;
 11642            Probe = probe;
 11643            Protocol = protocol;
 11644            LoadDistribution = loadDistribution;
 11645            FrontendPort = frontendPort;
 11646            BackendPort = backendPort;
 11647            IdleTimeoutInMinutes = idleTimeoutInMinutes;
 11648            EnableFloatingIP = enableFloatingIP;
 11649            EnableTcpReset = enableTcpReset;
 11650            DisableOutboundSnat = disableOutboundSnat;
 11651            ProvisioningState = provisioningState;
 11652        }
 53
 54        /// <summary> The name of the resource that is unique within the set of load balancing rules used by the load ba
 32855        public string Name { get; set; }
 56        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 9657        public string Etag { get; }
 58        /// <summary> Type of the resource. </summary>
 8859        public string Type { get; }
 60        /// <summary> A reference to frontend IP addresses. </summary>
 30461        public SubResource FrontendIPConfiguration { get; set; }
 62        /// <summary> A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend
 30463        public SubResource BackendAddressPool { get; set; }
 64        /// <summary> The reference to the load balancer probe used by the load balancing rule. </summary>
 31665        public SubResource Probe { get; set; }
 66        /// <summary> The reference to the transport protocol used by the load balancing rule. </summary>
 30467        public TransportProtocol? Protocol { get; set; }
 68        /// <summary> The load distribution policy for this rule. </summary>
 24469        public LoadDistribution? LoadDistribution { get; set; }
 70        /// <summary> The port for the external endpoint. Port numbers for each rule must be unique within the Load Bala
 30471        public int? FrontendPort { get; set; }
 72        /// <summary> The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535.
 30473        public int? BackendPort { get; set; }
 74        /// <summary> The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The defaul
 26475        public int? IdleTimeoutInMinutes { get; set; }
 76        /// <summary> Configures a virtual machine&apos;s endpoint for the floating IP capability required to configure 
 30477        public bool? EnableFloatingIP { get; set; }
 78        /// <summary> Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. Thi
 20479        public bool? EnableTcpReset { get; set; }
 80        /// <summary> Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the front
 19681        public bool? DisableOutboundSnat { get; set; }
 82        /// <summary> The provisioning state of the load balancing rule resource. </summary>
 10483        public ProvisioningState? ProvisioningState { get; }
 84    }
 85}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\LoadBalancingRule.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 LoadBalancingRule : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 8017            writer.WriteStartObject();
 8018            if (Name != null)
 19            {
 8020                writer.WritePropertyName("name");
 8021                writer.WriteStringValue(Name);
 22            }
 8023            if (Etag != null)
 24            {
 825                writer.WritePropertyName("etag");
 826                writer.WriteStringValue(Etag);
 27            }
 8028            if (Type != null)
 29            {
 830                writer.WritePropertyName("type");
 831                writer.WriteStringValue(Type);
 32            }
 8033            if (Id != null)
 34            {
 835                writer.WritePropertyName("id");
 836                writer.WriteStringValue(Id);
 37            }
 8038            writer.WritePropertyName("properties");
 8039            writer.WriteStartObject();
 8040            if (FrontendIPConfiguration != null)
 41            {
 8042                writer.WritePropertyName("frontendIPConfiguration");
 8043                writer.WriteObjectValue(FrontendIPConfiguration);
 44            }
 8045            if (BackendAddressPool != null)
 46            {
 8047                writer.WritePropertyName("backendAddressPool");
 8048                writer.WriteObjectValue(BackendAddressPool);
 49            }
 8050            if (Probe != null)
 51            {
 7252                writer.WritePropertyName("probe");
 7253                writer.WriteObjectValue(Probe);
 54            }
 8055            if (Protocol != null)
 56            {
 8057                writer.WritePropertyName("protocol");
 8058                writer.WriteStringValue(Protocol.Value.ToString());
 59            }
 8060            if (LoadDistribution != null)
 61            {
 2462                writer.WritePropertyName("loadDistribution");
 2463                writer.WriteStringValue(LoadDistribution.Value.ToString());
 64            }
 8065            if (FrontendPort != null)
 66            {
 8067                writer.WritePropertyName("frontendPort");
 8068                writer.WriteNumberValue(FrontendPort.Value);
 69            }
 8070            if (BackendPort != null)
 71            {
 8072                writer.WritePropertyName("backendPort");
 8073                writer.WriteNumberValue(BackendPort.Value);
 74            }
 8075            if (IdleTimeoutInMinutes != null)
 76            {
 4077                writer.WritePropertyName("idleTimeoutInMinutes");
 4078                writer.WriteNumberValue(IdleTimeoutInMinutes.Value);
 79            }
 8080            if (EnableFloatingIP != null)
 81            {
 8082                writer.WritePropertyName("enableFloatingIP");
 8083                writer.WriteBooleanValue(EnableFloatingIP.Value);
 84            }
 8085            if (EnableTcpReset != null)
 86            {
 887                writer.WritePropertyName("enableTcpReset");
 888                writer.WriteBooleanValue(EnableTcpReset.Value);
 89            }
 8090            if (DisableOutboundSnat != null)
 91            {
 092                writer.WritePropertyName("disableOutboundSnat");
 093                writer.WriteBooleanValue(DisableOutboundSnat.Value);
 94            }
 8095            if (ProvisioningState != null)
 96            {
 897                writer.WritePropertyName("provisioningState");
 898                writer.WriteStringValue(ProvisioningState.Value.ToString());
 99            }
 80100            writer.WriteEndObject();
 80101            writer.WriteEndObject();
 80102        }
 103
 104        internal static LoadBalancingRule DeserializeLoadBalancingRule(JsonElement element)
 105        {
 116106            string name = default;
 116107            string etag = default;
 116108            string type = default;
 116109            string id = default;
 116110            SubResource frontendIPConfiguration = default;
 116111            SubResource backendAddressPool = default;
 116112            SubResource probe = default;
 116113            TransportProtocol? protocol = default;
 116114            LoadDistribution? loadDistribution = default;
 116115            int? frontendPort = default;
 116116            int? backendPort = default;
 116117            int? idleTimeoutInMinutes = default;
 116118            bool? enableFloatingIP = default;
 116119            bool? enableTcpReset = default;
 116120            bool? disableOutboundSnat = default;
 116121            ProvisioningState? provisioningState = default;
 1392122            foreach (var property in element.EnumerateObject())
 123            {
 580124                if (property.NameEquals("name"))
 125                {
 116126                    if (property.Value.ValueKind == JsonValueKind.Null)
 127                    {
 128                        continue;
 129                    }
 116130                    name = property.Value.GetString();
 116131                    continue;
 132                }
 464133                if (property.NameEquals("etag"))
 134                {
 116135                    if (property.Value.ValueKind == JsonValueKind.Null)
 136                    {
 137                        continue;
 138                    }
 116139                    etag = property.Value.GetString();
 116140                    continue;
 141                }
 348142                if (property.NameEquals("type"))
 143                {
 116144                    if (property.Value.ValueKind == JsonValueKind.Null)
 145                    {
 146                        continue;
 147                    }
 116148                    type = property.Value.GetString();
 116149                    continue;
 150                }
 232151                if (property.NameEquals("id"))
 152                {
 116153                    if (property.Value.ValueKind == JsonValueKind.Null)
 154                    {
 155                        continue;
 156                    }
 116157                    id = property.Value.GetString();
 116158                    continue;
 159                }
 116160                if (property.NameEquals("properties"))
 161                {
 3240162                    foreach (var property0 in property.Value.EnumerateObject())
 163                    {
 1504164                        if (property0.NameEquals("frontendIPConfiguration"))
 165                        {
 116166                            if (property0.Value.ValueKind == JsonValueKind.Null)
 167                            {
 168                                continue;
 169                            }
 116170                            frontendIPConfiguration = DeserializeSubResource(property0.Value);
 116171                            continue;
 172                        }
 1388173                        if (property0.NameEquals("backendAddressPool"))
 174                        {
 116175                            if (property0.Value.ValueKind == JsonValueKind.Null)
 176                            {
 177                                continue;
 178                            }
 116179                            backendAddressPool = DeserializeSubResource(property0.Value);
 116180                            continue;
 181                        }
 1272182                        if (property0.NameEquals("probe"))
 183                        {
 112184                            if (property0.Value.ValueKind == JsonValueKind.Null)
 185                            {
 186                                continue;
 187                            }
 112188                            probe = DeserializeSubResource(property0.Value);
 112189                            continue;
 190                        }
 1160191                        if (property0.NameEquals("protocol"))
 192                        {
 116193                            if (property0.Value.ValueKind == JsonValueKind.Null)
 194                            {
 195                                continue;
 196                            }
 116197                            protocol = new TransportProtocol(property0.Value.GetString());
 116198                            continue;
 199                        }
 1044200                        if (property0.NameEquals("loadDistribution"))
 201                        {
 116202                            if (property0.Value.ValueKind == JsonValueKind.Null)
 203                            {
 204                                continue;
 205                            }
 116206                            loadDistribution = new LoadDistribution(property0.Value.GetString());
 116207                            continue;
 208                        }
 928209                        if (property0.NameEquals("frontendPort"))
 210                        {
 116211                            if (property0.Value.ValueKind == JsonValueKind.Null)
 212                            {
 213                                continue;
 214                            }
 116215                            frontendPort = property0.Value.GetInt32();
 116216                            continue;
 217                        }
 812218                        if (property0.NameEquals("backendPort"))
 219                        {
 116220                            if (property0.Value.ValueKind == JsonValueKind.Null)
 221                            {
 222                                continue;
 223                            }
 116224                            backendPort = property0.Value.GetInt32();
 116225                            continue;
 226                        }
 696227                        if (property0.NameEquals("idleTimeoutInMinutes"))
 228                        {
 116229                            if (property0.Value.ValueKind == JsonValueKind.Null)
 230                            {
 231                                continue;
 232                            }
 116233                            idleTimeoutInMinutes = property0.Value.GetInt32();
 116234                            continue;
 235                        }
 580236                        if (property0.NameEquals("enableFloatingIP"))
 237                        {
 116238                            if (property0.Value.ValueKind == JsonValueKind.Null)
 239                            {
 240                                continue;
 241                            }
 116242                            enableFloatingIP = property0.Value.GetBoolean();
 116243                            continue;
 244                        }
 464245                        if (property0.NameEquals("enableTcpReset"))
 246                        {
 116247                            if (property0.Value.ValueKind == JsonValueKind.Null)
 248                            {
 249                                continue;
 250                            }
 116251                            enableTcpReset = property0.Value.GetBoolean();
 116252                            continue;
 253                        }
 348254                        if (property0.NameEquals("disableOutboundSnat"))
 255                        {
 0256                            if (property0.Value.ValueKind == JsonValueKind.Null)
 257                            {
 258                                continue;
 259                            }
 0260                            disableOutboundSnat = property0.Value.GetBoolean();
 0261                            continue;
 262                        }
 348263                        if (property0.NameEquals("provisioningState"))
 264                        {
 116265                            if (property0.Value.ValueKind == JsonValueKind.Null)
 266                            {
 267                                continue;
 268                            }
 116269                            provisioningState = new ProvisioningState(property0.Value.GetString());
 270                            continue;
 271                        }
 272                    }
 273                    continue;
 274                }
 275            }
 116276            return new LoadBalancingRule(id, name, etag, type, frontendIPConfiguration, backendAddressPool, probe, proto
 277        }
 278    }
 279}