// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.compute.outputs;

import com.pulumi.core.annotations.CustomType;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class WindowsVirtualMachineScaleSetRollingUpgradePolicy {
    /**
     * @return Should the Virtual Machine Scale Set ignore the Azure Zone boundaries when constructing upgrade batches? Possible values are `true` or `false`.
     * 
     */
    private @Nullable Boolean crossZoneUpgradesEnabled;
    /**
     * @return The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability.
     * 
     */
    private Integer maxBatchInstancePercent;
    /**
     * @return The maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be checked prior to starting any batch.
     * 
     */
    private Integer maxUnhealthyInstancePercent;
    /**
     * @return The maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts.
     * 
     */
    private Integer maxUnhealthyUpgradedInstancePercent;
    /**
     * @return The wait time between completing the update for all virtual machines in one batch and starting the next batch. The time duration should be specified in ISO 8601 format.
     * 
     */
    private String pauseTimeBetweenBatches;
    /**
     * @return Upgrade all unhealthy instances in a scale set before any healthy instances. Possible values are `true` or `false`.
     * 
     */
    private @Nullable Boolean prioritizeUnhealthyInstancesEnabled;

    private WindowsVirtualMachineScaleSetRollingUpgradePolicy() {}
    /**
     * @return Should the Virtual Machine Scale Set ignore the Azure Zone boundaries when constructing upgrade batches? Possible values are `true` or `false`.
     * 
     */
    public Optional<Boolean> crossZoneUpgradesEnabled() {
        return Optional.ofNullable(this.crossZoneUpgradesEnabled);
    }
    /**
     * @return The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability.
     * 
     */
    public Integer maxBatchInstancePercent() {
        return this.maxBatchInstancePercent;
    }
    /**
     * @return The maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be checked prior to starting any batch.
     * 
     */
    public Integer maxUnhealthyInstancePercent() {
        return this.maxUnhealthyInstancePercent;
    }
    /**
     * @return The maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts.
     * 
     */
    public Integer maxUnhealthyUpgradedInstancePercent() {
        return this.maxUnhealthyUpgradedInstancePercent;
    }
    /**
     * @return The wait time between completing the update for all virtual machines in one batch and starting the next batch. The time duration should be specified in ISO 8601 format.
     * 
     */
    public String pauseTimeBetweenBatches() {
        return this.pauseTimeBetweenBatches;
    }
    /**
     * @return Upgrade all unhealthy instances in a scale set before any healthy instances. Possible values are `true` or `false`.
     * 
     */
    public Optional<Boolean> prioritizeUnhealthyInstancesEnabled() {
        return Optional.ofNullable(this.prioritizeUnhealthyInstancesEnabled);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static Builder builder(WindowsVirtualMachineScaleSetRollingUpgradePolicy defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable Boolean crossZoneUpgradesEnabled;
        private Integer maxBatchInstancePercent;
        private Integer maxUnhealthyInstancePercent;
        private Integer maxUnhealthyUpgradedInstancePercent;
        private String pauseTimeBetweenBatches;
        private @Nullable Boolean prioritizeUnhealthyInstancesEnabled;
        public Builder() {}
        public Builder(WindowsVirtualMachineScaleSetRollingUpgradePolicy defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.crossZoneUpgradesEnabled = defaults.crossZoneUpgradesEnabled;
    	      this.maxBatchInstancePercent = defaults.maxBatchInstancePercent;
    	      this.maxUnhealthyInstancePercent = defaults.maxUnhealthyInstancePercent;
    	      this.maxUnhealthyUpgradedInstancePercent = defaults.maxUnhealthyUpgradedInstancePercent;
    	      this.pauseTimeBetweenBatches = defaults.pauseTimeBetweenBatches;
    	      this.prioritizeUnhealthyInstancesEnabled = defaults.prioritizeUnhealthyInstancesEnabled;
        }

        @CustomType.Setter
        public Builder crossZoneUpgradesEnabled(@Nullable Boolean crossZoneUpgradesEnabled) {
            this.crossZoneUpgradesEnabled = crossZoneUpgradesEnabled;
            return this;
        }
        @CustomType.Setter
        public Builder maxBatchInstancePercent(Integer maxBatchInstancePercent) {
            this.maxBatchInstancePercent = Objects.requireNonNull(maxBatchInstancePercent);
            return this;
        }
        @CustomType.Setter
        public Builder maxUnhealthyInstancePercent(Integer maxUnhealthyInstancePercent) {
            this.maxUnhealthyInstancePercent = Objects.requireNonNull(maxUnhealthyInstancePercent);
            return this;
        }
        @CustomType.Setter
        public Builder maxUnhealthyUpgradedInstancePercent(Integer maxUnhealthyUpgradedInstancePercent) {
            this.maxUnhealthyUpgradedInstancePercent = Objects.requireNonNull(maxUnhealthyUpgradedInstancePercent);
            return this;
        }
        @CustomType.Setter
        public Builder pauseTimeBetweenBatches(String pauseTimeBetweenBatches) {
            this.pauseTimeBetweenBatches = Objects.requireNonNull(pauseTimeBetweenBatches);
            return this;
        }
        @CustomType.Setter
        public Builder prioritizeUnhealthyInstancesEnabled(@Nullable Boolean prioritizeUnhealthyInstancesEnabled) {
            this.prioritizeUnhealthyInstancesEnabled = prioritizeUnhealthyInstancesEnabled;
            return this;
        }
        public WindowsVirtualMachineScaleSetRollingUpgradePolicy build() {
            final var o = new WindowsVirtualMachineScaleSetRollingUpgradePolicy();
            o.crossZoneUpgradesEnabled = crossZoneUpgradesEnabled;
            o.maxBatchInstancePercent = maxBatchInstancePercent;
            o.maxUnhealthyInstancePercent = maxUnhealthyInstancePercent;
            o.maxUnhealthyUpgradedInstancePercent = maxUnhealthyUpgradedInstancePercent;
            o.pauseTimeBetweenBatches = pauseTimeBetweenBatches;
            o.prioritizeUnhealthyInstancesEnabled = prioritizeUnhealthyInstancesEnabled;
            return o;
        }
    }
}
