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

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

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

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



/**
 * A container for specifying the configuration for Lambda notifications.
 */
public class LambdaFunctionConfiguration private constructor(builder: Builder) {
    /**
     * The Amazon S3 bucket event for which to invoke the Lambda function. For more information, see [Supported Event Types](https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) in the *Amazon S3 User Guide*.
     */
    public val events: List = requireNotNull(builder.events) { "A non-null value must be provided for events" }
    /**
     * Specifies object key name filtering rules. For information about key name filtering, see [Configuring event notifications using object key name filtering](https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-filtering.html) in the *Amazon S3 User Guide*.
     */
    public val filter: aws.sdk.kotlin.services.s3.model.NotificationConfigurationFilter? = builder.filter
    /**
     * An optional unique identifier for configurations in a notification configuration. If you don't provide one, Amazon S3 will assign an ID.
     */
    public val id: kotlin.String? = builder.id
    /**
     * The Amazon Resource Name (ARN) of the Lambda function that Amazon S3 invokes when the specified event type occurs.
     */
    public val lambdaFunctionArn: kotlin.String = requireNotNull(builder.lambdaFunctionArn) { "A non-null value must be provided for lambdaFunctionArn" }

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

    override fun toString(): kotlin.String = buildString {
        append("LambdaFunctionConfiguration(")
        append("events=$events,")
        append("filter=$filter,")
        append("id=$id,")
        append("lambdaFunctionArn=$lambdaFunctionArn")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = events.hashCode()
        result = 31 * result + (filter?.hashCode() ?: 0)
        result = 31 * result + (id?.hashCode() ?: 0)
        result = 31 * result + (lambdaFunctionArn.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 LambdaFunctionConfiguration

        if (events != other.events) return false
        if (filter != other.filter) return false
        if (id != other.id) return false
        if (lambdaFunctionArn != other.lambdaFunctionArn) return false

        return true
    }

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

    public class Builder {
        /**
         * The Amazon S3 bucket event for which to invoke the Lambda function. For more information, see [Supported Event Types](https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) in the *Amazon S3 User Guide*.
         */
        public var events: List? = null
        /**
         * Specifies object key name filtering rules. For information about key name filtering, see [Configuring event notifications using object key name filtering](https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-filtering.html) in the *Amazon S3 User Guide*.
         */
        public var filter: aws.sdk.kotlin.services.s3.model.NotificationConfigurationFilter? = null
        /**
         * An optional unique identifier for configurations in a notification configuration. If you don't provide one, Amazon S3 will assign an ID.
         */
        public var id: kotlin.String? = null
        /**
         * The Amazon Resource Name (ARN) of the Lambda function that Amazon S3 invokes when the specified event type occurs.
         */
        public var lambdaFunctionArn: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.s3.model.LambdaFunctionConfiguration) : this() {
            this.events = x.events
            this.filter = x.filter
            this.id = x.id
            this.lambdaFunctionArn = x.lambdaFunctionArn
        }

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

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

        internal fun correctErrors(): Builder {
            if (events == null) events = emptyList()
            if (lambdaFunctionArn == null) lambdaFunctionArn = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy