
commonMain.aws.sdk.kotlin.services.appmesh.model.WeightedTarget.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.appmesh.model
import aws.smithy.kotlin.runtime.SdkDsl
/**
* An object that represents a target and its relative weight. Traffic is distributed across targets according to their relative weight. For example, a weighted target with a relative weight of 50 receives five times as much traffic as one with a relative weight of 10. The total weight for all targets combined must be less than or equal to 100.
*/
public class WeightedTarget private constructor(builder: Builder) {
/**
* The targeted port of the weighted object.
*/
public val port: kotlin.Int? = builder.port
/**
* The virtual node to associate with the weighted target.
*/
public val virtualNode: kotlin.String = requireNotNull(builder.virtualNode) { "A non-null value must be provided for virtualNode" }
/**
* The relative weight of the weighted target.
*/
public val weight: kotlin.Int = builder.weight
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.appmesh.model.WeightedTarget = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("WeightedTarget(")
append("port=$port,")
append("virtualNode=$virtualNode,")
append("weight=$weight")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = port ?: 0
result = 31 * result + (virtualNode.hashCode())
result = 31 * result + (weight)
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 WeightedTarget
if (port != other.port) return false
if (virtualNode != other.virtualNode) return false
if (weight != other.weight) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.appmesh.model.WeightedTarget = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* The targeted port of the weighted object.
*/
public var port: kotlin.Int? = null
/**
* The virtual node to associate with the weighted target.
*/
public var virtualNode: kotlin.String? = null
/**
* The relative weight of the weighted target.
*/
public var weight: kotlin.Int = 0
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.appmesh.model.WeightedTarget) : this() {
this.port = x.port
this.virtualNode = x.virtualNode
this.weight = x.weight
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.appmesh.model.WeightedTarget = WeightedTarget(this)
internal fun correctErrors(): Builder {
if (virtualNode == null) virtualNode = ""
return this
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy