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

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

// 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 the performance metric that an SLO monitors.
 */
public class ServiceLevelIndicator private constructor(builder: Builder) {
    /**
     * The arithmetic operation used when comparing the specified metric to the threshold.
     */
    public val comparisonOperator: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicatorComparisonOperator = requireNotNull(builder.comparisonOperator) { "A non-null value must be provided for comparisonOperator" }
    /**
     * The value that the SLI metric is compared to.
     */
    public val metricThreshold: kotlin.Double = requireNotNull(builder.metricThreshold) { "A non-null value must be provided for metricThreshold" }
    /**
     * A structure that contains information about the metric that the SLO monitors.
     */
    public val sliMetric: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicatorMetric? = builder.sliMetric

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

    override fun toString(): kotlin.String = buildString {
        append("ServiceLevelIndicator(")
        append("comparisonOperator=$comparisonOperator,")
        append("metricThreshold=$metricThreshold,")
        append("sliMetric=$sliMetric")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = comparisonOperator.hashCode()
        result = 31 * result + (metricThreshold.hashCode())
        result = 31 * result + (sliMetric?.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 ServiceLevelIndicator

        if (comparisonOperator != other.comparisonOperator) return false
        if (metricThreshold != other.metricThreshold) return false
        if (sliMetric != other.sliMetric) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The arithmetic operation used when comparing the specified metric to the threshold.
         */
        public var comparisonOperator: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicatorComparisonOperator? = null
        /**
         * The value that the SLI metric is compared to.
         */
        public var metricThreshold: kotlin.Double? = null
        /**
         * A structure that contains information about the metric that the SLO monitors.
         */
        public var sliMetric: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicatorMetric? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicator) : this() {
            this.comparisonOperator = x.comparisonOperator
            this.metricThreshold = x.metricThreshold
            this.sliMetric = x.sliMetric
        }

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

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

        internal fun correctErrors(): Builder {
            if (comparisonOperator == null) comparisonOperator = ServiceLevelIndicatorComparisonOperator.SdkUnknown("no value provided")
            if (metricThreshold == null) metricThreshold = 0.0
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy