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

commonMain.aws.sdk.kotlin.services.lookoutmetrics.model.Metric.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.lookoutmetrics.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * A calculation made by contrasting a measure and a dimension from your source data.
 */
public class Metric private constructor(builder: Builder) {
    /**
     * The function with which the metric is calculated.
     */
    public val aggregationFunction: aws.sdk.kotlin.services.lookoutmetrics.model.AggregationFunction = requireNotNull(builder.aggregationFunction) { "A non-null value must be provided for aggregationFunction" }
    /**
     * The name of the metric.
     */
    public val metricName: kotlin.String = requireNotNull(builder.metricName) { "A non-null value must be provided for metricName" }
    /**
     * The namespace for the metric.
     */
    public val namespace: kotlin.String? = builder.namespace

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

    override fun toString(): kotlin.String = buildString {
        append("Metric(")
        append("aggregationFunction=$aggregationFunction,")
        append("metricName=$metricName,")
        append("namespace=$namespace")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = aggregationFunction.hashCode()
        result = 31 * result + (metricName.hashCode())
        result = 31 * result + (namespace?.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 Metric

        if (aggregationFunction != other.aggregationFunction) return false
        if (metricName != other.metricName) return false
        if (namespace != other.namespace) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The function with which the metric is calculated.
         */
        public var aggregationFunction: aws.sdk.kotlin.services.lookoutmetrics.model.AggregationFunction? = null
        /**
         * The name of the metric.
         */
        public var metricName: kotlin.String? = null
        /**
         * The namespace for the metric.
         */
        public var namespace: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.lookoutmetrics.model.Metric) : this() {
            this.aggregationFunction = x.aggregationFunction
            this.metricName = x.metricName
            this.namespace = x.namespace
        }

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

        internal fun correctErrors(): Builder {
            if (aggregationFunction == null) aggregationFunction = AggregationFunction.SdkUnknown("no value provided")
            if (metricName == null) metricName = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy