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

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

The 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 specifies the information about the service and the performance metric that a period-based SLO is to monitor.
 */
public class ServiceLevelIndicatorConfig private constructor(builder: Builder) {
    /**
     * The arithmetic operation to use 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" }
    /**
     * This parameter is used only when a request-based SLO tracks the `Latency` metric. Specify the threshold value that the observed `Latency` metric values are to be compared to.
     */
    public val metricThreshold: kotlin.Double = requireNotNull(builder.metricThreshold) { "A non-null value must be provided for metricThreshold" }
    /**
     * Use this structure to specify the metric to be used for the SLO.
     */
    public val sliMetricConfig: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicatorMetricConfig? = builder.sliMetricConfig

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

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

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

        if (comparisonOperator != other.comparisonOperator) return false
        if (!(metricThreshold?.equals(other.metricThreshold) ?: (other.metricThreshold == null))) return false
        if (sliMetricConfig != other.sliMetricConfig) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The arithmetic operation to use when comparing the specified metric to the threshold.
         */
        public var comparisonOperator: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicatorComparisonOperator? = null
        /**
         * This parameter is used only when a request-based SLO tracks the `Latency` metric. Specify the threshold value that the observed `Latency` metric values are to be compared to.
         */
        public var metricThreshold: kotlin.Double? = null
        /**
         * Use this structure to specify the metric to be used for the SLO.
         */
        public var sliMetricConfig: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicatorMetricConfig? = null

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

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

        /**
         * construct an [aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicatorMetricConfig] inside the given [block]
         */
        public fun sliMetricConfig(block: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicatorMetricConfig.Builder.() -> kotlin.Unit) {
            this.sliMetricConfig = aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicatorMetricConfig.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