< Summary

Class:Azure.ResourceManager.Network.Models.NetworkInterface
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkInterface.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkInterface.Serialization.cs
Covered lines:201
Uncovered lines:25
Coverable lines:226
Total lines:481
Line coverage:88.9% (201 of 226)
Covered branches:128
Total branches:144
Branch coverage:88.8% (128 of 144)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Etag()-100%100%
get_VirtualMachine()-100%100%
get_NetworkSecurityGroup()-100%100%
get_PrivateEndpoint()-100%100%
get_IpConfigurations()-100%100%
get_TapConfigurations()-100%100%
get_DnsSettings()-100%100%
get_MacAddress()-100%100%
get_Primary()-100%100%
get_EnableAcceleratedNetworking()-100%100%
get_EnableIPForwarding()-100%100%
get_HostedWorkloads()-100%100%
get_ResourceGuid()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-84.21%86.96%
DeserializeNetworkInterface(...)-88.98%89.8%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkInterface.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> A network interface in a resource group. </summary>
 13    public partial class NetworkInterface : Resource
 14    {
 15        /// <summary> Initializes a new instance of NetworkInterface. </summary>
 6816        public NetworkInterface()
 17        {
 6818        }
 19
 20        /// <summary> Initializes a new instance of NetworkInterface. </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="virtualMachine"> The reference to a virtual machine. </param>
 28        /// <param name="networkSecurityGroup"> The reference to the NetworkSecurityGroup resource. </param>
 29        /// <param name="privateEndpoint"> A reference to the private endpoint to which the network interface is linked.
 30        /// <param name="ipConfigurations"> A list of IPConfigurations of the network interface. </param>
 31        /// <param name="tapConfigurations"> A list of TapConfigurations of the network interface. </param>
 32        /// <param name="dnsSettings"> The DNS settings in network interface. </param>
 33        /// <param name="macAddress"> The MAC address of the network interface. </param>
 34        /// <param name="primary"> Whether this is a primary network interface on a virtual machine. </param>
 35        /// <param name="enableAcceleratedNetworking"> If the network interface is accelerated networking enabled. </par
 36        /// <param name="enableIPForwarding"> Indicates whether IP forwarding is enabled on this network interface. </pa
 37        /// <param name="hostedWorkloads"> A list of references to linked BareMetal resources. </param>
 38        /// <param name="resourceGuid"> The resource GUID property of the network interface resource. </param>
 39        /// <param name="provisioningState"> The provisioning state of the network interface resource. </param>
 26440        internal NetworkInterface(string id, string name, string type, string location, IDictionary<string, string> tags
 41        {
 26442            Etag = etag;
 26443            VirtualMachine = virtualMachine;
 26444            NetworkSecurityGroup = networkSecurityGroup;
 26445            PrivateEndpoint = privateEndpoint;
 26446            IpConfigurations = ipConfigurations;
 26447            TapConfigurations = tapConfigurations;
 26448            DnsSettings = dnsSettings;
 26449            MacAddress = macAddress;
 26450            Primary = primary;
 26451            EnableAcceleratedNetworking = enableAcceleratedNetworking;
 26452            EnableIPForwarding = enableIPForwarding;
 26453            HostedWorkloads = hostedWorkloads;
 26454            ResourceGuid = resourceGuid;
 26455            ProvisioningState = provisioningState;
 26456        }
 57
 58        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 26859        public string Etag { get; }
 60        /// <summary> The reference to a virtual machine. </summary>
 21661        public SubResource VirtualMachine { get; }
 62        /// <summary> The reference to the NetworkSecurityGroup resource. </summary>
 51663        public NetworkSecurityGroup NetworkSecurityGroup { get; set; }
 64        /// <summary> A reference to the private endpoint to which the network interface is linked. </summary>
 18865        public PrivateEndpoint PrivateEndpoint { get; }
 66        /// <summary> A list of IPConfigurations of the network interface. </summary>
 99267        public IList<NetworkInterfaceIPConfiguration> IpConfigurations { get; set; }
 68        /// <summary> A list of TapConfigurations of the network interface. </summary>
 24469        public IList<NetworkInterfaceTapConfiguration> TapConfigurations { get; }
 70        /// <summary> The DNS settings in network interface. </summary>
 65671        public NetworkInterfaceDnsSettings DnsSettings { get; set; }
 72        /// <summary> The MAC address of the network interface. </summary>
 21673        public string MacAddress { get; }
 74        /// <summary> Whether this is a primary network interface on a virtual machine. </summary>
 18875        public bool? Primary { get; }
 76        /// <summary> If the network interface is accelerated networking enabled. </summary>
 52077        public bool? EnableAcceleratedNetworking { get; set; }
 78        /// <summary> Indicates whether IP forwarding is enabled on this network interface. </summary>
 53279        public bool? EnableIPForwarding { get; set; }
 80        /// <summary> A list of references to linked BareMetal resources. </summary>
 24481        public IList<string> HostedWorkloads { get; }
 82        /// <summary> The resource GUID property of the network interface resource. </summary>
 25683        public string ResourceGuid { get; }
 84        /// <summary> The provisioning state of the network interface resource. </summary>
 30085        public ProvisioningState? ProvisioningState { get; }
 86    }
 87}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkInterface.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 NetworkInterface : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 18818            writer.WriteStartObject();
 18819            if (Etag != null)
 20            {
 5621                writer.WritePropertyName("etag");
 5622                writer.WriteStringValue(Etag);
 23            }
 18824            if (Id != null)
 25            {
 5626                writer.WritePropertyName("id");
 5627                writer.WriteStringValue(Id);
 28            }
 18829            if (Name != null)
 30            {
 5631                writer.WritePropertyName("name");
 5632                writer.WriteStringValue(Name);
 33            }
 18834            if (Type != null)
 35            {
 5636                writer.WritePropertyName("type");
 5637                writer.WriteStringValue(Type);
 38            }
 18839            if (Location != null)
 40            {
 18841                writer.WritePropertyName("location");
 18842                writer.WriteStringValue(Location);
 43            }
 18844            if (Tags != null)
 45            {
 18846                writer.WritePropertyName("tags");
 18847                writer.WriteStartObject();
 75248                foreach (var item in Tags)
 49                {
 18850                    writer.WritePropertyName(item.Key);
 18851                    writer.WriteStringValue(item.Value);
 52                }
 18853                writer.WriteEndObject();
 54            }
 18855            writer.WritePropertyName("properties");
 18856            writer.WriteStartObject();
 18857            if (VirtualMachine != null)
 58            {
 059                writer.WritePropertyName("virtualMachine");
 060                writer.WriteObjectValue(VirtualMachine);
 61            }
 18862            if (NetworkSecurityGroup != null)
 63            {
 864                writer.WritePropertyName("networkSecurityGroup");
 865                writer.WriteObjectValue(NetworkSecurityGroup);
 66            }
 18867            if (PrivateEndpoint != null)
 68            {
 069                writer.WritePropertyName("privateEndpoint");
 070                writer.WriteObjectValue(PrivateEndpoint);
 71            }
 18872            if (IpConfigurations != null)
 73            {
 18874                writer.WritePropertyName("ipConfigurations");
 18875                writer.WriteStartArray();
 80876                foreach (var item in IpConfigurations)
 77                {
 21678                    writer.WriteObjectValue(item);
 79                }
 18880                writer.WriteEndArray();
 81            }
 18882            if (TapConfigurations != null)
 83            {
 5684                writer.WritePropertyName("tapConfigurations");
 5685                writer.WriteStartArray();
 086                foreach (var item in TapConfigurations)
 87                {
 088                    writer.WriteObjectValue(item);
 89                }
 5690                writer.WriteEndArray();
 91            }
 18892            if (DnsSettings != null)
 93            {
 7294                writer.WritePropertyName("dnsSettings");
 7295                writer.WriteObjectValue(DnsSettings);
 96            }
 18897            if (MacAddress != null)
 98            {
 099                writer.WritePropertyName("macAddress");
 0100                writer.WriteStringValue(MacAddress);
 101            }
 188102            if (Primary != null)
 103            {
 0104                writer.WritePropertyName("primary");
 0105                writer.WriteBooleanValue(Primary.Value);
 106            }
 188107            if (EnableAcceleratedNetworking != null)
 108            {
 64109                writer.WritePropertyName("enableAcceleratedNetworking");
 64110                writer.WriteBooleanValue(EnableAcceleratedNetworking.Value);
 111            }
 188112            if (EnableIPForwarding != null)
 113            {
 64114                writer.WritePropertyName("enableIPForwarding");
 64115                writer.WriteBooleanValue(EnableIPForwarding.Value);
 116            }
 188117            if (HostedWorkloads != null)
 118            {
 56119                writer.WritePropertyName("hostedWorkloads");
 56120                writer.WriteStartArray();
 0121                foreach (var item in HostedWorkloads)
 122                {
 0123                    writer.WriteStringValue(item);
 124                }
 56125                writer.WriteEndArray();
 126            }
 188127            if (ResourceGuid != null)
 128            {
 56129                writer.WritePropertyName("resourceGuid");
 56130                writer.WriteStringValue(ResourceGuid);
 131            }
 188132            if (ProvisioningState != null)
 133            {
 56134                writer.WritePropertyName("provisioningState");
 56135                writer.WriteStringValue(ProvisioningState.Value.ToString());
 136            }
 188137            writer.WriteEndObject();
 188138            writer.WriteEndObject();
 188139        }
 140
 141        internal static NetworkInterface DeserializeNetworkInterface(JsonElement element)
 142        {
 264143            string etag = default;
 264144            string id = default;
 264145            string name = default;
 264146            string type = default;
 264147            string location = default;
 264148            IDictionary<string, string> tags = default;
 264149            SubResource virtualMachine = default;
 264150            NetworkSecurityGroup networkSecurityGroup = default;
 264151            PrivateEndpoint privateEndpoint = default;
 264152            IList<NetworkInterfaceIPConfiguration> ipConfigurations = default;
 264153            IList<NetworkInterfaceTapConfiguration> tapConfigurations = default;
 264154            NetworkInterfaceDnsSettings dnsSettings = default;
 264155            string macAddress = default;
 264156            bool? primary = default;
 264157            bool? enableAcceleratedNetworking = default;
 264158            bool? enableIPForwarding = default;
 264159            IList<string> hostedWorkloads = default;
 264160            string resourceGuid = default;
 264161            ProvisioningState? provisioningState = default;
 3928162            foreach (var property in element.EnumerateObject())
 163            {
 1700164                if (property.NameEquals("etag"))
 165                {
 252166                    if (property.Value.ValueKind == JsonValueKind.Null)
 167                    {
 168                        continue;
 169                    }
 252170                    etag = property.Value.GetString();
 252171                    continue;
 172                }
 1448173                if (property.NameEquals("id"))
 174                {
 264175                    if (property.Value.ValueKind == JsonValueKind.Null)
 176                    {
 177                        continue;
 178                    }
 264179                    id = property.Value.GetString();
 264180                    continue;
 181                }
 1184182                if (property.NameEquals("name"))
 183                {
 252184                    if (property.Value.ValueKind == JsonValueKind.Null)
 185                    {
 186                        continue;
 187                    }
 252188                    name = property.Value.GetString();
 252189                    continue;
 190                }
 932191                if (property.NameEquals("type"))
 192                {
 228193                    if (property.Value.ValueKind == JsonValueKind.Null)
 194                    {
 195                        continue;
 196                    }
 228197                    type = property.Value.GetString();
 228198                    continue;
 199                }
 704200                if (property.NameEquals("location"))
 201                {
 228202                    if (property.Value.ValueKind == JsonValueKind.Null)
 203                    {
 204                        continue;
 205                    }
 228206                    location = property.Value.GetString();
 228207                    continue;
 208                }
 476209                if (property.NameEquals("tags"))
 210                {
 224211                    if (property.Value.ValueKind == JsonValueKind.Null)
 212                    {
 213                        continue;
 214                    }
 224215                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 896216                    foreach (var property0 in property.Value.EnumerateObject())
 217                    {
 224218                        if (property0.Value.ValueKind == JsonValueKind.Null)
 219                        {
 0220                            dictionary.Add(property0.Name, null);
 221                        }
 222                        else
 223                        {
 224224                            dictionary.Add(property0.Name, property0.Value.GetString());
 225                        }
 226                    }
 224227                    tags = dictionary;
 224228                    continue;
 229                }
 252230                if (property.NameEquals("properties"))
 231                {
 5312232                    foreach (var property0 in property.Value.EnumerateObject())
 233                    {
 2404234                        if (property0.NameEquals("virtualMachine"))
 235                        {
 40236                            if (property0.Value.ValueKind == JsonValueKind.Null)
 237                            {
 238                                continue;
 239                            }
 40240                            virtualMachine = SubResource.DeserializeSubResource(property0.Value);
 40241                            continue;
 242                        }
 2364243                        if (property0.NameEquals("networkSecurityGroup"))
 244                        {
 48245                            if (property0.Value.ValueKind == JsonValueKind.Null)
 246                            {
 247                                continue;
 248                            }
 48249                            networkSecurityGroup = NetworkSecurityGroup.DeserializeNetworkSecurityGroup(property0.Value)
 48250                            continue;
 251                        }
 2316252                        if (property0.NameEquals("privateEndpoint"))
 253                        {
 0254                            if (property0.Value.ValueKind == JsonValueKind.Null)
 255                            {
 256                                continue;
 257                            }
 0258                            privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(property0.Value);
 0259                            continue;
 260                        }
 2316261                        if (property0.NameEquals("ipConfigurations"))
 262                        {
 252263                            if (property0.Value.ValueKind == JsonValueKind.Null)
 264                            {
 265                                continue;
 266                            }
 252267                            List<NetworkInterfaceIPConfiguration> array = new List<NetworkInterfaceIPConfiguration>();
 1104268                            foreach (var item in property0.Value.EnumerateArray())
 269                            {
 300270                                if (item.ValueKind == JsonValueKind.Null)
 271                                {
 0272                                    array.Add(null);
 273                                }
 274                                else
 275                                {
 300276                                    array.Add(NetworkInterfaceIPConfiguration.DeserializeNetworkInterfaceIPConfiguration
 277                                }
 278                            }
 252279                            ipConfigurations = array;
 252280                            continue;
 281                        }
 2064282                        if (property0.NameEquals("tapConfigurations"))
 283                        {
 252284                            if (property0.Value.ValueKind == JsonValueKind.Null)
 285                            {
 286                                continue;
 287                            }
 252288                            List<NetworkInterfaceTapConfiguration> array = new List<NetworkInterfaceTapConfiguration>();
 0289                            foreach (var item in property0.Value.EnumerateArray())
 290                            {
 0291                                if (item.ValueKind == JsonValueKind.Null)
 292                                {
 0293                                    array.Add(null);
 294                                }
 295                                else
 296                                {
 0297                                    array.Add(NetworkInterfaceTapConfiguration.DeserializeNetworkInterfaceTapConfigurati
 298                                }
 299                            }
 252300                            tapConfigurations = array;
 252301                            continue;
 302                        }
 1812303                        if (property0.NameEquals("dnsSettings"))
 304                        {
 252305                            if (property0.Value.ValueKind == JsonValueKind.Null)
 306                            {
 307                                continue;
 308                            }
 252309                            dnsSettings = NetworkInterfaceDnsSettings.DeserializeNetworkInterfaceDnsSettings(property0.V
 252310                            continue;
 311                        }
 1560312                        if (property0.NameEquals("macAddress"))
 313                        {
 40314                            if (property0.Value.ValueKind == JsonValueKind.Null)
 315                            {
 316                                continue;
 317                            }
 40318                            macAddress = property0.Value.GetString();
 40319                            continue;
 320                        }
 1520321                        if (property0.NameEquals("primary"))
 322                        {
 32323                            if (property0.Value.ValueKind == JsonValueKind.Null)
 324                            {
 325                                continue;
 326                            }
 32327                            primary = property0.Value.GetBoolean();
 32328                            continue;
 329                        }
 1488330                        if (property0.NameEquals("enableAcceleratedNetworking"))
 331                        {
 252332                            if (property0.Value.ValueKind == JsonValueKind.Null)
 333                            {
 334                                continue;
 335                            }
 252336                            enableAcceleratedNetworking = property0.Value.GetBoolean();
 252337                            continue;
 338                        }
 1236339                        if (property0.NameEquals("enableIPForwarding"))
 340                        {
 252341                            if (property0.Value.ValueKind == JsonValueKind.Null)
 342                            {
 343                                continue;
 344                            }
 252345                            enableIPForwarding = property0.Value.GetBoolean();
 252346                            continue;
 347                        }
 984348                        if (property0.NameEquals("hostedWorkloads"))
 349                        {
 252350                            if (property0.Value.ValueKind == JsonValueKind.Null)
 351                            {
 352                                continue;
 353                            }
 252354                            List<string> array = new List<string>();
 0355                            foreach (var item in property0.Value.EnumerateArray())
 356                            {
 0357                                if (item.ValueKind == JsonValueKind.Null)
 358                                {
 0359                                    array.Add(null);
 360                                }
 361                                else
 362                                {
 0363                                    array.Add(item.GetString());
 364                                }
 365                            }
 252366                            hostedWorkloads = array;
 252367                            continue;
 368                        }
 732369                        if (property0.NameEquals("resourceGuid"))
 370                        {
 252371                            if (property0.Value.ValueKind == JsonValueKind.Null)
 372                            {
 373                                continue;
 374                            }
 252375                            resourceGuid = property0.Value.GetString();
 252376                            continue;
 377                        }
 480378                        if (property0.NameEquals("provisioningState"))
 379                        {
 252380                            if (property0.Value.ValueKind == JsonValueKind.Null)
 381                            {
 382                                continue;
 383                            }
 252384                            provisioningState = new ProvisioningState(property0.Value.GetString());
 385                            continue;
 386                        }
 387                    }
 388                    continue;
 389                }
 390            }
 264391            return new NetworkInterface(id, name, type, location, tags, etag, virtualMachine, networkSecurityGroup, priv
 392        }
 393    }
 394}