WafRuleArgs

data class WafRuleArgs(val action: Output<String>? = null, val ccStatus: Output<String>? = null, val cnRegionList: Output<String>? = null, val conditions: Output<List<WafRuleConditionArgs>>? = null, val effect: Output<String>? = null, val otherRegionList: Output<String>? = null, val policyId: Output<String>? = null, val rateLimit: Output<WafRuleRateLimitArgs>? = null, val regularRules: Output<List<String>>? = null, val regularTypes: Output<List<String>>? = null, val remoteAddrs: Output<List<String>>? = null, val ruleName: Output<String>? = null, val scenes: Output<List<String>>? = null, val status: Output<String>? = null, val wafGroupIds: Output<String>? = null) : ConvertibleToJava<WafRuleArgs>

Provides a Dcdn Waf Rule resource. For information about Dcdn Waf Rule and how to use it, see What is Waf Rule.

NOTE: Available since v1.201.0.

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.dcdn.WafPolicy;
import com.pulumi.alicloud.dcdn.WafPolicyArgs;
import com.pulumi.alicloud.dcdn.WafRule;
import com.pulumi.alicloud.dcdn.WafRuleArgs;
import com.pulumi.alicloud.dcdn.inputs.WafRuleConditionArgs;
import com.pulumi.alicloud.dcdn.inputs.WafRuleRateLimitArgs;
import com.pulumi.alicloud.dcdn.inputs.WafRuleRateLimitStatusArgs;
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) {
final var config = ctx.config();
final var name = config.get("name").orElse("tf_example");
var exampleWafPolicy = new WafPolicy("exampleWafPolicy", WafPolicyArgs.builder()
.defenseScene("waf_group")
.policyName(name)
.policyType("custom")
.status("on")
.build());
var exampleWafRule = new WafRule("exampleWafRule", WafRuleArgs.builder()
.policyId(exampleWafPolicy.id())
.ruleName(name)
.conditions(
WafRuleConditionArgs.builder()
.key("URI")
.opValue("ne")
.values("/login.php")
.build(),
WafRuleConditionArgs.builder()
.key("Header")
.subKey("a")
.opValue("eq")
.values("b")
.build())
.status("on")
.ccStatus("on")
.action("monitor")
.effect("rule")
.rateLimit(WafRuleRateLimitArgs.builder()
.target("IP")
.interval("5")
.threshold("5")
.ttl("1800")
.status(WafRuleRateLimitStatusArgs.builder()
.code("200")
.ratio("60")
.build())
.build())
.build());
}
}

Import

Dcdn Waf Rule can be imported using the id, e.g.

$ pulumi import alicloud:dcdn/wafRule:WafRule example <id>

Constructors

Link copied to clipboard
fun WafRuleArgs(action: Output<String>? = null, ccStatus: Output<String>? = null, cnRegionList: Output<String>? = null, conditions: Output<List<WafRuleConditionArgs>>? = null, effect: Output<String>? = null, otherRegionList: Output<String>? = null, policyId: Output<String>? = null, rateLimit: Output<WafRuleRateLimitArgs>? = null, regularRules: Output<List<String>>? = null, regularTypes: Output<List<String>>? = null, remoteAddrs: Output<List<String>>? = null, ruleName: Output<String>? = null, scenes: Output<List<String>>? = null, status: Output<String>? = null, wafGroupIds: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): WafRuleArgs

Properties

Link copied to clipboard
val action: Output<String>? = null

Specifies the action of the rule. Valid values: block, monitor, js.

Link copied to clipboard
val ccStatus: Output<String>? = null

Specifies whether to enable rate limiting. Valid values: on and off. NOTE: This parameter is required when policy is of type custom_acl.

Link copied to clipboard
val cnRegionList: Output<String>? = null

The blocked regions in the Chinese mainland, separated by commas (,).

Link copied to clipboard
val conditions: Output<List<WafRuleConditionArgs>>? = null

Conditions that trigger the rule. See conditions below. NOTE: This parameter is required when policy is of type custom_acl or whitelist.

Link copied to clipboard
val effect: Output<String>? = null

The effective scope of the rate limiting blacklist. If you set ccStatus to on, you must configure this parameter. Valid values: rule (takes effect for the current rule) and service (takes effect globally).

Link copied to clipboard
val otherRegionList: Output<String>? = null

Blocked regions outside the Chinese mainland, separated by commas (,).

Link copied to clipboard
val policyId: Output<String>? = null

The protection policy ID.

Link copied to clipboard
val rateLimit: Output<WafRuleRateLimitArgs>? = null

The rules of rate limiting. If you set cc_status to on, you must configure this parameter. See rate_limit below.

Link copied to clipboard
val regularRules: Output<List<String>>? = null

The regular expression.e, when waf_group appears in tags, this value can be filled in, and only one list of six digits in string format can appear with regultypes.

Link copied to clipboard
val regularTypes: Output<List<String>>? = null

Regular rule type, when waf_group appears in tags, this value can be filled in, optional values:"sqli", "xss", "code_exec", "crlf", "lfileii", "rfileii", "webshell", "vvip", "other"

Link copied to clipboard
val remoteAddrs: Output<List<String>>? = null

Filter by IP address.

Link copied to clipboard
val ruleName: Output<String>? = null

The name of the protection rule. The name can be up to 64 characters in length and can contain letters, digits, and underscores (_). NOTE: This parameter cannot be modified when policy is of type region_block.

Link copied to clipboard
val scenes: Output<List<String>>? = null

The types of the protection policies.

Link copied to clipboard
val status: Output<String>? = null

The status of the waf rule. Valid values: on and off. Default value: on.

Link copied to clipboard
val wafGroupIds: Output<String>? = null

The id of the waf rule group. The default value is "1012". Multiple rules are separated by commas.