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" }
    /**
     * 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
    /**
     * 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.
     */
    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("createdTime=$createdTime,")
        append("description=$description,")
        append("goal=$goal,")
        append("lastUpdatedTime=$lastUpdatedTime,")
        append("name=$name,")
        append("sli=$sli")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = arn.hashCode()
        result = 31 * result + (createdTime.hashCode())
        result = 31 * result + (description?.hashCode() ?: 0)
        result = 31 * result + (goal?.hashCode() ?: 0)
        result = 31 * result + (lastUpdatedTime.hashCode())
        result = 31 * result + (name.hashCode())
        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 (createdTime != other.createdTime) return false
        if (description != other.description) return false
        if (goal != other.goal) return false
        if (lastUpdatedTime != other.lastUpdatedTime) return false
        if (name != other.name) 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
        /**
         * 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
        /**
         * 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.
         */
        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.createdTime = x.createdTime
            this.description = x.description
            this.goal = x.goal
            this.lastUpdatedTime = x.lastUpdatedTime
            this.name = x.name
            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.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