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

com.pulumi.cloudflare.kotlin.FirewallRuleArgs.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: 5.40.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.FirewallRuleArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Define Firewall rules using filter expressions for more control over
 * how traffic is matched to the rule. A filter expression permits
 * selecting traffic by multiple criteria allowing greater freedom in
 * rule creation.
 * Filter expressions needs to be created first before using Firewall
 * Rule.
 * > `cloudflare.FirewallRule` is in a deprecation phase until January 15th, 2025.
 *   During this time period, this resource is still
 *   fully supported but you are strongly advised  to move to the
 *   `cloudflare.Ruleset` resource. Full details can be found in the
 *   developer documentation.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const wordpress = new cloudflare.Filter("wordpress", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     description: "Wordpress break-in attempts that are outside of the office",
 *     expression: "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1",
 * });
 * const wordpressFirewallRule = new cloudflare.FirewallRule("wordpress", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     description: "Block wordpress break-in attempts",
 *     filterId: wordpress.id,
 *     action: "block",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * wordpress = cloudflare.Filter("wordpress",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     description="Wordpress break-in attempts that are outside of the office",
 *     expression="(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1")
 * wordpress_firewall_rule = cloudflare.FirewallRule("wordpress",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     description="Block wordpress break-in attempts",
 *     filter_id=wordpress.id,
 *     action="block")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var wordpress = new Cloudflare.Filter("wordpress", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Description = "Wordpress break-in attempts that are outside of the office",
 *         Expression = "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1",
 *     });
 *     var wordpressFirewallRule = new Cloudflare.FirewallRule("wordpress", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Description = "Block wordpress break-in attempts",
 *         FilterId = wordpress.Id,
 *         Action = "block",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		wordpress, err := cloudflare.NewFilter(ctx, "wordpress", &cloudflare.FilterArgs{
 * 			ZoneId:      pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Description: pulumi.String("Wordpress break-in attempts that are outside of the office"),
 * 			Expression:  pulumi.String("(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cloudflare.NewFirewallRule(ctx, "wordpress", &cloudflare.FirewallRuleArgs{
 * 			ZoneId:      pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Description: pulumi.String("Block wordpress break-in attempts"),
 * 			FilterId:    wordpress.ID(),
 * 			Action:      pulumi.String("block"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.cloudflare.Filter;
 * import com.pulumi.cloudflare.FilterArgs;
 * import com.pulumi.cloudflare.FirewallRule;
 * import com.pulumi.cloudflare.FirewallRuleArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var wordpress = new Filter("wordpress", FilterArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .description("Wordpress break-in attempts that are outside of the office")
 *             .expression("(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1")
 *             .build());
 *         var wordpressFirewallRule = new FirewallRule("wordpressFirewallRule", FirewallRuleArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .description("Block wordpress break-in attempts")
 *             .filterId(wordpress.id())
 *             .action("block")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   wordpress:
 *     type: cloudflare:Filter
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       description: Wordpress break-in attempts that are outside of the office
 *       expression: (http.request.uri.path ~ ".*wp-login.php" or http.request.uri.path ~ ".*xmlrpc.php") and ip.src ne 192.0.2.1
 *   wordpressFirewallRule:
 *     type: cloudflare:FirewallRule
 *     name: wordpress
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       description: Block wordpress break-in attempts
 *       filterId: ${wordpress.id}
 *       action: block
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/firewallRule:FirewallRule example /
 * ```
 * @property action The action to apply to a matched request. Available values: `block`, `challenge`, `allow`, `js_challenge`, `managed_challenge`, `log`, `bypass`.
 * @property description A description of the rule to help identify it.
 * @property filterId The identifier of the Filter to use for determining if the Firewall Rule should be triggered.
 * @property paused Whether this filter based firewall rule is currently paused.
 * @property priority The priority of the rule to allow control of processing order. A lower number indicates high priority. If not provided, any rules with a priority will be sequenced before those without.
 * @property products List of products to bypass for a request when the bypass action is used. Available values: `zoneLockdown`, `uaBlock`, `bic`, `hot`, `securityLevel`, `rateLimit`, `waf`.
 * @property zoneId The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
 */
public data class FirewallRuleArgs(
    public val action: Output? = null,
    public val description: Output? = null,
    public val filterId: Output? = null,
    public val paused: Output? = null,
    public val priority: Output? = null,
    public val products: Output>? = null,
    public val zoneId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.cloudflare.FirewallRuleArgs =
        com.pulumi.cloudflare.FirewallRuleArgs.builder()
            .action(action?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .filterId(filterId?.applyValue({ args0 -> args0 }))
            .paused(paused?.applyValue({ args0 -> args0 }))
            .priority(priority?.applyValue({ args0 -> args0 }))
            .products(products?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .zoneId(zoneId?.applyValue({ args0 -> args0 })).build()
}

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

    private var description: Output? = null

    private var filterId: Output? = null

    private var paused: Output? = null

    private var priority: Output? = null

    private var products: Output>? = null

    private var zoneId: Output? = null

    /**
     * @param value The action to apply to a matched request. Available values: `block`, `challenge`, `allow`, `js_challenge`, `managed_challenge`, `log`, `bypass`.
     */
    @JvmName("hhppumobycayabta")
    public suspend fun action(`value`: Output) {
        this.action = value
    }

    /**
     * @param value A description of the rule to help identify it.
     */
    @JvmName("ccpmbxyowbsptpkx")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value The identifier of the Filter to use for determining if the Firewall Rule should be triggered.
     */
    @JvmName("jycgsyvmlljkskjs")
    public suspend fun filterId(`value`: Output) {
        this.filterId = value
    }

    /**
     * @param value Whether this filter based firewall rule is currently paused.
     */
    @JvmName("vlsuagtiupomvcmf")
    public suspend fun paused(`value`: Output) {
        this.paused = value
    }

    /**
     * @param value The priority of the rule to allow control of processing order. A lower number indicates high priority. If not provided, any rules with a priority will be sequenced before those without.
     */
    @JvmName("qlkgpuwvbkrkyxds")
    public suspend fun priority(`value`: Output) {
        this.priority = value
    }

    /**
     * @param value List of products to bypass for a request when the bypass action is used. Available values: `zoneLockdown`, `uaBlock`, `bic`, `hot`, `securityLevel`, `rateLimit`, `waf`.
     */
    @JvmName("hecgiwvowfcrewjt")
    public suspend fun products(`value`: Output>) {
        this.products = value
    }

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

    /**
     * @param values List of products to bypass for a request when the bypass action is used. Available values: `zoneLockdown`, `uaBlock`, `bic`, `hot`, `securityLevel`, `rateLimit`, `waf`.
     */
    @JvmName("pujgsxrlbsmcglxs")
    public suspend fun products(values: List>) {
        this.products = Output.all(values)
    }

    /**
     * @param value The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("gaxwblobxowlnfsg")
    public suspend fun zoneId(`value`: Output) {
        this.zoneId = value
    }

    /**
     * @param value The action to apply to a matched request. Available values: `block`, `challenge`, `allow`, `js_challenge`, `managed_challenge`, `log`, `bypass`.
     */
    @JvmName("almoaqtfngehxwlp")
    public suspend fun action(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.action = mapped
    }

    /**
     * @param value A description of the rule to help identify it.
     */
    @JvmName("mdhobgtsucrhecmx")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value The identifier of the Filter to use for determining if the Firewall Rule should be triggered.
     */
    @JvmName("wevwwnwmbyuucsnr")
    public suspend fun filterId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.filterId = mapped
    }

    /**
     * @param value Whether this filter based firewall rule is currently paused.
     */
    @JvmName("iafuogygpupecbwr")
    public suspend fun paused(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.paused = mapped
    }

    /**
     * @param value The priority of the rule to allow control of processing order. A lower number indicates high priority. If not provided, any rules with a priority will be sequenced before those without.
     */
    @JvmName("bivekygwwqkjakuq")
    public suspend fun priority(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.priority = mapped
    }

    /**
     * @param value List of products to bypass for a request when the bypass action is used. Available values: `zoneLockdown`, `uaBlock`, `bic`, `hot`, `securityLevel`, `rateLimit`, `waf`.
     */
    @JvmName("gmurawfvxdcjixul")
    public suspend fun products(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.products = mapped
    }

    /**
     * @param values List of products to bypass for a request when the bypass action is used. Available values: `zoneLockdown`, `uaBlock`, `bic`, `hot`, `securityLevel`, `rateLimit`, `waf`.
     */
    @JvmName("hokuqdvmqydlxtxt")
    public suspend fun products(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.products = mapped
    }

    /**
     * @param value The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("dgikarrxhvausefs")
    public suspend fun zoneId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.zoneId = mapped
    }

    internal fun build(): FirewallRuleArgs = FirewallRuleArgs(
        action = action,
        description = description,
        filterId = filterId,
        paused = paused,
        priority = priority,
        products = products,
        zoneId = zoneId,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy