< Summary

Class:Azure.ResourceManager.Network.Models.PublicIPAddress
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PublicIPAddress.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PublicIPAddress.Serialization.cs
Covered lines:184
Uncovered lines:34
Coverable lines:218
Total lines:464
Line coverage:84.4% (184 of 218)
Covered branches:116
Total branches:138
Branch coverage:84% (116 of 138)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Sku()-100%100%
get_Etag()-100%100%
get_Zones()-100%100%
get_PublicIPAllocationMethod()-100%100%
get_PublicIPAddressVersion()-100%100%
get_IpConfiguration()-100%100%
get_DnsSettings()-100%100%
get_DdosSettings()-100%100%
get_IpTags()-100%100%
get_IpAddress()-100%100%
get_PublicIPPrefix()-100%100%
get_IdleTimeoutInMinutes()-100%100%
get_ResourceGuid()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-79.45%81.82%
DeserializePublicIPAddress(...)-83.19%85.11%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PublicIPAddress.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> Public IP address resource. </summary>
 13    public partial class PublicIPAddress : Resource
 14    {
 15        /// <summary> Initializes a new instance of PublicIPAddress. </summary>
 8016        public PublicIPAddress()
 17        {
 8018        }
 19
 20        /// <summary> Initializes a new instance of PublicIPAddress. </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 public IP address SKU. </param>
 27        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 28        /// <param name="zones"> A list of availability zones denoting the IP allocated for the resource needs to come f
 29        /// <param name="publicIPAllocationMethod"> The public IP address allocation method. </param>
 30        /// <param name="publicIPAddressVersion"> The public IP address version. </param>
 31        /// <param name="ipConfiguration"> The IP configuration associated with the public IP address. </param>
 32        /// <param name="dnsSettings"> The FQDN of the DNS record associated with the public IP address. </param>
 33        /// <param name="ddosSettings"> The DDoS protection custom policy associated with the public IP address. </param
 34        /// <param name="ipTags"> The list of tags associated with the public IP address. </param>
 35        /// <param name="ipAddress"> The IP address associated with the public IP address resource. </param>
 36        /// <param name="publicIPPrefix"> The Public IP Prefix this Public IP Address should be allocated from. </param>
 37        /// <param name="idleTimeoutInMinutes"> The idle timeout of the public IP address. </param>
 38        /// <param name="resourceGuid"> The resource GUID property of the public IP address resource. </param>
 39        /// <param name="provisioningState"> The provisioning state of the public IP address resource. </param>
 35640        internal PublicIPAddress(string id, string name, string type, string location, IDictionary<string, string> tags,
 41        {
 35642            Sku = sku;
 35643            Etag = etag;
 35644            Zones = zones;
 35645            PublicIPAllocationMethod = publicIPAllocationMethod;
 35646            PublicIPAddressVersion = publicIPAddressVersion;
 35647            IpConfiguration = ipConfiguration;
 35648            DnsSettings = dnsSettings;
 35649            DdosSettings = ddosSettings;
 35650            IpTags = ipTags;
 35651            IpAddress = ipAddress;
 35652            PublicIPPrefix = publicIPPrefix;
 35653            IdleTimeoutInMinutes = idleTimeoutInMinutes;
 35654            ResourceGuid = resourceGuid;
 35655            ProvisioningState = provisioningState;
 35656        }
 57
 58        /// <summary> The public IP address SKU. </summary>
 54059        public PublicIPAddressSku Sku { get; set; }
 60        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 18861        public string Etag { get; }
 62        /// <summary> A list of availability zones denoting the IP allocated for the resource needs to come from. </summ
 53263        public IList<string> Zones { get; set; }
 64        /// <summary> The public IP address allocation method. </summary>
 70865        public IPAllocationMethod? PublicIPAllocationMethod { get; set; }
 66        /// <summary> The public IP address version. </summary>
 59667        public IPVersion? PublicIPAddressVersion { get; set; }
 68        /// <summary> The IP configuration associated with the public IP address. </summary>
 19669        public IPConfiguration IpConfiguration { get; }
 70        /// <summary> The FQDN of the DNS record associated with the public IP address. </summary>
 76871        public PublicIPAddressDnsSettings DnsSettings { get; set; }
 72        /// <summary> The DDoS protection custom policy associated with the public IP address. </summary>
 53273        public DdosSettings DdosSettings { get; set; }
 74        /// <summary> The list of tags associated with the public IP address. </summary>
 54075        public IList<IpTag> IpTags { get; set; }
 76        /// <summary> The IP address associated with the public IP address resource. </summary>
 53277        public string IpAddress { get; set; }
 78        /// <summary> The Public IP Prefix this Public IP Address should be allocated from. </summary>
 53279        public SubResource PublicIPPrefix { get; set; }
 80        /// <summary> The idle timeout of the public IP address. </summary>
 59281        public int? IdleTimeoutInMinutes { get; set; }
 82        /// <summary> The resource GUID property of the public IP address resource. </summary>
 20883        public string ResourceGuid { get; }
 84        /// <summary> The provisioning state of the public IP address resource. </summary>
 25685        public ProvisioningState? ProvisioningState { get; }
 86    }
 87}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\PublicIPAddress.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 PublicIPAddress : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 17618            writer.WriteStartObject();
 17619            if (Sku != null)
 20            {
 821                writer.WritePropertyName("sku");
 822                writer.WriteObjectValue(Sku);
 23            }
 17624            if (Etag != null)
 25            {
 826                writer.WritePropertyName("etag");
 827                writer.WriteStringValue(Etag);
 28            }
 17629            if (Zones != null)
 30            {
 031                writer.WritePropertyName("zones");
 032                writer.WriteStartArray();
 033                foreach (var item in Zones)
 34                {
 035                    writer.WriteStringValue(item);
 36                }
 037                writer.WriteEndArray();
 38            }
 17639            if (Id != null)
 40            {
 6441                writer.WritePropertyName("id");
 6442                writer.WriteStringValue(Id);
 43            }
 17644            if (Name != null)
 45            {
 846                writer.WritePropertyName("name");
 847                writer.WriteStringValue(Name);
 48            }
 17649            if (Type != null)
 50            {
 851                writer.WritePropertyName("type");
 852                writer.WriteStringValue(Type);
 53            }
 17654            if (Location != null)
 55            {
 12056                writer.WritePropertyName("location");
 12057                writer.WriteStringValue(Location);
 58            }
 17659            if (Tags != null)
 60            {
 12061                writer.WritePropertyName("tags");
 12062                writer.WriteStartObject();
 48063                foreach (var item in Tags)
 64                {
 12065                    writer.WritePropertyName(item.Key);
 12066                    writer.WriteStringValue(item.Value);
 67                }
 12068                writer.WriteEndObject();
 69            }
 17670            writer.WritePropertyName("properties");
 17671            writer.WriteStartObject();
 17672            if (PublicIPAllocationMethod != null)
 73            {
 12074                writer.WritePropertyName("publicIPAllocationMethod");
 12075                writer.WriteStringValue(PublicIPAllocationMethod.Value.ToString());
 76            }
 17677            if (PublicIPAddressVersion != null)
 78            {
 2479                writer.WritePropertyName("publicIPAddressVersion");
 2480                writer.WriteStringValue(PublicIPAddressVersion.Value.ToString());
 81            }
 17682            if (IpConfiguration != null)
 83            {
 084                writer.WritePropertyName("ipConfiguration");
 085                writer.WriteObjectValue(IpConfiguration);
 86            }
 17687            if (DnsSettings != null)
 88            {
 12089                writer.WritePropertyName("dnsSettings");
 12090                writer.WriteObjectValue(DnsSettings);
 91            }
 17692            if (DdosSettings != null)
 93            {
 094                writer.WritePropertyName("ddosSettings");
 095                writer.WriteObjectValue(DdosSettings);
 96            }
 17697            if (IpTags != null)
 98            {
 899                writer.WritePropertyName("ipTags");
 8100                writer.WriteStartArray();
 0101                foreach (var item in IpTags)
 102                {
 0103                    writer.WriteObjectValue(item);
 104                }
 8105                writer.WriteEndArray();
 106            }
 176107            if (IpAddress != null)
 108            {
 0109                writer.WritePropertyName("ipAddress");
 0110                writer.WriteStringValue(IpAddress);
 111            }
 176112            if (PublicIPPrefix != null)
 113            {
 0114                writer.WritePropertyName("publicIPPrefix");
 0115                writer.WriteObjectValue(PublicIPPrefix);
 116            }
 176117            if (IdleTimeoutInMinutes != null)
 118            {
 16119                writer.WritePropertyName("idleTimeoutInMinutes");
 16120                writer.WriteNumberValue(IdleTimeoutInMinutes.Value);
 121            }
 176122            if (ResourceGuid != null)
 123            {
 8124                writer.WritePropertyName("resourceGuid");
 8125                writer.WriteStringValue(ResourceGuid);
 126            }
 176127            if (ProvisioningState != null)
 128            {
 8129                writer.WritePropertyName("provisioningState");
 8130                writer.WriteStringValue(ProvisioningState.Value.ToString());
 131            }
 176132            writer.WriteEndObject();
 176133            writer.WriteEndObject();
 176134        }
 135
 136        internal static PublicIPAddress DeserializePublicIPAddress(JsonElement element)
 137        {
 356138            PublicIPAddressSku sku = default;
 356139            string etag = default;
 356140            IList<string> zones = default;
 356141            string id = default;
 356142            string name = default;
 356143            string type = default;
 356144            string location = default;
 356145            IDictionary<string, string> tags = default;
 356146            IPAllocationMethod? publicIPAllocationMethod = default;
 356147            IPVersion? publicIPAddressVersion = default;
 356148            IPConfiguration ipConfiguration = default;
 356149            PublicIPAddressDnsSettings dnsSettings = default;
 356150            DdosSettings ddosSettings = default;
 356151            IList<IpTag> ipTags = default;
 356152            string ipAddress = default;
 356153            SubResource publicIPPrefix = default;
 356154            int? idleTimeoutInMinutes = default;
 356155            string resourceGuid = default;
 356156            ProvisioningState? provisioningState = default;
 4376157            foreach (var property in element.EnumerateObject())
 158            {
 1832159                if (property.NameEquals("sku"))
 160                {
 228161                    if (property.Value.ValueKind == JsonValueKind.Null)
 162                    {
 163                        continue;
 164                    }
 228165                    sku = PublicIPAddressSku.DeserializePublicIPAddressSku(property.Value);
 228166                    continue;
 167                }
 1604168                if (property.NameEquals("etag"))
 169                {
 228170                    if (property.Value.ValueKind == JsonValueKind.Null)
 171                    {
 172                        continue;
 173                    }
 228174                    etag = property.Value.GetString();
 228175                    continue;
 176                }
 1376177                if (property.NameEquals("zones"))
 178                {
 0179                    if (property.Value.ValueKind == JsonValueKind.Null)
 180                    {
 181                        continue;
 182                    }
 0183                    List<string> array = new List<string>();
 0184                    foreach (var item in property.Value.EnumerateArray())
 185                    {
 0186                        if (item.ValueKind == JsonValueKind.Null)
 187                        {
 0188                            array.Add(null);
 189                        }
 190                        else
 191                        {
 0192                            array.Add(item.GetString());
 193                        }
 194                    }
 0195                    zones = array;
 0196                    continue;
 197                }
 1376198                if (property.NameEquals("id"))
 199                {
 356200                    if (property.Value.ValueKind == JsonValueKind.Null)
 201                    {
 202                        continue;
 203                    }
 356204                    id = property.Value.GetString();
 356205                    continue;
 206                }
 1020207                if (property.NameEquals("name"))
 208                {
 228209                    if (property.Value.ValueKind == JsonValueKind.Null)
 210                    {
 211                        continue;
 212                    }
 228213                    name = property.Value.GetString();
 228214                    continue;
 215                }
 792216                if (property.NameEquals("type"))
 217                {
 188218                    if (property.Value.ValueKind == JsonValueKind.Null)
 219                    {
 220                        continue;
 221                    }
 188222                    type = property.Value.GetString();
 188223                    continue;
 224                }
 604225                if (property.NameEquals("location"))
 226                {
 188227                    if (property.Value.ValueKind == JsonValueKind.Null)
 228                    {
 229                        continue;
 230                    }
 188231                    location = property.Value.GetString();
 188232                    continue;
 233                }
 416234                if (property.NameEquals("tags"))
 235                {
 188236                    if (property.Value.ValueKind == JsonValueKind.Null)
 237                    {
 238                        continue;
 239                    }
 188240                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 752241                    foreach (var property0 in property.Value.EnumerateObject())
 242                    {
 188243                        if (property0.Value.ValueKind == JsonValueKind.Null)
 244                        {
 0245                            dictionary.Add(property0.Name, null);
 246                        }
 247                        else
 248                        {
 188249                            dictionary.Add(property0.Name, property0.Value.GetString());
 250                        }
 251                    }
 188252                    tags = dictionary;
 188253                    continue;
 254                }
 228255                if (property.NameEquals("properties"))
 256                {
 3792257                    foreach (var property0 in property.Value.EnumerateObject())
 258                    {
 1668259                        if (property0.NameEquals("publicIPAllocationMethod"))
 260                        {
 228261                            if (property0.Value.ValueKind == JsonValueKind.Null)
 262                            {
 263                                continue;
 264                            }
 228265                            publicIPAllocationMethod = new IPAllocationMethod(property0.Value.GetString());
 228266                            continue;
 267                        }
 1440268                        if (property0.NameEquals("publicIPAddressVersion"))
 269                        {
 228270                            if (property0.Value.ValueKind == JsonValueKind.Null)
 271                            {
 272                                continue;
 273                            }
 228274                            publicIPAddressVersion = new IPVersion(property0.Value.GetString());
 228275                            continue;
 276                        }
 1212277                        if (property0.NameEquals("ipConfiguration"))
 278                        {
 48279                            if (property0.Value.ValueKind == JsonValueKind.Null)
 280                            {
 281                                continue;
 282                            }
 48283                            ipConfiguration = IPConfiguration.DeserializeIPConfiguration(property0.Value);
 48284                            continue;
 285                        }
 1164286                        if (property0.NameEquals("dnsSettings"))
 287                        {
 228288                            if (property0.Value.ValueKind == JsonValueKind.Null)
 289                            {
 290                                continue;
 291                            }
 228292                            dnsSettings = PublicIPAddressDnsSettings.DeserializePublicIPAddressDnsSettings(property0.Val
 228293                            continue;
 294                        }
 936295                        if (property0.NameEquals("ddosSettings"))
 296                        {
 0297                            if (property0.Value.ValueKind == JsonValueKind.Null)
 298                            {
 299                                continue;
 300                            }
 0301                            ddosSettings = DdosSettings.DeserializeDdosSettings(property0.Value);
 0302                            continue;
 303                        }
 936304                        if (property0.NameEquals("ipTags"))
 305                        {
 228306                            if (property0.Value.ValueKind == JsonValueKind.Null)
 307                            {
 308                                continue;
 309                            }
 228310                            List<IpTag> array = new List<IpTag>();
 0311                            foreach (var item in property0.Value.EnumerateArray())
 312                            {
 0313                                if (item.ValueKind == JsonValueKind.Null)
 314                                {
 0315                                    array.Add(null);
 316                                }
 317                                else
 318                                {
 0319                                    array.Add(IpTag.DeserializeIpTag(item));
 320                                }
 321                            }
 228322                            ipTags = array;
 228323                            continue;
 324                        }
 708325                        if (property0.NameEquals("ipAddress"))
 326                        {
 24327                            if (property0.Value.ValueKind == JsonValueKind.Null)
 328                            {
 329                                continue;
 330                            }
 24331                            ipAddress = property0.Value.GetString();
 24332                            continue;
 333                        }
 684334                        if (property0.NameEquals("publicIPPrefix"))
 335                        {
 0336                            if (property0.Value.ValueKind == JsonValueKind.Null)
 337                            {
 338                                continue;
 339                            }
 0340                            publicIPPrefix = SubResource.DeserializeSubResource(property0.Value);
 0341                            continue;
 342                        }
 684343                        if (property0.NameEquals("idleTimeoutInMinutes"))
 344                        {
 228345                            if (property0.Value.ValueKind == JsonValueKind.Null)
 346                            {
 347                                continue;
 348                            }
 228349                            idleTimeoutInMinutes = property0.Value.GetInt32();
 228350                            continue;
 351                        }
 456352                        if (property0.NameEquals("resourceGuid"))
 353                        {
 228354                            if (property0.Value.ValueKind == JsonValueKind.Null)
 355                            {
 356                                continue;
 357                            }
 228358                            resourceGuid = property0.Value.GetString();
 228359                            continue;
 360                        }
 228361                        if (property0.NameEquals("provisioningState"))
 362                        {
 228363                            if (property0.Value.ValueKind == JsonValueKind.Null)
 364                            {
 365                                continue;
 366                            }
 228367                            provisioningState = new ProvisioningState(property0.Value.GetString());
 368                            continue;
 369                        }
 370                    }
 371                    continue;
 372                }
 373            }
 356374            return new PublicIPAddress(id, name, type, location, tags, sku, etag, zones, publicIPAllocationMethod, publi
 375        }
 376    }
 377}