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

commonMain.aws.sdk.kotlin.services.s3.model.ObjectLockRule.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.s3.model



/**
 * The container element for an Object Lock rule.
 */
public class ObjectLockRule private constructor(builder: Builder) {
    /**
     * The default Object Lock retention mode and period that you want to apply to new objects placed in the specified bucket. Bucket settings require both a mode and a period. The period can be either `Days` or `Years` but you must select one. You cannot specify `Days` and `Years` at the same time.
     */
    public val defaultRetention: aws.sdk.kotlin.services.s3.model.DefaultRetention? = builder.defaultRetention

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

    override fun toString(): kotlin.String = buildString {
        append("ObjectLockRule(")
        append("defaultRetention=$defaultRetention")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = defaultRetention?.hashCode() ?: 0
        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 ObjectLockRule

        if (defaultRetention != other.defaultRetention) return false

        return true
    }

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

    public class Builder {
        /**
         * The default Object Lock retention mode and period that you want to apply to new objects placed in the specified bucket. Bucket settings require both a mode and a period. The period can be either `Days` or `Years` but you must select one. You cannot specify `Days` and `Years` at the same time.
         */
        public var defaultRetention: aws.sdk.kotlin.services.s3.model.DefaultRetention? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.s3.model.ObjectLockRule) : this() {
            this.defaultRetention = x.defaultRetention
        }

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

        /**
         * construct an [aws.sdk.kotlin.services.s3.model.DefaultRetention] inside the given [block]
         */
        public fun defaultRetention(block: aws.sdk.kotlin.services.s3.model.DefaultRetention.Builder.() -> kotlin.Unit) {
            this.defaultRetention = aws.sdk.kotlin.services.s3.model.DefaultRetention.invoke(block)
        }

        internal fun correctErrors(): Builder {
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy