Skip to content
v2.278.0

CfnRuleProps ​

Struct External

Properties for defining a CfnRule.

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 cfnRuleProps: waf.CfnRuleProps = {
  metricName: 'metricName',
  name: 'name',

  // the properties below are optional
  predicates: [{
    dataId: 'dataId',
    negated: false,
    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_rule_props = waf.CfnRuleProps(
    metric_name="metricName",
    name="name",

    # the properties below are optional
    predicates=[waf.CfnRule.PredicateProperty(
        data_id="dataId",
        negated=False,
        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.*;

CfnRuleProps cfnRuleProps = CfnRuleProps.builder()
        .metricName("metricName")
        .name("name")

        // the properties below are optional
        .predicates(List.of(PredicateProperty.builder()
                .dataId("dataId")
                .negated(false)
                .type("type")
                .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 cfnRuleProps = new CfnRuleProps {
    MetricName = "metricName",
    Name = "name",

    // the properties below are optional
    Predicates = new [] { new PredicateProperty {
        DataId = "dataId",
        Negated = false,
        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"

cfnRuleProps := &CfnRuleProps{
	MetricName: jsii.String("metricName"),
	Name: jsii.String("name"),

	// the properties below are optional
	Predicates: []interface{}{
		&PredicateProperty{
			DataId: jsii.String("dataId"),
			Negated: jsii.Boolean(false),
			Type: jsii.String("type"),
		},
	},
}

Properties ​

metricNamestringmetric_namestrmetricNameStringMetricNamestringMetricName*string required #
The name of the metrics for this `Rule` .
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 Rule .

namestringnamestrnameStringNamestringName*string required #
The friendly name or description for the `Rule` .

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

predicatesoptionalIResolvable | IResolvable | CfnRule.PredicateProperty[]predicatesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, PredicateProperty]]]predicatesoptionalIResolvablePredicatesoptionalIResolvablePredicatesoptionalinterface{} #
The `Predicates` object contains one `Predicate` element for each `ByteMatchSet` , `IPSet` , or `SqlInjectionMatchSet` object that you want to include in a `Rule` .