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

commonMain.aws.sdk.kotlin.services.wafv2.model.Cookies.kt Maven / Gradle / Ivy

There is a newer version: 1.3.76
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.wafv2.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Inspect the cookies in the web request. You can specify the parts of the cookies to inspect and you can narrow the set of cookies to inspect by including or excluding specific keys.
 *
 * This is used to indicate the web request component to inspect, in the FieldToMatch specification.
 *
 * Example JSON: `"Cookies": { "MatchPattern": { "All": {} }, "MatchScope": "KEY", "OversizeHandling": "MATCH" }`
 */
public class Cookies private constructor(builder: Builder) {
    /**
     * The filter to use to identify the subset of cookies to inspect in a web request.
     *
     * You must specify exactly one setting: either `All`, `IncludedCookies`, or `ExcludedCookies`.
     *
     * Example JSON: `"MatchPattern": { "IncludedCookies": [ "session-id-time", "session-id" ] }`
     */
    public val matchPattern: aws.sdk.kotlin.services.wafv2.model.CookieMatchPattern? = builder.matchPattern
    /**
     * The parts of the cookies to inspect with the rule inspection criteria. If you specify `ALL`, WAF inspects both keys and values.
     *
     * `All` does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical `AND` statement to combine two match rules, one that inspects the keys and another that inspects the values.
     */
    public val matchScope: aws.sdk.kotlin.services.wafv2.model.MapMatchScope = requireNotNull(builder.matchScope) { "A non-null value must be provided for matchScope" }
    /**
     * What WAF should do if the cookies of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request cookies when they exceed 8 KB (8192 bytes) or 200 total cookies. The underlying host service forwards a maximum of 200 cookies and at most 8 KB of cookie contents to WAF.
     *
     * The options for oversize handling are the following:
     * + `CONTINUE` - Inspect the available cookies normally, according to the rule inspection criteria.
     * + `MATCH` - Treat the web request as matching the rule statement. WAF applies the rule action to the request.
     * + `NO_MATCH` - Treat the web request as not matching the rule statement.
     */
    public val oversizeHandling: aws.sdk.kotlin.services.wafv2.model.OversizeHandling = requireNotNull(builder.oversizeHandling) { "A non-null value must be provided for oversizeHandling" }

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

    override fun toString(): kotlin.String = buildString {
        append("Cookies(")
        append("matchPattern=$matchPattern,")
        append("matchScope=$matchScope,")
        append("oversizeHandling=$oversizeHandling")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = matchPattern?.hashCode() ?: 0
        result = 31 * result + (matchScope.hashCode())
        result = 31 * result + (oversizeHandling.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 Cookies

        if (matchPattern != other.matchPattern) return false
        if (matchScope != other.matchScope) return false
        if (oversizeHandling != other.oversizeHandling) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The filter to use to identify the subset of cookies to inspect in a web request.
         *
         * You must specify exactly one setting: either `All`, `IncludedCookies`, or `ExcludedCookies`.
         *
         * Example JSON: `"MatchPattern": { "IncludedCookies": [ "session-id-time", "session-id" ] }`
         */
        public var matchPattern: aws.sdk.kotlin.services.wafv2.model.CookieMatchPattern? = null
        /**
         * The parts of the cookies to inspect with the rule inspection criteria. If you specify `ALL`, WAF inspects both keys and values.
         *
         * `All` does not require a match to be found in the keys and a match to be found in the values. It requires a match to be found in the keys or the values or both. To require a match in the keys and in the values, use a logical `AND` statement to combine two match rules, one that inspects the keys and another that inspects the values.
         */
        public var matchScope: aws.sdk.kotlin.services.wafv2.model.MapMatchScope? = null
        /**
         * What WAF should do if the cookies of the request are more numerous or larger than WAF can inspect. WAF does not support inspecting the entire contents of request cookies when they exceed 8 KB (8192 bytes) or 200 total cookies. The underlying host service forwards a maximum of 200 cookies and at most 8 KB of cookie contents to WAF.
         *
         * The options for oversize handling are the following:
         * + `CONTINUE` - Inspect the available cookies normally, according to the rule inspection criteria.
         * + `MATCH` - Treat the web request as matching the rule statement. WAF applies the rule action to the request.
         * + `NO_MATCH` - Treat the web request as not matching the rule statement.
         */
        public var oversizeHandling: aws.sdk.kotlin.services.wafv2.model.OversizeHandling? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.wafv2.model.Cookies) : this() {
            this.matchPattern = x.matchPattern
            this.matchScope = x.matchScope
            this.oversizeHandling = x.oversizeHandling
        }

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

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

        internal fun correctErrors(): Builder {
            if (matchScope == null) matchScope = MapMatchScope.SdkUnknown("no value provided")
            if (oversizeHandling == null) oversizeHandling = OversizeHandling.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy