Skip to content
v2.278.0

RuleGroupReferenceStatementProperty Struct ​

A rule statement used to run the rules that are defined in a RuleGroup .

To use this, create a rule group with your rules, then provide the ARN of the rule group in this statement.

You cannot nest a RuleGroupReferenceStatement , for example for use inside a NotStatement or OrStatement . You cannot use a rule group reference statement inside another rule group. You can only reference a rule group as a top-level statement within a rule that you define in a web ACL.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_wafv2 as wafv2 } from 'aws-cdk-lib';
const ruleGroupReferenceStatementProperty: wafv2.CfnWebACL.RuleGroupReferenceStatementProperty = {
  arn: 'arn',

  // the properties below are optional
  excludedRules: [{
    name: 'name',
  }],
  ruleActionOverrides: [{
    actionToUse: {
      allow: {
        customRequestHandling: {
          insertHeaders: [{
            name: 'name',
            value: 'value',
          }],
        },
      },
      block: {
        customResponse: {
          responseCode: 123,

          // the properties below are optional
          customResponseBodyKey: 'customResponseBodyKey',
          responseHeaders: [{
            name: 'name',
            value: 'value',
          }],
        },
      },
      captcha: {
        customRequestHandling: {
          insertHeaders: [{
            name: 'name',
            value: 'value',
          }],
        },
      },
      challenge: {
        customRequestHandling: {
          insertHeaders: [{
            name: 'name',
            value: 'value',
          }],
        },
      },
      count: {
        customRequestHandling: {
          insertHeaders: [{
            name: 'name',
            value: 'value',
          }],
        },
      },
      monetize: {
        priceMultiplier: 'priceMultiplier',
      },
    },
    name: 'name',
  }],
};
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_wafv2 as wafv2

rule_group_reference_statement_property = wafv2.CfnWebACL.RuleGroupReferenceStatementProperty(
    arn="arn",

    # the properties below are optional
    excluded_rules=[wafv2.CfnWebACL.ExcludedRuleProperty(
        name="name"
    )],
    rule_action_overrides=[wafv2.CfnWebACL.RuleActionOverrideProperty(
        action_to_use=wafv2.CfnWebACL.RuleActionProperty(
            allow=wafv2.CfnWebACL.AllowActionProperty(
                custom_request_handling=wafv2.CfnWebACL.CustomRequestHandlingProperty(
                    insert_headers=[wafv2.CfnWebACL.CustomHTTPHeaderProperty(
                        name="name",
                        value="value"
                    )]
                )
            ),
            block=wafv2.CfnWebACL.BlockActionProperty(
                custom_response=wafv2.CfnWebACL.CustomResponseProperty(
                    response_code=123,

                    # the properties below are optional
                    custom_response_body_key="customResponseBodyKey",
                    response_headers=[wafv2.CfnWebACL.CustomHTTPHeaderProperty(
                        name="name",
                        value="value"
                    )]
                )
            ),
            captcha=wafv2.CfnWebACL.CaptchaActionProperty(
                custom_request_handling=wafv2.CfnWebACL.CustomRequestHandlingProperty(
                    insert_headers=[wafv2.CfnWebACL.CustomHTTPHeaderProperty(
                        name="name",
                        value="value"
                    )]
                )
            ),
            challenge=wafv2.CfnWebACL.ChallengeActionProperty(
                custom_request_handling=wafv2.CfnWebACL.CustomRequestHandlingProperty(
                    insert_headers=[wafv2.CfnWebACL.CustomHTTPHeaderProperty(
                        name="name",
                        value="value"
                    )]
                )
            ),
            count=wafv2.CfnWebACL.CountActionProperty(
                custom_request_handling=wafv2.CfnWebACL.CustomRequestHandlingProperty(
                    insert_headers=[wafv2.CfnWebACL.CustomHTTPHeaderProperty(
                        name="name",
                        value="value"
                    )]
                )
            ),
            monetize=wafv2.CfnWebACL.MonetizeActionProperty(
                price_multiplier="priceMultiplier"
            )
        ),
        name="name"
    )]
)
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.wafv2.*;

RuleGroupReferenceStatementProperty ruleGroupReferenceStatementProperty = RuleGroupReferenceStatementProperty.builder()
        .arn("arn")

        // the properties below are optional
        .excludedRules(List.of(ExcludedRuleProperty.builder()
                .name("name")
                .build()))
        .ruleActionOverrides(List.of(RuleActionOverrideProperty.builder()
                .actionToUse(RuleActionProperty.builder()
                        .allow(AllowActionProperty.builder()
                                .customRequestHandling(CustomRequestHandlingProperty.builder()
                                        .insertHeaders(List.of(CustomHTTPHeaderProperty.builder()
                                                .name("name")
                                                .value("value")
                                                .build()))
                                        .build())
                                .build())
                        .block(BlockActionProperty.builder()
                                .customResponse(CustomResponseProperty.builder()
                                        .responseCode(123)

                                        // the properties below are optional
                                        .customResponseBodyKey("customResponseBodyKey")
                                        .responseHeaders(List.of(CustomHTTPHeaderProperty.builder()
                                                .name("name")
                                                .value("value")
                                                .build()))
                                        .build())
                                .build())
                        .captcha(CaptchaActionProperty.builder()
                                .customRequestHandling(CustomRequestHandlingProperty.builder()
                                        .insertHeaders(List.of(CustomHTTPHeaderProperty.builder()
                                                .name("name")
                                                .value("value")
                                                .build()))
                                        .build())
                                .build())
                        .challenge(ChallengeActionProperty.builder()
                                .customRequestHandling(CustomRequestHandlingProperty.builder()
                                        .insertHeaders(List.of(CustomHTTPHeaderProperty.builder()
                                                .name("name")
                                                .value("value")
                                                .build()))
                                        .build())
                                .build())
                        .count(CountActionProperty.builder()
                                .customRequestHandling(CustomRequestHandlingProperty.builder()
                                        .insertHeaders(List.of(CustomHTTPHeaderProperty.builder()
                                                .name("name")
                                                .value("value")
                                                .build()))
                                        .build())
                                .build())
                        .monetize(MonetizeActionProperty.builder()
                                .priceMultiplier("priceMultiplier")
                                .build())
                        .build())
                .name("name")
                .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.WAFv2;

var ruleGroupReferenceStatementProperty = new RuleGroupReferenceStatementProperty {
    Arn = "arn",

    // the properties below are optional
    ExcludedRules = new [] { new ExcludedRuleProperty {
        Name = "name"
    } },
    RuleActionOverrides = new [] { new RuleActionOverrideProperty {
        ActionToUse = new RuleActionProperty {
            Allow = new AllowActionProperty {
                CustomRequestHandling = new CustomRequestHandlingProperty {
                    InsertHeaders = new [] { new CustomHTTPHeaderProperty {
                        Name = "name",
                        Value = "value"
                    } }
                }
            },
            Block = new BlockActionProperty {
                CustomResponse = new CustomResponseProperty {
                    ResponseCode = 123,

                    // the properties below are optional
                    CustomResponseBodyKey = "customResponseBodyKey",
                    ResponseHeaders = new [] { new CustomHTTPHeaderProperty {
                        Name = "name",
                        Value = "value"
                    } }
                }
            },
            Captcha = new CaptchaActionProperty {
                CustomRequestHandling = new CustomRequestHandlingProperty {
                    InsertHeaders = new [] { new CustomHTTPHeaderProperty {
                        Name = "name",
                        Value = "value"
                    } }
                }
            },
            Challenge = new ChallengeActionProperty {
                CustomRequestHandling = new CustomRequestHandlingProperty {
                    InsertHeaders = new [] { new CustomHTTPHeaderProperty {
                        Name = "name",
                        Value = "value"
                    } }
                }
            },
            Count = new CountActionProperty {
                CustomRequestHandling = new CustomRequestHandlingProperty {
                    InsertHeaders = new [] { new CustomHTTPHeaderProperty {
                        Name = "name",
                        Value = "value"
                    } }
                }
            },
            Monetize = new MonetizeActionProperty {
                PriceMultiplier = "priceMultiplier"
            }
        },
        Name = "name"
    } }
};
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"

ruleGroupReferenceStatementProperty := &RuleGroupReferenceStatementProperty{
	Arn: jsii.String("arn"),

	// the properties below are optional
	ExcludedRules: []interface{}{
		&ExcludedRuleProperty{
			Name: jsii.String("name"),
		},
	},
	RuleActionOverrides: []interface{}{
		&RuleActionOverrideProperty{
			ActionToUse: &RuleActionProperty{
				Allow: &AllowActionProperty{
					CustomRequestHandling: &CustomRequestHandlingProperty{
						InsertHeaders: []interface{}{
							&CustomHTTPHeaderProperty{
								Name: jsii.String("name"),
								Value: jsii.String("value"),
							},
						},
					},
				},
				Block: &BlockActionProperty{
					CustomResponse: &CustomResponseProperty{
						ResponseCode: jsii.Number(123),

						// the properties below are optional
						CustomResponseBodyKey: jsii.String("customResponseBodyKey"),
						ResponseHeaders: []interface{}{
							&CustomHTTPHeaderProperty{
								Name: jsii.String("name"),
								Value: jsii.String("value"),
							},
						},
					},
				},
				Captcha: &CaptchaActionProperty{
					CustomRequestHandling: &CustomRequestHandlingProperty{
						InsertHeaders: []interface{}{
							&CustomHTTPHeaderProperty{
								Name: jsii.String("name"),
								Value: jsii.String("value"),
							},
						},
					},
				},
				Challenge: &ChallengeActionProperty{
					CustomRequestHandling: &CustomRequestHandlingProperty{
						InsertHeaders: []interface{}{
							&CustomHTTPHeaderProperty{
								Name: jsii.String("name"),
								Value: jsii.String("value"),
							},
						},
					},
				},
				Count: &CountActionProperty{
					CustomRequestHandling: &CustomRequestHandlingProperty{
						InsertHeaders: []interface{}{
							&CustomHTTPHeaderProperty{
								Name: jsii.String("name"),
								Value: jsii.String("value"),
							},
						},
					},
				},
				Monetize: &MonetizeActionProperty{
					PriceMultiplier: jsii.String("priceMultiplier"),
				},
			},
			Name: jsii.String("name"),
		},
	},
}

Properties ​

arnstringarnstrarnStringArnstringArn*string required #
The Amazon Resource Name (ARN) of the entity.
excludedRulesoptionalIResolvable | IResolvable | CfnWebACL.ExcludedRuleProperty[]excluded_rulesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, ExcludedRuleProperty]]]excludedRulesoptionalIResolvableExcludedRulesoptionalIResolvableExcludedRulesoptionalinterface{} #
Rules in the referenced rule group whose actions are set to `Count` .

Instead of this option, use RuleActionOverrides . It accepts any valid action setting, including Count .

ruleActionOverridesoptionalIResolvable | IResolvable | CfnWebACL.RuleActionOverrideProperty[]rule_action_overridesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, RuleActionOverrideProperty]]]ruleActionOverridesoptionalIResolvableRuleActionOverridesoptionalIResolvableRuleActionOverridesoptionalinterface{} #
Action settings to use in the place of the rule actions that are configured inside the rule group.
notes

You specify one override for each rule whose action you want to change.

Verify the rule names in your overrides carefully. With managed rule groups, AWS WAF silently ignores any override that uses an invalid rule name. With customer-owned rule groups, invalid rule names in your overrides will cause web ACL updates to fail. An invalid rule name is any name that doesn't exactly match the case-sensitive name of an existing rule in the rule group.

You can use overrides for testing, for example you can override all of rule actions to Count and then monitor the resulting count metrics to understand how the rule group would handle your web traffic. You can also permanently override some or all actions, to modify how the rule group manages your web traffic.