
commonMain.aws.sdk.kotlin.services.appmesh.model.OutlierDetection.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 the outlier detection for a virtual node's listener.
*/
public class OutlierDetection private constructor(builder: Builder) {
/**
* The base amount of time for which a host is ejected.
*/
public val baseEjectionDuration: aws.sdk.kotlin.services.appmesh.model.Duration? = builder.baseEjectionDuration
/**
* The time interval between ejection sweep analysis.
*/
public val interval: aws.sdk.kotlin.services.appmesh.model.Duration? = builder.interval
/**
* Maximum percentage of hosts in load balancing pool for upstream service that can be ejected. Will eject at least one host regardless of the value.
*/
public val maxEjectionPercent: kotlin.Int = requireNotNull(builder.maxEjectionPercent) { "A non-null value must be provided for maxEjectionPercent" }
/**
* Number of consecutive `5xx` errors required for ejection.
*/
public val maxServerErrors: kotlin.Long = requireNotNull(builder.maxServerErrors) { "A non-null value must be provided for maxServerErrors" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.appmesh.model.OutlierDetection = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("OutlierDetection(")
append("baseEjectionDuration=$baseEjectionDuration,")
append("interval=$interval,")
append("maxEjectionPercent=$maxEjectionPercent,")
append("maxServerErrors=$maxServerErrors")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = baseEjectionDuration?.hashCode() ?: 0
result = 31 * result + (interval?.hashCode() ?: 0)
result = 31 * result + (maxEjectionPercent)
result = 31 * result + (maxServerErrors.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 OutlierDetection
if (baseEjectionDuration != other.baseEjectionDuration) return false
if (interval != other.interval) return false
if (maxEjectionPercent != other.maxEjectionPercent) return false
if (maxServerErrors != other.maxServerErrors) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.appmesh.model.OutlierDetection = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* The base amount of time for which a host is ejected.
*/
public var baseEjectionDuration: aws.sdk.kotlin.services.appmesh.model.Duration? = null
/**
* The time interval between ejection sweep analysis.
*/
public var interval: aws.sdk.kotlin.services.appmesh.model.Duration? = null
/**
* Maximum percentage of hosts in load balancing pool for upstream service that can be ejected. Will eject at least one host regardless of the value.
*/
public var maxEjectionPercent: kotlin.Int? = null
/**
* Number of consecutive `5xx` errors required for ejection.
*/
public var maxServerErrors: kotlin.Long? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.appmesh.model.OutlierDetection) : this() {
this.baseEjectionDuration = x.baseEjectionDuration
this.interval = x.interval
this.maxEjectionPercent = x.maxEjectionPercent
this.maxServerErrors = x.maxServerErrors
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.appmesh.model.OutlierDetection = OutlierDetection(this)
/**
* construct an [aws.sdk.kotlin.services.appmesh.model.Duration] inside the given [block]
*/
public fun baseEjectionDuration(block: aws.sdk.kotlin.services.appmesh.model.Duration.Builder.() -> kotlin.Unit) {
this.baseEjectionDuration = aws.sdk.kotlin.services.appmesh.model.Duration.invoke(block)
}
/**
* construct an [aws.sdk.kotlin.services.appmesh.model.Duration] inside the given [block]
*/
public fun interval(block: aws.sdk.kotlin.services.appmesh.model.Duration.Builder.() -> kotlin.Unit) {
this.interval = aws.sdk.kotlin.services.appmesh.model.Duration.invoke(block)
}
internal fun correctErrors(): Builder {
if (maxEjectionPercent == null) maxEjectionPercent = 0
if (maxServerErrors == null) maxServerErrors = 0L
return this
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy