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

commonMain.aws.sdk.kotlin.services.applicationsignals.model.MetricReference.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 contains information about one CloudWatch metric associated with this entity discovered by Application Signals.
 */
public class MetricReference private constructor(builder: Builder) {
    /**
     * An array of one or more dimensions that further define the metric. For more information, see [CloudWatchDimensions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension).
     */
    public val dimensions: List? = builder.dimensions
    /**
     * The name of the metric.
     */
    public val metricName: kotlin.String = requireNotNull(builder.metricName) { "A non-null value must be provided for metricName" }
    /**
     * Used to display the appropriate statistics in the CloudWatch console.
     */
    public val metricType: kotlin.String = requireNotNull(builder.metricType) { "A non-null value must be provided for metricType" }
    /**
     * The namespace of the metric. For more information, see [CloudWatchNamespaces](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace).
     */
    public val namespace: kotlin.String = requireNotNull(builder.namespace) { "A non-null value must be provided for namespace" }

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

    override fun toString(): kotlin.String = buildString {
        append("MetricReference(")
        append("dimensions=$dimensions,")
        append("metricName=$metricName,")
        append("metricType=$metricType,")
        append("namespace=$namespace")
        append(")")
    }

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

        if (dimensions != other.dimensions) return false
        if (metricName != other.metricName) return false
        if (metricType != other.metricType) return false
        if (namespace != other.namespace) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * An array of one or more dimensions that further define the metric. For more information, see [CloudWatchDimensions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension).
         */
        public var dimensions: List? = null
        /**
         * The name of the metric.
         */
        public var metricName: kotlin.String? = null
        /**
         * Used to display the appropriate statistics in the CloudWatch console.
         */
        public var metricType: kotlin.String? = null
        /**
         * The namespace of the metric. For more information, see [CloudWatchNamespaces](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Namespace).
         */
        public var namespace: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.applicationsignals.model.MetricReference) : this() {
            this.dimensions = x.dimensions
            this.metricName = x.metricName
            this.metricType = x.metricType
            this.namespace = x.namespace
        }

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

        internal fun correctErrors(): Builder {
            if (metricName == null) metricName = ""
            if (metricType == null) metricType = ""
            if (namespace == null) namespace = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy