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

commonMain.aws.sdk.kotlin.services.applicationautoscaling.model.CustomizedMetricSpecification.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

/**
 * Represents a CloudWatch metric of your choosing for a target tracking scaling policy to use with Application Auto Scaling.
 *
 * For information about the available metrics for a service, see [Amazon Web Services services that publish CloudWatch metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html) in the *Amazon CloudWatch User Guide*.
 *
 * To create your customized metric specification:
 * + Add values for each required parameter from CloudWatch. You can use an existing metric, or a new metric that you create. To use your own metric, you must first publish the metric to CloudWatch. For more information, see [Publish custom metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html) in the *Amazon CloudWatch User Guide*.
 * + Choose a metric that changes proportionally with capacity. The value of the metric should increase or decrease in inverse proportion to the number of capacity units. That is, the value of the metric should decrease when capacity increases, and increase when capacity decreases.
 *
 * For more information about the CloudWatch terminology below, see [Amazon CloudWatch concepts](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html) in the *Amazon CloudWatch User Guide*.
 */
public class CustomizedMetricSpecification private constructor(builder: Builder) {
    /**
     * The dimensions of the metric.
     *
     * Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
     */
    public val dimensions: List? = builder.dimensions
    /**
     * The name of the metric. To get the exact metric name, namespace, and dimensions, inspect the [Metric](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Metric.html) object that's returned by a call to [ListMetrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html).
     */
    public val metricName: kotlin.String? = builder.metricName
    /**
     * The metrics to include in the target tracking scaling policy, as a metric data query. This can include both raw metric and metric math expressions.
     */
    public val metrics: List? = builder.metrics
    /**
     * The namespace of the metric.
     */
    public val namespace: kotlin.String? = builder.namespace
    /**
     * The statistic of the metric.
     */
    public val statistic: aws.sdk.kotlin.services.applicationautoscaling.model.MetricStatistic? = builder.statistic
    /**
     * The unit of the metric. For a complete list of the units that CloudWatch supports, see the [MetricDatum](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html) data type in the *Amazon CloudWatch API Reference*.
     */
    public val unit: kotlin.String? = builder.unit

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

    override fun toString(): kotlin.String = buildString {
        append("CustomizedMetricSpecification(")
        append("dimensions=$dimensions,")
        append("metricName=$metricName,")
        append("metrics=$metrics,")
        append("namespace=$namespace,")
        append("statistic=$statistic,")
        append("unit=$unit")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = dimensions?.hashCode() ?: 0
        result = 31 * result + (metricName?.hashCode() ?: 0)
        result = 31 * result + (metrics?.hashCode() ?: 0)
        result = 31 * result + (namespace?.hashCode() ?: 0)
        result = 31 * result + (statistic?.hashCode() ?: 0)
        result = 31 * result + (unit?.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 CustomizedMetricSpecification

        if (dimensions != other.dimensions) return false
        if (metricName != other.metricName) return false
        if (metrics != other.metrics) return false
        if (namespace != other.namespace) return false
        if (statistic != other.statistic) return false
        if (unit != other.unit) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The dimensions of the metric.
         *
         * Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
         */
        public var dimensions: List? = null
        /**
         * The name of the metric. To get the exact metric name, namespace, and dimensions, inspect the [Metric](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Metric.html) object that's returned by a call to [ListMetrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html).
         */
        public var metricName: kotlin.String? = null
        /**
         * The metrics to include in the target tracking scaling policy, as a metric data query. This can include both raw metric and metric math expressions.
         */
        public var metrics: List? = null
        /**
         * The namespace of the metric.
         */
        public var namespace: kotlin.String? = null
        /**
         * The statistic of the metric.
         */
        public var statistic: aws.sdk.kotlin.services.applicationautoscaling.model.MetricStatistic? = null
        /**
         * The unit of the metric. For a complete list of the units that CloudWatch supports, see the [MetricDatum](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html) data type in the *Amazon CloudWatch API Reference*.
         */
        public var unit: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.applicationautoscaling.model.CustomizedMetricSpecification) : this() {
            this.dimensions = x.dimensions
            this.metricName = x.metricName
            this.metrics = x.metrics
            this.namespace = x.namespace
            this.statistic = x.statistic
            this.unit = x.unit
        }

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

        internal fun correctErrors(): Builder {
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy