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

commonMain.aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelObjective.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
import aws.smithy.kotlin.runtime.time.Instant

/**
 * A structure containing information about one service level objective (SLO) that has been created in Application Signals. Creating SLOs can help you ensure your services are performing to the level that you expect. SLOs help you set and track a specific target level for the reliability and availability of your applications and services. Each SLO uses a service level indicator (SLI), which is a key performance metric, to calculate how much underperformance can be tolerated before the goal that you set for the SLO is not achieved.
 */
public class ServiceLevelObjective private constructor(builder: Builder) {
    /**
     * The ARN of this SLO.
     */
    public val arn: kotlin.String = requireNotNull(builder.arn) { "A non-null value must be provided for arn" }
    /**
     * Each object in this array defines the length of the look-back window used to calculate one burn rate metric for this SLO. The burn rate measures how fast the service is consuming the error budget, relative to the attainment goal of the SLO.
     */
    public val burnRateConfigurations: List? = builder.burnRateConfigurations
    /**
     * The date and time that this SLO was created. When used in a raw HTTP Query API, it is formatted as `yyyy-MM-dd'T'HH:mm:ss`. For example, `2019-07-01T23:59:59`.
     */
    public val createdTime: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.createdTime) { "A non-null value must be provided for createdTime" }
    /**
     * The description that you created for this SLO.
     */
    public val description: kotlin.String? = builder.description
    /**
     * Displays whether this is a period-based SLO or a request-based SLO.
     */
    public val evaluationType: aws.sdk.kotlin.services.applicationsignals.model.EvaluationType? = builder.evaluationType
    /**
     * This structure contains the attributes that determine the goal of an SLO. This includes the time period for evaluation and the attainment threshold.
     */
    public val goal: aws.sdk.kotlin.services.applicationsignals.model.Goal? = builder.goal
    /**
     * The time that this SLO was most recently updated. When used in a raw HTTP Query API, it is formatted as `yyyy-MM-dd'T'HH:mm:ss`. For example, `2019-07-01T23:59:59`.
     */
    public val lastUpdatedTime: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.lastUpdatedTime) { "A non-null value must be provided for lastUpdatedTime" }
    /**
     * The name of this SLO.
     */
    public val name: kotlin.String = requireNotNull(builder.name) { "A non-null value must be provided for name" }
    /**
     * A structure containing information about the performance metric that this SLO monitors, if this is a request-based SLO.
     */
    public val requestBasedSli: aws.sdk.kotlin.services.applicationsignals.model.RequestBasedServiceLevelIndicator? = builder.requestBasedSli
    /**
     * A structure containing information about the performance metric that this SLO monitors, if this is a period-based SLO.
     */
    public val sli: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicator? = builder.sli

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

    override fun toString(): kotlin.String = buildString {
        append("ServiceLevelObjective(")
        append("arn=$arn,")
        append("burnRateConfigurations=$burnRateConfigurations,")
        append("createdTime=$createdTime,")
        append("description=$description,")
        append("evaluationType=$evaluationType,")
        append("goal=$goal,")
        append("lastUpdatedTime=$lastUpdatedTime,")
        append("name=$name,")
        append("requestBasedSli=$requestBasedSli,")
        append("sli=$sli")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = arn.hashCode()
        result = 31 * result + (burnRateConfigurations?.hashCode() ?: 0)
        result = 31 * result + (createdTime.hashCode())
        result = 31 * result + (description?.hashCode() ?: 0)
        result = 31 * result + (evaluationType?.hashCode() ?: 0)
        result = 31 * result + (goal?.hashCode() ?: 0)
        result = 31 * result + (lastUpdatedTime.hashCode())
        result = 31 * result + (name.hashCode())
        result = 31 * result + (requestBasedSli?.hashCode() ?: 0)
        result = 31 * result + (sli?.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 ServiceLevelObjective

        if (arn != other.arn) return false
        if (burnRateConfigurations != other.burnRateConfigurations) return false
        if (createdTime != other.createdTime) return false
        if (description != other.description) return false
        if (evaluationType != other.evaluationType) return false
        if (goal != other.goal) return false
        if (lastUpdatedTime != other.lastUpdatedTime) return false
        if (name != other.name) return false
        if (requestBasedSli != other.requestBasedSli) return false
        if (sli != other.sli) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The ARN of this SLO.
         */
        public var arn: kotlin.String? = null
        /**
         * Each object in this array defines the length of the look-back window used to calculate one burn rate metric for this SLO. The burn rate measures how fast the service is consuming the error budget, relative to the attainment goal of the SLO.
         */
        public var burnRateConfigurations: List? = null
        /**
         * The date and time that this SLO was created. When used in a raw HTTP Query API, it is formatted as `yyyy-MM-dd'T'HH:mm:ss`. For example, `2019-07-01T23:59:59`.
         */
        public var createdTime: aws.smithy.kotlin.runtime.time.Instant? = null
        /**
         * The description that you created for this SLO.
         */
        public var description: kotlin.String? = null
        /**
         * Displays whether this is a period-based SLO or a request-based SLO.
         */
        public var evaluationType: aws.sdk.kotlin.services.applicationsignals.model.EvaluationType? = null
        /**
         * This structure contains the attributes that determine the goal of an SLO. This includes the time period for evaluation and the attainment threshold.
         */
        public var goal: aws.sdk.kotlin.services.applicationsignals.model.Goal? = null
        /**
         * The time that this SLO was most recently updated. When used in a raw HTTP Query API, it is formatted as `yyyy-MM-dd'T'HH:mm:ss`. For example, `2019-07-01T23:59:59`.
         */
        public var lastUpdatedTime: aws.smithy.kotlin.runtime.time.Instant? = null
        /**
         * The name of this SLO.
         */
        public var name: kotlin.String? = null
        /**
         * A structure containing information about the performance metric that this SLO monitors, if this is a request-based SLO.
         */
        public var requestBasedSli: aws.sdk.kotlin.services.applicationsignals.model.RequestBasedServiceLevelIndicator? = null
        /**
         * A structure containing information about the performance metric that this SLO monitors, if this is a period-based SLO.
         */
        public var sli: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicator? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelObjective) : this() {
            this.arn = x.arn
            this.burnRateConfigurations = x.burnRateConfigurations
            this.createdTime = x.createdTime
            this.description = x.description
            this.evaluationType = x.evaluationType
            this.goal = x.goal
            this.lastUpdatedTime = x.lastUpdatedTime
            this.name = x.name
            this.requestBasedSli = x.requestBasedSli
            this.sli = x.sli
        }

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

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

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

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

        internal fun correctErrors(): Builder {
            if (arn == null) arn = ""
            if (createdTime == null) createdTime = Instant.fromEpochSeconds(0)
            if (lastUpdatedTime == null) lastUpdatedTime = Instant.fromEpochSeconds(0)
            if (name == null) name = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy