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

com.pulumi.googlenative.compute.beta.kotlin.inputs.AutoscalingPolicyArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.googlenative.compute.beta.kotlin.inputs

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.googlenative.compute.beta.inputs.AutoscalingPolicyArgs.builder
import com.pulumi.googlenative.compute.beta.kotlin.enums.AutoscalingPolicyMode
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Cloud Autoscaler policy.
 * @property coolDownPeriodSec The number of seconds that the autoscaler waits 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.
 * @property customMetricUtilizations Configuration parameters of autoscaling based on a custom metric.
 * @property loadBalancingUtilization Configuration parameters of autoscaling based on load balancer.
 * @property maxNumReplicas The maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas.
 * @property minNumReplicas The minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed.
 * @property mode Defines operating mode for this policy.
 * @property scaleDownControl
 * @property scaleInControl
 * @property scalingSchedules Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed.
 */
public data class AutoscalingPolicyArgs(
    public val coolDownPeriodSec: Output? = null,
    public val cpuUtilization: Output? = null,
    public val customMetricUtilizations: Output>? =
        null,
    public val loadBalancingUtilization: Output? =
        null,
    public val maxNumReplicas: Output? = null,
    public val minNumReplicas: Output? = null,
    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.googlenative.compute.beta.inputs.AutoscalingPolicyArgs =
        com.pulumi.googlenative.compute.beta.inputs.AutoscalingPolicyArgs.builder()
            .coolDownPeriodSec(coolDownPeriodSec?.applyValue({ args0 -> args0 }))
            .cpuUtilization(cpuUtilization?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .customMetricUtilizations(
                customMetricUtilizations?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            )
            .loadBalancingUtilization(
                loadBalancingUtilization?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .maxNumReplicas(maxNumReplicas?.applyValue({ args0 -> args0 }))
            .minNumReplicas(minNumReplicas?.applyValue({ args0 -> args0 }))
            .mode(mode?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .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.key.to(args0.value)
                    }).toMap()
                }),
            ).build()
}

/**
 * Builder for [AutoscalingPolicyArgs].
 */
@PulumiTagMarker
public class AutoscalingPolicyArgsBuilder internal constructor() {
    private var coolDownPeriodSec: Output? = null

    private var cpuUtilization: Output? = null

    private var customMetricUtilizations: Output>? =
        null

    private var loadBalancingUtilization: Output? =
        null

    private var maxNumReplicas: Output? = null

    private var minNumReplicas: 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 waits 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("cssiafjqygpyqwec")
    public suspend fun coolDownPeriodSec(`value`: Output) {
        this.coolDownPeriodSec = 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.
     */
    @JvmName("vhvtmqvfitcvsuru")
    public suspend fun cpuUtilization(`value`: Output) {
        this.cpuUtilization = value
    }

    /**
     * @param value Configuration parameters of autoscaling based on a custom metric.
     */
    @JvmName("pgcsaihxqtebtire")
    public suspend fun customMetricUtilizations(`value`: Output>) {
        this.customMetricUtilizations = value
    }

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

    /**
     * @param values Configuration parameters of autoscaling based on a custom metric.
     */
    @JvmName("wkshrkiqdvgqgepx")
    public suspend fun customMetricUtilizations(values: List>) {
        this.customMetricUtilizations = Output.all(values)
    }

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

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

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

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

    /**
     * @param value
     */
    @JvmName("dyxamwiqdjyieejl")
    public suspend fun scaleDownControl(`value`: Output) {
        this.scaleDownControl = value
    }

    /**
     * @param value
     */
    @JvmName("akyquxyuotcrsium")
    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. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed.
     */
    @JvmName("orrwnhkbcmfdiyxv")
    public suspend fun scalingSchedules(`value`: Output>) {
        this.scalingSchedules = value
    }

    /**
     * @param value The number of seconds that the autoscaler waits 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("wrqtbolavcfnrgbq")
    public suspend fun coolDownPeriodSec(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.coolDownPeriodSec = 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.
     */
    @JvmName("khdvkrolbixouyer")
    public suspend fun cpuUtilization(`value`: AutoscalingPolicyCpuUtilizationArgs?) {
        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.
     */
    @JvmName("nfdiftmbmjcagtcw")
    public suspend fun cpuUtilization(argument: suspend AutoscalingPolicyCpuUtilizationArgsBuilder.() -> Unit) {
        val toBeMapped = AutoscalingPolicyCpuUtilizationArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.cpuUtilization = mapped
    }

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

    /**
     * @param argument Configuration parameters of autoscaling based on a custom metric.
     */
    @JvmName("hqevludyldhqbtab")
    public suspend fun customMetricUtilizations(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            AutoscalingPolicyCustomMetricUtilizationArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.customMetricUtilizations = mapped
    }

    /**
     * @param argument Configuration parameters of autoscaling based on a custom metric.
     */
    @JvmName("tlogdmftexfmktmi")
    public suspend fun customMetricUtilizations(vararg argument: suspend AutoscalingPolicyCustomMetricUtilizationArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            AutoscalingPolicyCustomMetricUtilizationArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.customMetricUtilizations = mapped
    }

    /**
     * @param argument Configuration parameters of autoscaling based on a custom metric.
     */
    @JvmName("uipvcpcyplejyboo")
    public suspend fun customMetricUtilizations(argument: suspend AutoscalingPolicyCustomMetricUtilizationArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            AutoscalingPolicyCustomMetricUtilizationArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.customMetricUtilizations = mapped
    }

    /**
     * @param values Configuration parameters of autoscaling based on a custom metric.
     */
    @JvmName("xanqhvufiiofqerg")
    public suspend fun customMetricUtilizations(vararg values: AutoscalingPolicyCustomMetricUtilizationArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.customMetricUtilizations = mapped
    }

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

    /**
     * @param argument Configuration parameters of autoscaling based on load balancer.
     */
    @JvmName("gigflqtxcobobxvu")
    public suspend fun loadBalancingUtilization(argument: suspend AutoscalingPolicyLoadBalancingUtilizationArgsBuilder.() -> Unit) {
        val toBeMapped = AutoscalingPolicyLoadBalancingUtilizationArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.loadBalancingUtilization = mapped
    }

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

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

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

    /**
     * @param value
     */
    @JvmName("mnduscugcianrdlk")
    public suspend fun scaleDownControl(`value`: AutoscalingPolicyScaleDownControlArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scaleDownControl = mapped
    }

    /**
     * @param argument
     */
    @JvmName("ufwfskyjkssuclfh")
    public suspend fun scaleDownControl(argument: suspend AutoscalingPolicyScaleDownControlArgsBuilder.() -> Unit) {
        val toBeMapped = AutoscalingPolicyScaleDownControlArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.scaleDownControl = mapped
    }

    /**
     * @param value
     */
    @JvmName("neewxgkaqjqnnivo")
    public suspend fun scaleInControl(`value`: AutoscalingPolicyScaleInControlArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scaleInControl = mapped
    }

    /**
     * @param argument
     */
    @JvmName("xfhgvpdqjljvakxw")
    public suspend fun scaleInControl(argument: suspend AutoscalingPolicyScaleInControlArgsBuilder.() -> Unit) {
        val toBeMapped = AutoscalingPolicyScaleInControlArgsBuilder().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. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed.
     */
    @JvmName("joveqdrmquvvoeaq")
    public suspend fun scalingSchedules(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scalingSchedules = mapped
    }

    /**
     * @param values Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed.
     */
    @JvmName("peoyitxsubpcpshy")
    public fun scalingSchedules(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.scalingSchedules = mapped
    }

    internal fun build(): AutoscalingPolicyArgs = AutoscalingPolicyArgs(
        coolDownPeriodSec = coolDownPeriodSec,
        cpuUtilization = cpuUtilization,
        customMetricUtilizations = customMetricUtilizations,
        loadBalancingUtilization = loadBalancingUtilization,
        maxNumReplicas = maxNumReplicas,
        minNumReplicas = minNumReplicas,
        mode = mode,
        scaleDownControl = scaleDownControl,
        scaleInControl = scaleInControl,
        scalingSchedules = scalingSchedules,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy