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

com.pulumi.awsnative.wafv2.kotlin.inputs.RuleGroupRateBasedStatementArgs.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.24.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

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

import com.pulumi.awsnative.wafv2.inputs.RuleGroupRateBasedStatementArgs.builder
import com.pulumi.awsnative.wafv2.kotlin.enums.RuleGroupRateBasedStatementAggregateKeyType
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.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 *
 * @property aggregateKeyType Setting that indicates how to aggregate the request counts.
 * > Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based rule evaluation and handling.
 * - `CONSTANT` - Count and limit the requests that match the rate-based rule's scope-down statement. With this option, the counted requests aren't further aggregated. The scope-down statement is the only specification used. When the count of all requests that satisfy the scope-down statement goes over the limit, AWS WAF applies the rule action to all requests that satisfy the scope-down statement.
 * With this option, you must configure the `ScopeDownStatement` property.
 * - `CUSTOM_KEYS` - Aggregate the request counts using one or more web request components as the aggregate keys.
 * With this option, you must specify the aggregate keys in the `CustomKeys` property.
 * To aggregate on only the IP address or only the forwarded IP address, don't use custom keys. Instead, set the aggregate key type to `IP` or `FORWARDED_IP` .
 * - `FORWARDED_IP` - Aggregate the request counts on the first IP address in an HTTP header.
 * With this option, you must specify the header to use in the `ForwardedIPConfig` property.
 * To aggregate on a combination of the forwarded IP address with other aggregate keys, use `CUSTOM_KEYS` .
 * - `IP` - Aggregate the request counts on the IP address from the web request origin.
 * To aggregate on a combination of the IP address with other aggregate keys, use `CUSTOM_KEYS` .
 * @property customKeys Specifies the aggregate keys to use in a rate-base rule.
 * @property evaluationWindowSec The amount of time, in seconds, that AWS WAF should include in its request counts, looking back from the current time. For example, for a setting of 120, when AWS WAF checks the rate, it counts the requests for the 2 minutes immediately preceding the current time. Valid settings are 60, 120, 300, and 600.
 * This setting doesn't determine how often AWS WAF checks the rate, but how far back it looks each time it checks. AWS WAF checks the rate about every 10 seconds.
 * Default: `300` (5 minutes)
 * @property forwardedIpConfig The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name.
 * > If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.
 * This is required if you specify a forwarded IP in the rule's aggregate key settings.
 * @property limit The limit on requests per 5-minute period for a single aggregation instance for the rate-based rule. If the rate-based statement includes a `ScopeDownStatement` , this limit is applied only to the requests that match the statement.
 * Examples:
 * - If you aggregate on just the IP address, this is the limit on requests from any single IP address.
 * - If you aggregate on the HTTP method and the query argument name "city", then this is the limit on requests for any single method, city pair.
 * @property scopeDownStatement An optional nested statement that narrows the scope of the web requests that are evaluated and managed by the rate-based statement. When you use a scope-down statement, the rate-based rule only tracks and rate limits requests that match the scope-down statement. You can use any nestable `Statement` in the scope-down statement, and you can nest statements at any level, the same as you can for a rule statement.
 */
public data class RuleGroupRateBasedStatementArgs(
    public val aggregateKeyType: Output,
    public val customKeys: Output>? = null,
    public val evaluationWindowSec: Output? = null,
    public val forwardedIpConfig: Output? = null,
    public val limit: Output,
    public val scopeDownStatement: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.awsnative.wafv2.inputs.RuleGroupRateBasedStatementArgs =
        com.pulumi.awsnative.wafv2.inputs.RuleGroupRateBasedStatementArgs.builder()
            .aggregateKeyType(aggregateKeyType.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .customKeys(
                customKeys?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .evaluationWindowSec(evaluationWindowSec?.applyValue({ args0 -> args0 }))
            .forwardedIpConfig(forwardedIpConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .limit(limit.applyValue({ args0 -> args0 }))
            .scopeDownStatement(
                scopeDownStatement?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            ).build()
}

/**
 * Builder for [RuleGroupRateBasedStatementArgs].
 */
@PulumiTagMarker
public class RuleGroupRateBasedStatementArgsBuilder internal constructor() {
    private var aggregateKeyType: Output? = null

    private var customKeys: Output>? = null

    private var evaluationWindowSec: Output? = null

    private var forwardedIpConfig: Output? = null

    private var limit: Output? = null

    private var scopeDownStatement: Output? = null

    /**
     * @param value Setting that indicates how to aggregate the request counts.
     * > Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based rule evaluation and handling.
     * - `CONSTANT` - Count and limit the requests that match the rate-based rule's scope-down statement. With this option, the counted requests aren't further aggregated. The scope-down statement is the only specification used. When the count of all requests that satisfy the scope-down statement goes over the limit, AWS WAF applies the rule action to all requests that satisfy the scope-down statement.
     * With this option, you must configure the `ScopeDownStatement` property.
     * - `CUSTOM_KEYS` - Aggregate the request counts using one or more web request components as the aggregate keys.
     * With this option, you must specify the aggregate keys in the `CustomKeys` property.
     * To aggregate on only the IP address or only the forwarded IP address, don't use custom keys. Instead, set the aggregate key type to `IP` or `FORWARDED_IP` .
     * - `FORWARDED_IP` - Aggregate the request counts on the first IP address in an HTTP header.
     * With this option, you must specify the header to use in the `ForwardedIPConfig` property.
     * To aggregate on a combination of the forwarded IP address with other aggregate keys, use `CUSTOM_KEYS` .
     * - `IP` - Aggregate the request counts on the IP address from the web request origin.
     * To aggregate on a combination of the IP address with other aggregate keys, use `CUSTOM_KEYS` .
     */
    @JvmName("miwbolyahsllqdlu")
    public suspend fun aggregateKeyType(`value`: Output) {
        this.aggregateKeyType = value
    }

    /**
     * @param value Specifies the aggregate keys to use in a rate-base rule.
     */
    @JvmName("hmmaywpbojlxebym")
    public suspend fun customKeys(`value`: Output>) {
        this.customKeys = value
    }

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

    /**
     * @param values Specifies the aggregate keys to use in a rate-base rule.
     */
    @JvmName("hoxuvcokbjbrowmt")
    public suspend fun customKeys(values: List>) {
        this.customKeys = Output.all(values)
    }

    /**
     * @param value The amount of time, in seconds, that AWS WAF should include in its request counts, looking back from the current time. For example, for a setting of 120, when AWS WAF checks the rate, it counts the requests for the 2 minutes immediately preceding the current time. Valid settings are 60, 120, 300, and 600.
     * This setting doesn't determine how often AWS WAF checks the rate, but how far back it looks each time it checks. AWS WAF checks the rate about every 10 seconds.
     * Default: `300` (5 minutes)
     */
    @JvmName("ifvsnyxasxsojrlt")
    public suspend fun evaluationWindowSec(`value`: Output) {
        this.evaluationWindowSec = value
    }

    /**
     * @param value The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name.
     * > If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.
     * This is required if you specify a forwarded IP in the rule's aggregate key settings.
     */
    @JvmName("mcixfbpjbuwkirsc")
    public suspend fun forwardedIpConfig(`value`: Output) {
        this.forwardedIpConfig = value
    }

    /**
     * @param value The limit on requests per 5-minute period for a single aggregation instance for the rate-based rule. If the rate-based statement includes a `ScopeDownStatement` , this limit is applied only to the requests that match the statement.
     * Examples:
     * - If you aggregate on just the IP address, this is the limit on requests from any single IP address.
     * - If you aggregate on the HTTP method and the query argument name "city", then this is the limit on requests for any single method, city pair.
     */
    @JvmName("nkyjeeddeagcixmr")
    public suspend fun limit(`value`: Output) {
        this.limit = value
    }

    /**
     * @param value An optional nested statement that narrows the scope of the web requests that are evaluated and managed by the rate-based statement. When you use a scope-down statement, the rate-based rule only tracks and rate limits requests that match the scope-down statement. You can use any nestable `Statement` in the scope-down statement, and you can nest statements at any level, the same as you can for a rule statement.
     */
    @JvmName("kgrihpftaodbsuut")
    public suspend fun scopeDownStatement(`value`: Output) {
        this.scopeDownStatement = value
    }

    /**
     * @param value Setting that indicates how to aggregate the request counts.
     * > Web requests that are missing any of the components specified in the aggregation keys are omitted from the rate-based rule evaluation and handling.
     * - `CONSTANT` - Count and limit the requests that match the rate-based rule's scope-down statement. With this option, the counted requests aren't further aggregated. The scope-down statement is the only specification used. When the count of all requests that satisfy the scope-down statement goes over the limit, AWS WAF applies the rule action to all requests that satisfy the scope-down statement.
     * With this option, you must configure the `ScopeDownStatement` property.
     * - `CUSTOM_KEYS` - Aggregate the request counts using one or more web request components as the aggregate keys.
     * With this option, you must specify the aggregate keys in the `CustomKeys` property.
     * To aggregate on only the IP address or only the forwarded IP address, don't use custom keys. Instead, set the aggregate key type to `IP` or `FORWARDED_IP` .
     * - `FORWARDED_IP` - Aggregate the request counts on the first IP address in an HTTP header.
     * With this option, you must specify the header to use in the `ForwardedIPConfig` property.
     * To aggregate on a combination of the forwarded IP address with other aggregate keys, use `CUSTOM_KEYS` .
     * - `IP` - Aggregate the request counts on the IP address from the web request origin.
     * To aggregate on a combination of the IP address with other aggregate keys, use `CUSTOM_KEYS` .
     */
    @JvmName("usknumxnddjxiwcu")
    public suspend fun aggregateKeyType(`value`: RuleGroupRateBasedStatementAggregateKeyType) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.aggregateKeyType = mapped
    }

    /**
     * @param value Specifies the aggregate keys to use in a rate-base rule.
     */
    @JvmName("srsrqbybrevncaox")
    public suspend fun customKeys(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.customKeys = mapped
    }

    /**
     * @param argument Specifies the aggregate keys to use in a rate-base rule.
     */
    @JvmName("rnqgykvpnyihwsvs")
    public suspend fun customKeys(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            RuleGroupRateBasedStatementCustomKeyArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.customKeys = mapped
    }

    /**
     * @param argument Specifies the aggregate keys to use in a rate-base rule.
     */
    @JvmName("tmdlfvajvpoowgim")
    public suspend fun customKeys(vararg argument: suspend RuleGroupRateBasedStatementCustomKeyArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            RuleGroupRateBasedStatementCustomKeyArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.customKeys = mapped
    }

    /**
     * @param argument Specifies the aggregate keys to use in a rate-base rule.
     */
    @JvmName("cgcjwbqibqganbiq")
    public suspend fun customKeys(argument: suspend RuleGroupRateBasedStatementCustomKeyArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            RuleGroupRateBasedStatementCustomKeyArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.customKeys = mapped
    }

    /**
     * @param values Specifies the aggregate keys to use in a rate-base rule.
     */
    @JvmName("vvakvghitknlajsx")
    public suspend fun customKeys(vararg values: RuleGroupRateBasedStatementCustomKeyArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.customKeys = mapped
    }

    /**
     * @param value The amount of time, in seconds, that AWS WAF should include in its request counts, looking back from the current time. For example, for a setting of 120, when AWS WAF checks the rate, it counts the requests for the 2 minutes immediately preceding the current time. Valid settings are 60, 120, 300, and 600.
     * This setting doesn't determine how often AWS WAF checks the rate, but how far back it looks each time it checks. AWS WAF checks the rate about every 10 seconds.
     * Default: `300` (5 minutes)
     */
    @JvmName("mncphxogkeswsptn")
    public suspend fun evaluationWindowSec(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.evaluationWindowSec = mapped
    }

    /**
     * @param value The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name.
     * > If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.
     * This is required if you specify a forwarded IP in the rule's aggregate key settings.
     */
    @JvmName("cnhxpvoahtirqepq")
    public suspend fun forwardedIpConfig(`value`: RuleGroupForwardedIpConfigurationArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.forwardedIpConfig = mapped
    }

    /**
     * @param argument The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name.
     * > If the specified header isn't present in the request, AWS WAF doesn't apply the rule to the web request at all.
     * This is required if you specify a forwarded IP in the rule's aggregate key settings.
     */
    @JvmName("ugoldchvkdtfxfgu")
    public suspend fun forwardedIpConfig(argument: suspend RuleGroupForwardedIpConfigurationArgsBuilder.() -> Unit) {
        val toBeMapped = RuleGroupForwardedIpConfigurationArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.forwardedIpConfig = mapped
    }

    /**
     * @param value The limit on requests per 5-minute period for a single aggregation instance for the rate-based rule. If the rate-based statement includes a `ScopeDownStatement` , this limit is applied only to the requests that match the statement.
     * Examples:
     * - If you aggregate on just the IP address, this is the limit on requests from any single IP address.
     * - If you aggregate on the HTTP method and the query argument name "city", then this is the limit on requests for any single method, city pair.
     */
    @JvmName("jdvqeilyoljnlpse")
    public suspend fun limit(`value`: Int) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.limit = mapped
    }

    /**
     * @param value An optional nested statement that narrows the scope of the web requests that are evaluated and managed by the rate-based statement. When you use a scope-down statement, the rate-based rule only tracks and rate limits requests that match the scope-down statement. You can use any nestable `Statement` in the scope-down statement, and you can nest statements at any level, the same as you can for a rule statement.
     */
    @JvmName("cctuxglcinvoxkvx")
    public suspend fun scopeDownStatement(`value`: RuleGroupStatementArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scopeDownStatement = mapped
    }

    /**
     * @param argument An optional nested statement that narrows the scope of the web requests that are evaluated and managed by the rate-based statement. When you use a scope-down statement, the rate-based rule only tracks and rate limits requests that match the scope-down statement. You can use any nestable `Statement` in the scope-down statement, and you can nest statements at any level, the same as you can for a rule statement.
     */
    @JvmName("qubobmwkpxbteysl")
    public suspend fun scopeDownStatement(argument: suspend RuleGroupStatementArgsBuilder.() -> Unit) {
        val toBeMapped = RuleGroupStatementArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.scopeDownStatement = mapped
    }

    internal fun build(): RuleGroupRateBasedStatementArgs = RuleGroupRateBasedStatementArgs(
        aggregateKeyType = aggregateKeyType ?: throw PulumiNullFieldException("aggregateKeyType"),
        customKeys = customKeys,
        evaluationWindowSec = evaluationWindowSec,
        forwardedIpConfig = forwardedIpConfig,
        limit = limit ?: throw PulumiNullFieldException("limit"),
        scopeDownStatement = scopeDownStatement,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy