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

com.pulumi.azurenative.cdn.kotlin.inputs.CustomRuleArgs.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: 2.82.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azurenative.cdn.kotlin.inputs

import com.pulumi.azurenative.cdn.inputs.CustomRuleArgs.builder
import com.pulumi.azurenative.cdn.kotlin.enums.ActionType
import com.pulumi.azurenative.cdn.kotlin.enums.CustomRuleEnabledState
import com.pulumi.core.Either
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

/**
 * Defines the common attributes for a custom rule that can be included in a waf policy
 * @property action Describes what action to be applied when rule matches
 * @property enabledState Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified.
 * @property matchConditions List of match conditions.
 * @property name Defines the name of the custom rule
 * @property priority Defines in what order this rule be evaluated in the overall list of custom rules
 */
public data class CustomRuleArgs(
    public val action: Output>,
    public val enabledState: Output>? = null,
    public val matchConditions: Output>,
    public val name: Output,
    public val priority: Output,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azurenative.cdn.inputs.CustomRuleArgs =
        com.pulumi.azurenative.cdn.inputs.CustomRuleArgs.builder()
            .action(
                action.applyValue({ args0 ->
                    args0.transform({ args0 -> args0 }, { args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            )
            .enabledState(
                enabledState?.applyValue({ args0 ->
                    args0.transform({ args0 -> args0 }, { args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            )
            .matchConditions(
                matchConditions.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .name(name.applyValue({ args0 -> args0 }))
            .priority(priority.applyValue({ args0 -> args0 })).build()
}

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

    private var enabledState: Output>? = null

    private var matchConditions: Output>? = null

    private var name: Output? = null

    private var priority: Output? = null

    /**
     * @param value Describes what action to be applied when rule matches
     */
    @JvmName("tvnwbdbmreexwlor")
    public suspend fun action(`value`: Output>) {
        this.action = value
    }

    /**
     * @param value Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified.
     */
    @JvmName("mwqjdwvpmplhtats")
    public suspend fun enabledState(`value`: Output>) {
        this.enabledState = value
    }

    /**
     * @param value List of match conditions.
     */
    @JvmName("fdjynwflfcssdvty")
    public suspend fun matchConditions(`value`: Output>) {
        this.matchConditions = value
    }

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

    /**
     * @param values List of match conditions.
     */
    @JvmName("qidiqsmwyshcxlhq")
    public suspend fun matchConditions(values: List>) {
        this.matchConditions = Output.all(values)
    }

    /**
     * @param value Defines the name of the custom rule
     */
    @JvmName("sdvnwknptlotjqdh")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Defines in what order this rule be evaluated in the overall list of custom rules
     */
    @JvmName("chdhevbuxpptoorp")
    public suspend fun priority(`value`: Output) {
        this.priority = value
    }

    /**
     * @param value Describes what action to be applied when rule matches
     */
    @JvmName("yxbtcvdvimyowtbw")
    public suspend fun action(`value`: Either) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.action = mapped
    }

    /**
     * @param value Describes what action to be applied when rule matches
     */
    @JvmName("idsnujatxmmkobbv")
    public fun action(`value`: String) {
        val toBeMapped = Either.ofLeft(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.action = mapped
    }

    /**
     * @param value Describes what action to be applied when rule matches
     */
    @JvmName("sajvgdfasrbshrls")
    public fun action(`value`: ActionType) {
        val toBeMapped = Either.ofRight(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.action = mapped
    }

    /**
     * @param value Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified.
     */
    @JvmName("xxiapbeuntljygpi")
    public suspend fun enabledState(`value`: Either?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.enabledState = mapped
    }

    /**
     * @param value Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified.
     */
    @JvmName("rkofimjmixwtdlhe")
    public fun enabledState(`value`: String) {
        val toBeMapped = Either.ofLeft(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.enabledState = mapped
    }

    /**
     * @param value Describes if the custom rule is in enabled or disabled state. Defaults to Enabled if not specified.
     */
    @JvmName("uldkblayqnsxulad")
    public fun enabledState(`value`: CustomRuleEnabledState) {
        val toBeMapped = Either.ofRight(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.enabledState = mapped
    }

    /**
     * @param value List of match conditions.
     */
    @JvmName("hrqskfmvhpieofgg")
    public suspend fun matchConditions(`value`: List) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.matchConditions = mapped
    }

    /**
     * @param argument List of match conditions.
     */
    @JvmName("dclehhhagvjyusmf")
    public suspend fun matchConditions(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            MatchConditionArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.matchConditions = mapped
    }

    /**
     * @param argument List of match conditions.
     */
    @JvmName("bencxuxpdydblgrl")
    public suspend fun matchConditions(vararg argument: suspend MatchConditionArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            MatchConditionArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.matchConditions = mapped
    }

    /**
     * @param argument List of match conditions.
     */
    @JvmName("stagsdytnvndnrav")
    public suspend fun matchConditions(argument: suspend MatchConditionArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(MatchConditionArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.matchConditions = mapped
    }

    /**
     * @param values List of match conditions.
     */
    @JvmName("avepndivhmqgoqnf")
    public suspend fun matchConditions(vararg values: MatchConditionArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.matchConditions = mapped
    }

    /**
     * @param value Defines the name of the custom rule
     */
    @JvmName("qrcfqeqltahdbywj")
    public suspend fun name(`value`: String) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Defines in what order this rule be evaluated in the overall list of custom rules
     */
    @JvmName("ifnngkeqkoxxfanj")
    public suspend fun priority(`value`: Int) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.priority = mapped
    }

    internal fun build(): CustomRuleArgs = CustomRuleArgs(
        action = action ?: throw PulumiNullFieldException("action"),
        enabledState = enabledState,
        matchConditions = matchConditions ?: throw PulumiNullFieldException("matchConditions"),
        name = name ?: throw PulumiNullFieldException("name"),
        priority = priority ?: throw PulumiNullFieldException("priority"),
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy