< Summary

Class:Azure.ResourceManager.Compute.Models.VirtualMachineExtensionImage
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineExtensionImage.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineExtensionImage.Serialization.cs
Covered lines:55
Uncovered lines:57
Coverable lines:112
Total lines:258
Line coverage:49.1% (55 of 112)
Covered branches:38
Total branches:70
Branch coverage:54.2% (38 of 70)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_OperatingSystem()-100%100%
get_ComputeRole()-100%100%
get_HandlerSchema()-100%100%
get_VmScaleSetEnabled()-100%100%
get_SupportsMultipleExtensions()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeVirtualMachineExtensionImage(...)-75.44%79.17%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineExtensionImage.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> Describes a Virtual Machine Extension Image. </summary>
 14    public partial class VirtualMachineExtensionImage : Resource
 15    {
 16        /// <summary> Initializes a new instance of VirtualMachineExtensionImage. </summary>
 17        /// <param name="location"> Resource location. </param>
 018        public VirtualMachineExtensionImage(string location) : base(location)
 19        {
 020            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 024        }
 25
 26        /// <summary> Initializes a new instance of VirtualMachineExtensionImage. </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="operatingSystem"> The operating system this extension supports. </param>
 33        /// <param name="computeRole"> The type of role (IaaS or PaaS) this extension supports. </param>
 34        /// <param name="handlerSchema"> The schema defined by publisher, where extension consumers should provide setti
 35        /// <param name="vmScaleSetEnabled"> Whether the extension can be used on xRP VMScaleSets. By default existing e
 36        /// <param name="supportsMultipleExtensions"> Whether the handler can support multiple extensions. </param>
 7637        internal VirtualMachineExtensionImage(string id, string name, string type, string location, IDictionary<string, 
 38        {
 7639            OperatingSystem = operatingSystem;
 7640            ComputeRole = computeRole;
 7641            HandlerSchema = handlerSchema;
 7642            VmScaleSetEnabled = vmScaleSetEnabled;
 7643            SupportsMultipleExtensions = supportsMultipleExtensions;
 7644        }
 45
 46        /// <summary> The operating system this extension supports. </summary>
 8047        public string OperatingSystem { get; set; }
 48        /// <summary> The type of role (IaaS or PaaS) this extension supports. </summary>
 8049        public string ComputeRole { get; set; }
 50        /// <summary> The schema defined by publisher, where extension consumers should provide settings in a matching s
 8051        public string HandlerSchema { get; set; }
 52        /// <summary> Whether the extension can be used on xRP VMScaleSets. By default existing extensions are usable on
 8053        public bool? VmScaleSetEnabled { get; set; }
 54        /// <summary> Whether the handler can support multiple extensions. </summary>
 8055        public bool? SupportsMultipleExtensions { get; set; }
 56    }
 57}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineExtensionImage.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Compute.Models
 13{
 14    public partial class VirtualMachineExtensionImage : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 024            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 029            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 034            writer.WritePropertyName("location");
 035            writer.WriteStringValue(Location);
 036            if (Tags != null)
 37            {
 038                writer.WritePropertyName("tags");
 039                writer.WriteStartObject();
 040                foreach (var item in Tags)
 41                {
 042                    writer.WritePropertyName(item.Key);
 043                    writer.WriteStringValue(item.Value);
 44                }
 045                writer.WriteEndObject();
 46            }
 047            writer.WritePropertyName("properties");
 048            writer.WriteStartObject();
 049            if (OperatingSystem != null)
 50            {
 051                writer.WritePropertyName("operatingSystem");
 052                writer.WriteStringValue(OperatingSystem);
 53            }
 054            if (ComputeRole != null)
 55            {
 056                writer.WritePropertyName("computeRole");
 057                writer.WriteStringValue(ComputeRole);
 58            }
 059            if (HandlerSchema != null)
 60            {
 061                writer.WritePropertyName("handlerSchema");
 062                writer.WriteStringValue(HandlerSchema);
 63            }
 064            if (VmScaleSetEnabled != null)
 65            {
 066                writer.WritePropertyName("vmScaleSetEnabled");
 067                writer.WriteBooleanValue(VmScaleSetEnabled.Value);
 68            }
 069            if (SupportsMultipleExtensions != null)
 70            {
 071                writer.WritePropertyName("supportsMultipleExtensions");
 072                writer.WriteBooleanValue(SupportsMultipleExtensions.Value);
 73            }
 074            writer.WriteEndObject();
 075            writer.WriteEndObject();
 076        }
 77
 78        internal static VirtualMachineExtensionImage DeserializeVirtualMachineExtensionImage(JsonElement element)
 79        {
 7680            string id = default;
 7681            string name = default;
 7682            string type = default;
 7683            string location = default;
 7684            IDictionary<string, string> tags = default;
 7685            string operatingSystem = default;
 7686            string computeRole = default;
 7687            string handlerSchema = default;
 7688            bool? vmScaleSetEnabled = default;
 7689            bool? supportsMultipleExtensions = default;
 61690            foreach (var property in element.EnumerateObject())
 91            {
 23292                if (property.NameEquals("id"))
 93                {
 7694                    if (property.Value.ValueKind == JsonValueKind.Null)
 95                    {
 96                        continue;
 97                    }
 7698                    id = property.Value.GetString();
 7699                    continue;
 100                }
 156101                if (property.NameEquals("name"))
 102                {
 76103                    if (property.Value.ValueKind == JsonValueKind.Null)
 104                    {
 105                        continue;
 106                    }
 76107                    name = property.Value.GetString();
 76108                    continue;
 109                }
 80110                if (property.NameEquals("type"))
 111                {
 0112                    if (property.Value.ValueKind == JsonValueKind.Null)
 113                    {
 114                        continue;
 115                    }
 0116                    type = property.Value.GetString();
 0117                    continue;
 118                }
 80119                if (property.NameEquals("location"))
 120                {
 76121                    location = property.Value.GetString();
 76122                    continue;
 123                }
 4124                if (property.NameEquals("tags"))
 125                {
 0126                    if (property.Value.ValueKind == JsonValueKind.Null)
 127                    {
 128                        continue;
 129                    }
 0130                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0131                    foreach (var property0 in property.Value.EnumerateObject())
 132                    {
 0133                        if (property0.Value.ValueKind == JsonValueKind.Null)
 134                        {
 0135                            dictionary.Add(property0.Name, null);
 136                        }
 137                        else
 138                        {
 0139                            dictionary.Add(property0.Name, property0.Value.GetString());
 140                        }
 141                    }
 0142                    tags = dictionary;
 0143                    continue;
 144                }
 4145                if (property.NameEquals("properties"))
 146                {
 56147                    foreach (var property0 in property.Value.EnumerateObject())
 148                    {
 24149                        if (property0.NameEquals("operatingSystem"))
 150                        {
 4151                            if (property0.Value.ValueKind == JsonValueKind.Null)
 152                            {
 153                                continue;
 154                            }
 4155                            operatingSystem = property0.Value.GetString();
 4156                            continue;
 157                        }
 20158                        if (property0.NameEquals("computeRole"))
 159                        {
 4160                            if (property0.Value.ValueKind == JsonValueKind.Null)
 161                            {
 162                                continue;
 163                            }
 4164                            computeRole = property0.Value.GetString();
 4165                            continue;
 166                        }
 16167                        if (property0.NameEquals("handlerSchema"))
 168                        {
 0169                            if (property0.Value.ValueKind == JsonValueKind.Null)
 170                            {
 171                                continue;
 172                            }
 0173                            handlerSchema = property0.Value.GetString();
 0174                            continue;
 175                        }
 16176                        if (property0.NameEquals("vmScaleSetEnabled"))
 177                        {
 4178                            if (property0.Value.ValueKind == JsonValueKind.Null)
 179                            {
 180                                continue;
 181                            }
 4182                            vmScaleSetEnabled = property0.Value.GetBoolean();
 4183                            continue;
 184                        }
 12185                        if (property0.NameEquals("supportsMultipleExtensions"))
 186                        {
 4187                            if (property0.Value.ValueKind == JsonValueKind.Null)
 188                            {
 189                                continue;
 190                            }
 4191                            supportsMultipleExtensions = property0.Value.GetBoolean();
 192                            continue;
 193                        }
 194                    }
 195                    continue;
 196                }
 197            }
 76198            return new VirtualMachineExtensionImage(id, name, type, location, tags, operatingSystem, computeRole, handle
 199        }
 200    }
 201}