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

commonMain.aws.sdk.kotlin.services.dynamodb.model.AttributeDefinition.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.dynamodb.model



/**
 * Represents an attribute for describing the schema for the table and indexes.
 */
public class AttributeDefinition private constructor(builder: Builder) {
    /**
     * A name for the attribute.
     */
    public val attributeName: kotlin.String = requireNotNull(builder.attributeName) { "A non-null value must be provided for attributeName" }
    /**
     * The data type for the attribute, where:
     * + `S` - the attribute is of type String
     * + `N` - the attribute is of type Number
     * + `B` - the attribute is of type Binary
     */
    public val attributeType: aws.sdk.kotlin.services.dynamodb.model.ScalarAttributeType = requireNotNull(builder.attributeType) { "A non-null value must be provided for attributeType" }

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

    override fun toString(): kotlin.String = buildString {
        append("AttributeDefinition(")
        append("attributeName=$attributeName,")
        append("attributeType=$attributeType")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = attributeName.hashCode()
        result = 31 * result + (attributeType.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 AttributeDefinition

        if (attributeName != other.attributeName) return false
        if (attributeType != other.attributeType) return false

        return true
    }

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

    public class Builder {
        /**
         * A name for the attribute.
         */
        public var attributeName: kotlin.String? = null
        /**
         * The data type for the attribute, where:
         * + `S` - the attribute is of type String
         * + `N` - the attribute is of type Number
         * + `B` - the attribute is of type Binary
         */
        public var attributeType: aws.sdk.kotlin.services.dynamodb.model.ScalarAttributeType? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.dynamodb.model.AttributeDefinition) : this() {
            this.attributeName = x.attributeName
            this.attributeType = x.attributeType
        }

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

        internal fun correctErrors(): Builder {
            if (attributeName == null) attributeName = ""
            if (attributeType == null) attributeType = ScalarAttributeType.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy