< Summary

Class:Azure.ResourceManager.Compute.Models.GalleryImage
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImage.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImage.Serialization.cs
Covered lines:132
Uncovered lines:60
Coverable lines:192
Total lines:411
Line coverage:68.7% (132 of 192)
Covered branches:82
Total branches:118
Branch coverage:69.4% (82 of 118)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-75%50%
.ctor(...)-100%100%
get_Description()-100%100%
get_Eula()-100%100%
get_PrivacyStatementUri()-100%100%
get_ReleaseNoteUri()-100%100%
get_OsType()-100%100%
get_OsState()-100%100%
get_HyperVGeneration()-100%100%
get_EndOfLifeDate()-100%100%
get_Identifier()-100%100%
get_Recommended()-100%100%
get_Disallowed()-100%100%
get_PurchasePlan()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-52.38%58.33%
DeserializeGalleryImage(...)-70.1%75%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImage.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;
 9using System.Collections.Generic;
 10
 11namespace Azure.ResourceManager.Compute.Models
 12{
 13    /// <summary> Specifies information about the gallery Image Definition that you want to create or update. </summary>
 14    public partial class GalleryImage : Resource
 15    {
 16        /// <summary> Initializes a new instance of GalleryImage. </summary>
 17        /// <param name="location"> Resource location. </param>
 818        public GalleryImage(string location) : base(location)
 19        {
 820            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 824        }
 25
 26        /// <summary> Initializes a new instance of GalleryImage. </summary>
 27        /// <param name="id"> Resource Id. </param>
 28        /// <param name="name"> Resource name. </param>
 29        /// <param name="type"> Resource type. </param>
 30        /// <param name="location"> Resource location. </param>
 31        /// <param name="tags"> Resource tags. </param>
 32        /// <param name="description"> The description of this gallery Image Definition resource. This property is updat
 33        /// <param name="eula"> The Eula agreement for the gallery Image Definition. </param>
 34        /// <param name="privacyStatementUri"> The privacy statement uri. </param>
 35        /// <param name="releaseNoteUri"> The release note uri. </param>
 36        /// <param name="osType"> This property allows you to specify the type of the OS that is included in the disk wh
 37        /// <param name="osState"> This property allows the user to specify whether the virtual machines created under t
 38        /// <param name="hyperVGeneration"> The hypervisor generation of the Virtual Machine. Applicable to OS disks onl
 39        /// <param name="endOfLifeDate"> The end of life date of the gallery Image Definition. This property can be used
 40        /// <param name="identifier"> This is the gallery Image Definition identifier. </param>
 41        /// <param name="recommended"> The properties describe the recommended machine configuration for this Image Defi
 42        /// <param name="disallowed"> Describes the disallowed disk types. </param>
 43        /// <param name="purchasePlan"> Describes the gallery Image Definition purchase plan. This is used by marketplac
 44        /// <param name="provisioningState"> The provisioning state, which only appears in the response. </param>
 2445        internal GalleryImage(string id, string name, string type, string location, IDictionary<string, string> tags, st
 46        {
 2447            Description = description;
 2448            Eula = eula;
 2449            PrivacyStatementUri = privacyStatementUri;
 2450            ReleaseNoteUri = releaseNoteUri;
 2451            OsType = osType;
 2452            OsState = osState;
 2453            HyperVGeneration = hyperVGeneration;
 2454            EndOfLifeDate = endOfLifeDate;
 2455            Identifier = identifier;
 2456            Recommended = recommended;
 2457            Disallowed = disallowed;
 2458            PurchasePlan = purchasePlan;
 2459            ProvisioningState = provisioningState;
 2460        }
 61
 62        /// <summary> The description of this gallery Image Definition resource. This property is updatable. </summary>
 10863        public string Description { get; set; }
 64        /// <summary> The Eula agreement for the gallery Image Definition. </summary>
 4865        public string Eula { get; set; }
 66        /// <summary> The privacy statement uri. </summary>
 4867        public string PrivacyStatementUri { get; set; }
 68        /// <summary> The release note uri. </summary>
 4869        public string ReleaseNoteUri { get; set; }
 70        /// <summary> This property allows you to specify the type of the OS that is included in the disk when creating 
 9671        public OperatingSystemTypes? OsType { get; set; }
 72        /// <summary> This property allows the user to specify whether the virtual machines created under this image are
 9673        public OperatingSystemStateTypes? OsState { get; set; }
 74        /// <summary> The hypervisor generation of the Virtual Machine. Applicable to OS disks only. </summary>
 7275        public HyperVGeneration? HyperVGeneration { get; set; }
 76        /// <summary> The end of life date of the gallery Image Definition. This property can be used for decommissionin
 4877        public DateTimeOffset? EndOfLifeDate { get; set; }
 78        /// <summary> This is the gallery Image Definition identifier. </summary>
 12879        public GalleryImageIdentifier Identifier { get; set; }
 80        /// <summary> The properties describe the recommended machine configuration for this Image Definition. These pro
 4881        public RecommendedMachineConfiguration Recommended { get; set; }
 82        /// <summary> Describes the disallowed disk types. </summary>
 4883        public Disallowed Disallowed { get; set; }
 84        /// <summary> Describes the gallery Image Definition purchase plan. This is used by marketplace images. </summar
 4885        public ImagePurchasePlan PurchasePlan { get; set; }
 86        /// <summary> The provisioning state, which only appears in the response. </summary>
 3287        public GalleryImagePropertiesProvisioningState? ProvisioningState { get; }
 88    }
 89}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImage.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;
 9using System.Collections.Generic;
 10using System.Text.Json;
 11using Azure.Core;
 12
 13namespace Azure.ResourceManager.Compute.Models
 14{
 15    public partial class GalleryImage : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 2419            writer.WriteStartObject();
 2420            if (Id != null)
 21            {
 022                writer.WritePropertyName("id");
 023                writer.WriteStringValue(Id);
 24            }
 2425            if (Name != null)
 26            {
 027                writer.WritePropertyName("name");
 028                writer.WriteStringValue(Name);
 29            }
 2430            if (Type != null)
 31            {
 032                writer.WritePropertyName("type");
 033                writer.WriteStringValue(Type);
 34            }
 2435            writer.WritePropertyName("location");
 2436            writer.WriteStringValue(Location);
 2437            if (Tags != null)
 38            {
 039                writer.WritePropertyName("tags");
 040                writer.WriteStartObject();
 041                foreach (var item in Tags)
 42                {
 043                    writer.WritePropertyName(item.Key);
 044                    writer.WriteStringValue(item.Value);
 45                }
 046                writer.WriteEndObject();
 47            }
 2448            writer.WritePropertyName("properties");
 2449            writer.WriteStartObject();
 2450            if (Description != null)
 51            {
 2452                writer.WritePropertyName("description");
 2453                writer.WriteStringValue(Description);
 54            }
 2455            if (Eula != null)
 56            {
 057                writer.WritePropertyName("eula");
 058                writer.WriteStringValue(Eula);
 59            }
 2460            if (PrivacyStatementUri != null)
 61            {
 062                writer.WritePropertyName("privacyStatementUri");
 063                writer.WriteStringValue(PrivacyStatementUri);
 64            }
 2465            if (ReleaseNoteUri != null)
 66            {
 067                writer.WritePropertyName("releaseNoteUri");
 068                writer.WriteStringValue(ReleaseNoteUri);
 69            }
 2470            if (OsType != null)
 71            {
 2472                writer.WritePropertyName("osType");
 2473                writer.WriteStringValue(OsType.Value.ToSerialString());
 74            }
 2475            if (OsState != null)
 76            {
 2477                writer.WritePropertyName("osState");
 2478                writer.WriteStringValue(OsState.Value.ToSerialString());
 79            }
 2480            if (HyperVGeneration != null)
 81            {
 082                writer.WritePropertyName("hyperVGeneration");
 083                writer.WriteStringValue(HyperVGeneration.Value.ToString());
 84            }
 2485            if (EndOfLifeDate != null)
 86            {
 087                writer.WritePropertyName("endOfLifeDate");
 088                writer.WriteStringValue(EndOfLifeDate.Value, "O");
 89            }
 2490            if (Identifier != null)
 91            {
 2492                writer.WritePropertyName("identifier");
 2493                writer.WriteObjectValue(Identifier);
 94            }
 2495            if (Recommended != null)
 96            {
 097                writer.WritePropertyName("recommended");
 098                writer.WriteObjectValue(Recommended);
 99            }
 24100            if (Disallowed != null)
 101            {
 0102                writer.WritePropertyName("disallowed");
 0103                writer.WriteObjectValue(Disallowed);
 104            }
 24105            if (PurchasePlan != null)
 106            {
 0107                writer.WritePropertyName("purchasePlan");
 0108                writer.WriteObjectValue(PurchasePlan);
 109            }
 24110            if (ProvisioningState != null)
 111            {
 0112                writer.WritePropertyName("provisioningState");
 0113                writer.WriteStringValue(ProvisioningState.Value.ToString());
 114            }
 24115            writer.WriteEndObject();
 24116            writer.WriteEndObject();
 24117        }
 118
 119        internal static GalleryImage DeserializeGalleryImage(JsonElement element)
 120        {
 24121            string id = default;
 24122            string name = default;
 24123            string type = default;
 24124            string location = default;
 24125            IDictionary<string, string> tags = default;
 24126            string description = default;
 24127            string eula = default;
 24128            string privacyStatementUri = default;
 24129            string releaseNoteUri = default;
 24130            OperatingSystemTypes? osType = default;
 24131            OperatingSystemStateTypes? osState = default;
 24132            HyperVGeneration? hyperVGeneration = default;
 24133            DateTimeOffset? endOfLifeDate = default;
 24134            GalleryImageIdentifier identifier = default;
 24135            RecommendedMachineConfiguration recommended = default;
 24136            Disallowed disallowed = default;
 24137            ImagePurchasePlan purchasePlan = default;
 24138            GalleryImagePropertiesProvisioningState? provisioningState = default;
 288139            foreach (var property in element.EnumerateObject())
 140            {
 120141                if (property.NameEquals("id"))
 142                {
 24143                    if (property.Value.ValueKind == JsonValueKind.Null)
 144                    {
 145                        continue;
 146                    }
 24147                    id = property.Value.GetString();
 24148                    continue;
 149                }
 96150                if (property.NameEquals("name"))
 151                {
 24152                    if (property.Value.ValueKind == JsonValueKind.Null)
 153                    {
 154                        continue;
 155                    }
 24156                    name = property.Value.GetString();
 24157                    continue;
 158                }
 72159                if (property.NameEquals("type"))
 160                {
 24161                    if (property.Value.ValueKind == JsonValueKind.Null)
 162                    {
 163                        continue;
 164                    }
 24165                    type = property.Value.GetString();
 24166                    continue;
 167                }
 48168                if (property.NameEquals("location"))
 169                {
 24170                    location = property.Value.GetString();
 24171                    continue;
 172                }
 24173                if (property.NameEquals("tags"))
 174                {
 0175                    if (property.Value.ValueKind == JsonValueKind.Null)
 176                    {
 177                        continue;
 178                    }
 0179                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0180                    foreach (var property0 in property.Value.EnumerateObject())
 181                    {
 0182                        if (property0.Value.ValueKind == JsonValueKind.Null)
 183                        {
 0184                            dictionary.Add(property0.Name, null);
 185                        }
 186                        else
 187                        {
 0188                            dictionary.Add(property0.Name, property0.Value.GetString());
 189                        }
 190                    }
 0191                    tags = dictionary;
 0192                    continue;
 193                }
 24194                if (property.NameEquals("properties"))
 195                {
 336196                    foreach (var property0 in property.Value.EnumerateObject())
 197                    {
 144198                        if (property0.NameEquals("description"))
 199                        {
 24200                            if (property0.Value.ValueKind == JsonValueKind.Null)
 201                            {
 202                                continue;
 203                            }
 24204                            description = property0.Value.GetString();
 24205                            continue;
 206                        }
 120207                        if (property0.NameEquals("eula"))
 208                        {
 0209                            if (property0.Value.ValueKind == JsonValueKind.Null)
 210                            {
 211                                continue;
 212                            }
 0213                            eula = property0.Value.GetString();
 0214                            continue;
 215                        }
 120216                        if (property0.NameEquals("privacyStatementUri"))
 217                        {
 0218                            if (property0.Value.ValueKind == JsonValueKind.Null)
 219                            {
 220                                continue;
 221                            }
 0222                            privacyStatementUri = property0.Value.GetString();
 0223                            continue;
 224                        }
 120225                        if (property0.NameEquals("releaseNoteUri"))
 226                        {
 0227                            if (property0.Value.ValueKind == JsonValueKind.Null)
 228                            {
 229                                continue;
 230                            }
 0231                            releaseNoteUri = property0.Value.GetString();
 0232                            continue;
 233                        }
 120234                        if (property0.NameEquals("osType"))
 235                        {
 24236                            if (property0.Value.ValueKind == JsonValueKind.Null)
 237                            {
 238                                continue;
 239                            }
 24240                            osType = property0.Value.GetString().ToOperatingSystemTypes();
 24241                            continue;
 242                        }
 96243                        if (property0.NameEquals("osState"))
 244                        {
 24245                            if (property0.Value.ValueKind == JsonValueKind.Null)
 246                            {
 247                                continue;
 248                            }
 24249                            osState = property0.Value.GetString().ToOperatingSystemStateTypes();
 24250                            continue;
 251                        }
 72252                        if (property0.NameEquals("hyperVGeneration"))
 253                        {
 24254                            if (property0.Value.ValueKind == JsonValueKind.Null)
 255                            {
 256                                continue;
 257                            }
 24258                            hyperVGeneration = new HyperVGeneration(property0.Value.GetString());
 24259                            continue;
 260                        }
 48261                        if (property0.NameEquals("endOfLifeDate"))
 262                        {
 0263                            if (property0.Value.ValueKind == JsonValueKind.Null)
 264                            {
 265                                continue;
 266                            }
 0267                            endOfLifeDate = property0.Value.GetDateTimeOffset("O");
 0268                            continue;
 269                        }
 48270                        if (property0.NameEquals("identifier"))
 271                        {
 24272                            if (property0.Value.ValueKind == JsonValueKind.Null)
 273                            {
 274                                continue;
 275                            }
 24276                            identifier = GalleryImageIdentifier.DeserializeGalleryImageIdentifier(property0.Value);
 24277                            continue;
 278                        }
 24279                        if (property0.NameEquals("recommended"))
 280                        {
 0281                            if (property0.Value.ValueKind == JsonValueKind.Null)
 282                            {
 283                                continue;
 284                            }
 0285                            recommended = RecommendedMachineConfiguration.DeserializeRecommendedMachineConfiguration(pro
 0286                            continue;
 287                        }
 24288                        if (property0.NameEquals("disallowed"))
 289                        {
 0290                            if (property0.Value.ValueKind == JsonValueKind.Null)
 291                            {
 292                                continue;
 293                            }
 0294                            disallowed = Disallowed.DeserializeDisallowed(property0.Value);
 0295                            continue;
 296                        }
 24297                        if (property0.NameEquals("purchasePlan"))
 298                        {
 0299                            if (property0.Value.ValueKind == JsonValueKind.Null)
 300                            {
 301                                continue;
 302                            }
 0303                            purchasePlan = ImagePurchasePlan.DeserializeImagePurchasePlan(property0.Value);
 0304                            continue;
 305                        }
 24306                        if (property0.NameEquals("provisioningState"))
 307                        {
 24308                            if (property0.Value.ValueKind == JsonValueKind.Null)
 309                            {
 310                                continue;
 311                            }
 24312                            provisioningState = new GalleryImagePropertiesProvisioningState(property0.Value.GetString())
 313                            continue;
 314                        }
 315                    }
 316                    continue;
 317                }
 318            }
 24319            return new GalleryImage(id, name, type, location, tags, description, eula, privacyStatementUri, releaseNoteU
 320        }
 321    }
 322}