Beispiel #1
0
 internal VirtualMachineScaleSetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ComputeSku sku, ComputePlan plan, ManagedServiceIdentity identity, IList <string> zones, Models.ExtendedLocation extendedLocation, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVmProfile virtualMachineProfile, string provisioningState, bool?overprovision, bool?doNotRunExtensionsOnOverprovisionedVms, string uniqueId, bool?singlePlacementGroup, bool?zoneBalance, int?platformFaultDomainCount, WritableSubResource proximityPlacementGroup, WritableSubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, OrchestrationMode?orchestrationMode, SpotRestorePolicy spotRestorePolicy, DateTimeOffset?timeCreated) : base(id, name, resourceType, systemData, tags, location)
 {
     Sku                    = sku;
     Plan                   = plan;
     Identity               = identity;
     Zones                  = zones;
     ExtendedLocation       = extendedLocation;
     UpgradePolicy          = upgradePolicy;
     AutomaticRepairsPolicy = automaticRepairsPolicy;
     VirtualMachineProfile  = virtualMachineProfile;
     ProvisioningState      = provisioningState;
     Overprovision          = overprovision;
     DoNotRunExtensionsOnOverprovisionedVms = doNotRunExtensionsOnOverprovisionedVms;
     UniqueId                 = uniqueId;
     SinglePlacementGroup     = singlePlacementGroup;
     ZoneBalance              = zoneBalance;
     PlatformFaultDomainCount = platformFaultDomainCount;
     ProximityPlacementGroup  = proximityPlacementGroup;
     HostGroup                = hostGroup;
     AdditionalCapabilities   = additionalCapabilities;
     ScaleInPolicy            = scaleInPolicy;
     OrchestrationMode        = orchestrationMode;
     SpotRestorePolicy        = spotRestorePolicy;
     TimeCreated              = timeCreated;
 }
 internal VirtualMachineScaleSetData(ResourceIdentifier id, string name, ResourceType type, IDictionary <string, string> tags, Location location, Models.Sku sku, Models.Plan plan, ResourceIdentity identity, IList <string> zones, ExtendedLocation extendedLocation, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool?overprovision, bool?doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool?singlePlacementGroup, bool?zoneBalance, int?platformFaultDomainCount, WritableSubResource proximityPlacementGroup, WritableSubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, OrchestrationMode?orchestrationMode) : base(id, name, type, tags, location)
 {
     Sku                    = sku;
     Plan                   = plan;
     Identity               = identity;
     Zones                  = zones;
     ExtendedLocation       = extendedLocation;
     UpgradePolicy          = upgradePolicy;
     AutomaticRepairsPolicy = automaticRepairsPolicy;
     VirtualMachineProfile  = virtualMachineProfile;
     ProvisioningState      = provisioningState;
     Overprovision          = overprovision;
     DoNotRunExtensionsOnOverprovisionedVMs = doNotRunExtensionsOnOverprovisionedVMs;
     UniqueId                 = uniqueId;
     SinglePlacementGroup     = singlePlacementGroup;
     ZoneBalance              = zoneBalance;
     PlatformFaultDomainCount = platformFaultDomainCount;
     ProximityPlacementGroup  = proximityPlacementGroup;
     HostGroup                = hostGroup;
     AdditionalCapabilities   = additionalCapabilities;
     ScaleInPolicy            = scaleInPolicy;
     OrchestrationMode        = orchestrationMode;
 }
        private void Run()
        {
            // Sku
            Sku vSku = null;

            // Plan
            Plan vPlan = null;

            // UpgradePolicy
            UpgradePolicy vUpgradePolicy = null;

            // AutomaticRepairsPolicy
            AutomaticRepairsPolicy vAutomaticRepairsPolicy = null;

            // VirtualMachineProfile
            PSVirtualMachineScaleSetVMProfile vVirtualMachineProfile = null;

            // ProximityPlacementGroup
            SubResource vProximityPlacementGroup = null;

            // AdditionalCapabilities
            AdditionalCapabilities vAdditionalCapabilities = null;

            // ScaleInPolicy
            ScaleInPolicy vScaleInPolicy = null;

            // Identity
            VirtualMachineScaleSetIdentity vIdentity = null;

            if (this.IsParameterBound(c => c.SkuName))
            {
                if (vSku == null)
                {
                    vSku = new Sku();
                }
                vSku.Name = this.SkuName;
            }

            if (this.IsParameterBound(c => c.SkuTier))
            {
                if (vSku == null)
                {
                    vSku = new Sku();
                }
                vSku.Tier = this.SkuTier;
            }

            if (this.IsParameterBound(c => c.SkuCapacity))
            {
                if (vSku == null)
                {
                    vSku = new Sku();
                }
                vSku.Capacity = this.SkuCapacity;
            }

            if (this.IsParameterBound(c => c.PlanName))
            {
                if (vPlan == null)
                {
                    vPlan = new Plan();
                }
                vPlan.Name = this.PlanName;
            }

            if (this.IsParameterBound(c => c.PlanPublisher))
            {
                if (vPlan == null)
                {
                    vPlan = new Plan();
                }
                vPlan.Publisher = this.PlanPublisher;
            }

            if (this.IsParameterBound(c => c.PlanProduct))
            {
                if (vPlan == null)
                {
                    vPlan = new Plan();
                }
                vPlan.Product = this.PlanProduct;
            }

            if (this.IsParameterBound(c => c.PlanPromotionCode))
            {
                if (vPlan == null)
                {
                    vPlan = new Plan();
                }
                vPlan.PromotionCode = this.PlanPromotionCode;
            }

            if (this.IsParameterBound(c => c.UpgradePolicyMode))
            {
                if (vUpgradePolicy == null)
                {
                    vUpgradePolicy = new UpgradePolicy();
                }
                vUpgradePolicy.Mode = this.UpgradePolicyMode;
            }

            if (this.IsParameterBound(c => c.RollingUpgradePolicy))
            {
                if (vUpgradePolicy == null)
                {
                    vUpgradePolicy = new UpgradePolicy();
                }
                vUpgradePolicy.RollingUpgradePolicy = this.RollingUpgradePolicy;
            }

            if (vUpgradePolicy == null)
            {
                vUpgradePolicy = new UpgradePolicy();
            }
            if (vUpgradePolicy.AutomaticOSUpgradePolicy == null)
            {
                vUpgradePolicy.AutomaticOSUpgradePolicy = new AutomaticOSUpgradePolicy();
            }
            vUpgradePolicy.AutomaticOSUpgradePolicy.EnableAutomaticOSUpgrade = this.AutoOSUpgrade.IsPresent;

            if (this.EnableAutomaticRepair.IsPresent)
            {
                if (vAutomaticRepairsPolicy == null)
                {
                    vAutomaticRepairsPolicy = new AutomaticRepairsPolicy();
                }
                vAutomaticRepairsPolicy.Enabled = this.EnableAutomaticRepair.IsPresent;
            }

            if (this.IsParameterBound(c => c.AutomaticRepairGracePeriod))
            {
                if (vAutomaticRepairsPolicy == null)
                {
                    vAutomaticRepairsPolicy = new AutomaticRepairsPolicy();
                }
                vAutomaticRepairsPolicy.GracePeriod = this.AutomaticRepairGracePeriod;
            }

            if (this.IsParameterBound(c => c.DisableAutoRollback))
            {
                if (vUpgradePolicy == null)
                {
                    vUpgradePolicy = new UpgradePolicy();
                }
                if (vUpgradePolicy.AutomaticOSUpgradePolicy == null)
                {
                    vUpgradePolicy.AutomaticOSUpgradePolicy = new AutomaticOSUpgradePolicy();
                }
                vUpgradePolicy.AutomaticOSUpgradePolicy.DisableAutomaticRollback = this.DisableAutoRollback;
            }

            if (this.IsParameterBound(c => c.OsProfile))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                vVirtualMachineProfile.OsProfile = this.OsProfile;
            }

            if (this.IsParameterBound(c => c.StorageProfile))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                vVirtualMachineProfile.StorageProfile = this.StorageProfile;
            }

            if (this.IsParameterBound(c => c.HealthProbeId))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.NetworkProfile == null)
                {
                    vVirtualMachineProfile.NetworkProfile = new VirtualMachineScaleSetNetworkProfile();
                }
                if (vVirtualMachineProfile.NetworkProfile.HealthProbe == null)
                {
                    vVirtualMachineProfile.NetworkProfile.HealthProbe = new ApiEntityReference();
                }
                vVirtualMachineProfile.NetworkProfile.HealthProbe.Id = this.HealthProbeId;
            }

            if (this.IsParameterBound(c => c.NetworkInterfaceConfiguration))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.NetworkProfile == null)
                {
                    vVirtualMachineProfile.NetworkProfile = new VirtualMachineScaleSetNetworkProfile();
                }
                vVirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations = this.NetworkInterfaceConfiguration;
            }

            if (this.IsParameterBound(c => c.BootDiagnostic))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.DiagnosticsProfile == null)
                {
                    vVirtualMachineProfile.DiagnosticsProfile = new DiagnosticsProfile();
                }
                vVirtualMachineProfile.DiagnosticsProfile.BootDiagnostics = this.BootDiagnostic;
            }

            if (this.IsParameterBound(c => c.Extension))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.ExtensionProfile == null)
                {
                    vVirtualMachineProfile.ExtensionProfile = new PSVirtualMachineScaleSetExtensionProfile();
                }
                vVirtualMachineProfile.ExtensionProfile.Extensions = this.Extension;
            }

            if (this.IsParameterBound(c => c.LicenseType))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                vVirtualMachineProfile.LicenseType = this.LicenseType;
            }

            if (this.IsParameterBound(c => c.Priority))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                vVirtualMachineProfile.Priority = this.Priority;
            }

            if (this.IsParameterBound(c => c.EvictionPolicy))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                vVirtualMachineProfile.EvictionPolicy = this.EvictionPolicy;
            }

            if (this.IsParameterBound(c => c.MaxPrice))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.BillingProfile == null)
                {
                    vVirtualMachineProfile.BillingProfile = new BillingProfile();
                }
                vVirtualMachineProfile.BillingProfile.MaxPrice = this.MaxPrice;
            }

            if (this.TerminateScheduledEvents.IsPresent)
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.ScheduledEventsProfile == null)
                {
                    vVirtualMachineProfile.ScheduledEventsProfile = new ScheduledEventsProfile();
                }
                if (vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile == null)
                {
                    vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile = new TerminateNotificationProfile();
                }
                vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile.Enable = this.TerminateScheduledEvents.IsPresent;
            }

            if (this.IsParameterBound(c => c.TerminateScheduledEventNotBeforeTimeoutInMinutes))
            {
                if (vVirtualMachineProfile == null)
                {
                    vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile();
                }
                if (vVirtualMachineProfile.ScheduledEventsProfile == null)
                {
                    vVirtualMachineProfile.ScheduledEventsProfile = new ScheduledEventsProfile();
                }
                if (vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile == null)
                {
                    vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile = new TerminateNotificationProfile();
                }
                vVirtualMachineProfile.ScheduledEventsProfile.TerminateNotificationProfile.NotBeforeTimeout = XmlConvert.ToString(new TimeSpan(0, this.TerminateScheduledEventNotBeforeTimeoutInMinutes, 0));
            }

            if (this.IsParameterBound(c => c.ProximityPlacementGroupId))
            {
                if (vProximityPlacementGroup == null)
                {
                    vProximityPlacementGroup = new SubResource();
                }
                vProximityPlacementGroup.Id = this.ProximityPlacementGroupId;
            }

            if (this.EnableUltraSSD.IsPresent)
            {
                if (vAdditionalCapabilities == null)
                {
                    vAdditionalCapabilities = new AdditionalCapabilities(true);
                }
            }

            if (this.IsParameterBound(c => c.ScaleInPolicy))
            {
                if (vScaleInPolicy == null)
                {
                    vScaleInPolicy = new ScaleInPolicy();
                }
                vScaleInPolicy.Rules = this.ScaleInPolicy;
            }

            if (this.IsParameterBound(c => c.IdentityType))
            {
                if (vIdentity == null)
                {
                    vIdentity = new VirtualMachineScaleSetIdentity();
                }
                vIdentity.Type = this.IdentityType;
            }

            if (this.IsParameterBound(c => c.IdentityId))
            {
                if (vIdentity == null)
                {
                    vIdentity = new VirtualMachineScaleSetIdentity();
                }

                vIdentity.UserAssignedIdentities = new Dictionary <string, VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue>();

                foreach (var id in this.IdentityId)
                {
                    vIdentity.UserAssignedIdentities.Add(id, new VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue());
                }
            }

            var vVirtualMachineScaleSet = new PSVirtualMachineScaleSet
            {
                Overprovision = this.IsParameterBound(c => c.Overprovision) ? this.Overprovision : (bool?)null,
                DoNotRunExtensionsOnOverprovisionedVMs = this.SkipExtensionsOnOverprovisionedVMs.IsPresent ? true : (bool?)null,
                SinglePlacementGroup     = this.IsParameterBound(c => c.SinglePlacementGroup) ? this.SinglePlacementGroup : (bool?)null,
                ZoneBalance              = this.ZoneBalance.IsPresent ? true : (bool?)null,
                PlatformFaultDomainCount = this.IsParameterBound(c => c.PlatformFaultDomainCount) ? this.PlatformFaultDomainCount : (int?)null,
                Zones                   = this.IsParameterBound(c => c.Zone) ? this.Zone : null,
                Location                = this.IsParameterBound(c => c.Location) ? this.Location : null,
                Tags                    = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null,
                Sku                     = vSku,
                Plan                    = vPlan,
                UpgradePolicy           = vUpgradePolicy,
                AutomaticRepairsPolicy  = vAutomaticRepairsPolicy,
                VirtualMachineProfile   = vVirtualMachineProfile,
                ProximityPlacementGroup = vProximityPlacementGroup,
                AdditionalCapabilities  = vAdditionalCapabilities,
                ScaleInPolicy           = vScaleInPolicy,
                Identity                = vIdentity,
            };

            WriteObject(vVirtualMachineScaleSet);
        }
        internal static VirtualMachineScaleSetData DeserializeVirtualMachineScaleSetData(JsonElement element)
        {
            Optional <Models.Sku>              sku                            = default;
            Optional <Models.Plan>             plan                           = default;
            Optional <ManagedServiceIdentity>  identity                       = default;
            Optional <IList <string> >         zones                          = default;
            Optional <Models.ExtendedLocation> extendedLocation               = default;
            IDictionary <string, string>       tags                           = default;
            AzureLocation                              location               = default;
            ResourceIdentifier                         id                     = default;
            string                                     name                   = default;
            ResourceType                               type                   = default;
            SystemData                                 systemData             = default;
            Optional <UpgradePolicy>                   upgradePolicy          = default;
            Optional <AutomaticRepairsPolicy>          automaticRepairsPolicy = default;
            Optional <VirtualMachineScaleSetVmProfile> virtualMachineProfile  = default;
            Optional <string>                          provisioningState      = default;
            Optional <bool>                            overprovision          = default;
            Optional <bool>                            doNotRunExtensionsOnOverprovisionedVMs = default;
            Optional <string>                          uniqueId                 = default;
            Optional <bool>                            singlePlacementGroup     = default;
            Optional <bool>                            zoneBalance              = default;
            Optional <int>                             platformFaultDomainCount = default;
            Optional <WritableSubResource>             proximityPlacementGroup  = default;
            Optional <WritableSubResource>             hostGroup                = default;
            Optional <AdditionalCapabilities>          additionalCapabilities   = default;
            Optional <ScaleInPolicy>                   scaleInPolicy            = default;
            Optional <OrchestrationMode>               orchestrationMode        = default;
            Optional <SpotRestorePolicy>               spotRestorePolicy        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = Models.Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("plan"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    plan = Models.Plan.DeserializePlan(property.Value);
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = JsonSerializer.Deserialize <ManagedServiceIdentity>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("zones"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    zones = array;
                    continue;
                }
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = Models.ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("upgradePolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            upgradePolicy = UpgradePolicy.DeserializeUpgradePolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("automaticRepairsPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            automaticRepairsPolicy = AutomaticRepairsPolicy.DeserializeAutomaticRepairsPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("virtualMachineProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualMachineProfile = VirtualMachineScaleSetVmProfile.DeserializeVirtualMachineScaleSetVmProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("overprovision"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            overprovision = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("doNotRunExtensionsOnOverprovisionedVMs"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            doNotRunExtensionsOnOverprovisionedVMs = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("uniqueId"))
                        {
                            uniqueId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("singlePlacementGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            singlePlacementGroup = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("zoneBalance"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            zoneBalance = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("platformFaultDomainCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            platformFaultDomainCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("proximityPlacementGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            proximityPlacementGroup = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("hostGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hostGroup = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("additionalCapabilities"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            additionalCapabilities = AdditionalCapabilities.DeserializeAdditionalCapabilities(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("scaleInPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            scaleInPolicy = ScaleInPolicy.DeserializeScaleInPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("orchestrationMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            orchestrationMode = new OrchestrationMode(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("spotRestorePolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            spotRestorePolicy = SpotRestorePolicy.DeserializeSpotRestorePolicy(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualMachineScaleSetData(id, name, type, systemData, tags, location, sku.Value, plan.Value, identity, Optional.ToList(zones), extendedLocation.Value, upgradePolicy.Value, automaticRepairsPolicy.Value, virtualMachineProfile.Value, provisioningState.Value, Optional.ToNullable(overprovision), Optional.ToNullable(doNotRunExtensionsOnOverprovisionedVMs), uniqueId.Value, Optional.ToNullable(singlePlacementGroup), Optional.ToNullable(zoneBalance), Optional.ToNullable(platformFaultDomainCount), proximityPlacementGroup, hostGroup, additionalCapabilities.Value, scaleInPolicy.Value, Optional.ToNullable(orchestrationMode), spotRestorePolicy.Value));
        }