< Summary

Class:Azure.ResourceManager.Compute.Models.VirtualMachineScaleSetVM
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSetVM.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSetVM.Serialization.cs
Covered lines:152
Uncovered lines:126
Coverable lines:278
Total lines:577
Line coverage:54.6% (152 of 278)
Covered branches:102
Total branches:172
Branch coverage:59.3% (102 of 172)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_InstanceId()-100%100%
get_Sku()-100%100%
get_Plan()-0%100%
get_Resources()-0%100%
get_Zones()-100%100%
get_LatestModelApplied()-0%100%
get_VmId()-0%100%
get_InstanceView()-0%100%
get_HardwareProfile()-0%100%
get_StorageProfile()-100%100%
get_AdditionalCapabilities()-0%100%
get_OsProfile()-100%100%
get_NetworkProfile()-0%100%
get_NetworkProfileConfiguration()-0%100%
get_DiagnosticsProfile()-0%100%
get_AvailabilitySet()-0%100%
get_ProvisioningState()-100%100%
get_LicenseType()-0%100%
get_ModelDefinitionApplied()-0%100%
get_ProtectionPolicy()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeVirtualMachineScaleSetVM(...)-87.32%87.93%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSetVM.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;
 9using System.Collections.Generic;
 10
 11namespace Azure.ResourceManager.Compute.Models
 12{
 13    /// <summary> Describes a virtual machine scale set virtual machine. </summary>
 14    public partial class VirtualMachineScaleSetVM : Resource
 15    {
 16        /// <summary> Initializes a new instance of VirtualMachineScaleSetVM. </summary>
 17        /// <param name="location"> Resource location. </param>
 018        public VirtualMachineScaleSetVM(string location) : base(location)
 19        {
 020            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 024        }
 25
 26        /// <summary> Initializes a new instance of VirtualMachineScaleSetVM. </summary>
 27        /// <param name="id"> Resource Id. </param>
 28        /// <param name="name"> Resource name. </param>
 29        /// <param name="type"> Resource type. </param>
 30        /// <param name="location"> Resource location. </param>
 31        /// <param name="tags"> Resource tags. </param>
 32        /// <param name="instanceId"> The virtual machine instance ID. </param>
 33        /// <param name="sku"> The virtual machine SKU. </param>
 34        /// <param name="plan"> Specifies information about the marketplace image used to create the virtual machine. Th
 35        /// <param name="resources"> The virtual machine child extension resources. </param>
 36        /// <param name="zones"> The virtual machine zones. </param>
 37        /// <param name="latestModelApplied"> Specifies whether the latest model has been applied to the virtual machine
 38        /// <param name="vmId"> Azure VM unique ID. </param>
 39        /// <param name="instanceView"> The virtual machine instance view. </param>
 40        /// <param name="hardwareProfile"> Specifies the hardware settings for the virtual machine. </param>
 41        /// <param name="storageProfile"> Specifies the storage settings for the virtual machine disks. </param>
 42        /// <param name="additionalCapabilities"> Specifies additional capabilities enabled or disabled on the virtual m
 43        /// <param name="osProfile"> Specifies the operating system settings for the virtual machine. </param>
 44        /// <param name="networkProfile"> Specifies the network interfaces of the virtual machine. </param>
 45        /// <param name="networkProfileConfiguration"> Specifies the network profile configuration of the virtual machin
 46        /// <param name="diagnosticsProfile"> Specifies the boot diagnostic settings state. &lt;br&gt;&lt;br&gt;Minimum 
 47        /// <param name="availabilitySet"> Specifies information about the availability set that the virtual machine sho
 48        /// <param name="provisioningState"> The provisioning state, which only appears in the response. </param>
 49        /// <param name="licenseType"> Specifies that the image or disk that is being used was licensed on-premises. Thi
 50        /// <param name="modelDefinitionApplied"> Specifies whether the model applied to the virtual machine is the mode
 51        /// <param name="protectionPolicy"> Specifies the protection policy of the virtual machine. </param>
 12052        internal VirtualMachineScaleSetVM(string id, string name, string type, string location, IDictionary<string, stri
 53        {
 12054            InstanceId = instanceId;
 12055            Sku = sku;
 12056            Plan = plan;
 12057            Resources = resources;
 12058            Zones = zones;
 12059            LatestModelApplied = latestModelApplied;
 12060            VmId = vmId;
 12061            InstanceView = instanceView;
 12062            HardwareProfile = hardwareProfile;
 12063            StorageProfile = storageProfile;
 12064            AdditionalCapabilities = additionalCapabilities;
 12065            OsProfile = osProfile;
 12066            NetworkProfile = networkProfile;
 12067            NetworkProfileConfiguration = networkProfileConfiguration;
 12068            DiagnosticsProfile = diagnosticsProfile;
 12069            AvailabilitySet = availabilitySet;
 12070            ProvisioningState = provisioningState;
 12071            LicenseType = licenseType;
 12072            ModelDefinitionApplied = modelDefinitionApplied;
 12073            ProtectionPolicy = protectionPolicy;
 12074        }
 75
 76        /// <summary> The virtual machine instance ID. </summary>
 2477        public string InstanceId { get; }
 78        /// <summary> The virtual machine SKU. </summary>
 3279        public Sku Sku { get; }
 80        /// <summary> Specifies information about the marketplace image used to create the virtual machine. This element
 081        public Plan Plan { get; set; }
 82        /// <summary> The virtual machine child extension resources. </summary>
 083        public IList<VirtualMachineExtension> Resources { get; }
 84        /// <summary> The virtual machine zones. </summary>
 4885        public IList<string> Zones { get; }
 86        /// <summary> Specifies whether the latest model has been applied to the virtual machine. </summary>
 087        public bool? LatestModelApplied { get; }
 88        /// <summary> Azure VM unique ID. </summary>
 089        public string VmId { get; }
 90        /// <summary> The virtual machine instance view. </summary>
 091        public VirtualMachineScaleSetVMInstanceView InstanceView { get; }
 92        /// <summary> Specifies the hardware settings for the virtual machine. </summary>
 093        public HardwareProfile HardwareProfile { get; set; }
 94        /// <summary> Specifies the storage settings for the virtual machine disks. </summary>
 42495        public StorageProfile StorageProfile { get; set; }
 96        /// <summary> Specifies additional capabilities enabled or disabled on the virtual machine in the scale set. For
 097        public AdditionalCapabilities AdditionalCapabilities { get; set; }
 98        /// <summary> Specifies the operating system settings for the virtual machine. </summary>
 15299        public OSProfile OsProfile { get; set; }
 100        /// <summary> Specifies the network interfaces of the virtual machine. </summary>
 0101        public NetworkProfile NetworkProfile { get; set; }
 102        /// <summary> Specifies the network profile configuration of the virtual machine. </summary>
 0103        public VirtualMachineScaleSetVMNetworkProfileConfiguration NetworkProfileConfiguration { get; set; }
 104        /// <summary> Specifies the boot diagnostic settings state. &lt;br&gt;&lt;br&gt;Minimum api-version: 2015-06-15.
 0105        public DiagnosticsProfile DiagnosticsProfile { get; set; }
 106        /// <summary> Specifies information about the availability set that the virtual machine should be assigned to. V
 0107        public SubResource AvailabilitySet { get; set; }
 108        /// <summary> The provisioning state, which only appears in the response. </summary>
 32109        public string ProvisioningState { get; }
 110        /// <summary> Specifies that the image or disk that is being used was licensed on-premises. This element is only
 0111        public string LicenseType { get; set; }
 112        /// <summary> Specifies whether the model applied to the virtual machine is the model of the virtual machine sca
 0113        public string ModelDefinitionApplied { get; }
 114        /// <summary> Specifies the protection policy of the virtual machine. </summary>
 0115        public VirtualMachineScaleSetVMProtectionPolicy ProtectionPolicy { get; set; }
 116    }
 117}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSetVM.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.Compute.Models
 13{
 14    public partial class VirtualMachineScaleSetVM : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (InstanceId != null)
 20            {
 021                writer.WritePropertyName("instanceId");
 022                writer.WriteStringValue(InstanceId);
 23            }
 024            if (Sku != null)
 25            {
 026                writer.WritePropertyName("sku");
 027                writer.WriteObjectValue(Sku);
 28            }
 029            if (Plan != null)
 30            {
 031                writer.WritePropertyName("plan");
 032                writer.WriteObjectValue(Plan);
 33            }
 034            if (Resources != null)
 35            {
 036                writer.WritePropertyName("resources");
 037                writer.WriteStartArray();
 038                foreach (var item in Resources)
 39                {
 040                    writer.WriteObjectValue(item);
 41                }
 042                writer.WriteEndArray();
 43            }
 044            if (Zones != null)
 45            {
 046                writer.WritePropertyName("zones");
 047                writer.WriteStartArray();
 048                foreach (var item in Zones)
 49                {
 050                    writer.WriteStringValue(item);
 51                }
 052                writer.WriteEndArray();
 53            }
 054            if (Id != null)
 55            {
 056                writer.WritePropertyName("id");
 057                writer.WriteStringValue(Id);
 58            }
 059            if (Name != null)
 60            {
 061                writer.WritePropertyName("name");
 062                writer.WriteStringValue(Name);
 63            }
 064            if (Type != null)
 65            {
 066                writer.WritePropertyName("type");
 067                writer.WriteStringValue(Type);
 68            }
 069            writer.WritePropertyName("location");
 070            writer.WriteStringValue(Location);
 071            if (Tags != null)
 72            {
 073                writer.WritePropertyName("tags");
 074                writer.WriteStartObject();
 075                foreach (var item in Tags)
 76                {
 077                    writer.WritePropertyName(item.Key);
 078                    writer.WriteStringValue(item.Value);
 79                }
 080                writer.WriteEndObject();
 81            }
 082            writer.WritePropertyName("properties");
 083            writer.WriteStartObject();
 084            if (LatestModelApplied != null)
 85            {
 086                writer.WritePropertyName("latestModelApplied");
 087                writer.WriteBooleanValue(LatestModelApplied.Value);
 88            }
 089            if (VmId != null)
 90            {
 091                writer.WritePropertyName("vmId");
 092                writer.WriteStringValue(VmId);
 93            }
 094            if (InstanceView != null)
 95            {
 096                writer.WritePropertyName("instanceView");
 097                writer.WriteObjectValue(InstanceView);
 98            }
 099            if (HardwareProfile != null)
 100            {
 0101                writer.WritePropertyName("hardwareProfile");
 0102                writer.WriteObjectValue(HardwareProfile);
 103            }
 0104            if (StorageProfile != null)
 105            {
 0106                writer.WritePropertyName("storageProfile");
 0107                writer.WriteObjectValue(StorageProfile);
 108            }
 0109            if (AdditionalCapabilities != null)
 110            {
 0111                writer.WritePropertyName("additionalCapabilities");
 0112                writer.WriteObjectValue(AdditionalCapabilities);
 113            }
 0114            if (OsProfile != null)
 115            {
 0116                writer.WritePropertyName("osProfile");
 0117                writer.WriteObjectValue(OsProfile);
 118            }
 0119            if (NetworkProfile != null)
 120            {
 0121                writer.WritePropertyName("networkProfile");
 0122                writer.WriteObjectValue(NetworkProfile);
 123            }
 0124            if (NetworkProfileConfiguration != null)
 125            {
 0126                writer.WritePropertyName("networkProfileConfiguration");
 0127                writer.WriteObjectValue(NetworkProfileConfiguration);
 128            }
 0129            if (DiagnosticsProfile != null)
 130            {
 0131                writer.WritePropertyName("diagnosticsProfile");
 0132                writer.WriteObjectValue(DiagnosticsProfile);
 133            }
 0134            if (AvailabilitySet != null)
 135            {
 0136                writer.WritePropertyName("availabilitySet");
 0137                writer.WriteObjectValue(AvailabilitySet);
 138            }
 0139            if (ProvisioningState != null)
 140            {
 0141                writer.WritePropertyName("provisioningState");
 0142                writer.WriteStringValue(ProvisioningState);
 143            }
 0144            if (LicenseType != null)
 145            {
 0146                writer.WritePropertyName("licenseType");
 0147                writer.WriteStringValue(LicenseType);
 148            }
 0149            if (ModelDefinitionApplied != null)
 150            {
 0151                writer.WritePropertyName("modelDefinitionApplied");
 0152                writer.WriteStringValue(ModelDefinitionApplied);
 153            }
 0154            if (ProtectionPolicy != null)
 155            {
 0156                writer.WritePropertyName("protectionPolicy");
 0157                writer.WriteObjectValue(ProtectionPolicy);
 158            }
 0159            writer.WriteEndObject();
 0160            writer.WriteEndObject();
 0161        }
 162
 163        internal static VirtualMachineScaleSetVM DeserializeVirtualMachineScaleSetVM(JsonElement element)
 164        {
 88165            string instanceId = default;
 88166            Sku sku = default;
 88167            Plan plan = default;
 88168            IList<VirtualMachineExtension> resources = default;
 88169            IList<string> zones = default;
 88170            string id = default;
 88171            string name = default;
 88172            string type = default;
 88173            string location = default;
 88174            IDictionary<string, string> tags = default;
 88175            bool? latestModelApplied = default;
 88176            string vmId = default;
 88177            VirtualMachineScaleSetVMInstanceView instanceView = default;
 88178            HardwareProfile hardwareProfile = default;
 88179            StorageProfile storageProfile = default;
 88180            AdditionalCapabilities additionalCapabilities = default;
 88181            OSProfile osProfile = default;
 88182            NetworkProfile networkProfile = default;
 88183            VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration = default;
 88184            DiagnosticsProfile diagnosticsProfile = default;
 88185            SubResource availabilitySet = default;
 88186            string provisioningState = default;
 88187            string licenseType = default;
 88188            string modelDefinitionApplied = default;
 88189            VirtualMachineScaleSetVMProtectionPolicy protectionPolicy = default;
 1856190            foreach (var property in element.EnumerateObject())
 191            {
 840192                if (property.NameEquals("instanceId"))
 193                {
 88194                    if (property.Value.ValueKind == JsonValueKind.Null)
 195                    {
 196                        continue;
 197                    }
 88198                    instanceId = property.Value.GetString();
 88199                    continue;
 200                }
 752201                if (property.NameEquals("sku"))
 202                {
 88203                    if (property.Value.ValueKind == JsonValueKind.Null)
 204                    {
 205                        continue;
 206                    }
 88207                    sku = Sku.DeserializeSku(property.Value);
 88208                    continue;
 209                }
 664210                if (property.NameEquals("plan"))
 211                {
 0212                    if (property.Value.ValueKind == JsonValueKind.Null)
 213                    {
 214                        continue;
 215                    }
 0216                    plan = Plan.DeserializePlan(property.Value);
 0217                    continue;
 218                }
 664219                if (property.NameEquals("resources"))
 220                {
 88221                    if (property.Value.ValueKind == JsonValueKind.Null)
 222                    {
 223                        continue;
 224                    }
 88225                    List<VirtualMachineExtension> array = new List<VirtualMachineExtension>();
 352226                    foreach (var item in property.Value.EnumerateArray())
 227                    {
 88228                        if (item.ValueKind == JsonValueKind.Null)
 229                        {
 0230                            array.Add(null);
 231                        }
 232                        else
 233                        {
 88234                            array.Add(VirtualMachineExtension.DeserializeVirtualMachineExtension(item));
 235                        }
 236                    }
 88237                    resources = array;
 88238                    continue;
 239                }
 576240                if (property.NameEquals("zones"))
 241                {
 48242                    if (property.Value.ValueKind == JsonValueKind.Null)
 243                    {
 244                        continue;
 245                    }
 48246                    List<string> array = new List<string>();
 192247                    foreach (var item in property.Value.EnumerateArray())
 248                    {
 48249                        if (item.ValueKind == JsonValueKind.Null)
 250                        {
 0251                            array.Add(null);
 252                        }
 253                        else
 254                        {
 48255                            array.Add(item.GetString());
 256                        }
 257                    }
 48258                    zones = array;
 48259                    continue;
 260                }
 528261                if (property.NameEquals("id"))
 262                {
 88263                    if (property.Value.ValueKind == JsonValueKind.Null)
 264                    {
 265                        continue;
 266                    }
 88267                    id = property.Value.GetString();
 88268                    continue;
 269                }
 440270                if (property.NameEquals("name"))
 271                {
 88272                    if (property.Value.ValueKind == JsonValueKind.Null)
 273                    {
 274                        continue;
 275                    }
 88276                    name = property.Value.GetString();
 88277                    continue;
 278                }
 352279                if (property.NameEquals("type"))
 280                {
 88281                    if (property.Value.ValueKind == JsonValueKind.Null)
 282                    {
 283                        continue;
 284                    }
 88285                    type = property.Value.GetString();
 88286                    continue;
 287                }
 264288                if (property.NameEquals("location"))
 289                {
 88290                    location = property.Value.GetString();
 88291                    continue;
 292                }
 176293                if (property.NameEquals("tags"))
 294                {
 88295                    if (property.Value.ValueKind == JsonValueKind.Null)
 296                    {
 297                        continue;
 298                    }
 88299                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 528300                    foreach (var property0 in property.Value.EnumerateObject())
 301                    {
 176302                        if (property0.Value.ValueKind == JsonValueKind.Null)
 303                        {
 0304                            dictionary.Add(property0.Name, null);
 305                        }
 306                        else
 307                        {
 176308                            dictionary.Add(property0.Name, property0.Value.GetString());
 309                        }
 310                    }
 88311                    tags = dictionary;
 88312                    continue;
 313                }
 88314                if (property.NameEquals("properties"))
 315                {
 1824316                    foreach (var property0 in property.Value.EnumerateObject())
 317                    {
 824318                        if (property0.NameEquals("latestModelApplied"))
 319                        {
 88320                            if (property0.Value.ValueKind == JsonValueKind.Null)
 321                            {
 322                                continue;
 323                            }
 88324                            latestModelApplied = property0.Value.GetBoolean();
 88325                            continue;
 326                        }
 736327                        if (property0.NameEquals("vmId"))
 328                        {
 88329                            if (property0.Value.ValueKind == JsonValueKind.Null)
 330                            {
 331                                continue;
 332                            }
 88333                            vmId = property0.Value.GetString();
 88334                            continue;
 335                        }
 648336                        if (property0.NameEquals("instanceView"))
 337                        {
 16338                            if (property0.Value.ValueKind == JsonValueKind.Null)
 339                            {
 340                                continue;
 341                            }
 16342                            instanceView = VirtualMachineScaleSetVMInstanceView.DeserializeVirtualMachineScaleSetVMInsta
 16343                            continue;
 344                        }
 632345                        if (property0.NameEquals("hardwareProfile"))
 346                        {
 88347                            if (property0.Value.ValueKind == JsonValueKind.Null)
 348                            {
 349                                continue;
 350                            }
 88351                            hardwareProfile = HardwareProfile.DeserializeHardwareProfile(property0.Value);
 88352                            continue;
 353                        }
 544354                        if (property0.NameEquals("storageProfile"))
 355                        {
 88356                            if (property0.Value.ValueKind == JsonValueKind.Null)
 357                            {
 358                                continue;
 359                            }
 88360                            storageProfile = StorageProfile.DeserializeStorageProfile(property0.Value);
 88361                            continue;
 362                        }
 456363                        if (property0.NameEquals("additionalCapabilities"))
 364                        {
 16365                            if (property0.Value.ValueKind == JsonValueKind.Null)
 366                            {
 367                                continue;
 368                            }
 16369                            additionalCapabilities = AdditionalCapabilities.DeserializeAdditionalCapabilities(property0.
 16370                            continue;
 371                        }
 440372                        if (property0.NameEquals("osProfile"))
 373                        {
 88374                            if (property0.Value.ValueKind == JsonValueKind.Null)
 375                            {
 376                                continue;
 377                            }
 88378                            osProfile = OSProfile.DeserializeOSProfile(property0.Value);
 88379                            continue;
 380                        }
 352381                        if (property0.NameEquals("networkProfile"))
 382                        {
 88383                            if (property0.Value.ValueKind == JsonValueKind.Null)
 384                            {
 385                                continue;
 386                            }
 88387                            networkProfile = NetworkProfile.DeserializeNetworkProfile(property0.Value);
 88388                            continue;
 389                        }
 264390                        if (property0.NameEquals("networkProfileConfiguration"))
 391                        {
 88392                            if (property0.Value.ValueKind == JsonValueKind.Null)
 393                            {
 394                                continue;
 395                            }
 88396                            networkProfileConfiguration = VirtualMachineScaleSetVMNetworkProfileConfiguration.Deserializ
 88397                            continue;
 398                        }
 176399                        if (property0.NameEquals("diagnosticsProfile"))
 400                        {
 0401                            if (property0.Value.ValueKind == JsonValueKind.Null)
 402                            {
 403                                continue;
 404                            }
 0405                            diagnosticsProfile = DiagnosticsProfile.DeserializeDiagnosticsProfile(property0.Value);
 0406                            continue;
 407                        }
 176408                        if (property0.NameEquals("availabilitySet"))
 409                        {
 0410                            if (property0.Value.ValueKind == JsonValueKind.Null)
 411                            {
 412                                continue;
 413                            }
 0414                            availabilitySet = SubResource.DeserializeSubResource(property0.Value);
 0415                            continue;
 416                        }
 176417                        if (property0.NameEquals("provisioningState"))
 418                        {
 88419                            if (property0.Value.ValueKind == JsonValueKind.Null)
 420                            {
 421                                continue;
 422                            }
 88423                            provisioningState = property0.Value.GetString();
 88424                            continue;
 425                        }
 88426                        if (property0.NameEquals("licenseType"))
 427                        {
 0428                            if (property0.Value.ValueKind == JsonValueKind.Null)
 429                            {
 430                                continue;
 431                            }
 0432                            licenseType = property0.Value.GetString();
 0433                            continue;
 434                        }
 88435                        if (property0.NameEquals("modelDefinitionApplied"))
 436                        {
 88437                            if (property0.Value.ValueKind == JsonValueKind.Null)
 438                            {
 439                                continue;
 440                            }
 88441                            modelDefinitionApplied = property0.Value.GetString();
 88442                            continue;
 443                        }
 0444                        if (property0.NameEquals("protectionPolicy"))
 445                        {
 0446                            if (property0.Value.ValueKind == JsonValueKind.Null)
 447                            {
 448                                continue;
 449                            }
 0450                            protectionPolicy = VirtualMachineScaleSetVMProtectionPolicy.DeserializeVirtualMachineScaleSe
 451                            continue;
 452                        }
 453                    }
 454                    continue;
 455                }
 456            }
 88457            return new VirtualMachineScaleSetVM(id, name, type, location, tags, instanceId, sku, plan, resources, zones,
 458        }
 459    }
 460}