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

commonMain.aws.sdk.kotlin.services.applicationsignals.model.MetricStat.kt Maven / Gradle / Ivy

There is a newer version: 1.3.99
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.applicationsignals.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * This structure defines the metric to be used as the service level indicator, along with the statistics, period, and unit.
 */
public class MetricStat private constructor(builder: Builder) {
    /**
     * The metric to use as the service level indicator, including the metric name, namespace, and dimensions.
     */
    public val metric: aws.sdk.kotlin.services.applicationsignals.model.Metric? = builder.metric
    /**
     * The granularity, in seconds, to be used for the metric. For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a `PutMetricData` call that includes a `StorageResolution` of 1 second.
     */
    public val period: kotlin.Int = requireNotNull(builder.period) { "A non-null value must be provided for period" }
    /**
     * The statistic to use for comparison to the threshold. It can be any CloudWatch statistic or extended statistic. For more information about statistics, see [CloudWatch statistics definitions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html).
     */
    public val stat: kotlin.String = requireNotNull(builder.stat) { "A non-null value must be provided for stat" }
    /**
     * If you omit `Unit` then all data that was collected with any unit is returned, along with the corresponding units that were specified when the data was reported to CloudWatch. If you specify a unit, the operation returns only data that was collected with that unit specified. If you specify a unit that does not match the data collected, the results of the operation are null. CloudWatch does not perform unit conversions.
     */
    public val unit: aws.sdk.kotlin.services.applicationsignals.model.StandardUnit? = builder.unit

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

    override fun toString(): kotlin.String = buildString {
        append("MetricStat(")
        append("metric=$metric,")
        append("period=$period,")
        append("stat=$stat,")
        append("unit=$unit")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = metric?.hashCode() ?: 0
        result = 31 * result + (period)
        result = 31 * result + (stat.hashCode())
        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 MetricStat

        if (metric != other.metric) return false
        if (period != other.period) return false
        if (stat != other.stat) return false
        if (unit != other.unit) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The metric to use as the service level indicator, including the metric name, namespace, and dimensions.
         */
        public var metric: aws.sdk.kotlin.services.applicationsignals.model.Metric? = null
        /**
         * The granularity, in seconds, to be used for the metric. For metrics with regular resolution, a period can be as short as one minute (60 seconds) and must be a multiple of 60. For high-resolution metrics that are collected at intervals of less than one minute, the period can be 1, 5, 10, 30, 60, or any multiple of 60. High-resolution metrics are those metrics stored by a `PutMetricData` call that includes a `StorageResolution` of 1 second.
         */
        public var period: kotlin.Int? = null
        /**
         * The statistic to use for comparison to the threshold. It can be any CloudWatch statistic or extended statistic. For more information about statistics, see [CloudWatch statistics definitions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html).
         */
        public var stat: kotlin.String? = null
        /**
         * If you omit `Unit` then all data that was collected with any unit is returned, along with the corresponding units that were specified when the data was reported to CloudWatch. If you specify a unit, the operation returns only data that was collected with that unit specified. If you specify a unit that does not match the data collected, the results of the operation are null. CloudWatch does not perform unit conversions.
         */
        public var unit: aws.sdk.kotlin.services.applicationsignals.model.StandardUnit? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.applicationsignals.model.MetricStat) : this() {
            this.metric = x.metric
            this.period = x.period
            this.stat = x.stat
            this.unit = x.unit
        }

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

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

        internal fun correctErrors(): Builder {
            if (period == null) period = 0
            if (stat == null) stat = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy