< Summary

Class:Azure.ResourceManager.Compute.Models.DataDisk
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DataDisk.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DataDisk.Serialization.cs
Covered lines:112
Uncovered lines:14
Coverable lines:126
Total lines:271
Line coverage:88.8% (112 of 126)
Covered branches:58
Total branches:66
Branch coverage:87.8% (58 of 66)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%100%
get_Lun()-100%100%
get_Name()-100%100%
get_Vhd()-100%100%
get_Image()-100%100%
get_Caching()-100%100%
get_WriteAcceleratorEnabled()-100%100%
get_CreateOption()-100%100%
get_DiskSizeGB()-100%100%
get_ManagedDisk()-100%100%
get_ToBeDetached()-100%100%
get_DiskIopsReadWrite()-100%100%
get_DiskMBpsReadWrite()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-78.38%80%
DeserializeDataDisk(...)-89.83%91.3%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DataDisk.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> Describes a data disk. </summary>
 11    public partial class DataDisk
 12    {
 13        /// <summary> Initializes a new instance of DataDisk. </summary>
 14        /// <param name="lun"> Specifies the logical unit number of the data disk. This value is used to identify data d
 15        /// <param name="createOption"> Specifies how the virtual machine should be created.&lt;br&gt;&lt;br&gt; Possibl
 3216        public DataDisk(int lun, DiskCreateOptionTypes createOption)
 17        {
 3218            Lun = lun;
 3219            CreateOption = createOption;
 3220        }
 21
 22        /// <summary> Initializes a new instance of DataDisk. </summary>
 23        /// <param name="lun"> Specifies the logical unit number of the data disk. This value is used to identify data d
 24        /// <param name="name"> The disk name. </param>
 25        /// <param name="vhd"> The virtual hard disk. </param>
 26        /// <param name="image"> The source user image virtual hard disk. The virtual hard disk will be copied before be
 27        /// <param name="caching"> Specifies the caching requirements. &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&
 28        /// <param name="writeAcceleratorEnabled"> Specifies whether writeAccelerator should be enabled or disabled on t
 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>
 32        /// <param name="toBeDetached"> Specifies whether the data disk is in process of detachment from the VirtualMach
 33        /// <param name="diskIopsReadWrite"> Specifies the Read-Write IOPS for the managed disk when StorageAccountType 
 34        /// <param name="diskMBpsReadWrite"> Specifies the bandwidth in MB per second for the managed disk when StorageA
 20835        internal DataDisk(int lun, string name, VirtualHardDisk vhd, VirtualHardDisk image, CachingTypes? caching, bool?
 36        {
 20837            Lun = lun;
 20838            Name = name;
 20839            Vhd = vhd;
 20840            Image = image;
 20841            Caching = caching;
 20842            WriteAcceleratorEnabled = writeAcceleratorEnabled;
 20843            CreateOption = createOption;
 20844            DiskSizeGB = diskSizeGB;
 20845            ManagedDisk = managedDisk;
 20846            ToBeDetached = toBeDetached;
 20847            DiskIopsReadWrite = diskIopsReadWrite;
 20848            DiskMBpsReadWrite = diskMBpsReadWrite;
 20849        }
 50
 51        /// <summary> Specifies the logical unit number of the data disk. This value is used to identify data disks with
 48452        public int Lun { get; set; }
 53        /// <summary> The disk name. </summary>
 42854        public string Name { get; set; }
 55        /// <summary> The virtual hard disk. </summary>
 38856        public VirtualHardDisk Vhd { get; set; }
 57        /// <summary> The source user image virtual hard disk. The virtual hard disk will be copied before being attache
 32058        public VirtualHardDisk Image { get; set; }
 59        /// <summary> Specifies the caching requirements. &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&gt;&lt;br&gt;
 53260        public CachingTypes? Caching { get; set; }
 61        /// <summary> Specifies whether writeAccelerator should be enabled or disabled on the disk. </summary>
 30462        public bool? WriteAcceleratorEnabled { get; set; }
 63        /// <summary> Specifies how the virtual machine should be created.&lt;br&gt;&lt;br&gt; Possible values are:&lt;b
 46464        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
 54466        public int? DiskSizeGB { get; set; }
 67        /// <summary> The managed disk parameters. </summary>
 60468        public ManagedDiskParameters ManagedDisk { get; set; }
 69        /// <summary> Specifies whether the data disk is in process of detachment from the VirtualMachine/VirtualMachine
 30470        public bool? ToBeDetached { get; set; }
 71        /// <summary> Specifies the Read-Write IOPS for the managed disk when StorageAccountType is UltraSSD_LRS. Return
 8072        public long? DiskIopsReadWrite { get; }
 73        /// <summary> Specifies the bandwidth in MB per second for the managed disk when StorageAccountType is UltraSSD_
 8074        public long? DiskMBpsReadWrite { get; }
 75    }
 76}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DataDisk.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 DataDisk : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 8017            writer.WriteStartObject();
 8018            writer.WritePropertyName("lun");
 8019            writer.WriteNumberValue(Lun);
 8020            if (Name != null)
 21            {
 4822                writer.WritePropertyName("name");
 4823                writer.WriteStringValue(Name);
 24            }
 8025            if (Vhd != null)
 26            {
 4827                writer.WritePropertyName("vhd");
 4828                writer.WriteObjectValue(Vhd);
 29            }
 8030            if (Image != null)
 31            {
 032                writer.WritePropertyName("image");
 033                writer.WriteObjectValue(Image);
 34            }
 8035            if (Caching != null)
 36            {
 8037                writer.WritePropertyName("caching");
 8038                writer.WriteStringValue(Caching.Value.ToSerialString());
 39            }
 8040            if (WriteAcceleratorEnabled != null)
 41            {
 042                writer.WritePropertyName("writeAcceleratorEnabled");
 043                writer.WriteBooleanValue(WriteAcceleratorEnabled.Value);
 44            }
 8045            writer.WritePropertyName("createOption");
 8046            writer.WriteStringValue(CreateOption.ToString());
 8047            if (DiskSizeGB != null)
 48            {
 8049                writer.WritePropertyName("diskSizeGB");
 8050                writer.WriteNumberValue(DiskSizeGB.Value);
 51            }
 8052            if (ManagedDisk != null)
 53            {
 3254                writer.WritePropertyName("managedDisk");
 3255                writer.WriteObjectValue(ManagedDisk);
 56            }
 8057            if (ToBeDetached != null)
 58            {
 1659                writer.WritePropertyName("toBeDetached");
 1660                writer.WriteBooleanValue(ToBeDetached.Value);
 61            }
 8062            if (DiskIopsReadWrite != null)
 63            {
 064                writer.WritePropertyName("diskIOPSReadWrite");
 065                writer.WriteNumberValue(DiskIopsReadWrite.Value);
 66            }
 8067            if (DiskMBpsReadWrite != null)
 68            {
 069                writer.WritePropertyName("diskMBpsReadWrite");
 070                writer.WriteNumberValue(DiskMBpsReadWrite.Value);
 71            }
 8072            writer.WriteEndObject();
 8073        }
 74
 75        internal static DataDisk DeserializeDataDisk(JsonElement element)
 76        {
 18077            int lun = default;
 18078            string name = default;
 18079            VirtualHardDisk vhd = default;
 18080            VirtualHardDisk image = default;
 18081            CachingTypes? caching = default;
 18082            bool? writeAcceleratorEnabled = default;
 18083            DiskCreateOptionTypes createOption = default;
 18084            int? diskSizeGB = default;
 18085            ManagedDiskParameters managedDisk = default;
 18086            bool? toBeDetached = default;
 18087            long? diskIOPSReadWrite = default;
 18088            long? diskMBpsReadWrite = default;
 294489            foreach (var property in element.EnumerateObject())
 90            {
 129291                if (property.NameEquals("lun"))
 92                {
 18093                    lun = property.Value.GetInt32();
 18094                    continue;
 95                }
 111296                if (property.NameEquals("name"))
 97                {
 18098                    if (property.Value.ValueKind == JsonValueKind.Null)
 99                    {
 100                        continue;
 101                    }
 180102                    name = property.Value.GetString();
 180103                    continue;
 104                }
 932105                if (property.NameEquals("vhd"))
 106                {
 48107                    if (property.Value.ValueKind == JsonValueKind.Null)
 108                    {
 109                        continue;
 110                    }
 48111                    vhd = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
 48112                    continue;
 113                }
 884114                if (property.NameEquals("image"))
 115                {
 0116                    if (property.Value.ValueKind == JsonValueKind.Null)
 117                    {
 118                        continue;
 119                    }
 0120                    image = VirtualHardDisk.DeserializeVirtualHardDisk(property.Value);
 0121                    continue;
 122                }
 884123                if (property.NameEquals("caching"))
 124                {
 180125                    if (property.Value.ValueKind == JsonValueKind.Null)
 126                    {
 127                        continue;
 128                    }
 180129                    caching = property.Value.GetString().ToCachingTypes();
 180130                    continue;
 131                }
 704132                if (property.NameEquals("writeAcceleratorEnabled"))
 133                {
 0134                    if (property.Value.ValueKind == JsonValueKind.Null)
 135                    {
 136                        continue;
 137                    }
 0138                    writeAcceleratorEnabled = property.Value.GetBoolean();
 0139                    continue;
 140                }
 704141                if (property.NameEquals("createOption"))
 142                {
 180143                    createOption = new DiskCreateOptionTypes(property.Value.GetString());
 180144                    continue;
 145                }
 524146                if (property.NameEquals("diskSizeGB"))
 147                {
 180148                    if (property.Value.ValueKind == JsonValueKind.Null)
 149                    {
 150                        continue;
 151                    }
 180152                    diskSizeGB = property.Value.GetInt32();
 180153                    continue;
 154                }
 344155                if (property.NameEquals("managedDisk"))
 156                {
 132157                    if (property.Value.ValueKind == JsonValueKind.Null)
 158                    {
 159                        continue;
 160                    }
 132161                    managedDisk = ManagedDiskParameters.DeserializeManagedDiskParameters(property.Value);
 132162                    continue;
 163                }
 212164                if (property.NameEquals("toBeDetached"))
 165                {
 180166                    if (property.Value.ValueKind == JsonValueKind.Null)
 167                    {
 168                        continue;
 169                    }
 180170                    toBeDetached = property.Value.GetBoolean();
 180171                    continue;
 172                }
 32173                if (property.NameEquals("diskIOPSReadWrite"))
 174                {
 16175                    if (property.Value.ValueKind == JsonValueKind.Null)
 176                    {
 177                        continue;
 178                    }
 16179                    diskIOPSReadWrite = property.Value.GetInt64();
 16180                    continue;
 181                }
 16182                if (property.NameEquals("diskMBpsReadWrite"))
 183                {
 16184                    if (property.Value.ValueKind == JsonValueKind.Null)
 185                    {
 186                        continue;
 187                    }
 16188                    diskMBpsReadWrite = property.Value.GetInt64();
 189                    continue;
 190                }
 191            }
 180192            return new DataDisk(lun, name, vhd, image, caching, writeAcceleratorEnabled, createOption, diskSizeGB, manag
 193        }
 194    }
 195}