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

commonMain.aws.sdk.kotlin.services.applicationautoscaling.model.TargetTrackingMetricDataQuery.kt Maven / Gradle / Ivy

The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.applicationautoscaling.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * The metric data to return. Also defines whether this call is returning data for one metric only, or whether it is performing a math expression on the values of returned metric statistics to create a new time series. A time series is a series of data points, each of which is associated with a timestamp.
 *
 * For more information and examples, see [Create a target tracking scaling policy for Application Auto Scaling using metric math](https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-target-tracking-metric-math.html) in the *Application Auto Scaling User Guide*.
 */
public class TargetTrackingMetricDataQuery private constructor(builder: Builder) {
    /**
     * The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the `Id` of the other metrics to refer to those metrics, and can also use the `Id` of other expressions to use the result of those expressions.
     *
     * Conditional: Within each `TargetTrackingMetricDataQuery` object, you must specify either `Expression` or `MetricStat`, but not both.
     */
    public val expression: kotlin.String? = builder.expression
    /**
     * A short name that identifies the object's results in the response. This name must be unique among all `MetricDataQuery` objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.
     */
    public val id: kotlin.String = requireNotNull(builder.id) { "A non-null value must be provided for id" }
    /**
     * A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
     */
    public val label: kotlin.String? = builder.label
    /**
     * Information about the metric data to return.
     *
     * Conditional: Within each `MetricDataQuery` object, you must specify either `Expression` or `MetricStat`, but not both.
     */
    public val metricStat: aws.sdk.kotlin.services.applicationautoscaling.model.TargetTrackingMetricStat? = builder.metricStat
    /**
     * Indicates whether to return the timestamps and raw data values of this metric.
     *
     * If you use any math expressions, specify `true` for this value for only the final math expression that the metric specification is based on. You must specify `false` for `ReturnData` for all the other metrics and expressions used in the metric specification.
     *
     * If you are only retrieving metrics and not performing any math expressions, do not specify anything for `ReturnData`. This sets it to its default (`true`).
     */
    public val returnData: kotlin.Boolean? = builder.returnData

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.applicationautoscaling.model.TargetTrackingMetricDataQuery = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("TargetTrackingMetricDataQuery(")
        append("expression=$expression,")
        append("id=$id,")
        append("label=$label,")
        append("metricStat=$metricStat,")
        append("returnData=$returnData")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = expression?.hashCode() ?: 0
        result = 31 * result + (id.hashCode())
        result = 31 * result + (label?.hashCode() ?: 0)
        result = 31 * result + (metricStat?.hashCode() ?: 0)
        result = 31 * result + (returnData?.hashCode() ?: 0)
        return result
    }

    override fun equals(other: kotlin.Any?): kotlin.Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as TargetTrackingMetricDataQuery

        if (expression != other.expression) return false
        if (id != other.id) return false
        if (label != other.label) return false
        if (metricStat != other.metricStat) return false
        if (returnData != other.returnData) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.applicationautoscaling.model.TargetTrackingMetricDataQuery = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * The math expression to perform on the returned data, if this object is performing a math expression. This expression can use the `Id` of the other metrics to refer to those metrics, and can also use the `Id` of other expressions to use the result of those expressions.
         *
         * Conditional: Within each `TargetTrackingMetricDataQuery` object, you must specify either `Expression` or `MetricStat`, but not both.
         */
        public var expression: kotlin.String? = null
        /**
         * A short name that identifies the object's results in the response. This name must be unique among all `MetricDataQuery` objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter.
         */
        public var id: kotlin.String? = null
        /**
         * A human-readable label for this metric or expression. This is especially useful if this is a math expression, so that you know what the value represents.
         */
        public var label: kotlin.String? = null
        /**
         * Information about the metric data to return.
         *
         * Conditional: Within each `MetricDataQuery` object, you must specify either `Expression` or `MetricStat`, but not both.
         */
        public var metricStat: aws.sdk.kotlin.services.applicationautoscaling.model.TargetTrackingMetricStat? = null
        /**
         * Indicates whether to return the timestamps and raw data values of this metric.
         *
         * If you use any math expressions, specify `true` for this value for only the final math expression that the metric specification is based on. You must specify `false` for `ReturnData` for all the other metrics and expressions used in the metric specification.
         *
         * If you are only retrieving metrics and not performing any math expressions, do not specify anything for `ReturnData`. This sets it to its default (`true`).
         */
        public var returnData: kotlin.Boolean? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.applicationautoscaling.model.TargetTrackingMetricDataQuery) : this() {
            this.expression = x.expression
            this.id = x.id
            this.label = x.label
            this.metricStat = x.metricStat
            this.returnData = x.returnData
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.applicationautoscaling.model.TargetTrackingMetricDataQuery = TargetTrackingMetricDataQuery(this)

        /**
         * construct an [aws.sdk.kotlin.services.applicationautoscaling.model.TargetTrackingMetricStat] inside the given [block]
         */
        public fun metricStat(block: aws.sdk.kotlin.services.applicationautoscaling.model.TargetTrackingMetricStat.Builder.() -> kotlin.Unit) {
            this.metricStat = aws.sdk.kotlin.services.applicationautoscaling.model.TargetTrackingMetricStat.invoke(block)
        }

        internal fun correctErrors(): Builder {
            if (id == null) id = ""
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy