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

commonMain.aws.sdk.kotlin.services.backup.model.DateRange.kt Maven / Gradle / Ivy

There is a newer version: 1.3.37
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.backup.model

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

/**
 * This is a resource filter containing FromDate: DateTime and ToDate: DateTime. Both values are required. Future DateTime values are not permitted.
 *
 * The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds ((milliseconds are optional). For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM.
 */
public class DateRange private constructor(builder: Builder) {
    /**
     * This value is the beginning date, inclusive.
     *
     * The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).
     */
    public val fromDate: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.fromDate) { "A non-null value must be provided for fromDate" }
    /**
     * This value is the end date, inclusive.
     *
     * The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).
     */
    public val toDate: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.toDate) { "A non-null value must be provided for toDate" }

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

    override fun toString(): kotlin.String = buildString {
        append("DateRange(")
        append("fromDate=$fromDate,")
        append("toDate=$toDate")
        append(")")
    }

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

        if (fromDate != other.fromDate) return false
        if (toDate != other.toDate) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * This value is the beginning date, inclusive.
         *
         * The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).
         */
        public var fromDate: aws.smithy.kotlin.runtime.time.Instant? = null
        /**
         * This value is the end date, inclusive.
         *
         * The date and time are in Unix format and Coordinated Universal Time (UTC), and it is accurate to milliseconds (milliseconds are optional).
         */
        public var toDate: aws.smithy.kotlin.runtime.time.Instant? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.backup.model.DateRange) : this() {
            this.fromDate = x.fromDate
            this.toDate = x.toDate
        }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy