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

com.pulumi.kubernetes.autoscaling.v2beta2.kotlin.inputs.MetricSpecArgs.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.kubernetes.autoscaling.v2beta2.kotlin.inputs

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiNullFieldException
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import com.pulumi.kubernetes.autoscaling.v2beta2.inputs.MetricSpecArgs.builder
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName

/**
 * MetricSpec specifies how to scale based on a single metric (only `type` and one other matching field should be set at once).
 * @property containerResource container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag.
 * @property external external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).
 * @property object object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).
 * @property pods pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second).  The values will be averaged together before being compared to the target value.
 * @property resource resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source.
 * @property type type is the type of metric source.  It should be one of "Object", "Pods" or "Resource", each mapping to a matching field in the object.
 */
public data class MetricSpecArgs(
    public val containerResource: Output? = null,
    public val `external`: Output? = null,
    public val `object`: Output? = null,
    public val pods: Output? = null,
    public val resource: Output? = null,
    public val type: Output,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.kubernetes.autoscaling.v2beta2.inputs.MetricSpecArgs =
        com.pulumi.kubernetes.autoscaling.v2beta2.inputs.MetricSpecArgs.builder()
            .containerResource(containerResource?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .`external`(`external`?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .`object`(`object`?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .pods(pods?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .resource(resource?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .type(type.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [MetricSpecArgs].
 */
@PulumiTagMarker
public class MetricSpecArgsBuilder internal constructor() {
    private var containerResource: Output? = null

    private var `external`: Output? = null

    private var `object`: Output? = null

    private var pods: Output? = null

    private var resource: Output? = null

    private var type: Output? = null

    /**
     * @param value container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag.
     */
    @JvmName("iyfklnsnlswnupag")
    public suspend fun containerResource(`value`: Output) {
        this.containerResource = value
    }

    /**
     * @param value external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).
     */
    @JvmName("ykbxgydcqojsekuh")
    public suspend fun `external`(`value`: Output) {
        this.`external` = value
    }

    /**
     * @param value object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).
     */
    @JvmName("rmtbepxvnhirxtfl")
    public suspend fun `object`(`value`: Output) {
        this.`object` = value
    }

    /**
     * @param value pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second).  The values will be averaged together before being compared to the target value.
     */
    @JvmName("piyjbgadwgxxwmwg")
    public suspend fun pods(`value`: Output) {
        this.pods = value
    }

    /**
     * @param value resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source.
     */
    @JvmName("vlnuyvpeqpiffpey")
    public suspend fun resource(`value`: Output) {
        this.resource = value
    }

    /**
     * @param value type is the type of metric source.  It should be one of "Object", "Pods" or "Resource", each mapping to a matching field in the object.
     */
    @JvmName("unsivksqtelfnjff")
    public suspend fun type(`value`: Output) {
        this.type = value
    }

    /**
     * @param value container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag.
     */
    @JvmName("hhdjpvsbywmyjlqh")
    public suspend fun containerResource(`value`: ContainerResourceMetricSourceArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.containerResource = mapped
    }

    /**
     * @param argument container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source. This is an alpha feature and can be enabled by the HPAContainerMetrics feature flag.
     */
    @JvmName("ggpixyjlwxvhshkp")
    public suspend fun containerResource(argument: suspend ContainerResourceMetricSourceArgsBuilder.() -> Unit) {
        val toBeMapped = ContainerResourceMetricSourceArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.containerResource = mapped
    }

    /**
     * @param value external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).
     */
    @JvmName("vyvrjcddlakcvall")
    public suspend fun `external`(`value`: ExternalMetricSourceArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.`external` = mapped
    }

    /**
     * @param argument external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).
     */
    @JvmName("swvwqtgpnsuktwnh")
    public suspend fun `external`(argument: suspend ExternalMetricSourceArgsBuilder.() -> Unit) {
        val toBeMapped = ExternalMetricSourceArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.`external` = mapped
    }

    /**
     * @param value object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).
     */
    @JvmName("eputdgmqtewilgjj")
    public suspend fun `object`(`value`: ObjectMetricSourceArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.`object` = mapped
    }

    /**
     * @param argument object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).
     */
    @JvmName("ojqshmldjrgxnysn")
    public suspend fun `object`(argument: suspend ObjectMetricSourceArgsBuilder.() -> Unit) {
        val toBeMapped = ObjectMetricSourceArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.`object` = mapped
    }

    /**
     * @param value pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second).  The values will be averaged together before being compared to the target value.
     */
    @JvmName("jovoiahmflrlkcij")
    public suspend fun pods(`value`: PodsMetricSourceArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.pods = mapped
    }

    /**
     * @param argument pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second).  The values will be averaged together before being compared to the target value.
     */
    @JvmName("tguuydyjyktwgokh")
    public suspend fun pods(argument: suspend PodsMetricSourceArgsBuilder.() -> Unit) {
        val toBeMapped = PodsMetricSourceArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.pods = mapped
    }

    /**
     * @param value resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source.
     */
    @JvmName("bplwlpfpcvwavrmr")
    public suspend fun resource(`value`: ResourceMetricSourceArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resource = mapped
    }

    /**
     * @param argument resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the "pods" source.
     */
    @JvmName("vrujayembdbmwufu")
    public suspend fun resource(argument: suspend ResourceMetricSourceArgsBuilder.() -> Unit) {
        val toBeMapped = ResourceMetricSourceArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.resource = mapped
    }

    /**
     * @param value type is the type of metric source.  It should be one of "Object", "Pods" or "Resource", each mapping to a matching field in the object.
     */
    @JvmName("jhmxmxcflunjxnje")
    public suspend fun type(`value`: String) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.type = mapped
    }

    internal fun build(): MetricSpecArgs = MetricSpecArgs(
        containerResource = containerResource,
        `external` = `external`,
        `object` = `object`,
        pods = pods,
        resource = resource,
        type = type ?: throw PulumiNullFieldException("type"),
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy