< Summary

Class:Azure.ResourceManager.Compute.Models.ImageDisk
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDisk.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDisk.Serialization.cs
Covered lines:18
Uncovered lines:60
Coverable lines:78
Total lines:186
Line coverage:23% (18 of 78)
Covered branches:0
Total branches:44
Branch coverage:0% (0 of 44)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Snapshot()-100%100%
get_ManagedDisk()-100%100%
get_BlobUri()-100%100%
get_Caching()-100%100%
get_DiskSizeGB()-100%100%
get_StorageAccountType()-100%100%
get_DiskEncryptionSet()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeImageDisk(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDisk.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 image disk. </summary>
 11    public partial class ImageDisk
 12    {
 13        /// <summary> Initializes a new instance of ImageDisk. </summary>
 1214        public ImageDisk()
 15        {
 1216        }
 17
 18        /// <summary> Initializes a new instance of ImageDisk. </summary>
 19        /// <param name="snapshot"> The snapshot. </param>
 20        /// <param name="managedDisk"> The managedDisk. </param>
 21        /// <param name="blobUri"> The Virtual Hard Disk. </param>
 22        /// <param name="caching"> Specifies the caching requirements. &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&
 23        /// <param name="diskSizeGB"> Specifies the size of empty data disks in gigabytes. This element can be used to o
 24        /// <param name="storageAccountType"> Specifies the storage account type for the managed disk. NOTE: UltraSSD_LR
 25        /// <param name="diskEncryptionSet"> Specifies the customer managed disk encryption set resource id for the mana
 4026        internal ImageDisk(SubResource snapshot, SubResource managedDisk, string blobUri, CachingTypes? caching, int? di
 27        {
 4028            Snapshot = snapshot;
 4029            ManagedDisk = managedDisk;
 4030            BlobUri = blobUri;
 4031            Caching = caching;
 4032            DiskSizeGB = diskSizeGB;
 4033            StorageAccountType = storageAccountType;
 4034            DiskEncryptionSet = diskEncryptionSet;
 4035        }
 36
 37        /// <summary> The snapshot. </summary>
 6438        public SubResource Snapshot { get; set; }
 39        /// <summary> The managedDisk. </summary>
 6440        public SubResource ManagedDisk { get; set; }
 41        /// <summary> The Virtual Hard Disk. </summary>
 11242        public string BlobUri { get; set; }
 43        /// <summary> Specifies the caching requirements. &lt;br&gt;&lt;br&gt; Possible values are: &lt;br&gt;&lt;br&gt;
 6444        public CachingTypes? Caching { get; set; }
 45        /// <summary> Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the nam
 6846        public int? DiskSizeGB { get; set; }
 47        /// <summary> Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with 
 6448        public StorageAccountTypes? StorageAccountType { get; set; }
 49        /// <summary> Specifies the customer managed disk encryption set resource id for the managed image disk. </summa
 7250        public SubResource DiskEncryptionSet { get; set; }
 51    }
 52}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ImageDisk.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 ImageDisk : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (Snapshot != null)
 19            {
 020                writer.WritePropertyName("snapshot");
 021                writer.WriteObjectValue(Snapshot);
 22            }
 023            if (ManagedDisk != null)
 24            {
 025                writer.WritePropertyName("managedDisk");
 026                writer.WriteObjectValue(ManagedDisk);
 27            }
 028            if (BlobUri != null)
 29            {
 030                writer.WritePropertyName("blobUri");
 031                writer.WriteStringValue(BlobUri);
 32            }
 033            if (Caching != null)
 34            {
 035                writer.WritePropertyName("caching");
 036                writer.WriteStringValue(Caching.Value.ToSerialString());
 37            }
 038            if (DiskSizeGB != null)
 39            {
 040                writer.WritePropertyName("diskSizeGB");
 041                writer.WriteNumberValue(DiskSizeGB.Value);
 42            }
 043            if (StorageAccountType != null)
 44            {
 045                writer.WritePropertyName("storageAccountType");
 046                writer.WriteStringValue(StorageAccountType.Value.ToString());
 47            }
 048            if (DiskEncryptionSet != null)
 49            {
 050                writer.WritePropertyName("diskEncryptionSet");
 051                writer.WriteObjectValue(DiskEncryptionSet);
 52            }
 053            writer.WriteEndObject();
 054        }
 55
 56        internal static ImageDisk DeserializeImageDisk(JsonElement element)
 57        {
 058            SubResource snapshot = default;
 059            SubResource managedDisk = default;
 060            string blobUri = default;
 061            CachingTypes? caching = default;
 062            int? diskSizeGB = default;
 063            StorageAccountTypes? storageAccountType = default;
 064            SubResource diskEncryptionSet = default;
 065            foreach (var property in element.EnumerateObject())
 66            {
 067                if (property.NameEquals("snapshot"))
 68                {
 069                    if (property.Value.ValueKind == JsonValueKind.Null)
 70                    {
 71                        continue;
 72                    }
 073                    snapshot = SubResource.DeserializeSubResource(property.Value);
 074                    continue;
 75                }
 076                if (property.NameEquals("managedDisk"))
 77                {
 078                    if (property.Value.ValueKind == JsonValueKind.Null)
 79                    {
 80                        continue;
 81                    }
 082                    managedDisk = SubResource.DeserializeSubResource(property.Value);
 083                    continue;
 84                }
 085                if (property.NameEquals("blobUri"))
 86                {
 087                    if (property.Value.ValueKind == JsonValueKind.Null)
 88                    {
 89                        continue;
 90                    }
 091                    blobUri = property.Value.GetString();
 092                    continue;
 93                }
 094                if (property.NameEquals("caching"))
 95                {
 096                    if (property.Value.ValueKind == JsonValueKind.Null)
 97                    {
 98                        continue;
 99                    }
 0100                    caching = property.Value.GetString().ToCachingTypes();
 0101                    continue;
 102                }
 0103                if (property.NameEquals("diskSizeGB"))
 104                {
 0105                    if (property.Value.ValueKind == JsonValueKind.Null)
 106                    {
 107                        continue;
 108                    }
 0109                    diskSizeGB = property.Value.GetInt32();
 0110                    continue;
 111                }
 0112                if (property.NameEquals("storageAccountType"))
 113                {
 0114                    if (property.Value.ValueKind == JsonValueKind.Null)
 115                    {
 116                        continue;
 117                    }
 0118                    storageAccountType = new StorageAccountTypes(property.Value.GetString());
 0119                    continue;
 120                }
 0121                if (property.NameEquals("diskEncryptionSet"))
 122                {
 0123                    if (property.Value.ValueKind == JsonValueKind.Null)
 124                    {
 125                        continue;
 126                    }
 0127                    diskEncryptionSet = SubResource.DeserializeSubResource(property.Value);
 128                    continue;
 129                }
 130            }
 0131            return new ImageDisk(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryption
 132        }
 133    }
 134}