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

commonMain.aws.sdk.kotlin.services.iot.model.KafkaAction.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.iot.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Send messages to an Amazon Managed Streaming for Apache Kafka (Amazon MSK) or self-managed Apache Kafka cluster.
 */
public class KafkaAction private constructor(builder: Builder) {
    /**
     * Properties of the Apache Kafka producer client.
     */
    public val clientProperties: Map = requireNotNull(builder.clientProperties) { "A non-null value must be provided for clientProperties" }
    /**
     * The ARN of Kafka action's VPC `TopicRuleDestination`.
     */
    public val destinationArn: kotlin.String = requireNotNull(builder.destinationArn) { "A non-null value must be provided for destinationArn" }
    /**
     * The list of Kafka headers that you specify.
     */
    public val headers: List? = builder.headers
    /**
     * The Kafka message key.
     */
    public val key: kotlin.String? = builder.key
    /**
     * The Kafka message partition.
     */
    public val partition: kotlin.String? = builder.partition
    /**
     * The Kafka topic for messages to be sent to the Kafka broker.
     */
    public val topic: kotlin.String = requireNotNull(builder.topic) { "A non-null value must be provided for topic" }

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

    override fun toString(): kotlin.String = buildString {
        append("KafkaAction(")
        append("clientProperties=$clientProperties,")
        append("destinationArn=$destinationArn,")
        append("headers=$headers,")
        append("key=$key,")
        append("partition=$partition,")
        append("topic=$topic")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = clientProperties.hashCode()
        result = 31 * result + (destinationArn.hashCode())
        result = 31 * result + (headers?.hashCode() ?: 0)
        result = 31 * result + (key?.hashCode() ?: 0)
        result = 31 * result + (partition?.hashCode() ?: 0)
        result = 31 * result + (topic.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 KafkaAction

        if (clientProperties != other.clientProperties) return false
        if (destinationArn != other.destinationArn) return false
        if (headers != other.headers) return false
        if (key != other.key) return false
        if (partition != other.partition) return false
        if (topic != other.topic) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Properties of the Apache Kafka producer client.
         */
        public var clientProperties: Map? = null
        /**
         * The ARN of Kafka action's VPC `TopicRuleDestination`.
         */
        public var destinationArn: kotlin.String? = null
        /**
         * The list of Kafka headers that you specify.
         */
        public var headers: List? = null
        /**
         * The Kafka message key.
         */
        public var key: kotlin.String? = null
        /**
         * The Kafka message partition.
         */
        public var partition: kotlin.String? = null
        /**
         * The Kafka topic for messages to be sent to the Kafka broker.
         */
        public var topic: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.iot.model.KafkaAction) : this() {
            this.clientProperties = x.clientProperties
            this.destinationArn = x.destinationArn
            this.headers = x.headers
            this.key = x.key
            this.partition = x.partition
            this.topic = x.topic
        }

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

        internal fun correctErrors(): Builder {
            if (clientProperties == null) clientProperties = emptyMap()
            if (destinationArn == null) destinationArn = ""
            if (topic == null) topic = ""
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy