Skip to content
v2.278.0

CfnWebACLProps ​

Struct External

Properties for defining a CfnWebACL.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_waf as waf } from 'aws-cdk-lib';
const cfnWebACLProps: waf.CfnWebACLProps = {
  defaultAction: {
    type: 'type',
  },
  metricName: 'metricName',
  name: 'name',

  // the properties below are optional
  rules: [{
    priority: 123,
    ruleId: 'ruleId',

    // the properties below are optional
    action: {
      type: 'type',
    },
  }],
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_waf as waf

cfn_web_acl_props = waf.CfnWebACLProps(
    default_action=waf.CfnWebACL.WafActionProperty(
        type="type"
    ),
    metric_name="metricName",
    name="name",

    # the properties below are optional
    rules=[waf.CfnWebACL.ActivatedRuleProperty(
        priority=123,
        rule_id="ruleId",

        # the properties below are optional
        action=waf.CfnWebACL.WafActionProperty(
            type="type"
        )
    )]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.waf.*;

CfnWebACLProps cfnWebACLProps = CfnWebACLProps.builder()
        .defaultAction(WafActionProperty.builder()
                .type("type")
                .build())
        .metricName("metricName")
        .name("name")

        // the properties below are optional
        .rules(List.of(ActivatedRuleProperty.builder()
                .priority(123)
                .ruleId("ruleId")

                // the properties below are optional
                .action(WafActionProperty.builder()
                        .type("type")
                        .build())
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.WAF;

var cfnWebACLProps = new CfnWebACLProps {
    DefaultAction = new WafActionProperty {
        Type = "type"
    },
    MetricName = "metricName",
    Name = "name",

    // the properties below are optional
    Rules = new [] { new ActivatedRuleProperty {
        Priority = 123,
        RuleId = "ruleId",

        // the properties below are optional
        Action = new WafActionProperty {
            Type = "type"
        }
    } }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnWebACLProps := &CfnWebACLProps{
	DefaultAction: &WafActionProperty{
		Type: jsii.String("type"),
	},
	MetricName: jsii.String("metricName"),
	Name: jsii.String("name"),

	// the properties below are optional
	Rules: []interface{}{
		&ActivatedRuleProperty{
			Priority: jsii.Number(123),
			RuleId: jsii.String("ruleId"),

			// the properties below are optional
			Action: &WafActionProperty{
				Type: jsii.String("type"),
			},
		},
	},
}

Properties ​

defaultActionIResolvable | CfnWebACL.WafActionPropertydefault_actiontyping.Union[IResolvable, WafActionProperty]defaultActionIResolvableDefaultActionIResolvableDefaultActioninterface{} required #
The action to perform if none of the `Rules` contained in the `WebACL` match.

The action is specified by the WafAction object.

metricNamestringmetric_namestrmetricNameStringMetricNamestringMetricName*string required #
The name of the metrics for this `WebACL` .
notes

The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF , including "All" and "Default_Action." You can't change MetricName after you create the WebACL .

namestringnamestrnameStringNamestringName*string required #
A friendly name or description of the `WebACL` .

You can't change the name of a WebACL after you create it.

rulesoptionalIResolvable | IResolvable | CfnWebACL.ActivatedRuleProperty[]rulesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, ActivatedRuleProperty]]]rulesoptionalIResolvableRulesoptionalIResolvableRulesoptionalinterface{} #
An array that contains the action for each `Rule` in a `WebACL` , the priority of the `Rule` , and the ID of the `Rule` .