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

com.pulumi.awsnative.wafv2.kotlin.inputs.WebAclRuleArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.wafv2.kotlin.inputs

import com.pulumi.awsnative.wafv2.inputs.WebAclRuleArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiNullFieldException
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Rule of WebACL that contains condition and action.
 * @property action The action that AWS WAF should take on a web request when it matches the rule's statement. Settings at the web ACL level can override the rule action setting.
 * This is used only for rules whose statements don't reference a rule group. Rule statements that reference a rule group are `RuleGroupReferenceStatement` and `ManagedRuleGroupStatement` .
 * You must set either this `Action` setting or the rule's `OverrideAction` , but not both:
 * - If the rule statement doesn't reference a rule group, you must set this rule action setting and you must not set the rule's override action setting.
 * - If the rule statement references a rule group, you must not set this action setting, because the actions are already set on the rules inside the rule group. You must set the rule's override action setting to indicate specifically whether to override the actions that are set on the rules in the rule group.
 * @property captchaConfig Specifies how AWS WAF should handle `CAPTCHA` evaluations. If you don't specify this, AWS WAF uses the `CAPTCHA` configuration that's defined for the web ACL.
 * @property challengeConfig Specifies how AWS WAF should handle `Challenge` evaluations. If you don't specify this, AWS WAF uses the challenge configuration that's defined for the web ACL.
 * @property name The name of the rule.
 * If you change the name of a `Rule` after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's `VisibilityConfig` settings. AWS WAF doesn't automatically update the metric name when you update the rule name.
 * @property overrideAction The override action to apply to the rules in a rule group, instead of the individual rule action settings. This is used only for rules whose statements reference a rule group. Rule statements that reference a rule group are `RuleGroupReferenceStatement` and `ManagedRuleGroupStatement` .
 * Set the override action to none to leave the rule group rule actions in effect. Set it to count to only count matches, regardless of the rule action settings.
 * You must set either this `OverrideAction` setting or the `Action` setting, but not both:
 * - If the rule statement references a rule group, you must set this override action setting and you must not set the rule's action setting.
 * - If the rule statement doesn't reference a rule group, you must set the rule action setting and you must not set the rule's override action setting.
 * @property priority If you define more than one `Rule` in a `WebACL` , AWS WAF evaluates each request against the `Rules` in order based on the value of `Priority` . AWS WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.
 * @property ruleLabels Collection of Rule Labels.
 * @property statement The AWS WAF processing statement for the rule, for example `ByteMatchStatement` or `SizeConstraintStatement` .
 * @property visibilityConfig Defines and enables Amazon CloudWatch metrics and web request sample collection.
 * If you change the name of a `Rule` after you create it and you want the rule's metric name to reflect the change, update the metric name as well. AWS WAF doesn't automatically update the metric name.
 */
public data class WebAclRuleArgs(
    public val action: Output? = null,
    public val captchaConfig: Output? = null,
    public val challengeConfig: Output? = null,
    public val name: Output,
    public val overrideAction: Output? = null,
    public val priority: Output,
    public val ruleLabels: Output>? = null,
    public val statement: Output,
    public val visibilityConfig: Output,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.awsnative.wafv2.inputs.WebAclRuleArgs =
        com.pulumi.awsnative.wafv2.inputs.WebAclRuleArgs.builder()
            .action(action?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .captchaConfig(captchaConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .challengeConfig(challengeConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .name(name.applyValue({ args0 -> args0 }))
            .overrideAction(overrideAction?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .priority(priority.applyValue({ args0 -> args0 }))
            .ruleLabels(
                ruleLabels?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .statement(statement.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .visibilityConfig(
                visibilityConfig.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            ).build()
}

/**
 * Builder for [WebAclRuleArgs].
 */
@PulumiTagMarker
public class WebAclRuleArgsBuilder internal constructor() {
    private var action: Output? = null

    private var captchaConfig: Output? = null

    private var challengeConfig: Output? = null

    private var name: Output? = null

    private var overrideAction: Output? = null

    private var priority: Output? = null

    private var ruleLabels: Output>? = null

    private var statement: Output? = null

    private var visibilityConfig: Output? = null

    /**
     * @param value The action that AWS WAF should take on a web request when it matches the rule's statement. Settings at the web ACL level can override the rule action setting.
     * This is used only for rules whose statements don't reference a rule group. Rule statements that reference a rule group are `RuleGroupReferenceStatement` and `ManagedRuleGroupStatement` .
     * You must set either this `Action` setting or the rule's `OverrideAction` , but not both:
     * - If the rule statement doesn't reference a rule group, you must set this rule action setting and you must not set the rule's override action setting.
     * - If the rule statement references a rule group, you must not set this action setting, because the actions are already set on the rules inside the rule group. You must set the rule's override action setting to indicate specifically whether to override the actions that are set on the rules in the rule group.
     */
    @JvmName("upaskbhnamxjyitn")
    public suspend fun action(`value`: Output) {
        this.action = value
    }

    /**
     * @param value Specifies how AWS WAF should handle `CAPTCHA` evaluations. If you don't specify this, AWS WAF uses the `CAPTCHA` configuration that's defined for the web ACL.
     */
    @JvmName("gfcyiwqkpdlllbun")
    public suspend fun captchaConfig(`value`: Output) {
        this.captchaConfig = value
    }

    /**
     * @param value Specifies how AWS WAF should handle `Challenge` evaluations. If you don't specify this, AWS WAF uses the challenge configuration that's defined for the web ACL.
     */
    @JvmName("ccldlhxxmobwbqqs")
    public suspend fun challengeConfig(`value`: Output) {
        this.challengeConfig = value
    }

    /**
     * @param value The name of the rule.
     * If you change the name of a `Rule` after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's `VisibilityConfig` settings. AWS WAF doesn't automatically update the metric name when you update the rule name.
     */
    @JvmName("axsulxyhnyesgwjl")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The override action to apply to the rules in a rule group, instead of the individual rule action settings. This is used only for rules whose statements reference a rule group. Rule statements that reference a rule group are `RuleGroupReferenceStatement` and `ManagedRuleGroupStatement` .
     * Set the override action to none to leave the rule group rule actions in effect. Set it to count to only count matches, regardless of the rule action settings.
     * You must set either this `OverrideAction` setting or the `Action` setting, but not both:
     * - If the rule statement references a rule group, you must set this override action setting and you must not set the rule's action setting.
     * - If the rule statement doesn't reference a rule group, you must set the rule action setting and you must not set the rule's override action setting.
     */
    @JvmName("savbjxcnqjhfwrjj")
    public suspend fun overrideAction(`value`: Output) {
        this.overrideAction = value
    }

    /**
     * @param value If you define more than one `Rule` in a `WebACL` , AWS WAF evaluates each request against the `Rules` in order based on the value of `Priority` . AWS WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.
     */
    @JvmName("jpthhlctlwhilheb")
    public suspend fun priority(`value`: Output) {
        this.priority = value
    }

    /**
     * @param value Collection of Rule Labels.
     */
    @JvmName("yuvybddweerfogsr")
    public suspend fun ruleLabels(`value`: Output>) {
        this.ruleLabels = value
    }

    @JvmName("gnvhuaqvdgyyqiey")
    public suspend fun ruleLabels(vararg values: Output) {
        this.ruleLabels = Output.all(values.asList())
    }

    /**
     * @param values Collection of Rule Labels.
     */
    @JvmName("yipjmfbugttewixp")
    public suspend fun ruleLabels(values: List>) {
        this.ruleLabels = Output.all(values)
    }

    /**
     * @param value The AWS WAF processing statement for the rule, for example `ByteMatchStatement` or `SizeConstraintStatement` .
     */
    @JvmName("ofhxlcmdcfrcqjug")
    public suspend fun statement(`value`: Output) {
        this.statement = value
    }

    /**
     * @param value Defines and enables Amazon CloudWatch metrics and web request sample collection.
     * If you change the name of a `Rule` after you create it and you want the rule's metric name to reflect the change, update the metric name as well. AWS WAF doesn't automatically update the metric name.
     */
    @JvmName("ldjbyonpyljqiqna")
    public suspend fun visibilityConfig(`value`: Output) {
        this.visibilityConfig = value
    }

    /**
     * @param value The action that AWS WAF should take on a web request when it matches the rule's statement. Settings at the web ACL level can override the rule action setting.
     * This is used only for rules whose statements don't reference a rule group. Rule statements that reference a rule group are `RuleGroupReferenceStatement` and `ManagedRuleGroupStatement` .
     * You must set either this `Action` setting or the rule's `OverrideAction` , but not both:
     * - If the rule statement doesn't reference a rule group, you must set this rule action setting and you must not set the rule's override action setting.
     * - If the rule statement references a rule group, you must not set this action setting, because the actions are already set on the rules inside the rule group. You must set the rule's override action setting to indicate specifically whether to override the actions that are set on the rules in the rule group.
     */
    @JvmName("vmnymekmfccwsptm")
    public suspend fun action(`value`: WebAclRuleActionArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.action = mapped
    }

    /**
     * @param argument The action that AWS WAF should take on a web request when it matches the rule's statement. Settings at the web ACL level can override the rule action setting.
     * This is used only for rules whose statements don't reference a rule group. Rule statements that reference a rule group are `RuleGroupReferenceStatement` and `ManagedRuleGroupStatement` .
     * You must set either this `Action` setting or the rule's `OverrideAction` , but not both:
     * - If the rule statement doesn't reference a rule group, you must set this rule action setting and you must not set the rule's override action setting.
     * - If the rule statement references a rule group, you must not set this action setting, because the actions are already set on the rules inside the rule group. You must set the rule's override action setting to indicate specifically whether to override the actions that are set on the rules in the rule group.
     */
    @JvmName("kgvnngohucbxyhec")
    public suspend fun action(argument: suspend WebAclRuleActionArgsBuilder.() -> Unit) {
        val toBeMapped = WebAclRuleActionArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.action = mapped
    }

    /**
     * @param value Specifies how AWS WAF should handle `CAPTCHA` evaluations. If you don't specify this, AWS WAF uses the `CAPTCHA` configuration that's defined for the web ACL.
     */
    @JvmName("affvyymwbhraqcol")
    public suspend fun captchaConfig(`value`: WebAclCaptchaConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.captchaConfig = mapped
    }

    /**
     * @param argument Specifies how AWS WAF should handle `CAPTCHA` evaluations. If you don't specify this, AWS WAF uses the `CAPTCHA` configuration that's defined for the web ACL.
     */
    @JvmName("fwrcbyjlynmowkbx")
    public suspend fun captchaConfig(argument: suspend WebAclCaptchaConfigArgsBuilder.() -> Unit) {
        val toBeMapped = WebAclCaptchaConfigArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.captchaConfig = mapped
    }

    /**
     * @param value Specifies how AWS WAF should handle `Challenge` evaluations. If you don't specify this, AWS WAF uses the challenge configuration that's defined for the web ACL.
     */
    @JvmName("holgmwlqrkhdcglf")
    public suspend fun challengeConfig(`value`: WebAclChallengeConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.challengeConfig = mapped
    }

    /**
     * @param argument Specifies how AWS WAF should handle `Challenge` evaluations. If you don't specify this, AWS WAF uses the challenge configuration that's defined for the web ACL.
     */
    @JvmName("osmmodmtpcuiikaf")
    public suspend fun challengeConfig(argument: suspend WebAclChallengeConfigArgsBuilder.() -> Unit) {
        val toBeMapped = WebAclChallengeConfigArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.challengeConfig = mapped
    }

    /**
     * @param value The name of the rule.
     * If you change the name of a `Rule` after you create it and you want the rule's metric name to reflect the change, update the metric name in the rule's `VisibilityConfig` settings. AWS WAF doesn't automatically update the metric name when you update the rule name.
     */
    @JvmName("gfjcatxwknwaukiq")
    public suspend fun name(`value`: String) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The override action to apply to the rules in a rule group, instead of the individual rule action settings. This is used only for rules whose statements reference a rule group. Rule statements that reference a rule group are `RuleGroupReferenceStatement` and `ManagedRuleGroupStatement` .
     * Set the override action to none to leave the rule group rule actions in effect. Set it to count to only count matches, regardless of the rule action settings.
     * You must set either this `OverrideAction` setting or the `Action` setting, but not both:
     * - If the rule statement references a rule group, you must set this override action setting and you must not set the rule's action setting.
     * - If the rule statement doesn't reference a rule group, you must set the rule action setting and you must not set the rule's override action setting.
     */
    @JvmName("whrbxnwftpvpxfpc")
    public suspend fun overrideAction(`value`: WebAclOverrideActionArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.overrideAction = mapped
    }

    /**
     * @param argument The override action to apply to the rules in a rule group, instead of the individual rule action settings. This is used only for rules whose statements reference a rule group. Rule statements that reference a rule group are `RuleGroupReferenceStatement` and `ManagedRuleGroupStatement` .
     * Set the override action to none to leave the rule group rule actions in effect. Set it to count to only count matches, regardless of the rule action settings.
     * You must set either this `OverrideAction` setting or the `Action` setting, but not both:
     * - If the rule statement references a rule group, you must set this override action setting and you must not set the rule's action setting.
     * - If the rule statement doesn't reference a rule group, you must set the rule action setting and you must not set the rule's override action setting.
     */
    @JvmName("lspkvvqsfmovslwh")
    public suspend fun overrideAction(argument: suspend WebAclOverrideActionArgsBuilder.() -> Unit) {
        val toBeMapped = WebAclOverrideActionArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.overrideAction = mapped
    }

    /**
     * @param value If you define more than one `Rule` in a `WebACL` , AWS WAF evaluates each request against the `Rules` in order based on the value of `Priority` . AWS WAF processes rules with lower priority first. The priorities don't need to be consecutive, but they must all be different.
     */
    @JvmName("kuhlqfctqvacxcqj")
    public suspend fun priority(`value`: Int) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.priority = mapped
    }

    /**
     * @param value Collection of Rule Labels.
     */
    @JvmName("nbcoycnpvxasnjuc")
    public suspend fun ruleLabels(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ruleLabels = mapped
    }

    /**
     * @param argument Collection of Rule Labels.
     */
    @JvmName("hcpyqbsqvbfrqxpk")
    public suspend fun ruleLabels(argument: List Unit>) {
        val toBeMapped = argument.toList().map { WebAclLabelArgsBuilder().applySuspend { it() }.build() }
        val mapped = of(toBeMapped)
        this.ruleLabels = mapped
    }

    /**
     * @param argument Collection of Rule Labels.
     */
    @JvmName("iwyfqrusoidwnehi")
    public suspend fun ruleLabels(vararg argument: suspend WebAclLabelArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map { WebAclLabelArgsBuilder().applySuspend { it() }.build() }
        val mapped = of(toBeMapped)
        this.ruleLabels = mapped
    }

    /**
     * @param argument Collection of Rule Labels.
     */
    @JvmName("jjllppptanwylwth")
    public suspend fun ruleLabels(argument: suspend WebAclLabelArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(WebAclLabelArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.ruleLabels = mapped
    }

    /**
     * @param values Collection of Rule Labels.
     */
    @JvmName("elkfqwqwvgjxbepj")
    public suspend fun ruleLabels(vararg values: WebAclLabelArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.ruleLabels = mapped
    }

    /**
     * @param value The AWS WAF processing statement for the rule, for example `ByteMatchStatement` or `SizeConstraintStatement` .
     */
    @JvmName("mboxnmigrgaxbsnj")
    public suspend fun statement(`value`: WebAclStatementArgs) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.statement = mapped
    }

    /**
     * @param argument The AWS WAF processing statement for the rule, for example `ByteMatchStatement` or `SizeConstraintStatement` .
     */
    @JvmName("hqnongxxbrweqlas")
    public suspend fun statement(argument: suspend WebAclStatementArgsBuilder.() -> Unit) {
        val toBeMapped = WebAclStatementArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.statement = mapped
    }

    /**
     * @param value Defines and enables Amazon CloudWatch metrics and web request sample collection.
     * If you change the name of a `Rule` after you create it and you want the rule's metric name to reflect the change, update the metric name as well. AWS WAF doesn't automatically update the metric name.
     */
    @JvmName("qhdnlucfgipwvkpc")
    public suspend fun visibilityConfig(`value`: WebAclVisibilityConfigArgs) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.visibilityConfig = mapped
    }

    /**
     * @param argument Defines and enables Amazon CloudWatch metrics and web request sample collection.
     * If you change the name of a `Rule` after you create it and you want the rule's metric name to reflect the change, update the metric name as well. AWS WAF doesn't automatically update the metric name.
     */
    @JvmName("sdxjlwqfehrihqcr")
    public suspend fun visibilityConfig(argument: suspend WebAclVisibilityConfigArgsBuilder.() -> Unit) {
        val toBeMapped = WebAclVisibilityConfigArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.visibilityConfig = mapped
    }

    internal fun build(): WebAclRuleArgs = WebAclRuleArgs(
        action = action,
        captchaConfig = captchaConfig,
        challengeConfig = challengeConfig,
        name = name ?: throw PulumiNullFieldException("name"),
        overrideAction = overrideAction,
        priority = priority ?: throw PulumiNullFieldException("priority"),
        ruleLabels = ruleLabels,
        statement = statement ?: throw PulumiNullFieldException("statement"),
        visibilityConfig = visibilityConfig ?: throw PulumiNullFieldException("visibilityConfig"),
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy