< Summary

Class:Azure.ResourceManager.Network.Models.VirtualNetwork
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetwork.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetwork.Serialization.cs
Covered lines:144
Uncovered lines:62
Coverable lines:206
Total lines:443
Line coverage:69.9% (144 of 206)
Covered branches:92
Total branches:132
Branch coverage:69.6% (92 of 132)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Etag()-100%100%
get_AddressSpace()-100%100%
get_DhcpOptions()-100%100%
get_Subnets()-100%100%
get_VirtualNetworkPeerings()-100%100%
get_ResourceGuid()-100%100%
get_ProvisioningState()-100%100%
get_EnableDdosProtection()-100%100%
get_EnableVmProtection()-100%100%
get_DdosProtectionPlan()-100%100%
get_BgpCommunities()-100%100%
get_IpAllocations()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-48.57%54.76%
DeserializeVirtualNetwork(...)-75.93%76.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetwork.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> Virtual Network resource. </summary>
 13    public partial class VirtualNetwork : Resource
 14    {
 15        /// <summary> Initializes a new instance of VirtualNetwork. </summary>
 10416        public VirtualNetwork()
 17        {
 10418        }
 19
 20        /// <summary> Initializes a new instance of VirtualNetwork. </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="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 27        /// <param name="addressSpace"> The AddressSpace that contains an array of IP address ranges that can be used by
 28        /// <param name="dhcpOptions"> The dhcpOptions that contains an array of DNS servers available to VMs deployed i
 29        /// <param name="subnets"> A list of subnets in a Virtual Network. </param>
 30        /// <param name="virtualNetworkPeerings"> A list of peerings in a Virtual Network. </param>
 31        /// <param name="resourceGuid"> The resourceGuid property of the Virtual Network resource. </param>
 32        /// <param name="provisioningState"> The provisioning state of the virtual network resource. </param>
 33        /// <param name="enableDdosProtection"> Indicates if DDoS protection is enabled for all the protected resources 
 34        /// <param name="enableVmProtection"> Indicates if VM protection is enabled for all the subnets in the virtual n
 35        /// <param name="ddosProtectionPlan"> The DDoS protection plan associated with the virtual network. </param>
 36        /// <param name="bgpCommunities"> Bgp Communities sent over ExpressRoute with each route corresponding to a pref
 37        /// <param name="ipAllocations"> Array of IpAllocation which reference this VNET. </param>
 15638        internal VirtualNetwork(string id, string name, string type, string location, IDictionary<string, string> tags, 
 39        {
 15640            Etag = etag;
 15641            AddressSpace = addressSpace;
 15642            DhcpOptions = dhcpOptions;
 15643            Subnets = subnets;
 15644            VirtualNetworkPeerings = virtualNetworkPeerings;
 15645            ResourceGuid = resourceGuid;
 15646            ProvisioningState = provisioningState;
 15647            EnableDdosProtection = enableDdosProtection;
 15648            EnableVmProtection = enableVmProtection;
 15649            DdosProtectionPlan = ddosProtectionPlan;
 15650            BgpCommunities = bgpCommunities;
 15651            IpAllocations = ipAllocations;
 15652        }
 53
 54        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 21655        public string Etag { get; }
 56        /// <summary> The AddressSpace that contains an array of IP address ranges that can be used by subnets. </summar
 70457        public AddressSpace AddressSpace { get; set; }
 58        /// <summary> The dhcpOptions that contains an array of DNS servers available to VMs deployed in the virtual net
 67659        public DhcpOptions DhcpOptions { get; set; }
 60        /// <summary> A list of subnets in a Virtual Network. </summary>
 78461        public IList<Subnet> Subnets { get; set; }
 62        /// <summary> A list of peerings in a Virtual Network. </summary>
 40463        public IList<VirtualNetworkPeering> VirtualNetworkPeerings { get; set; }
 64        /// <summary> The resourceGuid property of the Virtual Network resource. </summary>
 22865        public string ResourceGuid { get; }
 66        /// <summary> The provisioning state of the virtual network resource. </summary>
 26067        public ProvisioningState? ProvisioningState { get; }
 68        /// <summary> Indicates if DDoS protection is enabled for all the protected resources in the virtual network. It
 37269        public bool? EnableDdosProtection { get; set; }
 70        /// <summary> Indicates if VM protection is enabled for all the subnets in the virtual network. </summary>
 37271        public bool? EnableVmProtection { get; set; }
 72        /// <summary> The DDoS protection plan associated with the virtual network. </summary>
 37273        public SubResource DdosProtectionPlan { get; set; }
 74        /// <summary> Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. </s
 37275        public VirtualNetworkBgpCommunities BgpCommunities { get; set; }
 76        /// <summary> Array of IpAllocation which reference this VNET. </summary>
 37277        public IList<SubResource> IpAllocations { get; set; }
 78    }
 79}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\VirtualNetwork.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 VirtualNetwork : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 21618            writer.WriteStartObject();
 21619            if (Etag != null)
 20            {
 021                writer.WritePropertyName("etag");
 022                writer.WriteStringValue(Etag);
 23            }
 21624            if (Id != null)
 25            {
 026                writer.WritePropertyName("id");
 027                writer.WriteStringValue(Id);
 28            }
 21629            if (Name != null)
 30            {
 031                writer.WritePropertyName("name");
 032                writer.WriteStringValue(Name);
 33            }
 21634            if (Type != null)
 35            {
 036                writer.WritePropertyName("type");
 037                writer.WriteStringValue(Type);
 38            }
 21639            if (Location != null)
 40            {
 21641                writer.WritePropertyName("location");
 21642                writer.WriteStringValue(Location);
 43            }
 21644            if (Tags != null)
 45            {
 046                writer.WritePropertyName("tags");
 047                writer.WriteStartObject();
 048                foreach (var item in Tags)
 49                {
 050                    writer.WritePropertyName(item.Key);
 051                    writer.WriteStringValue(item.Value);
 52                }
 053                writer.WriteEndObject();
 54            }
 21655            writer.WritePropertyName("properties");
 21656            writer.WriteStartObject();
 21657            if (AddressSpace != null)
 58            {
 21659                writer.WritePropertyName("addressSpace");
 21660                writer.WriteObjectValue(AddressSpace);
 61            }
 21662            if (DhcpOptions != null)
 63            {
 20064                writer.WritePropertyName("dhcpOptions");
 20065                writer.WriteObjectValue(DhcpOptions);
 66            }
 21667            if (Subnets != null)
 68            {
 21669                writer.WritePropertyName("subnets");
 21670                writer.WriteStartArray();
 94471                foreach (var item in Subnets)
 72                {
 25673                    writer.WriteObjectValue(item);
 74                }
 21675                writer.WriteEndArray();
 76            }
 21677            if (VirtualNetworkPeerings != null)
 78            {
 079                writer.WritePropertyName("virtualNetworkPeerings");
 080                writer.WriteStartArray();
 081                foreach (var item in VirtualNetworkPeerings)
 82                {
 083                    writer.WriteObjectValue(item);
 84                }
 085                writer.WriteEndArray();
 86            }
 21687            if (ResourceGuid != null)
 88            {
 089                writer.WritePropertyName("resourceGuid");
 090                writer.WriteStringValue(ResourceGuid);
 91            }
 21692            if (ProvisioningState != null)
 93            {
 094                writer.WritePropertyName("provisioningState");
 095                writer.WriteStringValue(ProvisioningState.Value.ToString());
 96            }
 21697            if (EnableDdosProtection != null)
 98            {
 099                writer.WritePropertyName("enableDdosProtection");
 0100                writer.WriteBooleanValue(EnableDdosProtection.Value);
 101            }
 216102            if (EnableVmProtection != null)
 103            {
 0104                writer.WritePropertyName("enableVmProtection");
 0105                writer.WriteBooleanValue(EnableVmProtection.Value);
 106            }
 216107            if (DdosProtectionPlan != null)
 108            {
 0109                writer.WritePropertyName("ddosProtectionPlan");
 0110                writer.WriteObjectValue(DdosProtectionPlan);
 111            }
 216112            if (BgpCommunities != null)
 113            {
 0114                writer.WritePropertyName("bgpCommunities");
 0115                writer.WriteObjectValue(BgpCommunities);
 116            }
 216117            if (IpAllocations != null)
 118            {
 0119                writer.WritePropertyName("ipAllocations");
 0120                writer.WriteStartArray();
 0121                foreach (var item in IpAllocations)
 122                {
 0123                    writer.WriteObjectValue(item);
 124                }
 0125                writer.WriteEndArray();
 126            }
 216127            writer.WriteEndObject();
 216128            writer.WriteEndObject();
 216129        }
 130
 131        internal static VirtualNetwork DeserializeVirtualNetwork(JsonElement element)
 132        {
 156133            string etag = default;
 156134            string id = default;
 156135            string name = default;
 156136            string type = default;
 156137            string location = default;
 156138            IDictionary<string, string> tags = default;
 156139            AddressSpace addressSpace = default;
 156140            DhcpOptions dhcpOptions = default;
 156141            IList<Subnet> subnets = default;
 156142            IList<VirtualNetworkPeering> virtualNetworkPeerings = default;
 156143            string resourceGuid = default;
 156144            ProvisioningState? provisioningState = default;
 156145            bool? enableDdosProtection = default;
 156146            bool? enableVmProtection = default;
 156147            SubResource ddosProtectionPlan = default;
 156148            VirtualNetworkBgpCommunities bgpCommunities = default;
 156149            IList<SubResource> ipAllocations = default;
 2184150            foreach (var property in element.EnumerateObject())
 151            {
 936152                if (property.NameEquals("etag"))
 153                {
 156154                    if (property.Value.ValueKind == JsonValueKind.Null)
 155                    {
 156                        continue;
 157                    }
 156158                    etag = property.Value.GetString();
 156159                    continue;
 160                }
 780161                if (property.NameEquals("id"))
 162                {
 156163                    if (property.Value.ValueKind == JsonValueKind.Null)
 164                    {
 165                        continue;
 166                    }
 156167                    id = property.Value.GetString();
 156168                    continue;
 169                }
 624170                if (property.NameEquals("name"))
 171                {
 156172                    if (property.Value.ValueKind == JsonValueKind.Null)
 173                    {
 174                        continue;
 175                    }
 156176                    name = property.Value.GetString();
 156177                    continue;
 178                }
 468179                if (property.NameEquals("type"))
 180                {
 156181                    if (property.Value.ValueKind == JsonValueKind.Null)
 182                    {
 183                        continue;
 184                    }
 156185                    type = property.Value.GetString();
 156186                    continue;
 187                }
 312188                if (property.NameEquals("location"))
 189                {
 156190                    if (property.Value.ValueKind == JsonValueKind.Null)
 191                    {
 192                        continue;
 193                    }
 156194                    location = property.Value.GetString();
 156195                    continue;
 196                }
 156197                if (property.NameEquals("tags"))
 198                {
 0199                    if (property.Value.ValueKind == JsonValueKind.Null)
 200                    {
 201                        continue;
 202                    }
 0203                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0204                    foreach (var property0 in property.Value.EnumerateObject())
 205                    {
 0206                        if (property0.Value.ValueKind == JsonValueKind.Null)
 207                        {
 0208                            dictionary.Add(property0.Name, null);
 209                        }
 210                        else
 211                        {
 0212                            dictionary.Add(property0.Name, property0.Value.GetString());
 213                        }
 214                    }
 0215                    tags = dictionary;
 0216                    continue;
 217                }
 156218                if (property.NameEquals("properties"))
 219                {
 2792220                    foreach (var property0 in property.Value.EnumerateObject())
 221                    {
 1240222                        if (property0.NameEquals("addressSpace"))
 223                        {
 156224                            if (property0.Value.ValueKind == JsonValueKind.Null)
 225                            {
 226                                continue;
 227                            }
 156228                            addressSpace = AddressSpace.DeserializeAddressSpace(property0.Value);
 156229                            continue;
 230                        }
 1084231                        if (property0.NameEquals("dhcpOptions"))
 232                        {
 148233                            if (property0.Value.ValueKind == JsonValueKind.Null)
 234                            {
 235                                continue;
 236                            }
 148237                            dhcpOptions = DhcpOptions.DeserializeDhcpOptions(property0.Value);
 148238                            continue;
 239                        }
 936240                        if (property0.NameEquals("subnets"))
 241                        {
 156242                            if (property0.Value.ValueKind == JsonValueKind.Null)
 243                            {
 244                                continue;
 245                            }
 156246                            List<Subnet> array = new List<Subnet>();
 736247                            foreach (var item in property0.Value.EnumerateArray())
 248                            {
 212249                                if (item.ValueKind == JsonValueKind.Null)
 250                                {
 0251                                    array.Add(null);
 252                                }
 253                                else
 254                                {
 212255                                    array.Add(Subnet.DeserializeSubnet(item));
 256                                }
 257                            }
 156258                            subnets = array;
 156259                            continue;
 260                        }
 780261                        if (property0.NameEquals("virtualNetworkPeerings"))
 262                        {
 156263                            if (property0.Value.ValueKind == JsonValueKind.Null)
 264                            {
 265                                continue;
 266                            }
 156267                            List<VirtualNetworkPeering> array = new List<VirtualNetworkPeering>();
 320268                            foreach (var item in property0.Value.EnumerateArray())
 269                            {
 4270                                if (item.ValueKind == JsonValueKind.Null)
 271                                {
 0272                                    array.Add(null);
 273                                }
 274                                else
 275                                {
 4276                                    array.Add(VirtualNetworkPeering.DeserializeVirtualNetworkPeering(item));
 277                                }
 278                            }
 156279                            virtualNetworkPeerings = array;
 156280                            continue;
 281                        }
 624282                        if (property0.NameEquals("resourceGuid"))
 283                        {
 156284                            if (property0.Value.ValueKind == JsonValueKind.Null)
 285                            {
 286                                continue;
 287                            }
 156288                            resourceGuid = property0.Value.GetString();
 156289                            continue;
 290                        }
 468291                        if (property0.NameEquals("provisioningState"))
 292                        {
 156293                            if (property0.Value.ValueKind == JsonValueKind.Null)
 294                            {
 295                                continue;
 296                            }
 156297                            provisioningState = new ProvisioningState(property0.Value.GetString());
 156298                            continue;
 299                        }
 312300                        if (property0.NameEquals("enableDdosProtection"))
 301                        {
 156302                            if (property0.Value.ValueKind == JsonValueKind.Null)
 303                            {
 304                                continue;
 305                            }
 156306                            enableDdosProtection = property0.Value.GetBoolean();
 156307                            continue;
 308                        }
 156309                        if (property0.NameEquals("enableVmProtection"))
 310                        {
 156311                            if (property0.Value.ValueKind == JsonValueKind.Null)
 312                            {
 313                                continue;
 314                            }
 156315                            enableVmProtection = property0.Value.GetBoolean();
 156316                            continue;
 317                        }
 0318                        if (property0.NameEquals("ddosProtectionPlan"))
 319                        {
 0320                            if (property0.Value.ValueKind == JsonValueKind.Null)
 321                            {
 322                                continue;
 323                            }
 0324                            ddosProtectionPlan = SubResource.DeserializeSubResource(property0.Value);
 0325                            continue;
 326                        }
 0327                        if (property0.NameEquals("bgpCommunities"))
 328                        {
 0329                            if (property0.Value.ValueKind == JsonValueKind.Null)
 330                            {
 331                                continue;
 332                            }
 0333                            bgpCommunities = VirtualNetworkBgpCommunities.DeserializeVirtualNetworkBgpCommunities(proper
 0334                            continue;
 335                        }
 0336                        if (property0.NameEquals("ipAllocations"))
 337                        {
 0338                            if (property0.Value.ValueKind == JsonValueKind.Null)
 339                            {
 340                                continue;
 341                            }
 0342                            List<SubResource> array = new List<SubResource>();
 0343                            foreach (var item in property0.Value.EnumerateArray())
 344                            {
 0345                                if (item.ValueKind == JsonValueKind.Null)
 346                                {
 0347                                    array.Add(null);
 348                                }
 349                                else
 350                                {
 0351                                    array.Add(SubResource.DeserializeSubResource(item));
 352                                }
 353                            }
 0354                            ipAllocations = array;
 355                            continue;
 356                        }
 357                    }
 358                    continue;
 359                }
 360            }
 156361            return new VirtualNetwork(id, name, type, location, tags, etag, addressSpace, dhcpOptions, subnets, virtualN
 362        }
 363    }
 364}