commonMain.aws.sdk.kotlin.services.evidently.model.SegmentOverride.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of evidently-jvm Show documentation
Show all versions of evidently-jvm Show documentation
The AWS SDK for Kotlin client for Evidently
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.evidently.model
import aws.smithy.kotlin.runtime.SdkDsl
/**
* This structure specifies a segment that you have already created, and defines the traffic split for that segment to be used in a launch.
*/
public class SegmentOverride private constructor(builder: Builder) {
/**
* A number indicating the order to use to evaluate segment overrides, if there are more than one. Segment overrides with lower numbers are evaluated first.
*/
public val evaluationOrder: kotlin.Long = requireNotNull(builder.evaluationOrder) { "A non-null value must be provided for evaluationOrder" }
/**
* The ARN of the segment to use.
*/
public val segment: kotlin.String = requireNotNull(builder.segment) { "A non-null value must be provided for segment" }
/**
* The traffic allocation percentages among the feature variations to assign to this segment. This is a set of key-value pairs. The keys are variation names. The values represent the amount of traffic to allocate to that variation for this segment. This is expressed in thousandths of a percent, so a weight of 50000 represents 50% of traffic.
*/
public val weights: Map = requireNotNull(builder.weights) { "A non-null value must be provided for weights" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.evidently.model.SegmentOverride = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("SegmentOverride(")
append("evaluationOrder=$evaluationOrder,")
append("segment=$segment,")
append("weights=$weights")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = evaluationOrder.hashCode()
result = 31 * result + (segment.hashCode())
result = 31 * result + (weights.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 SegmentOverride
if (evaluationOrder != other.evaluationOrder) return false
if (segment != other.segment) return false
if (weights != other.weights) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.evidently.model.SegmentOverride = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* A number indicating the order to use to evaluate segment overrides, if there are more than one. Segment overrides with lower numbers are evaluated first.
*/
public var evaluationOrder: kotlin.Long? = null
/**
* The ARN of the segment to use.
*/
public var segment: kotlin.String? = null
/**
* The traffic allocation percentages among the feature variations to assign to this segment. This is a set of key-value pairs. The keys are variation names. The values represent the amount of traffic to allocate to that variation for this segment. This is expressed in thousandths of a percent, so a weight of 50000 represents 50% of traffic.
*/
public var weights: Map? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.evidently.model.SegmentOverride) : this() {
this.evaluationOrder = x.evaluationOrder
this.segment = x.segment
this.weights = x.weights
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.evidently.model.SegmentOverride = SegmentOverride(this)
internal fun correctErrors(): Builder {
if (evaluationOrder == null) evaluationOrder = 0L
if (segment == null) segment = ""
if (weights == null) weights = emptyMap()
return this
}
}
}