All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.compute.kotlin.inputs.AutoscalerAutoscalingPolicyArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.compute.kotlin.inputs

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.compute.inputs.AutoscalerAutoscalingPolicyArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiNullFieldException
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 *
 * @property cooldownPeriod The number of seconds that the autoscaler should wait before it
 * starts collecting information from a new instance. This prevents
 * the autoscaler from collecting information when the instance is
 * initializing, during which the collected usage would not be
 * reliable. The default time autoscaler waits is 60 seconds.
 * Virtual machine initialization times might vary because of
 * numerous factors. We recommend that you test how long an
 * instance may take to initialize. To do this, create an instance
 * and time the startup process.
 * @property cpuUtilization Defines the CPU utilization policy that allows the autoscaler to
 * scale based on the average CPU utilization of a managed instance
 * group.
 * Structure is documented below.
 * @property loadBalancingUtilization Configuration parameters of autoscaling based on a load balancer.
 * Structure is documented below.
 * @property maxReplicas The maximum number of instances that the autoscaler can scale up
 * to. This is required when creating or updating an autoscaler. The
 * maximum number of replicas should not be lower than minimal number
 * of replicas.
 * @property metrics Configuration parameters of autoscaling based on a custom metric.
 * Structure is documented below.
 * @property minReplicas The minimum number of replicas that the autoscaler can scale down
 * to. This cannot be less than 0. If not provided, autoscaler will
 * choose a default value depending on maximum number of instances
 * allowed.
 * @property mode Defines operating mode for this policy.
 * @property scaleDownControl Defines scale down controls to reduce the risk of response latency
 * and outages due to abrupt scale-in events
 * Structure is documented below.
 * @property scaleInControl Defines scale in controls to reduce the risk of response latency
 * and outages due to abrupt scale-in events
 * Structure is documented below.
 * @property scalingSchedules Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap.
 * Structure is documented below.
 */
public data class AutoscalerAutoscalingPolicyArgs(
    public val cooldownPeriod: Output? = null,
    public val cpuUtilization: Output? = null,
    public val loadBalancingUtilization: Output? = null,
    public val maxReplicas: Output,
    public val metrics: Output>? = null,
    public val minReplicas: Output,
    public val mode: Output? = null,
    public val scaleDownControl: Output? = null,
    public val scaleInControl: Output? = null,
    public val scalingSchedules: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.compute.inputs.AutoscalerAutoscalingPolicyArgs =
        com.pulumi.gcp.compute.inputs.AutoscalerAutoscalingPolicyArgs.builder()
            .cooldownPeriod(cooldownPeriod?.applyValue({ args0 -> args0 }))
            .cpuUtilization(cpuUtilization?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .loadBalancingUtilization(
                loadBalancingUtilization?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .maxReplicas(maxReplicas.applyValue({ args0 -> args0 }))
            .metrics(
                metrics?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .minReplicas(minReplicas.applyValue({ args0 -> args0 }))
            .mode(mode?.applyValue({ args0 -> args0 }))
            .scaleDownControl(scaleDownControl?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .scaleInControl(scaleInControl?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .scalingSchedules(
                scalingSchedules?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            ).build()
}

/**
 * Builder for [AutoscalerAutoscalingPolicyArgs].
 */
@PulumiTagMarker
public class AutoscalerAutoscalingPolicyArgsBuilder internal constructor() {
    private var cooldownPeriod: Output? = null

    private var cpuUtilization: Output? = null

    private var loadBalancingUtilization:
        Output? = null

    private var maxReplicas: Output? = null

    private var metrics: Output>? = null

    private var minReplicas: Output? = null

    private var mode: Output? = null

    private var scaleDownControl: Output? = null

    private var scaleInControl: Output? = null

    private var scalingSchedules: Output>? = null

    /**
     * @param value The number of seconds that the autoscaler should wait before it
     * starts collecting information from a new instance. This prevents
     * the autoscaler from collecting information when the instance is
     * initializing, during which the collected usage would not be
     * reliable. The default time autoscaler waits is 60 seconds.
     * Virtual machine initialization times might vary because of
     * numerous factors. We recommend that you test how long an
     * instance may take to initialize. To do this, create an instance
     * and time the startup process.
     */
    @JvmName("vdihbijtxbvrdmst")
    public suspend fun cooldownPeriod(`value`: Output) {
        this.cooldownPeriod = value
    }

    /**
     * @param value Defines the CPU utilization policy that allows the autoscaler to
     * scale based on the average CPU utilization of a managed instance
     * group.
     * Structure is documented below.
     */
    @JvmName("ahphjpadmsbuxvxc")
    public suspend fun cpuUtilization(`value`: Output) {
        this.cpuUtilization = value
    }

    /**
     * @param value Configuration parameters of autoscaling based on a load balancer.
     * Structure is documented below.
     */
    @JvmName("jbcftjncfiqvstxf")
    public suspend fun loadBalancingUtilization(`value`: Output) {
        this.loadBalancingUtilization = value
    }

    /**
     * @param value The maximum number of instances that the autoscaler can scale up
     * to. This is required when creating or updating an autoscaler. The
     * maximum number of replicas should not be lower than minimal number
     * of replicas.
     */
    @JvmName("wpaedggtxhgvhmwp")
    public suspend fun maxReplicas(`value`: Output) {
        this.maxReplicas = value
    }

    /**
     * @param value Configuration parameters of autoscaling based on a custom metric.
     * Structure is documented below.
     */
    @JvmName("groamuhvimalmgao")
    public suspend fun metrics(`value`: Output>) {
        this.metrics = value
    }

    @JvmName("iyqhwfaucvnveusk")
    public suspend fun metrics(vararg values: Output) {
        this.metrics = Output.all(values.asList())
    }

    /**
     * @param values Configuration parameters of autoscaling based on a custom metric.
     * Structure is documented below.
     */
    @JvmName("yavftoedjdypqxne")
    public suspend fun metrics(values: List>) {
        this.metrics = Output.all(values)
    }

    /**
     * @param value The minimum number of replicas that the autoscaler can scale down
     * to. This cannot be less than 0. If not provided, autoscaler will
     * choose a default value depending on maximum number of instances
     * allowed.
     */
    @JvmName("lhfcaeytnbunqkun")
    public suspend fun minReplicas(`value`: Output) {
        this.minReplicas = value
    }

    /**
     * @param value Defines operating mode for this policy.
     */
    @JvmName("wflpjmvgcfrhhcbr")
    public suspend fun mode(`value`: Output) {
        this.mode = value
    }

    /**
     * @param value Defines scale down controls to reduce the risk of response latency
     * and outages due to abrupt scale-in events
     * Structure is documented below.
     */
    @JvmName("kkrbbsixmvmyfudk")
    public suspend fun scaleDownControl(`value`: Output) {
        this.scaleDownControl = value
    }

    /**
     * @param value Defines scale in controls to reduce the risk of response latency
     * and outages due to abrupt scale-in events
     * Structure is documented below.
     */
    @JvmName("usdvtixovjqdamtr")
    public suspend fun scaleInControl(`value`: Output) {
        this.scaleInControl = value
    }

    /**
     * @param value Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap.
     * Structure is documented below.
     */
    @JvmName("epgiaxajhwvbbyca")
    public suspend fun scalingSchedules(`value`: Output>) {
        this.scalingSchedules = value
    }

    @JvmName("xlegspordopkpari")
    public suspend fun scalingSchedules(vararg values: Output) {
        this.scalingSchedules = Output.all(values.asList())
    }

    /**
     * @param values Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap.
     * Structure is documented below.
     */
    @JvmName("iwifafkhjvnnchix")
    public suspend fun scalingSchedules(values: List>) {
        this.scalingSchedules = Output.all(values)
    }

    /**
     * @param value The number of seconds that the autoscaler should wait before it
     * starts collecting information from a new instance. This prevents
     * the autoscaler from collecting information when the instance is
     * initializing, during which the collected usage would not be
     * reliable. The default time autoscaler waits is 60 seconds.
     * Virtual machine initialization times might vary because of
     * numerous factors. We recommend that you test how long an
     * instance may take to initialize. To do this, create an instance
     * and time the startup process.
     */
    @JvmName("ugylpcebvkieesvn")
    public suspend fun cooldownPeriod(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.cooldownPeriod = mapped
    }

    /**
     * @param value Defines the CPU utilization policy that allows the autoscaler to
     * scale based on the average CPU utilization of a managed instance
     * group.
     * Structure is documented below.
     */
    @JvmName("koghdfliofopqxhd")
    public suspend fun cpuUtilization(`value`: AutoscalerAutoscalingPolicyCpuUtilizationArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.cpuUtilization = mapped
    }

    /**
     * @param argument Defines the CPU utilization policy that allows the autoscaler to
     * scale based on the average CPU utilization of a managed instance
     * group.
     * Structure is documented below.
     */
    @JvmName("uqfudicylfomaobu")
    public suspend fun cpuUtilization(argument: suspend AutoscalerAutoscalingPolicyCpuUtilizationArgsBuilder.() -> Unit) {
        val toBeMapped = AutoscalerAutoscalingPolicyCpuUtilizationArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.cpuUtilization = mapped
    }

    /**
     * @param value Configuration parameters of autoscaling based on a load balancer.
     * Structure is documented below.
     */
    @JvmName("busmtfnyfvextjhg")
    public suspend fun loadBalancingUtilization(`value`: AutoscalerAutoscalingPolicyLoadBalancingUtilizationArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.loadBalancingUtilization = mapped
    }

    /**
     * @param argument Configuration parameters of autoscaling based on a load balancer.
     * Structure is documented below.
     */
    @JvmName("tlahsbybpilbilho")
    public suspend fun loadBalancingUtilization(argument: suspend AutoscalerAutoscalingPolicyLoadBalancingUtilizationArgsBuilder.() -> Unit) {
        val toBeMapped = AutoscalerAutoscalingPolicyLoadBalancingUtilizationArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.loadBalancingUtilization = mapped
    }

    /**
     * @param value The maximum number of instances that the autoscaler can scale up
     * to. This is required when creating or updating an autoscaler. The
     * maximum number of replicas should not be lower than minimal number
     * of replicas.
     */
    @JvmName("hckcrglpbdmeodxs")
    public suspend fun maxReplicas(`value`: Int) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.maxReplicas = mapped
    }

    /**
     * @param value Configuration parameters of autoscaling based on a custom metric.
     * Structure is documented below.
     */
    @JvmName("mykguaytthqrsunf")
    public suspend fun metrics(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.metrics = mapped
    }

    /**
     * @param argument Configuration parameters of autoscaling based on a custom metric.
     * Structure is documented below.
     */
    @JvmName("xvhgguauddhwgkjw")
    public suspend fun metrics(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            AutoscalerAutoscalingPolicyMetricArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.metrics = mapped
    }

    /**
     * @param argument Configuration parameters of autoscaling based on a custom metric.
     * Structure is documented below.
     */
    @JvmName("kfctjqxgulihgiwi")
    public suspend fun metrics(vararg argument: suspend AutoscalerAutoscalingPolicyMetricArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            AutoscalerAutoscalingPolicyMetricArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.metrics = mapped
    }

    /**
     * @param argument Configuration parameters of autoscaling based on a custom metric.
     * Structure is documented below.
     */
    @JvmName("ifibuojecyjfstne")
    public suspend fun metrics(argument: suspend AutoscalerAutoscalingPolicyMetricArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            AutoscalerAutoscalingPolicyMetricArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.metrics = mapped
    }

    /**
     * @param values Configuration parameters of autoscaling based on a custom metric.
     * Structure is documented below.
     */
    @JvmName("mmpjoyutvyrxfway")
    public suspend fun metrics(vararg values: AutoscalerAutoscalingPolicyMetricArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.metrics = mapped
    }

    /**
     * @param value The minimum number of replicas that the autoscaler can scale down
     * to. This cannot be less than 0. If not provided, autoscaler will
     * choose a default value depending on maximum number of instances
     * allowed.
     */
    @JvmName("dtgklwauyefcdncf")
    public suspend fun minReplicas(`value`: Int) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.minReplicas = mapped
    }

    /**
     * @param value Defines operating mode for this policy.
     */
    @JvmName("wrmailightnsieed")
    public suspend fun mode(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.mode = mapped
    }

    /**
     * @param value Defines scale down controls to reduce the risk of response latency
     * and outages due to abrupt scale-in events
     * Structure is documented below.
     */
    @JvmName("utaohadgrsrqlnhj")
    public suspend fun scaleDownControl(`value`: AutoscalerAutoscalingPolicyScaleDownControlArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scaleDownControl = mapped
    }

    /**
     * @param argument Defines scale down controls to reduce the risk of response latency
     * and outages due to abrupt scale-in events
     * Structure is documented below.
     */
    @JvmName("hojwjpwkmhtohwop")
    public suspend fun scaleDownControl(argument: suspend AutoscalerAutoscalingPolicyScaleDownControlArgsBuilder.() -> Unit) {
        val toBeMapped = AutoscalerAutoscalingPolicyScaleDownControlArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.scaleDownControl = mapped
    }

    /**
     * @param value Defines scale in controls to reduce the risk of response latency
     * and outages due to abrupt scale-in events
     * Structure is documented below.
     */
    @JvmName("lltxdinjrhswgnhs")
    public suspend fun scaleInControl(`value`: AutoscalerAutoscalingPolicyScaleInControlArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scaleInControl = mapped
    }

    /**
     * @param argument Defines scale in controls to reduce the risk of response latency
     * and outages due to abrupt scale-in events
     * Structure is documented below.
     */
    @JvmName("dstcwknsknjvceeo")
    public suspend fun scaleInControl(argument: suspend AutoscalerAutoscalingPolicyScaleInControlArgsBuilder.() -> Unit) {
        val toBeMapped = AutoscalerAutoscalingPolicyScaleInControlArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.scaleInControl = mapped
    }

    /**
     * @param value Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap.
     * Structure is documented below.
     */
    @JvmName("vwsdlnhfqfgyoqjl")
    public suspend fun scalingSchedules(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scalingSchedules = mapped
    }

    /**
     * @param argument Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap.
     * Structure is documented below.
     */
    @JvmName("ehyooptchkgddbpv")
    public suspend fun scalingSchedules(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            AutoscalerAutoscalingPolicyScalingScheduleArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.scalingSchedules = mapped
    }

    /**
     * @param argument Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap.
     * Structure is documented below.
     */
    @JvmName("sfshaqcqqbmhuhym")
    public suspend fun scalingSchedules(vararg argument: suspend AutoscalerAutoscalingPolicyScalingScheduleArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            AutoscalerAutoscalingPolicyScalingScheduleArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.scalingSchedules = mapped
    }

    /**
     * @param argument Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap.
     * Structure is documented below.
     */
    @JvmName("lydubryprjlcsvsn")
    public suspend fun scalingSchedules(argument: suspend AutoscalerAutoscalingPolicyScalingScheduleArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            AutoscalerAutoscalingPolicyScalingScheduleArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.scalingSchedules = mapped
    }

    /**
     * @param values Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap.
     * Structure is documented below.
     */
    @JvmName("twsjaicwouychxrv")
    public suspend fun scalingSchedules(vararg values: AutoscalerAutoscalingPolicyScalingScheduleArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.scalingSchedules = mapped
    }

    internal fun build(): AutoscalerAutoscalingPolicyArgs = AutoscalerAutoscalingPolicyArgs(
        cooldownPeriod = cooldownPeriod,
        cpuUtilization = cpuUtilization,
        loadBalancingUtilization = loadBalancingUtilization,
        maxReplicas = maxReplicas ?: throw PulumiNullFieldException("maxReplicas"),
        metrics = metrics,
        minReplicas = minReplicas ?: throw PulumiNullFieldException("minReplicas"),
        mode = mode,
        scaleDownControl = scaleDownControl,
        scaleInControl = scaleInControl,
        scalingSchedules = scalingSchedules,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy