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

commonMain.aws.sdk.kotlin.services.cleanrooms.model.AggregationConstraint.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.cleanrooms.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Constraint on query output removing output rows that do not meet a minimum number of distinct values of a specified column.
 */
public class AggregationConstraint private constructor(builder: Builder) {
    /**
     * Column in aggregation constraint for which there must be a minimum number of distinct values in an output row for it to be in the query output.
     */
    public val columnName: kotlin.String = requireNotNull(builder.columnName) { "A non-null value must be provided for columnName" }
    /**
     * The minimum number of distinct values that an output row must be an aggregation of. Minimum threshold of distinct values for a specified column that must exist in an output row for it to be in the query output.
     */
    public val minimum: kotlin.Int = requireNotNull(builder.minimum) { "A non-null value must be provided for minimum" }
    /**
     * The type of aggregation the constraint allows. The only valid value is currently `COUNT_DISTINCT`.
     */
    public val type: aws.sdk.kotlin.services.cleanrooms.model.AggregationType = requireNotNull(builder.type) { "A non-null value must be provided for type" }

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

    override fun toString(): kotlin.String = buildString {
        append("AggregationConstraint(")
        append("columnName=$columnName,")
        append("minimum=$minimum,")
        append("type=$type")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = columnName.hashCode()
        result = 31 * result + (minimum)
        result = 31 * result + (type.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 AggregationConstraint

        if (columnName != other.columnName) return false
        if (minimum != other.minimum) return false
        if (type != other.type) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Column in aggregation constraint for which there must be a minimum number of distinct values in an output row for it to be in the query output.
         */
        public var columnName: kotlin.String? = null
        /**
         * The minimum number of distinct values that an output row must be an aggregation of. Minimum threshold of distinct values for a specified column that must exist in an output row for it to be in the query output.
         */
        public var minimum: kotlin.Int? = null
        /**
         * The type of aggregation the constraint allows. The only valid value is currently `COUNT_DISTINCT`.
         */
        public var type: aws.sdk.kotlin.services.cleanrooms.model.AggregationType? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.cleanrooms.model.AggregationConstraint) : this() {
            this.columnName = x.columnName
            this.minimum = x.minimum
            this.type = x.type
        }

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

        internal fun correctErrors(): Builder {
            if (columnName == null) columnName = ""
            if (minimum == null) minimum = 0
            if (type == null) type = AggregationType.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy