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

commonMain.aws.sdk.kotlin.services.qbusiness.model.Rule.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.qbusiness.model



/**
 * Guardrail rules for an Amazon Q Business application. Amazon Q Business supports only one rule at a time.
 */
public class Rule private constructor(builder: Builder) {
    /**
     * Users and groups to be excluded from a rule.
     */
    public val excludedUsersAndGroups: aws.sdk.kotlin.services.qbusiness.model.UsersAndGroups? = builder.excludedUsersAndGroups
    /**
     * Users and groups to be included in a rule.
     */
    public val includedUsersAndGroups: aws.sdk.kotlin.services.qbusiness.model.UsersAndGroups? = builder.includedUsersAndGroups
    /**
     * The configuration information for a rule.
     */
    public val ruleConfiguration: aws.sdk.kotlin.services.qbusiness.model.RuleConfiguration? = builder.ruleConfiguration
    /**
     * The type of rule.
     */
    public val ruleType: aws.sdk.kotlin.services.qbusiness.model.RuleType = requireNotNull(builder.ruleType) { "A non-null value must be provided for ruleType" }

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

    override fun toString(): kotlin.String = buildString {
        append("Rule(")
        append("excludedUsersAndGroups=$excludedUsersAndGroups,")
        append("includedUsersAndGroups=$includedUsersAndGroups,")
        append("ruleConfiguration=$ruleConfiguration,")
        append("ruleType=$ruleType")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = excludedUsersAndGroups?.hashCode() ?: 0
        result = 31 * result + (includedUsersAndGroups?.hashCode() ?: 0)
        result = 31 * result + (ruleConfiguration?.hashCode() ?: 0)
        result = 31 * result + (ruleType.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 Rule

        if (excludedUsersAndGroups != other.excludedUsersAndGroups) return false
        if (includedUsersAndGroups != other.includedUsersAndGroups) return false
        if (ruleConfiguration != other.ruleConfiguration) return false
        if (ruleType != other.ruleType) return false

        return true
    }

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

    public class Builder {
        /**
         * Users and groups to be excluded from a rule.
         */
        public var excludedUsersAndGroups: aws.sdk.kotlin.services.qbusiness.model.UsersAndGroups? = null
        /**
         * Users and groups to be included in a rule.
         */
        public var includedUsersAndGroups: aws.sdk.kotlin.services.qbusiness.model.UsersAndGroups? = null
        /**
         * The configuration information for a rule.
         */
        public var ruleConfiguration: aws.sdk.kotlin.services.qbusiness.model.RuleConfiguration? = null
        /**
         * The type of rule.
         */
        public var ruleType: aws.sdk.kotlin.services.qbusiness.model.RuleType? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.qbusiness.model.Rule) : this() {
            this.excludedUsersAndGroups = x.excludedUsersAndGroups
            this.includedUsersAndGroups = x.includedUsersAndGroups
            this.ruleConfiguration = x.ruleConfiguration
            this.ruleType = x.ruleType
        }

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy