< Summary

Class:Azure.ResourceManager.Compute.Models.VirtualMachineScaleSet
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSet.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSet.Serialization.cs
Covered lines:206
Uncovered lines:34
Coverable lines:240
Total lines:503
Line coverage:85.8% (206 of 240)
Covered branches:127
Total branches:148
Branch coverage:85.8% (127 of 148)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-75%50%
.ctor(...)-100%100%
get_Sku()-100%100%
get_Plan()-100%100%
get_Identity()-100%100%
get_Zones()-100%100%
get_UpgradePolicy()-100%100%
get_AutomaticRepairsPolicy()-100%100%
get_VirtualMachineProfile()-100%100%
get_ProvisioningState()-100%100%
get_Overprovision()-100%100%
get_DoNotRunExtensionsOnOverprovisionedVMs()-100%100%
get_UniqueId()-100%100%
get_SinglePlacementGroup()-100%100%
get_ZoneBalance()-100%100%
get_PlatformFaultDomainCount()-100%100%
get_ProximityPlacementGroup()-100%100%
get_AdditionalCapabilities()-100%100%
get_ScaleInPolicy()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-71.79%76.09%
DeserializeVirtualMachineScaleSet(...)-90.98%91%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSet.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 Scale Set. </summary>
 14    public partial class VirtualMachineScaleSet : Resource
 15    {
 16        /// <summary> Initializes a new instance of VirtualMachineScaleSet. </summary>
 17        /// <param name="location"> Resource location. </param>
 16018        public VirtualMachineScaleSet(string location) : base(location)
 19        {
 16020            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 16024        }
 25
 26        /// <summary> Initializes a new instance of VirtualMachineScaleSet. </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="sku"> The virtual machine scale set sku. </param>
 33        /// <param name="plan"> Specifies information about the marketplace image used to create the virtual machine. Th
 34        /// <param name="identity"> The identity of the virtual machine scale set, if configured. </param>
 35        /// <param name="zones"> The virtual machine scale set zones. NOTE: Availability zones can only be set when you 
 36        /// <param name="upgradePolicy"> The upgrade policy. </param>
 37        /// <param name="automaticRepairsPolicy"> Policy for automatic repairs. </param>
 38        /// <param name="virtualMachineProfile"> The virtual machine profile. </param>
 39        /// <param name="provisioningState"> The provisioning state, which only appears in the response. </param>
 40        /// <param name="overprovision"> Specifies whether the Virtual Machine Scale Set should be overprovisioned. </pa
 41        /// <param name="doNotRunExtensionsOnOverprovisionedVMs"> When Overprovision is enabled, extensions are launched
 42        /// <param name="uniqueId"> Specifies the ID which uniquely identifies a Virtual Machine Scale Set. </param>
 43        /// <param name="singlePlacementGroup"> When true this limits the scale set to a single placement group, of max 
 44        /// <param name="zoneBalance"> Whether to force strictly even Virtual Machine distribution cross x-zones in case
 45        /// <param name="platformFaultDomainCount"> Fault Domain count for each placement group. </param>
 46        /// <param name="proximityPlacementGroup"> Specifies information about the proximity placement group that the vi
 47        /// <param name="additionalCapabilities"> Specifies additional capabilities enabled or disabled on the Virtual M
 48        /// <param name="scaleInPolicy"> Specifies the scale-in policy that decides which virtual machines are chosen fo
 44849        internal VirtualMachineScaleSet(string id, string name, string type, string location, IDictionary<string, string
 50        {
 44851            Sku = sku;
 44852            Plan = plan;
 44853            Identity = identity;
 44854            Zones = zones;
 44855            UpgradePolicy = upgradePolicy;
 44856            AutomaticRepairsPolicy = automaticRepairsPolicy;
 44857            VirtualMachineProfile = virtualMachineProfile;
 44858            ProvisioningState = provisioningState;
 44859            Overprovision = overprovision;
 44860            DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs;
 44861            UniqueId = uniqueId;
 44862            SinglePlacementGroup = singlePlacementGroup;
 44863            ZoneBalance = zoneBalance;
 44864            PlatformFaultDomainCount = platformFaultDomainCount;
 44865            ProximityPlacementGroup = proximityPlacementGroup;
 44866            AdditionalCapabilities = additionalCapabilities;
 44867            ScaleInPolicy = scaleInPolicy;
 44868        }
 69
 70        /// <summary> The virtual machine scale set sku. </summary>
 205271        public Sku Sku { get; set; }
 72        /// <summary> Specifies information about the marketplace image used to create the virtual machine. This element
 82073        public Plan Plan { get; set; }
 74        /// <summary> The identity of the virtual machine scale set, if configured. </summary>
 81275        public VirtualMachineScaleSetIdentity Identity { get; set; }
 76        /// <summary> The virtual machine scale set zones. NOTE: Availability zones can only be set when you create the 
 166077        public IList<string> Zones { get; set; }
 78        /// <summary> The upgrade policy. </summary>
 163279        public UpgradePolicy UpgradePolicy { get; set; }
 80        /// <summary> Policy for automatic repairs. </summary>
 139681        public AutomaticRepairsPolicy AutomaticRepairsPolicy { get; set; }
 82        /// <summary> The virtual machine profile. </summary>
 765283        public VirtualMachineScaleSetVMProfile VirtualMachineProfile { get; set; }
 84        /// <summary> The provisioning state, which only appears in the response. </summary>
 64885        public string ProvisioningState { get; }
 86        /// <summary> Specifies whether the Virtual Machine Scale Set should be overprovisioned. </summary>
 139287        public bool? Overprovision { get; set; }
 88        /// <summary> When Overprovision is enabled, extensions are launched only on the requested number of VMs which a
 81289        public bool? DoNotRunExtensionsOnOverprovisionedVMs { get; set; }
 90        /// <summary> Specifies the ID which uniquely identifies a Virtual Machine Scale Set. </summary>
 36491        public string UniqueId { get; }
 92        /// <summary> When true this limits the scale set to a single placement group, of max size 100 virtual machines.
 81293        public bool? SinglePlacementGroup { get; set; }
 94        /// <summary> Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone ou
 113295        public bool? ZoneBalance { get; set; }
 96        /// <summary> Fault Domain count for each placement group. </summary>
 88497        public int? PlatformFaultDomainCount { get; set; }
 98        /// <summary> Specifies information about the proximity placement group that the virtual machine scale set shoul
 83299        public SubResource ProximityPlacementGroup { get; set; }
 100        /// <summary> Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machi
 824101        public AdditionalCapabilities AdditionalCapabilities { get; set; }
 102        /// <summary> Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Vi
 812103        public ScaleInPolicy ScaleInPolicy { get; set; }
 104    }
 105}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\VirtualMachineScaleSet.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 VirtualMachineScaleSet : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 36418            writer.WriteStartObject();
 36419            if (Sku != null)
 20            {
 36421                writer.WritePropertyName("sku");
 36422                writer.WriteObjectValue(Sku);
 23            }
 36424            if (Plan != null)
 25            {
 426                writer.WritePropertyName("plan");
 427                writer.WriteObjectValue(Plan);
 28            }
 36429            if (Identity != null)
 30            {
 031                writer.WritePropertyName("identity");
 032                writer.WriteObjectValue(Identity);
 33            }
 36434            if (Zones != null)
 35            {
 2436                writer.WritePropertyName("zones");
 2437                writer.WriteStartArray();
 11238                foreach (var item in Zones)
 39                {
 3240                    writer.WriteStringValue(item);
 41                }
 2442                writer.WriteEndArray();
 43            }
 36444            if (Id != null)
 45            {
 046                writer.WritePropertyName("id");
 047                writer.WriteStringValue(Id);
 48            }
 36449            if (Name != null)
 50            {
 051                writer.WritePropertyName("name");
 052                writer.WriteStringValue(Name);
 53            }
 36454            if (Type != null)
 55            {
 056                writer.WritePropertyName("type");
 057                writer.WriteStringValue(Type);
 58            }
 36459            writer.WritePropertyName("location");
 36460            writer.WriteStringValue(Location);
 36461            if (Tags != null)
 62            {
 36463                writer.WritePropertyName("tags");
 36464                writer.WriteStartObject();
 218465                foreach (var item in Tags)
 66                {
 72867                    writer.WritePropertyName(item.Key);
 72868                    writer.WriteStringValue(item.Value);
 69                }
 36470                writer.WriteEndObject();
 71            }
 36472            writer.WritePropertyName("properties");
 36473            writer.WriteStartObject();
 36474            if (UpgradePolicy != null)
 75            {
 36476                writer.WritePropertyName("upgradePolicy");
 36477                writer.WriteObjectValue(UpgradePolicy);
 78            }
 36479            if (AutomaticRepairsPolicy != null)
 80            {
 3281                writer.WritePropertyName("automaticRepairsPolicy");
 3282                writer.WriteObjectValue(AutomaticRepairsPolicy);
 83            }
 36484            if (VirtualMachineProfile != null)
 85            {
 36486                writer.WritePropertyName("virtualMachineProfile");
 36487                writer.WriteObjectValue(VirtualMachineProfile);
 88            }
 36489            if (ProvisioningState != null)
 90            {
 091                writer.WritePropertyName("provisioningState");
 092                writer.WriteStringValue(ProvisioningState);
 93            }
 36494            if (Overprovision != null)
 95            {
 36496                writer.WritePropertyName("overprovision");
 36497                writer.WriteBooleanValue(Overprovision.Value);
 98            }
 36499            if (DoNotRunExtensionsOnOverprovisionedVMs != null)
 100            {
 0101                writer.WritePropertyName("doNotRunExtensionsOnOverprovisionedVMs");
 0102                writer.WriteBooleanValue(DoNotRunExtensionsOnOverprovisionedVMs.Value);
 103            }
 364104            if (UniqueId != null)
 105            {
 0106                writer.WritePropertyName("uniqueId");
 0107                writer.WriteStringValue(UniqueId);
 108            }
 364109            if (SinglePlacementGroup != null)
 110            {
 0111                writer.WritePropertyName("singlePlacementGroup");
 0112                writer.WriteBooleanValue(SinglePlacementGroup.Value);
 113            }
 364114            if (ZoneBalance != null)
 115            {
 0116                writer.WritePropertyName("zoneBalance");
 0117                writer.WriteBooleanValue(ZoneBalance.Value);
 118            }
 364119            if (PlatformFaultDomainCount != null)
 120            {
 0121                writer.WritePropertyName("platformFaultDomainCount");
 0122                writer.WriteNumberValue(PlatformFaultDomainCount.Value);
 123            }
 364124            if (ProximityPlacementGroup != null)
 125            {
 8126                writer.WritePropertyName("proximityPlacementGroup");
 8127                writer.WriteObjectValue(ProximityPlacementGroup);
 128            }
 364129            if (AdditionalCapabilities != null)
 130            {
 8131                writer.WritePropertyName("additionalCapabilities");
 8132                writer.WriteObjectValue(AdditionalCapabilities);
 133            }
 364134            if (ScaleInPolicy != null)
 135            {
 0136                writer.WritePropertyName("scaleInPolicy");
 0137                writer.WriteObjectValue(ScaleInPolicy);
 138            }
 364139            writer.WriteEndObject();
 364140            writer.WriteEndObject();
 364141        }
 142
 143        internal static VirtualMachineScaleSet DeserializeVirtualMachineScaleSet(JsonElement element)
 144        {
 448145            Sku sku = default;
 448146            Plan plan = default;
 448147            VirtualMachineScaleSetIdentity identity = default;
 448148            IList<string> zones = default;
 448149            string id = default;
 448150            string name = default;
 448151            string type = default;
 448152            string location = default;
 448153            IDictionary<string, string> tags = default;
 448154            UpgradePolicy upgradePolicy = default;
 448155            AutomaticRepairsPolicy automaticRepairsPolicy = default;
 448156            VirtualMachineScaleSetVMProfile virtualMachineProfile = default;
 448157            string provisioningState = default;
 448158            bool? overprovision = default;
 448159            bool? doNotRunExtensionsOnOverprovisionedVMs = default;
 448160            string uniqueId = default;
 448161            bool? singlePlacementGroup = default;
 448162            bool? zoneBalance = default;
 448163            int? platformFaultDomainCount = default;
 448164            SubResource proximityPlacementGroup = default;
 448165            AdditionalCapabilities additionalCapabilities = default;
 448166            ScaleInPolicy scaleInPolicy = default;
 7240167            foreach (var property in element.EnumerateObject())
 168            {
 3172169                if (property.NameEquals("sku"))
 170                {
 448171                    if (property.Value.ValueKind == JsonValueKind.Null)
 172                    {
 173                        continue;
 174                    }
 448175                    sku = Sku.DeserializeSku(property.Value);
 448176                    continue;
 177                }
 2724178                if (property.NameEquals("plan"))
 179                {
 0180                    if (property.Value.ValueKind == JsonValueKind.Null)
 181                    {
 182                        continue;
 183                    }
 0184                    plan = Plan.DeserializePlan(property.Value);
 0185                    continue;
 186                }
 2724187                if (property.NameEquals("identity"))
 188                {
 0189                    if (property.Value.ValueKind == JsonValueKind.Null)
 190                    {
 191                        continue;
 192                    }
 0193                    identity = VirtualMachineScaleSetIdentity.DeserializeVirtualMachineScaleSetIdentity(property.Value);
 0194                    continue;
 195                }
 2724196                if (property.NameEquals("zones"))
 197                {
 36198                    if (property.Value.ValueKind == JsonValueKind.Null)
 199                    {
 200                        continue;
 201                    }
 36202                    List<string> array = new List<string>();
 168203                    foreach (var item in property.Value.EnumerateArray())
 204                    {
 48205                        if (item.ValueKind == JsonValueKind.Null)
 206                        {
 0207                            array.Add(null);
 208                        }
 209                        else
 210                        {
 48211                            array.Add(item.GetString());
 212                        }
 213                    }
 36214                    zones = array;
 36215                    continue;
 216                }
 2688217                if (property.NameEquals("id"))
 218                {
 448219                    if (property.Value.ValueKind == JsonValueKind.Null)
 220                    {
 221                        continue;
 222                    }
 448223                    id = property.Value.GetString();
 448224                    continue;
 225                }
 2240226                if (property.NameEquals("name"))
 227                {
 448228                    if (property.Value.ValueKind == JsonValueKind.Null)
 229                    {
 230                        continue;
 231                    }
 448232                    name = property.Value.GetString();
 448233                    continue;
 234                }
 1792235                if (property.NameEquals("type"))
 236                {
 448237                    if (property.Value.ValueKind == JsonValueKind.Null)
 238                    {
 239                        continue;
 240                    }
 448241                    type = property.Value.GetString();
 448242                    continue;
 243                }
 1344244                if (property.NameEquals("location"))
 245                {
 448246                    location = property.Value.GetString();
 448247                    continue;
 248                }
 896249                if (property.NameEquals("tags"))
 250                {
 448251                    if (property.Value.ValueKind == JsonValueKind.Null)
 252                    {
 253                        continue;
 254                    }
 448255                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 2688256                    foreach (var property0 in property.Value.EnumerateObject())
 257                    {
 896258                        if (property0.Value.ValueKind == JsonValueKind.Null)
 259                        {
 0260                            dictionary.Add(property0.Name, null);
 261                        }
 262                        else
 263                        {
 896264                            dictionary.Add(property0.Name, property0.Value.GetString());
 265                        }
 266                    }
 448267                    tags = dictionary;
 448268                    continue;
 269                }
 448270                if (property.NameEquals("properties"))
 271                {
 7512272                    foreach (var property0 in property.Value.EnumerateObject())
 273                    {
 3308274                        if (property0.NameEquals("upgradePolicy"))
 275                        {
 448276                            if (property0.Value.ValueKind == JsonValueKind.Null)
 277                            {
 278                                continue;
 279                            }
 448280                            upgradePolicy = UpgradePolicy.DeserializeUpgradePolicy(property0.Value);
 448281                            continue;
 282                        }
 2860283                        if (property0.NameEquals("automaticRepairsPolicy"))
 284                        {
 40285                            if (property0.Value.ValueKind == JsonValueKind.Null)
 286                            {
 287                                continue;
 288                            }
 40289                            automaticRepairsPolicy = AutomaticRepairsPolicy.DeserializeAutomaticRepairsPolicy(property0.
 40290                            continue;
 291                        }
 2820292                        if (property0.NameEquals("virtualMachineProfile"))
 293                        {
 448294                            if (property0.Value.ValueKind == JsonValueKind.Null)
 295                            {
 296                                continue;
 297                            }
 448298                            virtualMachineProfile = VirtualMachineScaleSetVMProfile.DeserializeVirtualMachineScaleSetVMP
 448299                            continue;
 300                        }
 2372301                        if (property0.NameEquals("provisioningState"))
 302                        {
 448303                            if (property0.Value.ValueKind == JsonValueKind.Null)
 304                            {
 305                                continue;
 306                            }
 448307                            provisioningState = property0.Value.GetString();
 448308                            continue;
 309                        }
 1924310                        if (property0.NameEquals("overprovision"))
 311                        {
 448312                            if (property0.Value.ValueKind == JsonValueKind.Null)
 313                            {
 314                                continue;
 315                            }
 448316                            overprovision = property0.Value.GetBoolean();
 448317                            continue;
 318                        }
 1476319                        if (property0.NameEquals("doNotRunExtensionsOnOverprovisionedVMs"))
 320                        {
 448321                            if (property0.Value.ValueKind == JsonValueKind.Null)
 322                            {
 323                                continue;
 324                            }
 448325                            doNotRunExtensionsOnOverprovisionedVMs = property0.Value.GetBoolean();
 448326                            continue;
 327                        }
 1028328                        if (property0.NameEquals("uniqueId"))
 329                        {
 448330                            if (property0.Value.ValueKind == JsonValueKind.Null)
 331                            {
 332                                continue;
 333                            }
 448334                            uniqueId = property0.Value.GetString();
 448335                            continue;
 336                        }
 580337                        if (property0.NameEquals("singlePlacementGroup"))
 338                        {
 448339                            if (property0.Value.ValueKind == JsonValueKind.Null)
 340                            {
 341                                continue;
 342                            }
 448343                            singlePlacementGroup = property0.Value.GetBoolean();
 448344                            continue;
 345                        }
 132346                        if (property0.NameEquals("zoneBalance"))
 347                        {
 12348                            if (property0.Value.ValueKind == JsonValueKind.Null)
 349                            {
 350                                continue;
 351                            }
 12352                            zoneBalance = property0.Value.GetBoolean();
 12353                            continue;
 354                        }
 120355                        if (property0.NameEquals("platformFaultDomainCount"))
 356                        {
 96357                            if (property0.Value.ValueKind == JsonValueKind.Null)
 358                            {
 359                                continue;
 360                            }
 96361                            platformFaultDomainCount = property0.Value.GetInt32();
 96362                            continue;
 363                        }
 24364                        if (property0.NameEquals("proximityPlacementGroup"))
 365                        {
 12366                            if (property0.Value.ValueKind == JsonValueKind.Null)
 367                            {
 368                                continue;
 369                            }
 12370                            proximityPlacementGroup = SubResource.DeserializeSubResource(property0.Value);
 12371                            continue;
 372                        }
 12373                        if (property0.NameEquals("additionalCapabilities"))
 374                        {
 12375                            if (property0.Value.ValueKind == JsonValueKind.Null)
 376                            {
 377                                continue;
 378                            }
 12379                            additionalCapabilities = AdditionalCapabilities.DeserializeAdditionalCapabilities(property0.
 12380                            continue;
 381                        }
 0382                        if (property0.NameEquals("scaleInPolicy"))
 383                        {
 0384                            if (property0.Value.ValueKind == JsonValueKind.Null)
 385                            {
 386                                continue;
 387                            }
 0388                            scaleInPolicy = ScaleInPolicy.DeserializeScaleInPolicy(property0.Value);
 389                            continue;
 390                        }
 391                    }
 392                    continue;
 393                }
 394            }
 448395            return new VirtualMachineScaleSet(id, name, type, location, tags, sku, plan, identity, zones, upgradePolicy,
 396        }
 397    }
 398}