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

commonMain.aws.sdk.kotlin.services.devopsguru.model.EventTimeRange.kt Maven / Gradle / Ivy

The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.devopsguru.model

import aws.smithy.kotlin.runtime.SdkDsl
import aws.smithy.kotlin.runtime.time.Instant

/**
 * The time range during which an Amazon Web Services event occurred. Amazon Web Services resource events and metrics are analyzed by DevOps Guru to find anomalous behavior and provide recommendations to improve your operational solutions.
 */
public class EventTimeRange private constructor(builder: Builder) {
    /**
     * The time when the event started.
     */
    public val fromTime: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.fromTime) { "A non-null value must be provided for fromTime" }
    /**
     * The time when the event ended.
     */
    public val toTime: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.toTime) { "A non-null value must be provided for toTime" }

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

    override fun toString(): kotlin.String = buildString {
        append("EventTimeRange(")
        append("fromTime=$fromTime,")
        append("toTime=$toTime")
        append(")")
    }

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

        if (fromTime != other.fromTime) return false
        if (toTime != other.toTime) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The time when the event started.
         */
        public var fromTime: aws.smithy.kotlin.runtime.time.Instant? = null
        /**
         * The time when the event ended.
         */
        public var toTime: aws.smithy.kotlin.runtime.time.Instant? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.devopsguru.model.EventTimeRange) : this() {
            this.fromTime = x.fromTime
            this.toTime = x.toTime
        }

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

        internal fun correctErrors(): Builder {
            if (fromTime == null) fromTime = Instant.fromEpochSeconds(0)
            if (toTime == null) toTime = Instant.fromEpochSeconds(0)
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy