< Summary

Class:Azure.ResourceManager.Compute.Models.VirtualMachineExtension
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineExtension.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineExtension.Serialization.cs
Covered lines:72
Uncovered lines:80
Coverable lines:152
Total lines:334
Line coverage:47.3% (72 of 152)
Covered branches:52
Total branches:94
Branch coverage:55.3% (52 of 94)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_ForceUpdateTag()-0%100%
get_Publisher()-0%100%
get_TypePropertiesType()-0%100%
get_TypeHandlerVersion()-0%100%
get_AutoUpgradeMinorVersion()-0%100%
get_Settings()-0%100%
get_ProtectedSettings()-0%100%
get_ProvisioningState()-0%100%
get_InstanceView()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeVirtualMachineExtension(...)-79.22%81.25%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineExtension.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. </summary>
 14    public partial class VirtualMachineExtension : Resource
 15    {
 16        /// <summary> Initializes a new instance of VirtualMachineExtension. </summary>
 17        /// <param name="location"> Resource location. </param>
 018        public VirtualMachineExtension(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 VirtualMachineExtension. </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="forceUpdateTag"> How the extension handler should be forced to update even if the extension con
 33        /// <param name="publisher"> The name of the extension handler publisher. </param>
 34        /// <param name="typePropertiesType"> Specifies the type of the extension; an example is &quot;CustomScriptExten
 35        /// <param name="typeHandlerVersion"> Specifies the version of the script handler. </param>
 36        /// <param name="autoUpgradeMinorVersion"> Indicates whether the extension should use a newer minor version if o
 37        /// <param name="settings"> Json formatted public settings for the extension. </param>
 38        /// <param name="protectedSettings"> The extension can contain either protectedSettings or protectedSettingsFrom
 39        /// <param name="provisioningState"> The provisioning state, which only appears in the response. </param>
 40        /// <param name="instanceView"> The virtual machine extension instance view. </param>
 12041        internal VirtualMachineExtension(string id, string name, string type, string location, IDictionary<string, strin
 42        {
 12043            ForceUpdateTag = forceUpdateTag;
 12044            Publisher = publisher;
 12045            TypePropertiesType = typePropertiesType;
 12046            TypeHandlerVersion = typeHandlerVersion;
 12047            AutoUpgradeMinorVersion = autoUpgradeMinorVersion;
 12048            Settings = settings;
 12049            ProtectedSettings = protectedSettings;
 12050            ProvisioningState = provisioningState;
 12051            InstanceView = instanceView;
 12052        }
 53
 54        /// <summary> How the extension handler should be forced to update even if the extension configuration has not c
 055        public string ForceUpdateTag { get; set; }
 56        /// <summary> The name of the extension handler publisher. </summary>
 057        public string Publisher { get; set; }
 58        /// <summary> Specifies the type of the extension; an example is &quot;CustomScriptExtension&quot;. </summary>
 059        public string TypePropertiesType { get; set; }
 60        /// <summary> Specifies the version of the script handler. </summary>
 061        public string TypeHandlerVersion { get; set; }
 62        /// <summary> Indicates whether the extension should use a newer minor version if one is available at deployment
 063        public bool? AutoUpgradeMinorVersion { get; set; }
 64        /// <summary> Json formatted public settings for the extension. </summary>
 065        public object Settings { get; set; }
 66        /// <summary> The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protecte
 067        public object ProtectedSettings { get; set; }
 68        /// <summary> The provisioning state, which only appears in the response. </summary>
 069        public string ProvisioningState { get; }
 70        /// <summary> The virtual machine extension instance view. </summary>
 071        public VirtualMachineExtensionInstanceView InstanceView { get; set; }
 72    }
 73}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineExtension.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 VirtualMachineExtension : 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 (ForceUpdateTag != null)
 50            {
 051                writer.WritePropertyName("forceUpdateTag");
 052                writer.WriteStringValue(ForceUpdateTag);
 53            }
 054            if (Publisher != null)
 55            {
 056                writer.WritePropertyName("publisher");
 057                writer.WriteStringValue(Publisher);
 58            }
 059            if (TypePropertiesType != null)
 60            {
 061                writer.WritePropertyName("type");
 062                writer.WriteStringValue(TypePropertiesType);
 63            }
 064            if (TypeHandlerVersion != null)
 65            {
 066                writer.WritePropertyName("typeHandlerVersion");
 067                writer.WriteStringValue(TypeHandlerVersion);
 68            }
 069            if (AutoUpgradeMinorVersion != null)
 70            {
 071                writer.WritePropertyName("autoUpgradeMinorVersion");
 072                writer.WriteBooleanValue(AutoUpgradeMinorVersion.Value);
 73            }
 074            if (Settings != null)
 75            {
 076                writer.WritePropertyName("settings");
 077                writer.WriteObjectValue(Settings);
 78            }
 079            if (ProtectedSettings != null)
 80            {
 081                writer.WritePropertyName("protectedSettings");
 082                writer.WriteObjectValue(ProtectedSettings);
 83            }
 084            if (ProvisioningState != null)
 85            {
 086                writer.WritePropertyName("provisioningState");
 087                writer.WriteStringValue(ProvisioningState);
 88            }
 089            if (InstanceView != null)
 90            {
 091                writer.WritePropertyName("instanceView");
 092                writer.WriteObjectValue(InstanceView);
 93            }
 094            writer.WriteEndObject();
 095            writer.WriteEndObject();
 096        }
 97
 98        internal static VirtualMachineExtension DeserializeVirtualMachineExtension(JsonElement element)
 99        {
 120100            string id = default;
 120101            string name = default;
 120102            string type = default;
 120103            string location = default;
 120104            IDictionary<string, string> tags = default;
 120105            string forceUpdateTag = default;
 120106            string publisher = default;
 120107            string type0 = default;
 120108            string typeHandlerVersion = default;
 120109            bool? autoUpgradeMinorVersion = default;
 120110            object settings = default;
 120111            object protectedSettings = default;
 120112            string provisioningState = default;
 120113            VirtualMachineExtensionInstanceView instanceView = default;
 1232114            foreach (var property in element.EnumerateObject())
 115            {
 496116                if (property.NameEquals("id"))
 117                {
 120118                    if (property.Value.ValueKind == JsonValueKind.Null)
 119                    {
 120                        continue;
 121                    }
 120122                    id = property.Value.GetString();
 120123                    continue;
 124                }
 376125                if (property.NameEquals("name"))
 126                {
 94127                    if (property.Value.ValueKind == JsonValueKind.Null)
 128                    {
 129                        continue;
 130                    }
 94131                    name = property.Value.GetString();
 94132                    continue;
 133                }
 282134                if (property.NameEquals("type"))
 135                {
 94136                    if (property.Value.ValueKind == JsonValueKind.Null)
 137                    {
 138                        continue;
 139                    }
 94140                    type = property.Value.GetString();
 94141                    continue;
 142                }
 188143                if (property.NameEquals("location"))
 144                {
 94145                    location = property.Value.GetString();
 94146                    continue;
 147                }
 94148                if (property.NameEquals("tags"))
 149                {
 0150                    if (property.Value.ValueKind == JsonValueKind.Null)
 151                    {
 152                        continue;
 153                    }
 0154                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0155                    foreach (var property0 in property.Value.EnumerateObject())
 156                    {
 0157                        if (property0.Value.ValueKind == JsonValueKind.Null)
 158                        {
 0159                            dictionary.Add(property0.Name, null);
 160                        }
 161                        else
 162                        {
 0163                            dictionary.Add(property0.Name, property0.Value.GetString());
 164                        }
 165                    }
 0166                    tags = dictionary;
 0167                    continue;
 168                }
 94169                if (property.NameEquals("properties"))
 170                {
 1408171                    foreach (var property0 in property.Value.EnumerateObject())
 172                    {
 610173                        if (property0.NameEquals("forceUpdateTag"))
 174                        {
 0175                            if (property0.Value.ValueKind == JsonValueKind.Null)
 176                            {
 177                                continue;
 178                            }
 0179                            forceUpdateTag = property0.Value.GetString();
 0180                            continue;
 181                        }
 610182                        if (property0.NameEquals("publisher"))
 183                        {
 94184                            if (property0.Value.ValueKind == JsonValueKind.Null)
 185                            {
 186                                continue;
 187                            }
 94188                            publisher = property0.Value.GetString();
 94189                            continue;
 190                        }
 516191                        if (property0.NameEquals("type"))
 192                        {
 94193                            if (property0.Value.ValueKind == JsonValueKind.Null)
 194                            {
 195                                continue;
 196                            }
 94197                            type0 = property0.Value.GetString();
 94198                            continue;
 199                        }
 422200                        if (property0.NameEquals("typeHandlerVersion"))
 201                        {
 94202                            if (property0.Value.ValueKind == JsonValueKind.Null)
 203                            {
 204                                continue;
 205                            }
 94206                            typeHandlerVersion = property0.Value.GetString();
 94207                            continue;
 208                        }
 328209                        if (property0.NameEquals("autoUpgradeMinorVersion"))
 210                        {
 94211                            if (property0.Value.ValueKind == JsonValueKind.Null)
 212                            {
 213                                continue;
 214                            }
 94215                            autoUpgradeMinorVersion = property0.Value.GetBoolean();
 94216                            continue;
 217                        }
 234218                        if (property0.NameEquals("settings"))
 219                        {
 94220                            if (property0.Value.ValueKind == JsonValueKind.Null)
 221                            {
 222                                continue;
 223                            }
 94224                            settings = property0.Value.GetObject();
 94225                            continue;
 226                        }
 140227                        if (property0.NameEquals("protectedSettings"))
 228                        {
 0229                            if (property0.Value.ValueKind == JsonValueKind.Null)
 230                            {
 231                                continue;
 232                            }
 0233                            protectedSettings = property0.Value.GetObject();
 0234                            continue;
 235                        }
 140236                        if (property0.NameEquals("provisioningState"))
 237                        {
 94238                            if (property0.Value.ValueKind == JsonValueKind.Null)
 239                            {
 240                                continue;
 241                            }
 94242                            provisioningState = property0.Value.GetString();
 94243                            continue;
 244                        }
 46245                        if (property0.NameEquals("instanceView"))
 246                        {
 0247                            if (property0.Value.ValueKind == JsonValueKind.Null)
 248                            {
 249                                continue;
 250                            }
 0251                            instanceView = VirtualMachineExtensionInstanceView.DeserializeVirtualMachineExtensionInstanc
 252                            continue;
 253                        }
 254                    }
 255                    continue;
 256                }
 257            }
 120258            return new VirtualMachineExtension(id, name, type, location, tags, forceUpdateTag, publisher, type0, typeHan
 259        }
 260    }
 261}