CfnRuleGroupProps
- class aws_cdk.aws_wafv2.CfnRuleGroupProps(*, capacity, scope, visibility_config, available_labels=None, consumed_labels=None, custom_response_bodies=None, description=None, name=None, rules=None, tags=None)
Bases:
object
Properties for defining a
CfnRuleGroup
.- Parameters:
capacity (
Union
[int
,float
]) – The web ACL capacity units (WCUs) required for this rule group. When you create your own rule group, you define this, and you cannot change it after creation. When you add or modify the rules in a rule group, AWS WAF enforces this limit. AWS WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. AWS WAF calculates capacity differently for each rule type, to reflect the relative cost of each rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule group. The WCU limit for web ACLs is 1,500.scope (
str
) – Specifies whether this is for an Amazon CloudFront distribution or for a regional application. A regional application can be an Application Load Balancer (ALB), an Amazon API Gateway REST API, an AWS AppSync GraphQL API, an Amazon Cognito user pool, or an AWS App Runner service. Valid Values areCLOUDFRONT
andREGIONAL
. .. epigraph:: ForCLOUDFRONT
, you must create your WAFv2 resources in the US East (N. Virginia) Region,us-east-1
.visibility_config (
Union
[IResolvable
,VisibilityConfigProperty
,Dict
[str
,Any
]]) – Defines and enables Amazon CloudWatch metrics and web request sample collection.available_labels (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,LabelSummaryProperty
,Dict
[str
,Any
]]],None
]) – The labels that one or more rules in this rule group add to matching web requests. These labels are defined in theRuleLabels
for aRule
.consumed_labels (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,LabelSummaryProperty
,Dict
[str
,Any
]]],None
]) – The labels that one or more rules in this rule group match against in label match statements. These labels are defined in aLabelMatchStatement
specification, in theStatement
definition of a rule.custom_response_bodies (
Union
[IResolvable
,Mapping
[str
,Union
[IResolvable
,CustomResponseBodyProperty
,Dict
[str
,Any
]]],None
]) – A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the rule group, and then use them in the rules that you define in the rule group. For information about customizing web requests and responses, see Customizing web requests and responses in AWS WAF in the AWS WAF Developer Guide . For information about the limits on count and size for custom request and response settings, see AWS WAF quotas in the AWS WAF Developer Guide .description (
Optional
[str
]) – A description of the rule group that helps with identification.name (
Optional
[str
]) – The name of the rule group. You cannot change the name of a rule group after you create it.rules (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,RuleProperty
,Dict
[str
,Any
]]],None
]) – The rule statements used to identify the web requests that you want to allow, block, or count. Each rule includes one top-level statement that AWS WAF uses to identify matching web requests, and parameters that govern how AWS WAF handles them.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – Key:value pairs associated with an AWS resource. The key:value pair can be anything you define. Typically, the tag key represents a category (such as “environment”) and the tag value represents a specific value within that category (such as “test,” “development,” or “production”). You can add up to 50 tags to each AWS resource. .. epigraph:: To modify tags on existing resources, use the AWS WAF APIs or command line interface. With AWS CloudFormation , you can only add tags to AWS WAF resources during resource creation.
- Link:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_wafv2 as wafv2 # all: Any # allow: Any # all_query_arguments: Any # block: Any # captcha: Any # challenge: Any # count: Any # method: Any # query_string: Any # single_header: Any # single_query_argument: Any # statement_property_: wafv2.CfnRuleGroup.StatementProperty # uri_path: Any cfn_rule_group_props = wafv2.CfnRuleGroupProps( capacity=123, scope="scope", visibility_config=wafv2.CfnRuleGroup.VisibilityConfigProperty( cloud_watch_metrics_enabled=False, metric_name="metricName", sampled_requests_enabled=False ), # the properties below are optional available_labels=[wafv2.CfnRuleGroup.LabelSummaryProperty( name="name" )], consumed_labels=[wafv2.CfnRuleGroup.LabelSummaryProperty( name="name" )], custom_response_bodies={ "custom_response_bodies_key": wafv2.CfnRuleGroup.CustomResponseBodyProperty( content="content", content_type="contentType" ) }, description="description", name="name", rules=[wafv2.CfnRuleGroup.RuleProperty( name="name", priority=123, statement=wafv2.CfnRuleGroup.StatementProperty( and_statement=wafv2.CfnRuleGroup.AndStatementProperty( statements=[statement_property_] ), byte_match_statement=wafv2.CfnRuleGroup.ByteMatchStatementProperty( field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty( all_query_arguments=all_query_arguments, body=wafv2.CfnRuleGroup.BodyProperty( oversize_handling="oversizeHandling" ), cookies=wafv2.CfnRuleGroup.CookiesProperty( match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty( all=all, excluded_cookies=["excludedCookies"], included_cookies=["includedCookies"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), headers=wafv2.CfnRuleGroup.HeadersProperty( match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty( all=all, excluded_headers=["excludedHeaders"], included_headers=["includedHeaders"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), json_body=wafv2.CfnRuleGroup.JsonBodyProperty( match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty( all=all, included_paths=["includedPaths"] ), match_scope="matchScope", # the properties below are optional invalid_fallback_behavior="invalidFallbackBehavior", oversize_handling="oversizeHandling" ), method=method, query_string=query_string, single_header=single_header, single_query_argument=single_query_argument, uri_path=uri_path ), positional_constraint="positionalConstraint", text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty( priority=123, type="type" )], # the properties below are optional search_string="searchString", search_string_base64="searchStringBase64" ), geo_match_statement=wafv2.CfnRuleGroup.GeoMatchStatementProperty( country_codes=["countryCodes"], forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty( fallback_behavior="fallbackBehavior", header_name="headerName" ) ), ip_set_reference_statement={ "arn": "arn", # the properties below are optional "ip_set_forwarded_ip_config": { "fallback_behavior": "fallbackBehavior", "header_name": "headerName", "position": "position" } }, label_match_statement=wafv2.CfnRuleGroup.LabelMatchStatementProperty( key="key", scope="scope" ), not_statement=wafv2.CfnRuleGroup.NotStatementProperty( statement=statement_property_ ), or_statement=wafv2.CfnRuleGroup.OrStatementProperty( statements=[statement_property_] ), rate_based_statement=wafv2.CfnRuleGroup.RateBasedStatementProperty( aggregate_key_type="aggregateKeyType", limit=123, # the properties below are optional forwarded_ip_config=wafv2.CfnRuleGroup.ForwardedIPConfigurationProperty( fallback_behavior="fallbackBehavior", header_name="headerName" ), scope_down_statement=statement_property_ ), regex_match_statement=wafv2.CfnRuleGroup.RegexMatchStatementProperty( field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty( all_query_arguments=all_query_arguments, body=wafv2.CfnRuleGroup.BodyProperty( oversize_handling="oversizeHandling" ), cookies=wafv2.CfnRuleGroup.CookiesProperty( match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty( all=all, excluded_cookies=["excludedCookies"], included_cookies=["includedCookies"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), headers=wafv2.CfnRuleGroup.HeadersProperty( match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty( all=all, excluded_headers=["excludedHeaders"], included_headers=["includedHeaders"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), json_body=wafv2.CfnRuleGroup.JsonBodyProperty( match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty( all=all, included_paths=["includedPaths"] ), match_scope="matchScope", # the properties below are optional invalid_fallback_behavior="invalidFallbackBehavior", oversize_handling="oversizeHandling" ), method=method, query_string=query_string, single_header=single_header, single_query_argument=single_query_argument, uri_path=uri_path ), regex_string="regexString", text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty( priority=123, type="type" )] ), regex_pattern_set_reference_statement=wafv2.CfnRuleGroup.RegexPatternSetReferenceStatementProperty( arn="arn", field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty( all_query_arguments=all_query_arguments, body=wafv2.CfnRuleGroup.BodyProperty( oversize_handling="oversizeHandling" ), cookies=wafv2.CfnRuleGroup.CookiesProperty( match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty( all=all, excluded_cookies=["excludedCookies"], included_cookies=["includedCookies"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), headers=wafv2.CfnRuleGroup.HeadersProperty( match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty( all=all, excluded_headers=["excludedHeaders"], included_headers=["includedHeaders"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), json_body=wafv2.CfnRuleGroup.JsonBodyProperty( match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty( all=all, included_paths=["includedPaths"] ), match_scope="matchScope", # the properties below are optional invalid_fallback_behavior="invalidFallbackBehavior", oversize_handling="oversizeHandling" ), method=method, query_string=query_string, single_header=single_header, single_query_argument=single_query_argument, uri_path=uri_path ), text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty( priority=123, type="type" )] ), size_constraint_statement=wafv2.CfnRuleGroup.SizeConstraintStatementProperty( comparison_operator="comparisonOperator", field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty( all_query_arguments=all_query_arguments, body=wafv2.CfnRuleGroup.BodyProperty( oversize_handling="oversizeHandling" ), cookies=wafv2.CfnRuleGroup.CookiesProperty( match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty( all=all, excluded_cookies=["excludedCookies"], included_cookies=["includedCookies"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), headers=wafv2.CfnRuleGroup.HeadersProperty( match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty( all=all, excluded_headers=["excludedHeaders"], included_headers=["includedHeaders"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), json_body=wafv2.CfnRuleGroup.JsonBodyProperty( match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty( all=all, included_paths=["includedPaths"] ), match_scope="matchScope", # the properties below are optional invalid_fallback_behavior="invalidFallbackBehavior", oversize_handling="oversizeHandling" ), method=method, query_string=query_string, single_header=single_header, single_query_argument=single_query_argument, uri_path=uri_path ), size=123, text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty( priority=123, type="type" )] ), sqli_match_statement=wafv2.CfnRuleGroup.SqliMatchStatementProperty( field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty( all_query_arguments=all_query_arguments, body=wafv2.CfnRuleGroup.BodyProperty( oversize_handling="oversizeHandling" ), cookies=wafv2.CfnRuleGroup.CookiesProperty( match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty( all=all, excluded_cookies=["excludedCookies"], included_cookies=["includedCookies"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), headers=wafv2.CfnRuleGroup.HeadersProperty( match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty( all=all, excluded_headers=["excludedHeaders"], included_headers=["includedHeaders"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), json_body=wafv2.CfnRuleGroup.JsonBodyProperty( match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty( all=all, included_paths=["includedPaths"] ), match_scope="matchScope", # the properties below are optional invalid_fallback_behavior="invalidFallbackBehavior", oversize_handling="oversizeHandling" ), method=method, query_string=query_string, single_header=single_header, single_query_argument=single_query_argument, uri_path=uri_path ), text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty( priority=123, type="type" )], # the properties below are optional sensitivity_level="sensitivityLevel" ), xss_match_statement=wafv2.CfnRuleGroup.XssMatchStatementProperty( field_to_match=wafv2.CfnRuleGroup.FieldToMatchProperty( all_query_arguments=all_query_arguments, body=wafv2.CfnRuleGroup.BodyProperty( oversize_handling="oversizeHandling" ), cookies=wafv2.CfnRuleGroup.CookiesProperty( match_pattern=wafv2.CfnRuleGroup.CookieMatchPatternProperty( all=all, excluded_cookies=["excludedCookies"], included_cookies=["includedCookies"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), headers=wafv2.CfnRuleGroup.HeadersProperty( match_pattern=wafv2.CfnRuleGroup.HeaderMatchPatternProperty( all=all, excluded_headers=["excludedHeaders"], included_headers=["includedHeaders"] ), match_scope="matchScope", oversize_handling="oversizeHandling" ), json_body=wafv2.CfnRuleGroup.JsonBodyProperty( match_pattern=wafv2.CfnRuleGroup.JsonMatchPatternProperty( all=all, included_paths=["includedPaths"] ), match_scope="matchScope", # the properties below are optional invalid_fallback_behavior="invalidFallbackBehavior", oversize_handling="oversizeHandling" ), method=method, query_string=query_string, single_header=single_header, single_query_argument=single_query_argument, uri_path=uri_path ), text_transformations=[wafv2.CfnRuleGroup.TextTransformationProperty( priority=123, type="type" )] ) ), visibility_config=wafv2.CfnRuleGroup.VisibilityConfigProperty( cloud_watch_metrics_enabled=False, metric_name="metricName", sampled_requests_enabled=False ), # the properties below are optional action=wafv2.CfnRuleGroup.RuleActionProperty( allow=allow, block=block, captcha=captcha, challenge=challenge, count=count ), captcha_config=wafv2.CfnRuleGroup.CaptchaConfigProperty( immunity_time_property=wafv2.CfnRuleGroup.ImmunityTimePropertyProperty( immunity_time=123 ) ), challenge_config=wafv2.CfnRuleGroup.ChallengeConfigProperty( immunity_time_property=wafv2.CfnRuleGroup.ImmunityTimePropertyProperty( immunity_time=123 ) ), rule_labels=[wafv2.CfnRuleGroup.LabelProperty( name="name" )] )], tags=[CfnTag( key="key", value="value" )] )
Attributes
- available_labels
The labels that one or more rules in this rule group add to matching web requests.
These labels are defined in the
RuleLabels
for aRule
.
- capacity
The web ACL capacity units (WCUs) required for this rule group.
When you create your own rule group, you define this, and you cannot change it after creation. When you add or modify the rules in a rule group, AWS WAF enforces this limit.
AWS WAF uses WCUs to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. AWS WAF calculates capacity differently for each rule type, to reflect the relative cost of each rule. Simple rules that cost little to run use fewer WCUs than more complex rules that use more processing power. Rule group capacity is fixed at creation, which helps users plan their web ACL WCU usage when they use a rule group. The WCU limit for web ACLs is 1,500.
- consumed_labels
The labels that one or more rules in this rule group match against in label match statements.
These labels are defined in a
LabelMatchStatement
specification, in theStatement
definition of a rule.
- custom_response_bodies
A map of custom response keys and content bodies.
When you create a rule with a block action, you can send a custom response to the web request. You define these for the rule group, and then use them in the rules that you define in the rule group.
For information about customizing web requests and responses, see Customizing web requests and responses in AWS WAF in the AWS WAF Developer Guide .
For information about the limits on count and size for custom request and response settings, see AWS WAF quotas in the AWS WAF Developer Guide .
- description
A description of the rule group that helps with identification.
- name
The name of the rule group.
You cannot change the name of a rule group after you create it.
- rules
The rule statements used to identify the web requests that you want to allow, block, or count.
Each rule includes one top-level statement that AWS WAF uses to identify matching web requests, and parameters that govern how AWS WAF handles them.
- scope
Specifies whether this is for an Amazon CloudFront distribution or for a regional application.
A regional application can be an Application Load Balancer (ALB), an Amazon API Gateway REST API, an AWS AppSync GraphQL API, an Amazon Cognito user pool, or an AWS App Runner service. Valid Values are
CLOUDFRONT
andREGIONAL
. .. epigraph:For ``CLOUDFRONT`` , you must create your WAFv2 resources in the US East (N. Virginia) Region, ``us-east-1`` .
- tags
value pairs associated with an AWS resource.
The key:value pair can be anything you define. Typically, the tag key represents a category (such as “environment”) and the tag value represents a specific value within that category (such as “test,” “development,” or “production”). You can add up to 50 tags to each AWS resource. .. epigraph:
To modify tags on existing resources, use the AWS WAF APIs or command line interface. With AWS CloudFormation , you can only add tags to AWS WAF resources during resource creation.
- visibility_config
Defines and enables Amazon CloudWatch metrics and web request sample collection.