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

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

There is a newer version: 1.3.99
Show newest version
// 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

/**
 * If the interval for this service level objective is a calendar interval, this structure contains the interval specifications.
 */
public class CalendarInterval private constructor(builder: Builder) {
    /**
     * Specifies the duration of each calendar interval. For example, if `Duration` is `1` and `DurationUnit` is `MONTH`, each interval is one month, aligned with the calendar.
     */
    public val duration: kotlin.Int = requireNotNull(builder.duration) { "A non-null value must be provided for duration" }
    /**
     * Specifies the calendar interval unit.
     */
    public val durationUnit: aws.sdk.kotlin.services.applicationsignals.model.DurationUnit = requireNotNull(builder.durationUnit) { "A non-null value must be provided for durationUnit" }
    /**
     * The date and time when you want the first interval to start. Be sure to choose a time that configures the intervals the way that you want. For example, if you want weekly intervals starting on Mondays at 6 a.m., be sure to specify a start time that is a Monday at 6 a.m.
     *
     * When used in a raw HTTP Query API, it is formatted as be epoch time in seconds. For example: `1698778057`
     *
     * As soon as one calendar interval ends, another automatically begins.
     */
    public val startTime: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.startTime) { "A non-null value must be provided for startTime" }

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

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

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

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

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Specifies the duration of each calendar interval. For example, if `Duration` is `1` and `DurationUnit` is `MONTH`, each interval is one month, aligned with the calendar.
         */
        public var duration: kotlin.Int? = null
        /**
         * Specifies the calendar interval unit.
         */
        public var durationUnit: aws.sdk.kotlin.services.applicationsignals.model.DurationUnit? = null
        /**
         * The date and time when you want the first interval to start. Be sure to choose a time that configures the intervals the way that you want. For example, if you want weekly intervals starting on Mondays at 6 a.m., be sure to specify a start time that is a Monday at 6 a.m.
         *
         * When used in a raw HTTP Query API, it is formatted as be epoch time in seconds. For example: `1698778057`
         *
         * As soon as one calendar interval ends, another automatically begins.
         */
        public var startTime: aws.smithy.kotlin.runtime.time.Instant? = null

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy