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

commonMain.aws.sdk.kotlin.services.iot.model.MetricToRetain.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.iot.model



/**
 * The metric you want to retain. Dimensions are optional.
 */
public class MetricToRetain private constructor(builder: Builder) {
    /**
     * Value added in both Behavior and AdditionalMetricsToRetainV2 to indicate if Device Defender Detect should export the corresponding metrics.
     */
    public val exportMetric: kotlin.Boolean? = builder.exportMetric
    /**
     * What is measured by the behavior.
     */
    public val metric: kotlin.String = requireNotNull(builder.metric) { "A non-null value must be provided for metric" }
    /**
     * The dimension of a metric. This can't be used with custom metrics.
     */
    public val metricDimension: aws.sdk.kotlin.services.iot.model.MetricDimension? = builder.metricDimension

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

    override fun toString(): kotlin.String = buildString {
        append("MetricToRetain(")
        append("exportMetric=$exportMetric,")
        append("metric=$metric,")
        append("metricDimension=$metricDimension")
        append(")")
    }

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

        if (exportMetric != other.exportMetric) return false
        if (metric != other.metric) return false
        if (metricDimension != other.metricDimension) return false

        return true
    }

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

    public class Builder {
        /**
         * Value added in both Behavior and AdditionalMetricsToRetainV2 to indicate if Device Defender Detect should export the corresponding metrics.
         */
        public var exportMetric: kotlin.Boolean? = null
        /**
         * What is measured by the behavior.
         */
        public var metric: kotlin.String? = null
        /**
         * The dimension of a metric. This can't be used with custom metrics.
         */
        public var metricDimension: aws.sdk.kotlin.services.iot.model.MetricDimension? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.iot.model.MetricToRetain) : this() {
            this.exportMetric = x.exportMetric
            this.metric = x.metric
            this.metricDimension = x.metricDimension
        }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy