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

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

/**
 * A rule group that's defined for an Firewall Manager WAF policy.
 */
public class FirewallManagerRuleGroup private constructor(builder: Builder) {
    /**
     * The processing guidance for an Firewall Manager rule. This is like a regular rule Statement, but it can only contain a rule group reference.
     */
    public val firewallManagerStatement: aws.sdk.kotlin.services.wafv2.model.FirewallManagerStatement? = builder.firewallManagerStatement
    /**
     * The name of the rule group. You cannot change the name of a rule group after you create it.
     */
    public val name: kotlin.String = requireNotNull(builder.name) { "A non-null value must be provided for name" }
    /**
     * The action to use in the place of the action that results from the rule group evaluation. Set the override action to none to leave the result of the rule group alone. Set it to count to override the result to count only.
     *
     * You can only use this for rule statements that reference a rule group, like `RuleGroupReferenceStatement` and `ManagedRuleGroupStatement`.
     *
     * This option is usually set to none. It does not affect how the rules in the rule group are evaluated. If you want the rules in the rule group to only count matches, do not use this and instead use the rule action override option, with `Count` action, in your rule group reference statement settings.
     */
    public val overrideAction: aws.sdk.kotlin.services.wafv2.model.OverrideAction? = builder.overrideAction
    /**
     * If you define more than one rule group in the first or last Firewall Manager rule groups, WAF evaluates each request against the rule groups in order, starting from the lowest priority setting. The priorities don't need to be consecutive, but they must all be different.
     */
    public val priority: kotlin.Int = builder.priority
    /**
     * Defines and enables Amazon CloudWatch metrics and web request sample collection.
     */
    public val visibilityConfig: aws.sdk.kotlin.services.wafv2.model.VisibilityConfig? = builder.visibilityConfig

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

    override fun toString(): kotlin.String = buildString {
        append("FirewallManagerRuleGroup(")
        append("firewallManagerStatement=$firewallManagerStatement,")
        append("name=$name,")
        append("overrideAction=$overrideAction,")
        append("priority=$priority,")
        append("visibilityConfig=$visibilityConfig")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = firewallManagerStatement?.hashCode() ?: 0
        result = 31 * result + (name.hashCode())
        result = 31 * result + (overrideAction?.hashCode() ?: 0)
        result = 31 * result + (priority)
        result = 31 * result + (visibilityConfig?.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 FirewallManagerRuleGroup

        if (firewallManagerStatement != other.firewallManagerStatement) return false
        if (name != other.name) return false
        if (overrideAction != other.overrideAction) return false
        if (priority != other.priority) return false
        if (visibilityConfig != other.visibilityConfig) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The processing guidance for an Firewall Manager rule. This is like a regular rule Statement, but it can only contain a rule group reference.
         */
        public var firewallManagerStatement: aws.sdk.kotlin.services.wafv2.model.FirewallManagerStatement? = null
        /**
         * The name of the rule group. You cannot change the name of a rule group after you create it.
         */
        public var name: kotlin.String? = null
        /**
         * The action to use in the place of the action that results from the rule group evaluation. Set the override action to none to leave the result of the rule group alone. Set it to count to override the result to count only.
         *
         * You can only use this for rule statements that reference a rule group, like `RuleGroupReferenceStatement` and `ManagedRuleGroupStatement`.
         *
         * This option is usually set to none. It does not affect how the rules in the rule group are evaluated. If you want the rules in the rule group to only count matches, do not use this and instead use the rule action override option, with `Count` action, in your rule group reference statement settings.
         */
        public var overrideAction: aws.sdk.kotlin.services.wafv2.model.OverrideAction? = null
        /**
         * If you define more than one rule group in the first or last Firewall Manager rule groups, WAF evaluates each request against the rule groups in order, starting from the lowest priority setting. The priorities don't need to be consecutive, but they must all be different.
         */
        public var priority: kotlin.Int = 0
        /**
         * Defines and enables Amazon CloudWatch metrics and web request sample collection.
         */
        public var visibilityConfig: aws.sdk.kotlin.services.wafv2.model.VisibilityConfig? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.wafv2.model.FirewallManagerRuleGroup) : this() {
            this.firewallManagerStatement = x.firewallManagerStatement
            this.name = x.name
            this.overrideAction = x.overrideAction
            this.priority = x.priority
            this.visibilityConfig = x.visibilityConfig
        }

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

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

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

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

        internal fun correctErrors(): Builder {
            if (name == null) name = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy