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

commonMain.aws.sdk.kotlin.services.acmpca.model.Validity.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.acmpca.model



/**
 * Validity specifies the period of time during which a certificate is valid. Validity can be expressed as an explicit date and time when the validity of a certificate starts or expires, or as a span of time after issuance, stated in days, months, or years. For more information, see [Validity](https://tools.ietf.org/html/rfc5280#section-4.1.2.5) in RFC 5280.
 *
 * Amazon Web Services Private CA API consumes the `Validity` data type differently in two distinct parameters of the `IssueCertificate` action. The required parameter `IssueCertificate`:`Validity` specifies the end of a certificate's validity period. The optional parameter `IssueCertificate`:`ValidityNotBefore` specifies a customized starting time for the validity period.
 */
public class Validity private constructor(builder: Builder) {
    /**
     * Determines how *Amazon Web Services Private CA* interprets the `Value` parameter, an integer. Supported validity types include those listed below. Type definitions with values include a sample input value and the resulting output.
     *
     * `END_DATE`: The specific date and time when the certificate will expire, expressed using UTCTime (YYMMDDHHMMSS) or GeneralizedTime (YYYYMMDDHHMMSS) format. When UTCTime is used, if the year field (YY) is greater than or equal to 50, the year is interpreted as 19YY. If the year field is less than 50, the year is interpreted as 20YY.
     * + Sample input value: 491231235959 (UTCTime format)
     * + Output expiration date/time: 12/31/2049 23:59:59
     *
     * `ABSOLUTE`: The specific date and time when the validity of a certificate will start or expire, expressed in seconds since the Unix Epoch.
     * + Sample input value: 2524608000
     * + Output expiration date/time: 01/01/2050 00:00:00
     *
     * `DAYS`, `MONTHS`, `YEARS`: The relative time from the moment of issuance until the certificate will expire, expressed in days, months, or years.
     *
     * Example if `DAYS`, issued on 10/12/2020 at 12:34:54 UTC:
     * + Sample input value: 90
     * + Output expiration date: 01/10/2020 12:34:54 UTC
     *
     * The minimum validity duration for a certificate using relative time (`DAYS`) is one day. The minimum validity for a certificate using absolute time (`ABSOLUTE` or `END_DATE`) is one second.
     */
    public val type: aws.sdk.kotlin.services.acmpca.model.ValidityPeriodType = requireNotNull(builder.type) { "A non-null value must be provided for type" }
    /**
     * A long integer interpreted according to the value of `Type`, below.
     */
    public val value: kotlin.Long = requireNotNull(builder.value) { "A non-null value must be provided for value" }

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

    override fun toString(): kotlin.String = buildString {
        append("Validity(")
        append("type=$type,")
        append("value=$value")
        append(")")
    }

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

        if (type != other.type) return false
        if (value != other.value) return false

        return true
    }

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

    public class Builder {
        /**
         * Determines how *Amazon Web Services Private CA* interprets the `Value` parameter, an integer. Supported validity types include those listed below. Type definitions with values include a sample input value and the resulting output.
         *
         * `END_DATE`: The specific date and time when the certificate will expire, expressed using UTCTime (YYMMDDHHMMSS) or GeneralizedTime (YYYYMMDDHHMMSS) format. When UTCTime is used, if the year field (YY) is greater than or equal to 50, the year is interpreted as 19YY. If the year field is less than 50, the year is interpreted as 20YY.
         * + Sample input value: 491231235959 (UTCTime format)
         * + Output expiration date/time: 12/31/2049 23:59:59
         *
         * `ABSOLUTE`: The specific date and time when the validity of a certificate will start or expire, expressed in seconds since the Unix Epoch.
         * + Sample input value: 2524608000
         * + Output expiration date/time: 01/01/2050 00:00:00
         *
         * `DAYS`, `MONTHS`, `YEARS`: The relative time from the moment of issuance until the certificate will expire, expressed in days, months, or years.
         *
         * Example if `DAYS`, issued on 10/12/2020 at 12:34:54 UTC:
         * + Sample input value: 90
         * + Output expiration date: 01/10/2020 12:34:54 UTC
         *
         * The minimum validity duration for a certificate using relative time (`DAYS`) is one day. The minimum validity for a certificate using absolute time (`ABSOLUTE` or `END_DATE`) is one second.
         */
        public var type: aws.sdk.kotlin.services.acmpca.model.ValidityPeriodType? = null
        /**
         * A long integer interpreted according to the value of `Type`, below.
         */
        public var value: kotlin.Long? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.acmpca.model.Validity) : this() {
            this.type = x.type
            this.value = x.value
        }

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

        internal fun correctErrors(): Builder {
            if (type == null) type = ValidityPeriodType.SdkUnknown("no value provided")
            if (value == null) value = 0L
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy