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

commonMain.aws.sdk.kotlin.services.elasticbeanstalk.model.MaxCountRule.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.elasticbeanstalk.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * A lifecycle rule that deletes the oldest application version when the maximum count is exceeded.
 */
public class MaxCountRule private constructor(builder: Builder) {
    /**
     * Set to `true` to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.
     */
    public val deleteSourceFromS3: kotlin.Boolean? = builder.deleteSourceFromS3
    /**
     * Specify `true` to apply the rule, or `false` to disable it.
     */
    public val enabled: kotlin.Boolean = requireNotNull(builder.enabled) { "A non-null value must be provided for enabled" }
    /**
     * Specify the maximum number of application versions to retain.
     */
    public val maxCount: kotlin.Int? = builder.maxCount

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

    override fun toString(): kotlin.String = buildString {
        append("MaxCountRule(")
        append("deleteSourceFromS3=$deleteSourceFromS3,")
        append("enabled=$enabled,")
        append("maxCount=$maxCount")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = deleteSourceFromS3?.hashCode() ?: 0
        result = 31 * result + (enabled.hashCode())
        result = 31 * result + (maxCount ?: 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 MaxCountRule

        if (deleteSourceFromS3 != other.deleteSourceFromS3) return false
        if (enabled != other.enabled) return false
        if (maxCount != other.maxCount) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Set to `true` to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.
         */
        public var deleteSourceFromS3: kotlin.Boolean? = null
        /**
         * Specify `true` to apply the rule, or `false` to disable it.
         */
        public var enabled: kotlin.Boolean? = null
        /**
         * Specify the maximum number of application versions to retain.
         */
        public var maxCount: kotlin.Int? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.elasticbeanstalk.model.MaxCountRule) : this() {
            this.deleteSourceFromS3 = x.deleteSourceFromS3
            this.enabled = x.enabled
            this.maxCount = x.maxCount
        }

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

        internal fun correctErrors(): Builder {
            if (enabled == null) enabled = false
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy