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

commonMain.aws.sdk.kotlin.services.appmesh.model.HealthCheckPolicy.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 health check policy for a virtual node's listener.
 */
public class HealthCheckPolicy private constructor(builder: Builder) {
    /**
     * The number of consecutive successful health checks that must occur before declaring listener healthy.
     */
    public val healthyThreshold: kotlin.Int = requireNotNull(builder.healthyThreshold) { "A non-null value must be provided for healthyThreshold" }
    /**
     * The time period in milliseconds between each health check execution.
     */
    public val intervalMillis: kotlin.Long = requireNotNull(builder.intervalMillis) { "A non-null value must be provided for intervalMillis" }
    /**
     * The destination path for the health check request. This value is only used if the specified protocol is HTTP or HTTP/2. For any other protocol, this value is ignored.
     */
    public val path: kotlin.String? = builder.path
    /**
     * The destination port for the health check request. This port must match the port defined in the PortMapping for the listener.
     */
    public val port: kotlin.Int? = builder.port
    /**
     * The protocol for the health check request. If you specify `grpc`, then your service must conform to the [GRPC Health Checking Protocol](https://github.com/grpc/grpc/blob/master/doc/health-checking.md).
     */
    public val protocol: aws.sdk.kotlin.services.appmesh.model.PortProtocol = requireNotNull(builder.protocol) { "A non-null value must be provided for protocol" }
    /**
     * The amount of time to wait when receiving a response from the health check, in milliseconds.
     */
    public val timeoutMillis: kotlin.Long = requireNotNull(builder.timeoutMillis) { "A non-null value must be provided for timeoutMillis" }
    /**
     * The number of consecutive failed health checks that must occur before declaring a virtual node unhealthy.
     */
    public val unhealthyThreshold: kotlin.Int = requireNotNull(builder.unhealthyThreshold) { "A non-null value must be provided for unhealthyThreshold" }

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

    override fun toString(): kotlin.String = buildString {
        append("HealthCheckPolicy(")
        append("healthyThreshold=$healthyThreshold,")
        append("intervalMillis=$intervalMillis,")
        append("path=$path,")
        append("port=$port,")
        append("protocol=$protocol,")
        append("timeoutMillis=$timeoutMillis,")
        append("unhealthyThreshold=$unhealthyThreshold")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = healthyThreshold
        result = 31 * result + (intervalMillis.hashCode())
        result = 31 * result + (path?.hashCode() ?: 0)
        result = 31 * result + (port ?: 0)
        result = 31 * result + (protocol.hashCode())
        result = 31 * result + (timeoutMillis.hashCode())
        result = 31 * result + (unhealthyThreshold)
        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 HealthCheckPolicy

        if (healthyThreshold != other.healthyThreshold) return false
        if (intervalMillis != other.intervalMillis) return false
        if (path != other.path) return false
        if (port != other.port) return false
        if (protocol != other.protocol) return false
        if (timeoutMillis != other.timeoutMillis) return false
        if (unhealthyThreshold != other.unhealthyThreshold) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The number of consecutive successful health checks that must occur before declaring listener healthy.
         */
        public var healthyThreshold: kotlin.Int? = null
        /**
         * The time period in milliseconds between each health check execution.
         */
        public var intervalMillis: kotlin.Long? = null
        /**
         * The destination path for the health check request. This value is only used if the specified protocol is HTTP or HTTP/2. For any other protocol, this value is ignored.
         */
        public var path: kotlin.String? = null
        /**
         * The destination port for the health check request. This port must match the port defined in the PortMapping for the listener.
         */
        public var port: kotlin.Int? = null
        /**
         * The protocol for the health check request. If you specify `grpc`, then your service must conform to the [GRPC Health Checking Protocol](https://github.com/grpc/grpc/blob/master/doc/health-checking.md).
         */
        public var protocol: aws.sdk.kotlin.services.appmesh.model.PortProtocol? = null
        /**
         * The amount of time to wait when receiving a response from the health check, in milliseconds.
         */
        public var timeoutMillis: kotlin.Long? = null
        /**
         * The number of consecutive failed health checks that must occur before declaring a virtual node unhealthy.
         */
        public var unhealthyThreshold: kotlin.Int? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.appmesh.model.HealthCheckPolicy) : this() {
            this.healthyThreshold = x.healthyThreshold
            this.intervalMillis = x.intervalMillis
            this.path = x.path
            this.port = x.port
            this.protocol = x.protocol
            this.timeoutMillis = x.timeoutMillis
            this.unhealthyThreshold = x.unhealthyThreshold
        }

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

        internal fun correctErrors(): Builder {
            if (healthyThreshold == null) healthyThreshold = 0
            if (intervalMillis == null) intervalMillis = 0L
            if (protocol == null) protocol = PortProtocol.SdkUnknown("no value provided")
            if (timeoutMillis == null) timeoutMillis = 0L
            if (unhealthyThreshold == null) unhealthyThreshold = 0
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy