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

commonMain.aws.sdk.kotlin.services.bedrock.model.GuardrailRegex.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.bedrock.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * The regular expression configured for the guardrail.
 */
public class GuardrailRegex private constructor(builder: Builder) {
    /**
     * The action taken when a match to the regular expression is detected.
     */
    public val action: aws.sdk.kotlin.services.bedrock.model.GuardrailSensitiveInformationAction = requireNotNull(builder.action) { "A non-null value must be provided for action" }
    /**
     * The description of the regular expression for the guardrail.
     */
    public val description: kotlin.String? = builder.description
    /**
     * The name of the regular expression for the guardrail.
     */
    public val name: kotlin.String = requireNotNull(builder.name) { "A non-null value must be provided for name" }
    /**
     * The pattern of the regular expression configured for the guardrail.
     */
    public val pattern: kotlin.String = requireNotNull(builder.pattern) { "A non-null value must be provided for pattern" }

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

    override fun toString(): kotlin.String = buildString {
        append("GuardrailRegex(")
        append("action=$action,")
        append("description=$description,")
        append("name=$name,")
        append("pattern=$pattern")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = action.hashCode()
        result = 31 * result + (description?.hashCode() ?: 0)
        result = 31 * result + (name.hashCode())
        result = 31 * result + (pattern.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 GuardrailRegex

        if (action != other.action) return false
        if (description != other.description) return false
        if (name != other.name) return false
        if (pattern != other.pattern) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The action taken when a match to the regular expression is detected.
         */
        public var action: aws.sdk.kotlin.services.bedrock.model.GuardrailSensitiveInformationAction? = null
        /**
         * The description of the regular expression for the guardrail.
         */
        public var description: kotlin.String? = null
        /**
         * The name of the regular expression for the guardrail.
         */
        public var name: kotlin.String? = null
        /**
         * The pattern of the regular expression configured for the guardrail.
         */
        public var pattern: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.bedrock.model.GuardrailRegex) : this() {
            this.action = x.action
            this.description = x.description
            this.name = x.name
            this.pattern = x.pattern
        }

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

        internal fun correctErrors(): Builder {
            if (action == null) action = GuardrailSensitiveInformationAction.SdkUnknown("no value provided")
            if (name == null) name = ""
            if (pattern == null) pattern = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy