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

commonMain.aws.sdk.kotlin.services.iotanalytics.model.Message.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.iotanalytics.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Information about a message.
 */
public class Message private constructor(builder: Builder) {
    /**
     * The ID you want to assign to the message. Each `messageId` must be unique within each batch sent.
     */
    public val messageId: kotlin.String = requireNotNull(builder.messageId) { "A non-null value must be provided for messageId" }
    /**
     * The payload of the message. This can be a JSON string or a base64-encoded string representing binary data, in which case you must decode it by means of a pipeline activity.
     */
    public val payload: kotlin.ByteArray = requireNotNull(builder.payload) { "A non-null value must be provided for payload" }

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

    override fun toString(): kotlin.String = buildString {
        append("Message(")
        append("messageId=$messageId,")
        append("payload=$payload")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = messageId.hashCode()
        result = 31 * result + (payload.contentHashCode())
        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 Message

        if (messageId != other.messageId) return false
        if (payload != null) {
            if (other.payload == null) return false
            if (!payload.contentEquals(other.payload)) return false
        } else if (other.payload != null) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The ID you want to assign to the message. Each `messageId` must be unique within each batch sent.
         */
        public var messageId: kotlin.String? = null
        /**
         * The payload of the message. This can be a JSON string or a base64-encoded string representing binary data, in which case you must decode it by means of a pipeline activity.
         */
        public var payload: kotlin.ByteArray? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.iotanalytics.model.Message) : this() {
            this.messageId = x.messageId
            this.payload = x.payload
        }

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

        internal fun correctErrors(): Builder {
            if (messageId == null) messageId = ""
            if (payload == null) payload = ByteArray(0)
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy