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

commonMain.aws.sdk.kotlin.services.wafv2.model.DefaultAction.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

/**
 * In a WebACL, this is the action that you want WAF to perform when a web request doesn't match any of the rules in the `WebACL`. The default action must be a terminating action.
 */
public class DefaultAction private constructor(builder: Builder) {
    /**
     * Specifies that WAF should allow requests by default.
     */
    public val allow: aws.sdk.kotlin.services.wafv2.model.AllowAction? = builder.allow
    /**
     * Specifies that WAF should block requests by default.
     */
    public val block: aws.sdk.kotlin.services.wafv2.model.BlockAction? = builder.block

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

    override fun toString(): kotlin.String = buildString {
        append("DefaultAction(")
        append("allow=$allow,")
        append("block=$block")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = allow?.hashCode() ?: 0
        result = 31 * result + (block?.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 DefaultAction

        if (allow != other.allow) return false
        if (block != other.block) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Specifies that WAF should allow requests by default.
         */
        public var allow: aws.sdk.kotlin.services.wafv2.model.AllowAction? = null
        /**
         * Specifies that WAF should block requests by default.
         */
        public var block: aws.sdk.kotlin.services.wafv2.model.BlockAction? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.wafv2.model.DefaultAction) : this() {
            this.allow = x.allow
            this.block = x.block
        }

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy