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

commonMain.aws.sdk.kotlin.services.bedrockagent.model.OpenSearchServerlessConfiguration.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.bedrockagent.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Contains details about the storage configuration of the knowledge base in Amazon OpenSearch Service. For more information, see [Create a vector index in Amazon OpenSearch Service](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup-oss.html).
 */
public class OpenSearchServerlessConfiguration private constructor(builder: Builder) {
    /**
     * The Amazon Resource Name (ARN) of the OpenSearch Service vector store.
     */
    public val collectionArn: kotlin.String = requireNotNull(builder.collectionArn) { "A non-null value must be provided for collectionArn" }
    /**
     * Contains the names of the fields to which to map information about the vector store.
     */
    public val fieldMapping: aws.sdk.kotlin.services.bedrockagent.model.OpenSearchServerlessFieldMapping? = builder.fieldMapping
    /**
     * The name of the vector store.
     */
    public val vectorIndexName: kotlin.String = requireNotNull(builder.vectorIndexName) { "A non-null value must be provided for vectorIndexName" }

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

    override fun toString(): kotlin.String = buildString {
        append("OpenSearchServerlessConfiguration(")
        append("collectionArn=$collectionArn,")
        append("fieldMapping=$fieldMapping,")
        append("vectorIndexName=$vectorIndexName")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = collectionArn.hashCode()
        result = 31 * result + (fieldMapping?.hashCode() ?: 0)
        result = 31 * result + (vectorIndexName.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 OpenSearchServerlessConfiguration

        if (collectionArn != other.collectionArn) return false
        if (fieldMapping != other.fieldMapping) return false
        if (vectorIndexName != other.vectorIndexName) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The Amazon Resource Name (ARN) of the OpenSearch Service vector store.
         */
        public var collectionArn: kotlin.String? = null
        /**
         * Contains the names of the fields to which to map information about the vector store.
         */
        public var fieldMapping: aws.sdk.kotlin.services.bedrockagent.model.OpenSearchServerlessFieldMapping? = null
        /**
         * The name of the vector store.
         */
        public var vectorIndexName: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.bedrockagent.model.OpenSearchServerlessConfiguration) : this() {
            this.collectionArn = x.collectionArn
            this.fieldMapping = x.fieldMapping
            this.vectorIndexName = x.vectorIndexName
        }

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

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

        internal fun correctErrors(): Builder {
            if (collectionArn == null) collectionArn = ""
            if (vectorIndexName == null) vectorIndexName = ""
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy