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

commonMain.aws.sdk.kotlin.services.appmesh.model.RouteSpec.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 route specification. Specify one route type.
 */
public class RouteSpec private constructor(builder: Builder) {
    /**
     * An object that represents the specification of a gRPC route.
     */
    public val grpcRoute: aws.sdk.kotlin.services.appmesh.model.GrpcRoute? = builder.grpcRoute
    /**
     * An object that represents the specification of an HTTP/2 route.
     */
    public val http2Route: aws.sdk.kotlin.services.appmesh.model.HttpRoute? = builder.http2Route
    /**
     * An object that represents the specification of an HTTP route.
     */
    public val httpRoute: aws.sdk.kotlin.services.appmesh.model.HttpRoute? = builder.httpRoute
    /**
     * The priority for the route. Routes are matched based on the specified value, where 0 is the highest priority.
     */
    public val priority: kotlin.Int? = builder.priority
    /**
     * An object that represents the specification of a TCP route.
     */
    public val tcpRoute: aws.sdk.kotlin.services.appmesh.model.TcpRoute? = builder.tcpRoute

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

    override fun toString(): kotlin.String = buildString {
        append("RouteSpec(")
        append("grpcRoute=$grpcRoute,")
        append("http2Route=$http2Route,")
        append("httpRoute=$httpRoute,")
        append("priority=$priority,")
        append("tcpRoute=$tcpRoute")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = grpcRoute?.hashCode() ?: 0
        result = 31 * result + (http2Route?.hashCode() ?: 0)
        result = 31 * result + (httpRoute?.hashCode() ?: 0)
        result = 31 * result + (priority ?: 0)
        result = 31 * result + (tcpRoute?.hashCode() ?: 0)
        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 RouteSpec

        if (grpcRoute != other.grpcRoute) return false
        if (http2Route != other.http2Route) return false
        if (httpRoute != other.httpRoute) return false
        if (priority != other.priority) return false
        if (tcpRoute != other.tcpRoute) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * An object that represents the specification of a gRPC route.
         */
        public var grpcRoute: aws.sdk.kotlin.services.appmesh.model.GrpcRoute? = null
        /**
         * An object that represents the specification of an HTTP/2 route.
         */
        public var http2Route: aws.sdk.kotlin.services.appmesh.model.HttpRoute? = null
        /**
         * An object that represents the specification of an HTTP route.
         */
        public var httpRoute: aws.sdk.kotlin.services.appmesh.model.HttpRoute? = null
        /**
         * The priority for the route. Routes are matched based on the specified value, where 0 is the highest priority.
         */
        public var priority: kotlin.Int? = null
        /**
         * An object that represents the specification of a TCP route.
         */
        public var tcpRoute: aws.sdk.kotlin.services.appmesh.model.TcpRoute? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.appmesh.model.RouteSpec) : this() {
            this.grpcRoute = x.grpcRoute
            this.http2Route = x.http2Route
            this.httpRoute = x.httpRoute
            this.priority = x.priority
            this.tcpRoute = x.tcpRoute
        }

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

        /**
         * construct an [aws.sdk.kotlin.services.appmesh.model.GrpcRoute] inside the given [block]
         */
        public fun grpcRoute(block: aws.sdk.kotlin.services.appmesh.model.GrpcRoute.Builder.() -> kotlin.Unit) {
            this.grpcRoute = aws.sdk.kotlin.services.appmesh.model.GrpcRoute.invoke(block)
        }

        /**
         * construct an [aws.sdk.kotlin.services.appmesh.model.HttpRoute] inside the given [block]
         */
        public fun http2Route(block: aws.sdk.kotlin.services.appmesh.model.HttpRoute.Builder.() -> kotlin.Unit) {
            this.http2Route = aws.sdk.kotlin.services.appmesh.model.HttpRoute.invoke(block)
        }

        /**
         * construct an [aws.sdk.kotlin.services.appmesh.model.HttpRoute] inside the given [block]
         */
        public fun httpRoute(block: aws.sdk.kotlin.services.appmesh.model.HttpRoute.Builder.() -> kotlin.Unit) {
            this.httpRoute = aws.sdk.kotlin.services.appmesh.model.HttpRoute.invoke(block)
        }

        /**
         * construct an [aws.sdk.kotlin.services.appmesh.model.TcpRoute] inside the given [block]
         */
        public fun tcpRoute(block: aws.sdk.kotlin.services.appmesh.model.TcpRoute.Builder.() -> kotlin.Unit) {
            this.tcpRoute = aws.sdk.kotlin.services.appmesh.model.TcpRoute.invoke(block)
        }

        internal fun correctErrors(): Builder {
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy