1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. dcdn
  5. WafRule
Alibaba Cloud v3.45.0 published on Monday, Nov 27, 2023 by Pulumi

alicloud.dcdn.WafRule

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.45.0 published on Monday, Nov 27, 2023 by Pulumi

    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

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf_example";
        var exampleWafPolicy = new AliCloud.Dcdn.WafPolicy("exampleWafPolicy", new()
        {
            DefenseScene = "waf_group",
            PolicyName = name,
            PolicyType = "custom",
            Status = "on",
        });
    
        var exampleWafRule = new AliCloud.Dcdn.WafRule("exampleWafRule", new()
        {
            PolicyId = exampleWafPolicy.Id,
            RuleName = name,
            Conditions = new[]
            {
                new AliCloud.Dcdn.Inputs.WafRuleConditionArgs
                {
                    Key = "URI",
                    OpValue = "ne",
                    Values = "/login.php",
                },
                new AliCloud.Dcdn.Inputs.WafRuleConditionArgs
                {
                    Key = "Header",
                    SubKey = "a",
                    OpValue = "eq",
                    Values = "b",
                },
            },
            Status = "on",
            CcStatus = "on",
            Action = "monitor",
            Effect = "rule",
            RateLimit = new AliCloud.Dcdn.Inputs.WafRuleRateLimitArgs
            {
                Target = "IP",
                Interval = 5,
                Threshold = 5,
                Ttl = 1800,
                Status = new AliCloud.Dcdn.Inputs.WafRuleRateLimitStatusArgs
                {
                    Code = "200",
                    Ratio = 60,
                },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dcdn"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf_example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		exampleWafPolicy, err := dcdn.NewWafPolicy(ctx, "exampleWafPolicy", &dcdn.WafPolicyArgs{
    			DefenseScene: pulumi.String("waf_group"),
    			PolicyName:   pulumi.String(name),
    			PolicyType:   pulumi.String("custom"),
    			Status:       pulumi.String("on"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dcdn.NewWafRule(ctx, "exampleWafRule", &dcdn.WafRuleArgs{
    			PolicyId: exampleWafPolicy.ID(),
    			RuleName: pulumi.String(name),
    			Conditions: dcdn.WafRuleConditionArray{
    				&dcdn.WafRuleConditionArgs{
    					Key:     pulumi.String("URI"),
    					OpValue: pulumi.String("ne"),
    					Values:  pulumi.String("/login.php"),
    				},
    				&dcdn.WafRuleConditionArgs{
    					Key:     pulumi.String("Header"),
    					SubKey:  pulumi.String("a"),
    					OpValue: pulumi.String("eq"),
    					Values:  pulumi.String("b"),
    				},
    			},
    			Status:   pulumi.String("on"),
    			CcStatus: pulumi.String("on"),
    			Action:   pulumi.String("monitor"),
    			Effect:   pulumi.String("rule"),
    			RateLimit: &dcdn.WafRuleRateLimitArgs{
    				Target:    pulumi.String("IP"),
    				Interval:  pulumi.Int(5),
    				Threshold: pulumi.Int(5),
    				Ttl:       pulumi.Int(1800),
    				Status: &dcdn.WafRuleRateLimitStatusArgs{
    					Code:  pulumi.String("200"),
    					Ratio: pulumi.Int(60),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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 pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf_example"
    example_waf_policy = alicloud.dcdn.WafPolicy("exampleWafPolicy",
        defense_scene="waf_group",
        policy_name=name,
        policy_type="custom",
        status="on")
    example_waf_rule = alicloud.dcdn.WafRule("exampleWafRule",
        policy_id=example_waf_policy.id,
        rule_name=name,
        conditions=[
            alicloud.dcdn.WafRuleConditionArgs(
                key="URI",
                op_value="ne",
                values="/login.php",
            ),
            alicloud.dcdn.WafRuleConditionArgs(
                key="Header",
                sub_key="a",
                op_value="eq",
                values="b",
            ),
        ],
        status="on",
        cc_status="on",
        action="monitor",
        effect="rule",
        rate_limit=alicloud.dcdn.WafRuleRateLimitArgs(
            target="IP",
            interval=5,
            threshold=5,
            ttl=1800,
            status=alicloud.dcdn.WafRuleRateLimitStatusArgs(
                code="200",
                ratio=60,
            ),
        ))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf_example";
    const exampleWafPolicy = new alicloud.dcdn.WafPolicy("exampleWafPolicy", {
        defenseScene: "waf_group",
        policyName: name,
        policyType: "custom",
        status: "on",
    });
    const exampleWafRule = new alicloud.dcdn.WafRule("exampleWafRule", {
        policyId: exampleWafPolicy.id,
        ruleName: name,
        conditions: [
            {
                key: "URI",
                opValue: "ne",
                values: "/login.php",
            },
            {
                key: "Header",
                subKey: "a",
                opValue: "eq",
                values: "b",
            },
        ],
        status: "on",
        ccStatus: "on",
        action: "monitor",
        effect: "rule",
        rateLimit: {
            target: "IP",
            interval: 5,
            threshold: 5,
            ttl: 1800,
            status: {
                code: "200",
                ratio: 60,
            },
        },
    });
    
    configuration:
      name:
        type: string
        default: tf_example
    resources:
      exampleWafPolicy:
        type: alicloud:dcdn:WafPolicy
        properties:
          defenseScene: waf_group
          policyName: ${name}
          policyType: custom
          status: on
      exampleWafRule:
        type: alicloud:dcdn:WafRule
        properties:
          policyId: ${exampleWafPolicy.id}
          ruleName: ${name}
          conditions:
            - key: URI
              opValue: ne
              values: /login.php
            - key: Header
              subKey: a
              opValue: eq
              values: b
          status: on
          ccStatus: on
          action: monitor
          effect: rule
          rateLimit:
            target: IP
            interval: '5'
            threshold: '5'
            ttl: '1800'
            status:
              code: '200'
              ratio: '60'
    

    Create WafRule Resource

    new WafRule(name: string, args: WafRuleArgs, opts?: CustomResourceOptions);
    @overload
    def WafRule(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                action: Optional[str] = None,
                cc_status: Optional[str] = None,
                cn_region_list: Optional[str] = None,
                conditions: Optional[Sequence[WafRuleConditionArgs]] = None,
                effect: Optional[str] = None,
                other_region_list: Optional[str] = None,
                policy_id: Optional[str] = None,
                rate_limit: Optional[WafRuleRateLimitArgs] = None,
                regular_rules: Optional[Sequence[str]] = None,
                regular_types: Optional[Sequence[str]] = None,
                remote_addrs: Optional[Sequence[str]] = None,
                rule_name: Optional[str] = None,
                scenes: Optional[Sequence[str]] = None,
                status: Optional[str] = None,
                waf_group_ids: Optional[str] = None)
    @overload
    def WafRule(resource_name: str,
                args: WafRuleArgs,
                opts: Optional[ResourceOptions] = None)
    func NewWafRule(ctx *Context, name string, args WafRuleArgs, opts ...ResourceOption) (*WafRule, error)
    public WafRule(string name, WafRuleArgs args, CustomResourceOptions? opts = null)
    public WafRule(String name, WafRuleArgs args)
    public WafRule(String name, WafRuleArgs args, CustomResourceOptions options)
    
    type: alicloud:dcdn:WafRule
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args WafRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args WafRuleArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args WafRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args WafRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args WafRuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    WafRule Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The WafRule resource accepts the following input properties:

    PolicyId string

    The protection policy ID.

    RuleName string

    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.

    Action string

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

    CcStatus string

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

    CnRegionList string

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

    Conditions List<Pulumi.AliCloud.Dcdn.Inputs.WafRuleCondition>

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

    Effect string

    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).

    OtherRegionList string

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

    RateLimit Pulumi.AliCloud.Dcdn.Inputs.WafRuleRateLimit

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

    RegularRules List<string>

    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.

    RegularTypes List<string>

    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"]

    RemoteAddrs List<string>

    Filter by IP address.

    Scenes List<string>

    The types of the protection policies.

    Status string

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

    WafGroupIds string

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

    PolicyId string

    The protection policy ID.

    RuleName string

    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.

    Action string

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

    CcStatus string

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

    CnRegionList string

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

    Conditions []WafRuleConditionArgs

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

    Effect string

    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).

    OtherRegionList string

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

    RateLimit WafRuleRateLimitArgs

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

    RegularRules []string

    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.

    RegularTypes []string

    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"]

    RemoteAddrs []string

    Filter by IP address.

    Scenes []string

    The types of the protection policies.

    Status string

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

    WafGroupIds string

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

    policyId String

    The protection policy ID.

    ruleName String

    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.

    action String

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

    ccStatus String

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

    cnRegionList String

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

    conditions List<WafRuleCondition>

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

    effect String

    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).

    otherRegionList String

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

    rateLimit WafRuleRateLimit

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

    regularRules List<String>

    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.

    regularTypes List<String>

    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"]

    remoteAddrs List<String>

    Filter by IP address.

    scenes List<String>

    The types of the protection policies.

    status String

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

    wafGroupIds String

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

    policyId string

    The protection policy ID.

    ruleName string

    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.

    action string

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

    ccStatus string

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

    cnRegionList string

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

    conditions WafRuleCondition[]

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

    effect string

    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).

    otherRegionList string

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

    rateLimit WafRuleRateLimit

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

    regularRules string[]

    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.

    regularTypes string[]

    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"]

    remoteAddrs string[]

    Filter by IP address.

    scenes string[]

    The types of the protection policies.

    status string

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

    wafGroupIds string

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

    policy_id str

    The protection policy ID.

    rule_name str

    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.

    action str

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

    cc_status str

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

    cn_region_list str

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

    conditions Sequence[WafRuleConditionArgs]

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

    effect str

    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).

    other_region_list str

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

    rate_limit WafRuleRateLimitArgs

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

    regular_rules Sequence[str]

    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.

    regular_types Sequence[str]

    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"]

    remote_addrs Sequence[str]

    Filter by IP address.

    scenes Sequence[str]

    The types of the protection policies.

    status str

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

    waf_group_ids str

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

    policyId String

    The protection policy ID.

    ruleName String

    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.

    action String

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

    ccStatus String

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

    cnRegionList String

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

    conditions List<Property Map>

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

    effect String

    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).

    otherRegionList String

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

    rateLimit Property Map

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

    regularRules List<String>

    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.

    regularTypes List<String>

    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"]

    remoteAddrs List<String>

    Filter by IP address.

    scenes List<String>

    The types of the protection policies.

    status String

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

    wafGroupIds String

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

    Outputs

    All input properties are implicitly available as output properties. Additionally, the WafRule resource produces the following output properties:

    DefenseScene string

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    GmtModified string

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    Id string

    The provider-assigned unique ID for this managed resource.

    DefenseScene string

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    GmtModified string

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    Id string

    The provider-assigned unique ID for this managed resource.

    defenseScene String

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    gmtModified String

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    id String

    The provider-assigned unique ID for this managed resource.

    defenseScene string

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    gmtModified string

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    id string

    The provider-assigned unique ID for this managed resource.

    defense_scene str

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    gmt_modified str

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    id str

    The provider-assigned unique ID for this managed resource.

    defenseScene String

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    gmtModified String

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    id String

    The provider-assigned unique ID for this managed resource.

    Look up Existing WafRule Resource

    Get an existing WafRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: WafRuleState, opts?: CustomResourceOptions): WafRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            action: Optional[str] = None,
            cc_status: Optional[str] = None,
            cn_region_list: Optional[str] = None,
            conditions: Optional[Sequence[WafRuleConditionArgs]] = None,
            defense_scene: Optional[str] = None,
            effect: Optional[str] = None,
            gmt_modified: Optional[str] = None,
            other_region_list: Optional[str] = None,
            policy_id: Optional[str] = None,
            rate_limit: Optional[WafRuleRateLimitArgs] = None,
            regular_rules: Optional[Sequence[str]] = None,
            regular_types: Optional[Sequence[str]] = None,
            remote_addrs: Optional[Sequence[str]] = None,
            rule_name: Optional[str] = None,
            scenes: Optional[Sequence[str]] = None,
            status: Optional[str] = None,
            waf_group_ids: Optional[str] = None) -> WafRule
    func GetWafRule(ctx *Context, name string, id IDInput, state *WafRuleState, opts ...ResourceOption) (*WafRule, error)
    public static WafRule Get(string name, Input<string> id, WafRuleState? state, CustomResourceOptions? opts = null)
    public static WafRule get(String name, Output<String> id, WafRuleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Action string

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

    CcStatus string

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

    CnRegionList string

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

    Conditions List<Pulumi.AliCloud.Dcdn.Inputs.WafRuleCondition>

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

    DefenseScene string

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    Effect string

    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).

    GmtModified string

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    OtherRegionList string

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

    PolicyId string

    The protection policy ID.

    RateLimit Pulumi.AliCloud.Dcdn.Inputs.WafRuleRateLimit

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

    RegularRules List<string>

    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.

    RegularTypes List<string>

    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"]

    RemoteAddrs List<string>

    Filter by IP address.

    RuleName string

    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.

    Scenes List<string>

    The types of the protection policies.

    Status string

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

    WafGroupIds string

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

    Action string

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

    CcStatus string

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

    CnRegionList string

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

    Conditions []WafRuleConditionArgs

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

    DefenseScene string

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    Effect string

    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).

    GmtModified string

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    OtherRegionList string

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

    PolicyId string

    The protection policy ID.

    RateLimit WafRuleRateLimitArgs

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

    RegularRules []string

    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.

    RegularTypes []string

    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"]

    RemoteAddrs []string

    Filter by IP address.

    RuleName string

    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.

    Scenes []string

    The types of the protection policies.

    Status string

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

    WafGroupIds string

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

    action String

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

    ccStatus String

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

    cnRegionList String

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

    conditions List<WafRuleCondition>

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

    defenseScene String

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    effect String

    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).

    gmtModified String

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    otherRegionList String

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

    policyId String

    The protection policy ID.

    rateLimit WafRuleRateLimit

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

    regularRules List<String>

    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.

    regularTypes List<String>

    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"]

    remoteAddrs List<String>

    Filter by IP address.

    ruleName String

    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.

    scenes List<String>

    The types of the protection policies.

    status String

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

    wafGroupIds String

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

    action string

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

    ccStatus string

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

    cnRegionList string

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

    conditions WafRuleCondition[]

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

    defenseScene string

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    effect string

    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).

    gmtModified string

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    otherRegionList string

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

    policyId string

    The protection policy ID.

    rateLimit WafRuleRateLimit

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

    regularRules string[]

    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.

    regularTypes string[]

    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"]

    remoteAddrs string[]

    Filter by IP address.

    ruleName string

    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.

    scenes string[]

    The types of the protection policies.

    status string

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

    wafGroupIds string

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

    action str

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

    cc_status str

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

    cn_region_list str

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

    conditions Sequence[WafRuleConditionArgs]

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

    defense_scene str

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    effect str

    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).

    gmt_modified str

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    other_region_list str

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

    policy_id str

    The protection policy ID.

    rate_limit WafRuleRateLimitArgs

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

    regular_rules Sequence[str]

    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.

    regular_types Sequence[str]

    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"]

    remote_addrs Sequence[str]

    Filter by IP address.

    rule_name str

    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.

    scenes Sequence[str]

    The types of the protection policies.

    status str

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

    waf_group_ids str

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

    action String

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

    ccStatus String

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

    cnRegionList String

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

    conditions List<Property Map>

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

    defenseScene String

    The type of protection policy. The following scenarios are supported:-waf_group:Web basic protection-custom_acl: Custom protection policy-whitelist: whitelist

    effect String

    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).

    gmtModified String

    Revised the time. The date format is based on ISO8601 notation and uses UTC +0 time in the format of yyyy-MM-ddTHH:mm:ssZ.

    otherRegionList String

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

    policyId String

    The protection policy ID.

    rateLimit Property Map

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

    regularRules List<String>

    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.

    regularTypes List<String>

    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"]

    remoteAddrs List<String>

    Filter by IP address.

    ruleName String

    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.

    scenes List<String>

    The types of the protection policies.

    status String

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

    wafGroupIds String

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

    Supporting Types

    WafRuleCondition, WafRuleConditionArgs

    Key string

    The match field.

    OpValue string

    The logical symbol.

    SubKey string

    The match subfield.

    Values string

    The match content. Separate multiple values with commas (,).

    Key string

    The match field.

    OpValue string

    The logical symbol.

    SubKey string

    The match subfield.

    Values string

    The match content. Separate multiple values with commas (,).

    key String

    The match field.

    opValue String

    The logical symbol.

    subKey String

    The match subfield.

    values String

    The match content. Separate multiple values with commas (,).

    key string

    The match field.

    opValue string

    The logical symbol.

    subKey string

    The match subfield.

    values string

    The match content. Separate multiple values with commas (,).

    key str

    The match field.

    op_value str

    The logical symbol.

    sub_key str

    The match subfield.

    values str

    The match content. Separate multiple values with commas (,).

    key String

    The match field.

    opValue String

    The logical symbol.

    subKey String

    The match subfield.

    values String

    The match content. Separate multiple values with commas (,).

    WafRuleRateLimit, WafRuleRateLimitArgs

    Interval int

    Statistical duration, 5-1800.

    Status Pulumi.AliCloud.Dcdn.Inputs.WafRuleRateLimitStatus

    Response code statistics. See status below.

    SubKey string

    The subfield of the target field. If you set target to Header, Query String Parameter, or Cookie Name, you must configure sub_key.

    Target string

    The statistical field for frequency control. Currently, IP, Header, Query String Parameter, Cookie Name, Session is supported.

    Threshold int

    The trigger threshold of rate limiting. Valid values: 2 to 500000. Unit: requests.

    Ttl int

    The validity period of the blacklist. Valid values: 60 to 86400. Unit: seconds.

    Interval int

    Statistical duration, 5-1800.

    Status WafRuleRateLimitStatus

    Response code statistics. See status below.

    SubKey string

    The subfield of the target field. If you set target to Header, Query String Parameter, or Cookie Name, you must configure sub_key.

    Target string

    The statistical field for frequency control. Currently, IP, Header, Query String Parameter, Cookie Name, Session is supported.

    Threshold int

    The trigger threshold of rate limiting. Valid values: 2 to 500000. Unit: requests.

    Ttl int

    The validity period of the blacklist. Valid values: 60 to 86400. Unit: seconds.

    interval Integer

    Statistical duration, 5-1800.

    status WafRuleRateLimitStatus

    Response code statistics. See status below.

    subKey String

    The subfield of the target field. If you set target to Header, Query String Parameter, or Cookie Name, you must configure sub_key.

    target String

    The statistical field for frequency control. Currently, IP, Header, Query String Parameter, Cookie Name, Session is supported.

    threshold Integer

    The trigger threshold of rate limiting. Valid values: 2 to 500000. Unit: requests.

    ttl Integer

    The validity period of the blacklist. Valid values: 60 to 86400. Unit: seconds.

    interval number

    Statistical duration, 5-1800.

    status WafRuleRateLimitStatus

    Response code statistics. See status below.

    subKey string

    The subfield of the target field. If you set target to Header, Query String Parameter, or Cookie Name, you must configure sub_key.

    target string

    The statistical field for frequency control. Currently, IP, Header, Query String Parameter, Cookie Name, Session is supported.

    threshold number

    The trigger threshold of rate limiting. Valid values: 2 to 500000. Unit: requests.

    ttl number

    The validity period of the blacklist. Valid values: 60 to 86400. Unit: seconds.

    interval int

    Statistical duration, 5-1800.

    status WafRuleRateLimitStatus

    Response code statistics. See status below.

    sub_key str

    The subfield of the target field. If you set target to Header, Query String Parameter, or Cookie Name, you must configure sub_key.

    target str

    The statistical field for frequency control. Currently, IP, Header, Query String Parameter, Cookie Name, Session is supported.

    threshold int

    The trigger threshold of rate limiting. Valid values: 2 to 500000. Unit: requests.

    ttl int

    The validity period of the blacklist. Valid values: 60 to 86400. Unit: seconds.

    interval Number

    Statistical duration, 5-1800.

    status Property Map

    Response code statistics. See status below.

    subKey String

    The subfield of the target field. If you set target to Header, Query String Parameter, or Cookie Name, you must configure sub_key.

    target String

    The statistical field for frequency control. Currently, IP, Header, Query String Parameter, Cookie Name, Session is supported.

    threshold Number

    The trigger threshold of rate limiting. Valid values: 2 to 500000. Unit: requests.

    ttl Number

    The validity period of the blacklist. Valid values: 60 to 86400. Unit: seconds.

    WafRuleRateLimitStatus, WafRuleRateLimitStatusArgs

    Code string

    The HTTP status code returned.

    Count int

    The number of times that the HTTP status code that was returned. Valid values: 2 to 50000. You can configure only one of the ratio and count fields.

    Ratio int

    The percentage of HTTP status codes. Valid values: 1 to 100. You can configure only one of the ratio and count fields.

    Code string

    The HTTP status code returned.

    Count int

    The number of times that the HTTP status code that was returned. Valid values: 2 to 50000. You can configure only one of the ratio and count fields.

    Ratio int

    The percentage of HTTP status codes. Valid values: 1 to 100. You can configure only one of the ratio and count fields.

    code String

    The HTTP status code returned.

    count Integer

    The number of times that the HTTP status code that was returned. Valid values: 2 to 50000. You can configure only one of the ratio and count fields.

    ratio Integer

    The percentage of HTTP status codes. Valid values: 1 to 100. You can configure only one of the ratio and count fields.

    code string

    The HTTP status code returned.

    count number

    The number of times that the HTTP status code that was returned. Valid values: 2 to 50000. You can configure only one of the ratio and count fields.

    ratio number

    The percentage of HTTP status codes. Valid values: 1 to 100. You can configure only one of the ratio and count fields.

    code str

    The HTTP status code returned.

    count int

    The number of times that the HTTP status code that was returned. Valid values: 2 to 50000. You can configure only one of the ratio and count fields.

    ratio int

    The percentage of HTTP status codes. Valid values: 1 to 100. You can configure only one of the ratio and count fields.

    code String

    The HTTP status code returned.

    count Number

    The number of times that the HTTP status code that was returned. Valid values: 2 to 50000. You can configure only one of the ratio and count fields.

    ratio Number

    The percentage of HTTP status codes. Valid values: 1 to 100. You can configure only one of the ratio and count fields.

    Import

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

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the alicloud Terraform Provider.

    alicloud logo
    Alibaba Cloud v3.45.0 published on Monday, Nov 27, 2023 by Pulumi