< Summary

Class:Azure.ResourceManager.Compute.Models.CreationData
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\CreationData.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\CreationData.Serialization.cs
Covered lines:78
Uncovered lines:9
Coverable lines:87
Total lines:200
Line coverage:89.6% (78 of 87)
Covered branches:41
Total branches:46
Branch coverage:89.1% (41 of 46)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%100%
get_CreateOption()-100%100%
get_StorageAccountId()-100%100%
get_ImageReference()-100%100%
get_GalleryImageReference()-100%100%
get_SourceUri()-100%100%
get_SourceResourceId()-100%100%
get_SourceUniqueId()-100%100%
get_UploadSizeBytes()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-76.92%78.57%
DeserializeCreationData(...)-92.5%93.75%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\CreationData.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> Data used when creating a disk. </summary>
 11    public partial class CreationData
 12    {
 13        /// <summary> Initializes a new instance of CreationData. </summary>
 14        /// <param name="createOption"> This enumerates the possible sources of a disk&apos;s creation. </param>
 6815        public CreationData(DiskCreateOption createOption)
 16        {
 6817            CreateOption = createOption;
 6818        }
 19
 20        /// <summary> Initializes a new instance of CreationData. </summary>
 21        /// <param name="createOption"> This enumerates the possible sources of a disk&apos;s creation. </param>
 22        /// <param name="storageAccountId"> Required if createOption is Import. The Azure Resource Manager identifier of
 23        /// <param name="imageReference"> Disk source information. </param>
 24        /// <param name="galleryImageReference"> Required if creating from a Gallery Image. The id of the ImageDiskRefer
 25        /// <param name="sourceUri"> If createOption is Import, this is the URI of a blob to be imported into a managed 
 26        /// <param name="sourceResourceId"> If createOption is Copy, this is the ARM id of the source snapshot or disk. 
 27        /// <param name="sourceUniqueId"> If this field is set, this is the unique id identifying the source of this res
 28        /// <param name="uploadSizeBytes"> If createOption is Upload, this is the size of the contents of the upload inc
 34029        internal CreationData(DiskCreateOption createOption, string storageAccountId, ImageDiskReference imageReference,
 30        {
 34031            CreateOption = createOption;
 34032            StorageAccountId = storageAccountId;
 34033            ImageReference = imageReference;
 34034            GalleryImageReference = galleryImageReference;
 34035            SourceUri = sourceUri;
 34036            SourceResourceId = sourceResourceId;
 34037            SourceUniqueId = sourceUniqueId;
 34038            UploadSizeBytes = uploadSizeBytes;
 34039        }
 40
 41        /// <summary> This enumerates the possible sources of a disk&apos;s creation. </summary>
 91642        public DiskCreateOption CreateOption { get; set; }
 43        /// <summary> Required if createOption is Import. The Azure Resource Manager identifier of the storage account c
 89244        public string StorageAccountId { get; set; }
 45        /// <summary> Disk source information. </summary>
 84046        public ImageDiskReference ImageReference { get; set; }
 47        /// <summary> Required if creating from a Gallery Image. The id of the ImageDiskReference will be the ARM id of 
 84048        public ImageDiskReference GalleryImageReference { get; set; }
 49        /// <summary> If createOption is Import, this is the URI of a blob to be imported into a managed disk. </summary
 89250        public string SourceUri { get; set; }
 51        /// <summary> If createOption is Copy, this is the ARM id of the source snapshot or disk. </summary>
 88852        public string SourceResourceId { get; set; }
 53        /// <summary> If this field is set, this is the unique id identifying the source of this resource. </summary>
 26854        public string SourceUniqueId { get; }
 55        /// <summary> If createOption is Upload, this is the size of the contents of the upload including the VHD footer
 58056        public long? UploadSizeBytes { get; set; }
 57    }
 58}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\CreationData.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 CreationData : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 22817            writer.WriteStartObject();
 22818            writer.WritePropertyName("createOption");
 22819            writer.WriteStringValue(CreateOption.ToString());
 22820            if (StorageAccountId != null)
 21            {
 4022                writer.WritePropertyName("storageAccountId");
 4023                writer.WriteStringValue(StorageAccountId);
 24            }
 22825            if (ImageReference != null)
 26            {
 027                writer.WritePropertyName("imageReference");
 028                writer.WriteObjectValue(ImageReference);
 29            }
 22830            if (GalleryImageReference != null)
 31            {
 032                writer.WritePropertyName("galleryImageReference");
 033                writer.WriteObjectValue(GalleryImageReference);
 34            }
 22835            if (SourceUri != null)
 36            {
 4037                writer.WritePropertyName("sourceUri");
 4038                writer.WriteStringValue(SourceUri);
 39            }
 22840            if (SourceResourceId != null)
 41            {
 4842                writer.WritePropertyName("sourceResourceId");
 4843                writer.WriteStringValue(SourceResourceId);
 44            }
 22845            if (SourceUniqueId != null)
 46            {
 047                writer.WritePropertyName("sourceUniqueId");
 048                writer.WriteStringValue(SourceUniqueId);
 49            }
 22850            if (UploadSizeBytes != null)
 51            {
 852                writer.WritePropertyName("uploadSizeBytes");
 853                writer.WriteNumberValue(UploadSizeBytes.Value);
 54            }
 22855            writer.WriteEndObject();
 22856        }
 57
 58        internal static CreationData DeserializeCreationData(JsonElement element)
 59        {
 31660            DiskCreateOption createOption = default;
 31661            string storageAccountId = default;
 31662            ImageDiskReference imageReference = default;
 31663            ImageDiskReference galleryImageReference = default;
 31664            string sourceUri = default;
 31665            string sourceResourceId = default;
 31666            string sourceUniqueId = default;
 31667            long? uploadSizeBytes = default;
 191268            foreach (var property in element.EnumerateObject())
 69            {
 64070                if (property.NameEquals("createOption"))
 71                {
 31672                    createOption = new DiskCreateOption(property.Value.GetString());
 31673                    continue;
 74                }
 32475                if (property.NameEquals("storageAccountId"))
 76                {
 6877                    if (property.Value.ValueKind == JsonValueKind.Null)
 78                    {
 79                        continue;
 80                    }
 6881                    storageAccountId = property.Value.GetString();
 6882                    continue;
 83                }
 25684                if (property.NameEquals("imageReference"))
 85                {
 486                    if (property.Value.ValueKind == JsonValueKind.Null)
 87                    {
 88                        continue;
 89                    }
 490                    imageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
 491                    continue;
 92                }
 25293                if (property.NameEquals("galleryImageReference"))
 94                {
 095                    if (property.Value.ValueKind == JsonValueKind.Null)
 96                    {
 97                        continue;
 98                    }
 099                    galleryImageReference = ImageDiskReference.DeserializeImageDiskReference(property.Value);
 0100                    continue;
 101                }
 252102                if (property.NameEquals("sourceUri"))
 103                {
 68104                    if (property.Value.ValueKind == JsonValueKind.Null)
 105                    {
 106                        continue;
 107                    }
 68108                    sourceUri = property.Value.GetString();
 68109                    continue;
 110                }
 184111                if (property.NameEquals("sourceResourceId"))
 112                {
 88113                    if (property.Value.ValueKind == JsonValueKind.Null)
 114                    {
 115                        continue;
 116                    }
 88117                    sourceResourceId = property.Value.GetString();
 88118                    continue;
 119                }
 96120                if (property.NameEquals("sourceUniqueId"))
 121                {
 88122                    if (property.Value.ValueKind == JsonValueKind.Null)
 123                    {
 124                        continue;
 125                    }
 88126                    sourceUniqueId = property.Value.GetString();
 88127                    continue;
 128                }
 8129                if (property.NameEquals("uploadSizeBytes"))
 130                {
 8131                    if (property.Value.ValueKind == JsonValueKind.Null)
 132                    {
 133                        continue;
 134                    }
 8135                    uploadSizeBytes = property.Value.GetInt64();
 136                    continue;
 137                }
 138            }
 316139            return new CreationData(createOption, storageAccountId, imageReference, galleryImageReference, sourceUri, so
 140        }
 141    }
 142}