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

com.pulumi.azure.waf.kotlin.inputs.PolicyCustomRuleArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.waf.kotlin.inputs

import com.pulumi.azure.waf.inputs.PolicyCustomRuleArgs.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.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 *
 * @property action Type of action. Possible values are `Allow`, `Block` and `Log`.
 * @property enabled Describes if the policy is in enabled state or disabled state. Defaults to `true`.
 * @property groupRateLimitBy Specifies what grouping the rate limit will count requests by. Possible values are `GeoLocation`, `ClientAddr` and `None`.
 * @property matchConditions One or more `match_conditions` blocks as defined below.
 * @property name Gets name of the resource that is unique within a policy. This name can be used to access the resource.
 * @property priority Describes priority of the rule. Rules with a lower value will be evaluated before rules with a higher value.
 * @property rateLimitDuration Specifies the duration at which the rate limit policy will be applied. Should be used with `RateLimitRule` rule type. Possible values are `FiveMins` and `OneMin`.
 * @property rateLimitThreshold Specifies the threshold value for the rate limit policy. Must be greater than or equal to 1 if provided.
 * @property ruleType Describes the type of rule. Possible values are `MatchRule`, `RateLimitRule` and `Invalid`.
 */
public data class PolicyCustomRuleArgs(
    public val action: Output,
    public val enabled: Output? = null,
    public val groupRateLimitBy: Output? = null,
    public val matchConditions: Output>,
    public val name: Output? = null,
    public val priority: Output,
    public val rateLimitDuration: Output? = null,
    public val rateLimitThreshold: Output? = null,
    public val ruleType: Output,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.waf.inputs.PolicyCustomRuleArgs =
        com.pulumi.azure.waf.inputs.PolicyCustomRuleArgs.builder()
            .action(action.applyValue({ args0 -> args0 }))
            .enabled(enabled?.applyValue({ args0 -> args0 }))
            .groupRateLimitBy(groupRateLimitBy?.applyValue({ args0 -> args0 }))
            .matchConditions(
                matchConditions.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .name(name?.applyValue({ args0 -> args0 }))
            .priority(priority.applyValue({ args0 -> args0 }))
            .rateLimitDuration(rateLimitDuration?.applyValue({ args0 -> args0 }))
            .rateLimitThreshold(rateLimitThreshold?.applyValue({ args0 -> args0 }))
            .ruleType(ruleType.applyValue({ args0 -> args0 })).build()
}

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

    private var enabled: Output? = null

    private var groupRateLimitBy: Output? = null

    private var matchConditions: Output>? = null

    private var name: Output? = null

    private var priority: Output? = null

    private var rateLimitDuration: Output? = null

    private var rateLimitThreshold: Output? = null

    private var ruleType: Output? = null

    /**
     * @param value Type of action. Possible values are `Allow`, `Block` and `Log`.
     */
    @JvmName("jutklqlcpmxgdfwj")
    public suspend fun action(`value`: Output) {
        this.action = value
    }

    /**
     * @param value Describes if the policy is in enabled state or disabled state. Defaults to `true`.
     */
    @JvmName("fanbwiiifdtjwqrf")
    public suspend fun enabled(`value`: Output) {
        this.enabled = value
    }

    /**
     * @param value Specifies what grouping the rate limit will count requests by. Possible values are `GeoLocation`, `ClientAddr` and `None`.
     */
    @JvmName("jhhhjfyireykxnyn")
    public suspend fun groupRateLimitBy(`value`: Output) {
        this.groupRateLimitBy = value
    }

    /**
     * @param value One or more `match_conditions` blocks as defined below.
     */
    @JvmName("psodduepyhwfweby")
    public suspend fun matchConditions(`value`: Output>) {
        this.matchConditions = value
    }

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

    /**
     * @param values One or more `match_conditions` blocks as defined below.
     */
    @JvmName("badqkjnmliisjadf")
    public suspend fun matchConditions(values: List>) {
        this.matchConditions = Output.all(values)
    }

    /**
     * @param value Gets name of the resource that is unique within a policy. This name can be used to access the resource.
     */
    @JvmName("vgsbnaweokrwfuld")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Describes priority of the rule. Rules with a lower value will be evaluated before rules with a higher value.
     */
    @JvmName("osfkuelwsxdfdqgq")
    public suspend fun priority(`value`: Output) {
        this.priority = value
    }

    /**
     * @param value Specifies the duration at which the rate limit policy will be applied. Should be used with `RateLimitRule` rule type. Possible values are `FiveMins` and `OneMin`.
     */
    @JvmName("wqeymdejscitkdum")
    public suspend fun rateLimitDuration(`value`: Output) {
        this.rateLimitDuration = value
    }

    /**
     * @param value Specifies the threshold value for the rate limit policy. Must be greater than or equal to 1 if provided.
     */
    @JvmName("gltdbljdmpluemfj")
    public suspend fun rateLimitThreshold(`value`: Output) {
        this.rateLimitThreshold = value
    }

    /**
     * @param value Describes the type of rule. Possible values are `MatchRule`, `RateLimitRule` and `Invalid`.
     */
    @JvmName("hqrputjoqulpabwb")
    public suspend fun ruleType(`value`: Output) {
        this.ruleType = value
    }

    /**
     * @param value Type of action. Possible values are `Allow`, `Block` and `Log`.
     */
    @JvmName("drujsrxumbdmyqxk")
    public suspend fun action(`value`: String) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.action = mapped
    }

    /**
     * @param value Describes if the policy is in enabled state or disabled state. Defaults to `true`.
     */
    @JvmName("rgagscvgihvqkqop")
    public suspend fun enabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.enabled = mapped
    }

    /**
     * @param value Specifies what grouping the rate limit will count requests by. Possible values are `GeoLocation`, `ClientAddr` and `None`.
     */
    @JvmName("hxuyusfhcgmgaqio")
    public suspend fun groupRateLimitBy(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.groupRateLimitBy = mapped
    }

    /**
     * @param value One or more `match_conditions` blocks as defined below.
     */
    @JvmName("nqcrkttcoxwxlanb")
    public suspend fun matchConditions(`value`: List) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.matchConditions = mapped
    }

    /**
     * @param argument One or more `match_conditions` blocks as defined below.
     */
    @JvmName("mqrhkryveffbnssj")
    public suspend fun matchConditions(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            PolicyCustomRuleMatchConditionArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.matchConditions = mapped
    }

    /**
     * @param argument One or more `match_conditions` blocks as defined below.
     */
    @JvmName("vjdugohlaoaptukv")
    public suspend fun matchConditions(vararg argument: suspend PolicyCustomRuleMatchConditionArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            PolicyCustomRuleMatchConditionArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.matchConditions = mapped
    }

    /**
     * @param argument One or more `match_conditions` blocks as defined below.
     */
    @JvmName("nsxmjegsqgeixncu")
    public suspend fun matchConditions(argument: suspend PolicyCustomRuleMatchConditionArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            PolicyCustomRuleMatchConditionArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.matchConditions = mapped
    }

    /**
     * @param values One or more `match_conditions` blocks as defined below.
     */
    @JvmName("akedrvascrrdibvl")
    public suspend fun matchConditions(vararg values: PolicyCustomRuleMatchConditionArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.matchConditions = mapped
    }

    /**
     * @param value Gets name of the resource that is unique within a policy. This name can be used to access the resource.
     */
    @JvmName("qgtywjlbmyhawbnd")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Describes priority of the rule. Rules with a lower value will be evaluated before rules with a higher value.
     */
    @JvmName("syccleygablhyqxk")
    public suspend fun priority(`value`: Int) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.priority = mapped
    }

    /**
     * @param value Specifies the duration at which the rate limit policy will be applied. Should be used with `RateLimitRule` rule type. Possible values are `FiveMins` and `OneMin`.
     */
    @JvmName("qqoevqvtndhrkjby")
    public suspend fun rateLimitDuration(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.rateLimitDuration = mapped
    }

    /**
     * @param value Specifies the threshold value for the rate limit policy. Must be greater than or equal to 1 if provided.
     */
    @JvmName("jgpyssxvsdyclvfq")
    public suspend fun rateLimitThreshold(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.rateLimitThreshold = mapped
    }

    /**
     * @param value Describes the type of rule. Possible values are `MatchRule`, `RateLimitRule` and `Invalid`.
     */
    @JvmName("gxwjvtnawdnctvgm")
    public suspend fun ruleType(`value`: String) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.ruleType = mapped
    }

    internal fun build(): PolicyCustomRuleArgs = PolicyCustomRuleArgs(
        action = action ?: throw PulumiNullFieldException("action"),
        enabled = enabled,
        groupRateLimitBy = groupRateLimitBy,
        matchConditions = matchConditions ?: throw PulumiNullFieldException("matchConditions"),
        name = name,
        priority = priority ?: throw PulumiNullFieldException("priority"),
        rateLimitDuration = rateLimitDuration,
        rateLimitThreshold = rateLimitThreshold,
        ruleType = ruleType ?: throw PulumiNullFieldException("ruleType"),
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy