< Summary

Class:Azure.ResourceManager.Compute.Models.OSDisk
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\OSDisk.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\OSDisk.Serialization.cs
Covered lines:102
Uncovered lines:15
Coverable lines:117
Total lines:257
Line coverage:87.1% (102 of 117)
Covered branches:55
Total branches:64
Branch coverage:85.9% (55 of 64)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%100%
get_OsType()-100%100%
get_EncryptionSettings()-100%100%
get_Name()-100%100%
get_Vhd()-100%100%
get_Image()-100%100%
get_Caching()-100%100%
get_WriteAcceleratorEnabled()-100%100%
get_DiffDiskSettings()-100%100%
get_CreateOption()-100%100%
get_DiskSizeGB()-100%100%
get_ManagedDisk()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-82.86%85%
DeserializeOSDisk(...)-83.64%86.36%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\OSDisk.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
 8namespace Azure.ResourceManager.Compute.Models
 9{
 10    /// <summary> Specifies information about the operating system disk used by the virtual machine. &lt;br&gt;&lt;br&gt
 11    public partial class OSDisk
 12    {
 13        /// <summary> Initializes a new instance of OSDisk. </summary>
 14        /// <param name="createOption"> Specifies how the virtual machine should be created.&lt;br&gt;&lt;br&gt; Possibl
 11615        public OSDisk(DiskCreateOptionTypes createOption)
 16        {
 11617            CreateOption = createOption;
 11618        }
 19
 20        /// <summary> Initializes a new instance of OSDisk. </summary>
 21        /// <param name="osType"> This property allows you to specify the type of the OS that is included in the disk if
 22        /// <param name="encryptionSettings"> Specifies the encryption settings for the OS Disk. &lt;br&gt;&lt;br&gt; Mi
 23        /// <param name="name"> The disk name. </param>
 24        /// <param name="vhd"> The virtual hard disk. </param>
 25        /// <param name="image"> The source user image virtual hard disk. The virtual hard disk will be copied before be
 26        /// <param name="caching"> Specifies the caching requirements. &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&
 27        /// <param name="writeAcceleratorEnabled"> Specifies whether writeAccelerator should be enabled or disabled on t
 28        /// <param name="diffDiskSettings"> Specifies the ephemeral Disk Settings for the operating system disk used by 
 29        /// <param name="createOption"> Specifies how the virtual machine should be created.&lt;br&gt;&lt;br&gt; Possibl
 30        /// <param name="diskSizeGB"> Specifies the size of an empty data disk in gigabytes. This element can be used to
 31        /// <param name="managedDisk"> The managed disk parameters. </param>
 43632        internal OSDisk(OperatingSystemTypes? osType, DiskEncryptionSettings encryptionSettings, string name, VirtualHar
 33        {
 43634            OsType = osType;
 43635            EncryptionSettings = encryptionSettings;
 43636            Name = name;
 43637            Vhd = vhd;
 43638            Image = image;
 43639            Caching = caching;
 43640            WriteAcceleratorEnabled = writeAcceleratorEnabled;
 43641            DiffDiskSettings = diffDiskSettings;
 43642            CreateOption = createOption;
 43643            DiskSizeGB = diskSizeGB;
 43644            ManagedDisk = managedDisk;
 43645        }
 46
 47        /// <summary> This property allows you to specify the type of the OS that is included in the disk if creating a 
 69648        public OperatingSystemTypes? OsType { get; set; }
 49        /// <summary> Specifies the encryption settings for the OS Disk. &lt;br&gt;&lt;br&gt; Minimum api-version: 2015-
 68050        public DiskEncryptionSettings EncryptionSettings { get; set; }
 51        /// <summary> The disk name. </summary>
 136852        public string Name { get; set; }
 53        /// <summary> The virtual hard disk. </summary>
 140054        public VirtualHardDisk Vhd { get; set; }
 55        /// <summary> The source user image virtual hard disk. The virtual hard disk will be copied before being attache
 80856        public VirtualHardDisk Image { get; set; }
 57        /// <summary> Specifies the caching requirements. &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&gt;&lt;br&gt;
 135658        public CachingTypes? Caching { get; set; }
 59        /// <summary> Specifies whether writeAccelerator should be enabled or disabled on the disk. </summary>
 86860        public bool? WriteAcceleratorEnabled { get; set; }
 61        /// <summary> Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine. <
 69262        public DiffDiskSettings DiffDiskSettings { get; set; }
 63        /// <summary> Specifies how the virtual machine should be created.&lt;br&gt;&lt;br&gt; Possible values are:&lt;b
 79664        public DiskCreateOptionTypes CreateOption { get; set; }
 65        /// <summary> Specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the s
 70866        public int? DiskSizeGB { get; set; }
 67        /// <summary> The managed disk parameters. </summary>
 113668        public ManagedDiskParameters ManagedDisk { get; set; }
 69    }
 70}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\OSDisk.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.ResourceManager.Compute.Models
 12{
 13    public partial class OSDisk : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 24417            writer.WriteStartObject();
 24418            if (OsType != null)
 19            {
 1620                writer.WritePropertyName("osType");
 1621                writer.WriteStringValue(OsType.Value.ToSerialString());
 22            }
 24423            if (EncryptionSettings != null)
 24            {
 025                writer.WritePropertyName("encryptionSettings");
 026                writer.WriteObjectValue(EncryptionSettings);
 27            }
 24428            if (Name != null)
 29            {
 24430                writer.WritePropertyName("name");
 24431                writer.WriteStringValue(Name);
 32            }
 24433            if (Vhd != null)
 34            {
 21235                writer.WritePropertyName("vhd");
 21236                writer.WriteObjectValue(Vhd);
 37            }
 24438            if (Image != null)
 39            {
 040                writer.WritePropertyName("image");
 041                writer.WriteObjectValue(Image);
 42            }
 24443            if (Caching != null)
 44            {
 24445                writer.WritePropertyName("caching");
 24446                writer.WriteStringValue(Caching.Value.ToSerialString());
 47            }
 24448            if (WriteAcceleratorEnabled != null)
 49            {
 050                writer.WritePropertyName("writeAcceleratorEnabled");
 051                writer.WriteBooleanValue(WriteAcceleratorEnabled.Value);
 52            }
 24453            if (DiffDiskSettings != null)
 54            {
 855                writer.WritePropertyName("diffDiskSettings");
 856                writer.WriteObjectValue(DiffDiskSettings);
 57            }
 24458            writer.WritePropertyName("createOption");
 24459            writer.WriteStringValue(CreateOption.ToString());
 24460            if (DiskSizeGB != null)
 61            {
 2462                writer.WritePropertyName("diskSizeGB");
 2463                writer.WriteNumberValue(DiskSizeGB.Value);
 64            }
 24465            if (ManagedDisk != null)
 66            {
 3267                writer.WritePropertyName("managedDisk");
 3268                writer.WriteObjectValue(ManagedDisk);
 69            }
 24470            writer.WriteEndObject();
 24471        }
 72
 73        internal static OSDisk DeserializeOSDisk(JsonElement element)
 74        {
 43275            OperatingSystemTypes? osType = default;
 43276            DiskEncryptionSettings encryptionSettings = default;
 43277            string name = default;
 43278            VirtualHardDisk vhd = default;
 43279            VirtualHardDisk image = default;
 43280            CachingTypes? caching = default;
 43281            bool? writeAcceleratorEnabled = default;
 43282            DiffDiskSettings diffDiskSettings = default;
 43283            DiskCreateOptionTypes createOption = default;
 43284            int? diskSizeGB = default;
 43285            ManagedDiskParameters managedDisk = default;
 601686            foreach (var property in element.EnumerateObject())
 87            {
 257688                if (property.NameEquals("osType"))
 89                {
 43290                    if (property.Value.ValueKind == JsonValueKind.Null)
 91                    {
 92                        continue;
 93                    }
 43294                    osType = property.Value.GetString().ToOperatingSystemTypes();
 43295                    continue;
 96                }
 214497                if (property.NameEquals("encryptionSettings"))
 98                {
 099                    if (property.Value.ValueKind == JsonValueKind.Null)
 100                    {
 101                        continue;
 102                    }
 0103                    encryptionSettings = DiskEncryptionSettings.DeserializeDiskEncryptionSettings(property.Value);
 0104                    continue;
 105                }
 2144106                if (property.NameEquals("name"))
 107                {
 432108                    if (property.Value.ValueKind == JsonValueKind.Null)
 109                    {
 110                        continue;
 111                    }
 432112                    name = property.Value.GetString();
 432113                    continue;
 114                }
 1712115                if (property.NameEquals("vhd"))
 116                {
 300117                    if (property.Value.ValueKind == JsonValueKind.Null)
 118                    {
 119                        continue;
 120                    }
 300121                    vhd = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
 300122                    continue;
 123                }
 1412124                if (property.NameEquals("image"))
 125                {
 0126                    if (property.Value.ValueKind == JsonValueKind.Null)
 127                    {
 128                        continue;
 129                    }
 0130                    image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
 0131                    continue;
 132                }
 1412133                if (property.NameEquals("caching"))
 134                {
 432135                    if (property.Value.ValueKind == JsonValueKind.Null)
 136                    {
 137                        continue;
 138                    }
 432139                    caching = property.Value.GetString().ToCachingTypes();
 432140                    continue;
 141                }
 980142                if (property.NameEquals("writeAcceleratorEnabled"))
 143                {
 0144                    if (property.Value.ValueKind == JsonValueKind.Null)
 145                    {
 146                        continue;
 147                    }
 0148                    writeAcceleratorEnabled = property.Value.GetBoolean();
 0149                    continue;
 150                }
 980151                if (property.NameEquals("diffDiskSettings"))
 152                {
 16153                    if (property.Value.ValueKind == JsonValueKind.Null)
 154                    {
 155                        continue;
 156                    }
 16157                    diffDiskSettings = DiffDiskSettings.DeserializeDiffDiskSettings(property.Value);
 16158                    continue;
 159                }
 964160                if (property.NameEquals("createOption"))
 161                {
 432162                    createOption = new DiskCreateOptionTypes(property.Value.GetString());
 432163                    continue;
 164                }
 532165                if (property.NameEquals("diskSizeGB"))
 166                {
 400167                    if (property.Value.ValueKind == JsonValueKind.Null)
 168                    {
 169                        continue;
 170                    }
 400171                    diskSizeGB = property.Value.GetInt32();
 400172                    continue;
 173                }
 132174                if (property.NameEquals("managedDisk"))
 175                {
 132176                    if (property.Value.ValueKind == JsonValueKind.Null)
 177                    {
 178                        continue;
 179                    }
 132180                    managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value);
 181                    continue;
 182                }
 183            }
 432184            return new OSDisk(osType, encryptionSettings, name, vhd, image, caching, writeAcceleratorEnabled, diffDiskSe
 185        }
 186    }
 187}