< Summary

Class:Azure.ResourceManager.Compute.Models.VirtualMachineScaleSetOSDisk
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSetOSDisk.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSetOSDisk.Serialization.cs
Covered lines:94
Uncovered lines:21
Coverable lines:115
Total lines:258
Line coverage:81.7% (94 of 115)
Covered branches:51
Total branches:64
Branch coverage:79.6% (51 of 64)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%100%
get_Name()-100%100%
get_Caching()-100%100%
get_WriteAcceleratorEnabled()-100%100%
get_CreateOption()-100%100%
get_DiffDiskSettings()-100%100%
get_DiskSizeGB()-100%100%
get_OsType()-100%100%
get_Image()-100%100%
get_VhdContainers()-100%100%
get_ManagedDisk()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-77.14%80%
DeserializeVirtualMachineScaleSetOSDisk(...)-76.36%79.55%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSetOSDisk.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.Compute.Models
 11{
 12    /// <summary> Describes a virtual machine scale set operating system disk. </summary>
 13    public partial class VirtualMachineScaleSetOSDisk
 14    {
 15        /// <summary> Initializes a new instance of VirtualMachineScaleSetOSDisk. </summary>
 16        /// <param name="createOption"> Specifies how the virtual machines in the scale set should be created.&lt;br&gt;
 6017        public VirtualMachineScaleSetOSDisk(DiskCreateOptionTypes createOption)
 18        {
 6019            CreateOption = createOption;
 6020        }
 21
 22        /// <summary> Initializes a new instance of VirtualMachineScaleSetOSDisk. </summary>
 23        /// <param name="name"> The disk name. </param>
 24        /// <param name="caching"> Specifies the caching requirements. &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&
 25        /// <param name="writeAcceleratorEnabled"> Specifies whether writeAccelerator should be enabled or disabled on t
 26        /// <param name="createOption"> Specifies how the virtual machines in the scale set should be created.&lt;br&gt;
 27        /// <param name="diffDiskSettings"> Specifies the ephemeral disk Settings for the operating system disk used by 
 28        /// <param name="diskSizeGB"> Specifies the size of the operating system disk in gigabytes. This element can be 
 29        /// <param name="osType"> This property allows you to specify the type of the OS that is included in the disk if
 30        /// <param name="image"> Specifies information about the unmanaged user image to base the scale set on. </param>
 31        /// <param name="vhdContainers"> Specifies the container urls that are used to store operating system disks for 
 32        /// <param name="managedDisk"> The managed disk parameters. </param>
 44833        internal VirtualMachineScaleSetOSDisk(string name, CachingTypes? caching, bool? writeAcceleratorEnabled, DiskCre
 34        {
 44835            Name = name;
 44836            Caching = caching;
 44837            WriteAcceleratorEnabled = writeAcceleratorEnabled;
 44838            CreateOption = createOption;
 44839            DiffDiskSettings = diffDiskSettings;
 44840            DiskSizeGB = diskSizeGB;
 44841            OsType = osType;
 44842            Image = image;
 44843            VhdContainers = vhdContainers;
 44844            ManagedDisk = managedDisk;
 44845        }
 46
 47        /// <summary> The disk name. </summary>
 92048        public string Name { get; set; }
 49        /// <summary> Specifies the caching requirements. &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&gt;&lt;br&gt;
 98450        public CachingTypes? Caching { get; set; }
 51        /// <summary> Specifies whether writeAccelerator should be enabled or disabled on the disk. </summary>
 58052        public bool? WriteAcceleratorEnabled { get; set; }
 53        /// <summary> Specifies how the virtual machines in the scale set should be created.&lt;br&gt;&lt;br&gt; The onl
 66854        public DiskCreateOptionTypes CreateOption { get; set; }
 55        /// <summary> Specifies the ephemeral disk Settings for the operating system disk used by the virtual machine sc
 60456        public DiffDiskSettings DiffDiskSettings { get; set; }
 57        /// <summary> Specifies the size of the operating system disk in gigabytes. This element can be used to overwrit
 82058        public int? DiskSizeGB { get; set; }
 59        /// <summary> This property allows you to specify the type of the OS that is included in the disk if creating a 
 58460        public OperatingSystemTypes? OsType { get; set; }
 61        /// <summary> Specifies information about the unmanaged user image to base the scale set on. </summary>
 65262        public VirtualHardDisk Image { get; set; }
 63        /// <summary> Specifies the container urls that are used to store operating system disks for the scale set. </su
 75664        public IList<string> VhdContainers { get; set; }
 65        /// <summary> The managed disk parameters. </summary>
 97266        public VirtualMachineScaleSetManagedDiskParameters ManagedDisk { get; set; }
 67    }
 68}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSetOSDisk.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 VirtualMachineScaleSetOSDisk : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 13218            writer.WriteStartObject();
 13219            if (Name != null)
 20            {
 11621                writer.WritePropertyName("name");
 11622                writer.WriteStringValue(Name);
 23            }
 13224            if (Caching != null)
 25            {
 13226                writer.WritePropertyName("caching");
 13227                writer.WriteStringValue(Caching.Value.ToSerialString());
 28            }
 13229            if (WriteAcceleratorEnabled != null)
 30            {
 031                writer.WritePropertyName("writeAcceleratorEnabled");
 032                writer.WriteBooleanValue(WriteAcceleratorEnabled.Value);
 33            }
 13234            writer.WritePropertyName("createOption");
 13235            writer.WriteStringValue(CreateOption.ToString());
 13236            if (DiffDiskSettings != null)
 37            {
 038                writer.WritePropertyName("diffDiskSettings");
 039                writer.WriteObjectValue(DiffDiskSettings);
 40            }
 13241            if (DiskSizeGB != null)
 42            {
 1643                writer.WritePropertyName("diskSizeGB");
 1644                writer.WriteNumberValue(DiskSizeGB.Value);
 45            }
 13246            if (OsType != null)
 47            {
 048                writer.WritePropertyName("osType");
 049                writer.WriteStringValue(OsType.Value.ToSerialString());
 50            }
 13251            if (Image != null)
 52            {
 053                writer.WritePropertyName("image");
 054                writer.WriteObjectValue(Image);
 55            }
 13256            if (VhdContainers != null)
 57            {
 11658                writer.WritePropertyName("vhdContainers");
 11659                writer.WriteStartArray();
 46460                foreach (var item in VhdContainers)
 61                {
 11662                    writer.WriteStringValue(item);
 63                }
 11664                writer.WriteEndArray();
 65            }
 13266            if (ManagedDisk != null)
 67            {
 868                writer.WritePropertyName("managedDisk");
 869                writer.WriteObjectValue(ManagedDisk);
 70            }
 13271            writer.WriteEndObject();
 13272        }
 73
 74        internal static VirtualMachineScaleSetOSDisk DeserializeVirtualMachineScaleSetOSDisk(JsonElement element)
 75        {
 44876            string name = default;
 44877            CachingTypes? caching = default;
 44878            bool? writeAcceleratorEnabled = default;
 44879            DiskCreateOptionTypes createOption = default;
 44880            DiffDiskSettings diffDiskSettings = default;
 44881            int? diskSizeGB = default;
 44882            OperatingSystemTypes? osType = default;
 44883            VirtualHardDisk image = default;
 44884            IList<string> vhdContainers = default;
 44885            VirtualMachineScaleSetManagedDiskParameters managedDisk = default;
 448086            foreach (var property in element.EnumerateObject())
 87            {
 179288                if (property.NameEquals("name"))
 89                {
 14890                    if (property.Value.ValueKind == JsonValueKind.Null)
 91                    {
 92                        continue;
 93                    }
 14894                    name = property.Value.GetString();
 14895                    continue;
 96                }
 164497                if (property.NameEquals("caching"))
 98                {
 44899                    if (property.Value.ValueKind == JsonValueKind.Null)
 100                    {
 101                        continue;
 102                    }
 448103                    caching = property.Value.GetString().ToCachingTypes();
 448104                    continue;
 105                }
 1196106                if (property.NameEquals("writeAcceleratorEnabled"))
 107                {
 0108                    if (property.Value.ValueKind == JsonValueKind.Null)
 109                    {
 110                        continue;
 111                    }
 0112                    writeAcceleratorEnabled = property.Value.GetBoolean();
 0113                    continue;
 114                }
 1196115                if (property.NameEquals("createOption"))
 116                {
 448117                    createOption = new DiskCreateOptionTypes(property.Value.GetString());
 448118                    continue;
 119                }
 748120                if (property.NameEquals("diffDiskSettings"))
 121                {
 0122                    if (property.Value.ValueKind == JsonValueKind.Null)
 123                    {
 124                        continue;
 125                    }
 0126                    diffDiskSettings = DiffDiskSettings.DeserializeDiffDiskSettings(property.Value);
 0127                    continue;
 128                }
 748129                if (property.NameEquals("diskSizeGB"))
 130                {
 300131                    if (property.Value.ValueKind == JsonValueKind.Null)
 132                    {
 133                        continue;
 134                    }
 300135                    diskSizeGB = property.Value.GetInt32();
 300136                    continue;
 137                }
 448138                if (property.NameEquals("osType"))
 139                {
 0140                    if (property.Value.ValueKind == JsonValueKind.Null)
 141                    {
 142                        continue;
 143                    }
 0144                    osType = property.Value.GetString().ToOperatingSystemTypes();
 0145                    continue;
 146                }
 448147                if (property.NameEquals("image"))
 148                {
 0149                    if (property.Value.ValueKind == JsonValueKind.Null)
 150                    {
 151                        continue;
 152                    }
 0153                    image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
 0154                    continue;
 155                }
 448156                if (property.NameEquals("vhdContainers"))
 157                {
 148158                    if (property.Value.ValueKind == JsonValueKind.Null)
 159                    {
 160                        continue;
 161                    }
 148162                    List<string> array = new List<string>();
 592163                    foreach (var item in property.Value.EnumerateArray())
 164                    {
 148165                        if (item.ValueKind == JsonValueKind.Null)
 166                        {
 0167                            array.Add(null);
 168                        }
 169                        else
 170                        {
 148171                            array.Add(item.GetString());
 172                        }
 173                    }
 148174                    vhdContainers = array;
 148175                    continue;
 176                }
 300177                if (property.NameEquals("managedDisk"))
 178                {
 300179                    if (property.Value.ValueKind == JsonValueKind.Null)
 180                    {
 181                        continue;
 182                    }
 300183                    managedDisk = VirtualMachineScaleSetManagedDiskParameters.DeserializeVirtualMachineScaleSetManagedDi
 184                    continue;
 185                }
 186            }
 448187            return new VirtualMachineScaleSetOSDisk(name, caching, writeAcceleratorEnabled, createOption, diffDiskSettin
 188        }
 189    }
 190}