< Summary

Class:Azure.ResourceManager.Network.Models.LoadBalancer
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\LoadBalancer.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\LoadBalancer.Serialization.cs
Covered lines:195
Uncovered lines:33
Coverable lines:228
Total lines:492
Line coverage:85.5% (195 of 228)
Covered branches:126
Total branches:150
Branch coverage:84% (126 of 150)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Sku()-100%100%
get_Etag()-100%100%
get_FrontendIPConfigurations()-100%100%
get_BackendAddressPools()-100%100%
get_LoadBalancingRules()-100%100%
get_Probes()-100%100%
get_InboundNatRules()-100%100%
get_InboundNatPools()-100%100%
get_OutboundRules()-100%100%
get_ResourceGuid()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-86.08%87.5%
DeserializeLoadBalancer(...)-82.11%82.35%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\LoadBalancer.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> LoadBalancer resource. </summary>
 13    public partial class LoadBalancer : Resource
 14    {
 15        /// <summary> Initializes a new instance of LoadBalancer. </summary>
 3616        public LoadBalancer()
 17        {
 3618        }
 19
 20        /// <summary> Initializes a new instance of LoadBalancer. </summary>
 21        /// <param name="id"> Resource ID. </param>
 22        /// <param name="name"> Resource name. </param>
 23        /// <param name="type"> Resource type. </param>
 24        /// <param name="location"> Resource location. </param>
 25        /// <param name="tags"> Resource tags. </param>
 26        /// <param name="sku"> The load balancer SKU. </param>
 27        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 28        /// <param name="frontendIPConfigurations"> Object representing the frontend IPs to be used for the load balance
 29        /// <param name="backendAddressPools"> Collection of backend address pools used by a load balancer. </param>
 30        /// <param name="loadBalancingRules"> Object collection representing the load balancing rules Gets the provision
 31        /// <param name="probes"> Collection of probe objects used in the load balancer. </param>
 32        /// <param name="inboundNatRules"> Collection of inbound NAT Rules used by a load balancer. Defining inbound NAT
 33        /// <param name="inboundNatPools"> Defines an external port range for inbound NAT to a single backend port on NI
 34        /// <param name="outboundRules"> The outbound rules. </param>
 35        /// <param name="resourceGuid"> The resource GUID property of the load balancer resource. </param>
 36        /// <param name="provisioningState"> The provisioning state of the load balancer resource. </param>
 12037        internal LoadBalancer(string id, string name, string type, string location, IDictionary<string, string> tags, Lo
 38        {
 12039            Sku = sku;
 12040            Etag = etag;
 12041            FrontendIPConfigurations = frontendIPConfigurations;
 12042            BackendAddressPools = backendAddressPools;
 12043            LoadBalancingRules = loadBalancingRules;
 12044            Probes = probes;
 12045            InboundNatRules = inboundNatRules;
 12046            InboundNatPools = inboundNatPools;
 12047            OutboundRules = outboundRules;
 12048            ResourceGuid = resourceGuid;
 12049            ProvisioningState = provisioningState;
 12050        }
 51
 52        /// <summary> The load balancer SKU. </summary>
 24053        public LoadBalancerSku Sku { get; set; }
 54        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 16455        public string Etag { get; }
 56        /// <summary> Object representing the frontend IPs to be used for the load balancer. </summary>
 48457        public IList<FrontendIPConfiguration> FrontendIPConfigurations { get; set; }
 58        /// <summary> Collection of backend address pools used by a load balancer. </summary>
 43659        public IList<BackendAddressPool> BackendAddressPools { get; set; }
 60        /// <summary> Object collection representing the load balancing rules Gets the provisioning. </summary>
 46061        public IList<LoadBalancingRule> LoadBalancingRules { get; set; }
 62        /// <summary> Collection of probe objects used in the load balancer. </summary>
 39663        public IList<Probe> Probes { get; set; }
 64        /// <summary> Collection of inbound NAT Rules used by a load balancer. Defining inbound NAT rules on your load b
 50865        public IList<InboundNatRule> InboundNatRules { get; set; }
 66        /// <summary> Defines an external port range for inbound NAT to a single backend port on NICs associated with a 
 29267        public IList<InboundNatPool> InboundNatPools { get; set; }
 68        /// <summary> The outbound rules. </summary>
 22469        public IList<OutboundRule> OutboundRules { get; set; }
 70        /// <summary> The resource GUID property of the load balancer resource. </summary>
 12471        public string ResourceGuid { get; }
 72        /// <summary> The provisioning state of the load balancer resource. </summary>
 15273        public ProvisioningState? ProvisioningState { get; }
 74    }
 75}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\LoadBalancer.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 LoadBalancer : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 10418            writer.WriteStartObject();
 10419            if (Sku != null)
 20            {
 1621                writer.WritePropertyName("sku");
 1622                writer.WriteObjectValue(Sku);
 23            }
 10424            if (Etag != null)
 25            {
 1626                writer.WritePropertyName("etag");
 1627                writer.WriteStringValue(Etag);
 28            }
 10429            if (Id != null)
 30            {
 1631                writer.WritePropertyName("id");
 1632                writer.WriteStringValue(Id);
 33            }
 10434            if (Name != null)
 35            {
 1636                writer.WritePropertyName("name");
 1637                writer.WriteStringValue(Name);
 38            }
 10439            if (Type != null)
 40            {
 1641                writer.WritePropertyName("type");
 1642                writer.WriteStringValue(Type);
 43            }
 10444            if (Location != null)
 45            {
 10446                writer.WritePropertyName("location");
 10447                writer.WriteStringValue(Location);
 48            }
 10449            if (Tags != null)
 50            {
 051                writer.WritePropertyName("tags");
 052                writer.WriteStartObject();
 053                foreach (var item in Tags)
 54                {
 055                    writer.WritePropertyName(item.Key);
 056                    writer.WriteStringValue(item.Value);
 57                }
 058                writer.WriteEndObject();
 59            }
 10460            writer.WritePropertyName("properties");
 10461            writer.WriteStartObject();
 10462            if (FrontendIPConfigurations != null)
 63            {
 9664                writer.WritePropertyName("frontendIPConfigurations");
 9665                writer.WriteStartArray();
 38466                foreach (var item in FrontendIPConfigurations)
 67                {
 9668                    writer.WriteObjectValue(item);
 69                }
 9670                writer.WriteEndArray();
 71            }
 10472            if (BackendAddressPools != null)
 73            {
 8874                writer.WritePropertyName("backendAddressPools");
 8875                writer.WriteStartArray();
 33676                foreach (var item in BackendAddressPools)
 77                {
 8078                    writer.WriteObjectValue(item);
 79                }
 8880                writer.WriteEndArray();
 81            }
 10482            if (LoadBalancingRules != null)
 83            {
 8884                writer.WritePropertyName("loadBalancingRules");
 8885                writer.WriteStartArray();
 33686                foreach (var item in LoadBalancingRules)
 87                {
 8088                    writer.WriteObjectValue(item);
 89                }
 8890                writer.WriteEndArray();
 91            }
 10492            if (Probes != null)
 93            {
 8094                writer.WritePropertyName("probes");
 8095                writer.WriteStartArray();
 30496                foreach (var item in Probes)
 97                {
 7298                    writer.WriteObjectValue(item);
 99                }
 80100                writer.WriteEndArray();
 101            }
 104102            if (InboundNatRules != null)
 103            {
 80104                writer.WritePropertyName("inboundNatRules");
 80105                writer.WriteStartArray();
 416106                foreach (var item in InboundNatRules)
 107                {
 128108                    writer.WriteObjectValue(item);
 109                }
 80110                writer.WriteEndArray();
 111            }
 104112            if (InboundNatPools != null)
 113            {
 24114                writer.WritePropertyName("inboundNatPools");
 24115                writer.WriteStartArray();
 96116                foreach (var item in InboundNatPools)
 117                {
 24118                    writer.WriteObjectValue(item);
 119                }
 24120                writer.WriteEndArray();
 121            }
 104122            if (OutboundRules != null)
 123            {
 0124                writer.WritePropertyName("outboundRules");
 0125                writer.WriteStartArray();
 0126                foreach (var item in OutboundRules)
 127                {
 0128                    writer.WriteObjectValue(item);
 129                }
 0130                writer.WriteEndArray();
 131            }
 104132            if (ResourceGuid != null)
 133            {
 16134                writer.WritePropertyName("resourceGuid");
 16135                writer.WriteStringValue(ResourceGuid);
 136            }
 104137            if (ProvisioningState != null)
 138            {
 16139                writer.WritePropertyName("provisioningState");
 16140                writer.WriteStringValue(ProvisioningState.Value.ToString());
 141            }
 104142            writer.WriteEndObject();
 104143            writer.WriteEndObject();
 104144        }
 145
 146        internal static LoadBalancer DeserializeLoadBalancer(JsonElement element)
 147        {
 120148            LoadBalancerSku sku = default;
 120149            string etag = default;
 120150            string id = default;
 120151            string name = default;
 120152            string type = default;
 120153            string location = default;
 120154            IDictionary<string, string> tags = default;
 120155            IList<FrontendIPConfiguration> frontendIPConfigurations = default;
 120156            IList<BackendAddressPool> backendAddressPools = default;
 120157            IList<LoadBalancingRule> loadBalancingRules = default;
 120158            IList<Probe> probes = default;
 120159            IList<InboundNatRule> inboundNatRules = default;
 120160            IList<InboundNatPool> inboundNatPools = default;
 120161            IList<OutboundRule> outboundRules = default;
 120162            string resourceGuid = default;
 120163            ProvisioningState? provisioningState = default;
 1920164            foreach (var property in element.EnumerateObject())
 165            {
 840166                if (property.NameEquals("sku"))
 167                {
 120168                    if (property.Value.ValueKind == JsonValueKind.Null)
 169                    {
 170                        continue;
 171                    }
 120172                    sku = LoadBalancerSku.DeserializeLoadBalancerSku(property.Value);
 120173                    continue;
 174                }
 720175                if (property.NameEquals("etag"))
 176                {
 120177                    if (property.Value.ValueKind == JsonValueKind.Null)
 178                    {
 179                        continue;
 180                    }
 120181                    etag = property.Value.GetString();
 120182                    continue;
 183                }
 600184                if (property.NameEquals("id"))
 185                {
 120186                    if (property.Value.ValueKind == JsonValueKind.Null)
 187                    {
 188                        continue;
 189                    }
 120190                    id = property.Value.GetString();
 120191                    continue;
 192                }
 480193                if (property.NameEquals("name"))
 194                {
 120195                    if (property.Value.ValueKind == JsonValueKind.Null)
 196                    {
 197                        continue;
 198                    }
 120199                    name = property.Value.GetString();
 120200                    continue;
 201                }
 360202                if (property.NameEquals("type"))
 203                {
 120204                    if (property.Value.ValueKind == JsonValueKind.Null)
 205                    {
 206                        continue;
 207                    }
 120208                    type = property.Value.GetString();
 120209                    continue;
 210                }
 240211                if (property.NameEquals("location"))
 212                {
 120213                    if (property.Value.ValueKind == JsonValueKind.Null)
 214                    {
 215                        continue;
 216                    }
 120217                    location = property.Value.GetString();
 120218                    continue;
 219                }
 120220                if (property.NameEquals("tags"))
 221                {
 0222                    if (property.Value.ValueKind == JsonValueKind.Null)
 223                    {
 224                        continue;
 225                    }
 0226                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0227                    foreach (var property0 in property.Value.EnumerateObject())
 228                    {
 0229                        if (property0.Value.ValueKind == JsonValueKind.Null)
 230                        {
 0231                            dictionary.Add(property0.Name, null);
 232                        }
 233                        else
 234                        {
 0235                            dictionary.Add(property0.Name, property0.Value.GetString());
 236                        }
 237                    }
 0238                    tags = dictionary;
 0239                    continue;
 240                }
 120241                if (property.NameEquals("properties"))
 242                {
 2160243                    foreach (var property0 in property.Value.EnumerateObject())
 244                    {
 960245                        if (property0.NameEquals("frontendIPConfigurations"))
 246                        {
 120247                            if (property0.Value.ValueKind == JsonValueKind.Null)
 248                            {
 249                                continue;
 250                            }
 120251                            List<FrontendIPConfiguration> array = new List<FrontendIPConfiguration>();
 464252                            foreach (var item in property0.Value.EnumerateArray())
 253                            {
 112254                                if (item.ValueKind == JsonValueKind.Null)
 255                                {
 0256                                    array.Add(null);
 257                                }
 258                                else
 259                                {
 112260                                    array.Add(FrontendIPConfiguration.DeserializeFrontendIPConfiguration(item));
 261                                }
 262                            }
 120263                            frontendIPConfigurations = array;
 120264                            continue;
 265                        }
 840266                        if (property0.NameEquals("backendAddressPools"))
 267                        {
 120268                            if (property0.Value.ValueKind == JsonValueKind.Null)
 269                            {
 270                                continue;
 271                            }
 120272                            List<BackendAddressPool> array = new List<BackendAddressPool>();
 456273                            foreach (var item in property0.Value.EnumerateArray())
 274                            {
 108275                                if (item.ValueKind == JsonValueKind.Null)
 276                                {
 0277                                    array.Add(null);
 278                                }
 279                                else
 280                                {
 108281                                    array.Add(BackendAddressPool.DeserializeBackendAddressPool(item));
 282                                }
 283                            }
 120284                            backendAddressPools = array;
 120285                            continue;
 286                        }
 720287                        if (property0.NameEquals("loadBalancingRules"))
 288                        {
 120289                            if (property0.Value.ValueKind == JsonValueKind.Null)
 290                            {
 291                                continue;
 292                            }
 120293                            List<LoadBalancingRule> array = new List<LoadBalancingRule>();
 456294                            foreach (var item in property0.Value.EnumerateArray())
 295                            {
 108296                                if (item.ValueKind == JsonValueKind.Null)
 297                                {
 0298                                    array.Add(null);
 299                                }
 300                                else
 301                                {
 108302                                    array.Add(LoadBalancingRule.DeserializeLoadBalancingRule(item));
 303                                }
 304                            }
 120305                            loadBalancingRules = array;
 120306                            continue;
 307                        }
 600308                        if (property0.NameEquals("probes"))
 309                        {
 120310                            if (property0.Value.ValueKind == JsonValueKind.Null)
 311                            {
 312                                continue;
 313                            }
 120314                            List<Probe> array = new List<Probe>();
 448315                            foreach (var item in property0.Value.EnumerateArray())
 316                            {
 104317                                if (item.ValueKind == JsonValueKind.Null)
 318                                {
 0319                                    array.Add(null);
 320                                }
 321                                else
 322                                {
 104323                                    array.Add(Probe.DeserializeProbe(item));
 324                                }
 325                            }
 120326                            probes = array;
 120327                            continue;
 328                        }
 480329                        if (property0.NameEquals("inboundNatRules"))
 330                        {
 120331                            if (property0.Value.ValueKind == JsonValueKind.Null)
 332                            {
 333                                continue;
 334                            }
 120335                            List<InboundNatRule> array = new List<InboundNatRule>();
 624336                            foreach (var item in property0.Value.EnumerateArray())
 337                            {
 192338                                if (item.ValueKind == JsonValueKind.Null)
 339                                {
 0340                                    array.Add(null);
 341                                }
 342                                else
 343                                {
 192344                                    array.Add(InboundNatRule.DeserializeInboundNatRule(item));
 345                                }
 346                            }
 120347                            inboundNatRules = array;
 120348                            continue;
 349                        }
 360350                        if (property0.NameEquals("inboundNatPools"))
 351                        {
 120352                            if (property0.Value.ValueKind == JsonValueKind.Null)
 353                            {
 354                                continue;
 355                            }
 120356                            List<InboundNatPool> array = new List<InboundNatPool>();
 248357                            foreach (var item in property0.Value.EnumerateArray())
 358                            {
 4359                                if (item.ValueKind == JsonValueKind.Null)
 360                                {
 0361                                    array.Add(null);
 362                                }
 363                                else
 364                                {
 4365                                    array.Add(InboundNatPool.DeserializeInboundNatPool(item));
 366                                }
 367                            }
 120368                            inboundNatPools = array;
 120369                            continue;
 370                        }
 240371                        if (property0.NameEquals("outboundRules"))
 372                        {
 0373                            if (property0.Value.ValueKind == JsonValueKind.Null)
 374                            {
 375                                continue;
 376                            }
 0377                            List<OutboundRule> array = new List<OutboundRule>();
 0378                            foreach (var item in property0.Value.EnumerateArray())
 379                            {
 0380                                if (item.ValueKind == JsonValueKind.Null)
 381                                {
 0382                                    array.Add(null);
 383                                }
 384                                else
 385                                {
 0386                                    array.Add(OutboundRule.DeserializeOutboundRule(item));
 387                                }
 388                            }
 0389                            outboundRules = array;
 0390                            continue;
 391                        }
 240392                        if (property0.NameEquals("resourceGuid"))
 393                        {
 120394                            if (property0.Value.ValueKind == JsonValueKind.Null)
 395                            {
 396                                continue;
 397                            }
 120398                            resourceGuid = property0.Value.GetString();
 120399                            continue;
 400                        }
 120401                        if (property0.NameEquals("provisioningState"))
 402                        {
 120403                            if (property0.Value.ValueKind == JsonValueKind.Null)
 404                            {
 405                                continue;
 406                            }
 120407                            provisioningState = new ProvisioningState(property0.Value.GetString());
 408                            continue;
 409                        }
 410                    }
 411                    continue;
 412                }
 413            }
 120414            return new LoadBalancer(id, name, type, location, tags, sku, etag, frontendIPConfigurations, backendAddressP
 415        }
 416    }
 417}