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

commonMain.aws.sdk.kotlin.services.applicationsignals.model.RollingInterval.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

/**
 * If the interval for this SLO is a rolling interval, this structure contains the interval specifications.
 */
public class RollingInterval private constructor(builder: Builder) {
    /**
     * Specifies the duration of each rolling interval. For example, if `Duration` is `7` and `DurationUnit` is `DAY`, each rolling interval is seven days.
     */
    public val duration: kotlin.Int = requireNotNull(builder.duration) { "A non-null value must be provided for duration" }
    /**
     * Specifies the rolling interval unit.
     */
    public val durationUnit: aws.sdk.kotlin.services.applicationsignals.model.DurationUnit = requireNotNull(builder.durationUnit) { "A non-null value must be provided for durationUnit" }

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

    override fun toString(): kotlin.String = buildString {
        append("RollingInterval(")
        append("duration=$duration,")
        append("durationUnit=$durationUnit")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = duration
        result = 31 * result + (durationUnit.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 RollingInterval

        if (duration != other.duration) return false
        if (durationUnit != other.durationUnit) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Specifies the duration of each rolling interval. For example, if `Duration` is `7` and `DurationUnit` is `DAY`, each rolling interval is seven days.
         */
        public var duration: kotlin.Int? = null
        /**
         * Specifies the rolling interval unit.
         */
        public var durationUnit: aws.sdk.kotlin.services.applicationsignals.model.DurationUnit? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.applicationsignals.model.RollingInterval) : this() {
            this.duration = x.duration
            this.durationUnit = x.durationUnit
        }

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

        internal fun correctErrors(): Builder {
            if (duration == null) duration = 0
            if (durationUnit == null) durationUnit = DurationUnit.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy