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

commonMain.aws.sdk.kotlin.services.appmesh.model.HttpRouteMatch.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 requirements for a route to match HTTP requests for a virtual router.
 */
public class HttpRouteMatch private constructor(builder: Builder) {
    /**
     * The client request headers to match on.
     */
    public val headers: List? = builder.headers
    /**
     * The client request method to match on. Specify only one.
     */
    public val method: aws.sdk.kotlin.services.appmesh.model.HttpMethod? = builder.method
    /**
     * The client request path to match on.
     */
    public val path: aws.sdk.kotlin.services.appmesh.model.HttpPathMatch? = builder.path
    /**
     * The port number to match on.
     */
    public val port: kotlin.Int? = builder.port
    /**
     * Specifies the path to match requests with. This parameter must always start with `/`, which by itself matches all requests to the virtual service name. You can also match for path-based routing of requests. For example, if your virtual service name is `my-service.local` and you want the route to match requests to `my-service.local/metrics`, your prefix should be `/metrics`.
     */
    public val prefix: kotlin.String? = builder.prefix
    /**
     * The client request query parameters to match on.
     */
    public val queryParameters: List? = builder.queryParameters
    /**
     * The client request scheme to match on. Specify only one. Applicable only for HTTP2 routes.
     */
    public val scheme: aws.sdk.kotlin.services.appmesh.model.HttpScheme? = builder.scheme

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

    override fun toString(): kotlin.String = buildString {
        append("HttpRouteMatch(")
        append("headers=$headers,")
        append("method=$method,")
        append("path=$path,")
        append("port=$port,")
        append("prefix=$prefix,")
        append("queryParameters=$queryParameters,")
        append("scheme=$scheme")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = headers?.hashCode() ?: 0
        result = 31 * result + (method?.hashCode() ?: 0)
        result = 31 * result + (path?.hashCode() ?: 0)
        result = 31 * result + (port ?: 0)
        result = 31 * result + (prefix?.hashCode() ?: 0)
        result = 31 * result + (queryParameters?.hashCode() ?: 0)
        result = 31 * result + (scheme?.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 HttpRouteMatch

        if (headers != other.headers) return false
        if (method != other.method) return false
        if (path != other.path) return false
        if (port != other.port) return false
        if (prefix != other.prefix) return false
        if (queryParameters != other.queryParameters) return false
        if (scheme != other.scheme) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The client request headers to match on.
         */
        public var headers: List? = null
        /**
         * The client request method to match on. Specify only one.
         */
        public var method: aws.sdk.kotlin.services.appmesh.model.HttpMethod? = null
        /**
         * The client request path to match on.
         */
        public var path: aws.sdk.kotlin.services.appmesh.model.HttpPathMatch? = null
        /**
         * The port number to match on.
         */
        public var port: kotlin.Int? = null
        /**
         * Specifies the path to match requests with. This parameter must always start with `/`, which by itself matches all requests to the virtual service name. You can also match for path-based routing of requests. For example, if your virtual service name is `my-service.local` and you want the route to match requests to `my-service.local/metrics`, your prefix should be `/metrics`.
         */
        public var prefix: kotlin.String? = null
        /**
         * The client request query parameters to match on.
         */
        public var queryParameters: List? = null
        /**
         * The client request scheme to match on. Specify only one. Applicable only for HTTP2 routes.
         */
        public var scheme: aws.sdk.kotlin.services.appmesh.model.HttpScheme? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.appmesh.model.HttpRouteMatch) : this() {
            this.headers = x.headers
            this.method = x.method
            this.path = x.path
            this.port = x.port
            this.prefix = x.prefix
            this.queryParameters = x.queryParameters
            this.scheme = x.scheme
        }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy