Class CfnRuleGroup
This is the latest version of AWS WAF , named AWS WAF V2, released in November, 2019.
Inherited Members
Namespace: Amazon.CDK.AWS.WAFv2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnRuleGroup : CfnResource, IInspectable, ITaggable
Syntax (vb)
Public Class CfnRuleGroup
Inherits CfnResource
Implements IInspectable, ITaggable
Remarks
For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF developer guide .
Use an RuleGroup
to define a collection of rules for inspecting and controlling web requests. You use a rule group in an WebACL
by providing its Amazon Resource Name (ARN) to the rule statement RuleGroupReferenceStatement
, when you add rules to the web ACL.
When you create a rule group, you define an immutable capacity limit. If you update a rule group, you must stay within the capacity. This allows others to reuse the rule group with confidence in its capacity requirements.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html
CloudformationResource: AWS::WAFv2::RuleGroup
ExampleMetadata: fixture=_generated
Examples
// 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 all;
var allow;
var allQueryArguments;
var block;
var captcha;
var challenge;
var count;
var forwardedIp;
var httpMethod;
var ip;
var method;
var queryString;
var singleHeader;
var singleQueryArgument;
StatementProperty statementProperty_;
var uriPath;
var cfnRuleGroup = new CfnRuleGroup(this, "MyCfnRuleGroup", new CfnRuleGroupProps {
Capacity = 123,
Scope = "scope",
VisibilityConfig = new VisibilityConfigProperty {
CloudWatchMetricsEnabled = false,
MetricName = "metricName",
SampledRequestsEnabled = false
},
// the properties below are optional
AvailableLabels = new [] { new LabelSummaryProperty {
Name = "name"
} },
ConsumedLabels = new [] { new LabelSummaryProperty {
Name = "name"
} },
CustomResponseBodies = new Dictionary<string, object> {
{ "customResponseBodiesKey", new CustomResponseBodyProperty {
Content = "content",
ContentType = "contentType"
} }
},
Description = "description",
Name = "name",
Rules = new [] { new RuleProperty {
Name = "name",
Priority = 123,
Statement = new StatementProperty {
AndStatement = new AndStatementProperty {
Statements = new [] { statementProperty_ }
},
ByteMatchStatement = new ByteMatchStatementProperty {
FieldToMatch = new FieldToMatchProperty {
AllQueryArguments = allQueryArguments,
Body = new BodyProperty {
OversizeHandling = "oversizeHandling"
},
Cookies = new CookiesProperty {
MatchPattern = new CookieMatchPatternProperty {
All = all,
ExcludedCookies = new [] { "excludedCookies" },
IncludedCookies = new [] { "includedCookies" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Headers = new HeadersProperty {
MatchPattern = new HeaderMatchPatternProperty {
All = all,
ExcludedHeaders = new [] { "excludedHeaders" },
IncludedHeaders = new [] { "includedHeaders" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Ja3Fingerprint = new JA3FingerprintProperty {
FallbackBehavior = "fallbackBehavior"
},
JsonBody = new JsonBodyProperty {
MatchPattern = new JsonMatchPatternProperty {
All = all,
IncludedPaths = new [] { "includedPaths" }
},
MatchScope = "matchScope",
// the properties below are optional
InvalidFallbackBehavior = "invalidFallbackBehavior",
OversizeHandling = "oversizeHandling"
},
Method = method,
QueryString = queryString,
SingleHeader = singleHeader,
SingleQueryArgument = singleQueryArgument,
UriPath = uriPath
},
PositionalConstraint = "positionalConstraint",
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} },
// the properties below are optional
SearchString = "searchString",
SearchStringBase64 = "searchStringBase64"
},
GeoMatchStatement = new GeoMatchStatementProperty {
CountryCodes = new [] { "countryCodes" },
ForwardedIpConfig = new ForwardedIPConfigurationProperty {
FallbackBehavior = "fallbackBehavior",
HeaderName = "headerName"
}
},
IpSetReferenceStatement = new Dictionary<string, object> {
{ "arn", "arn" },
// the properties below are optional
{ "ipSetForwardedIpConfig", new Dictionary<string, string> {
{ "fallbackBehavior", "fallbackBehavior" },
{ "headerName", "headerName" },
{ "position", "position" }
} }
},
LabelMatchStatement = new LabelMatchStatementProperty {
Key = "key",
Scope = "scope"
},
NotStatement = new NotStatementProperty {
Statement = statementProperty_
},
OrStatement = new OrStatementProperty {
Statements = new [] { statementProperty_ }
},
RateBasedStatement = new RateBasedStatementProperty {
AggregateKeyType = "aggregateKeyType",
Limit = 123,
// the properties below are optional
CustomKeys = new [] { new RateBasedStatementCustomKeyProperty {
Cookie = new RateLimitCookieProperty {
Name = "name",
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} }
},
ForwardedIp = forwardedIp,
Header = new RateLimitHeaderProperty {
Name = "name",
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} }
},
HttpMethod = httpMethod,
Ip = ip,
LabelNamespace = new RateLimitLabelNamespaceProperty {
Namespace = "namespace"
},
QueryArgument = new RateLimitQueryArgumentProperty {
Name = "name",
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} }
},
QueryString = new RateLimitQueryStringProperty {
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} }
},
UriPath = new RateLimitUriPathProperty {
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} }
}
} },
EvaluationWindowSec = 123,
ForwardedIpConfig = new ForwardedIPConfigurationProperty {
FallbackBehavior = "fallbackBehavior",
HeaderName = "headerName"
},
ScopeDownStatement = statementProperty_
},
RegexMatchStatement = new RegexMatchStatementProperty {
FieldToMatch = new FieldToMatchProperty {
AllQueryArguments = allQueryArguments,
Body = new BodyProperty {
OversizeHandling = "oversizeHandling"
},
Cookies = new CookiesProperty {
MatchPattern = new CookieMatchPatternProperty {
All = all,
ExcludedCookies = new [] { "excludedCookies" },
IncludedCookies = new [] { "includedCookies" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Headers = new HeadersProperty {
MatchPattern = new HeaderMatchPatternProperty {
All = all,
ExcludedHeaders = new [] { "excludedHeaders" },
IncludedHeaders = new [] { "includedHeaders" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Ja3Fingerprint = new JA3FingerprintProperty {
FallbackBehavior = "fallbackBehavior"
},
JsonBody = new JsonBodyProperty {
MatchPattern = new JsonMatchPatternProperty {
All = all,
IncludedPaths = new [] { "includedPaths" }
},
MatchScope = "matchScope",
// the properties below are optional
InvalidFallbackBehavior = "invalidFallbackBehavior",
OversizeHandling = "oversizeHandling"
},
Method = method,
QueryString = queryString,
SingleHeader = singleHeader,
SingleQueryArgument = singleQueryArgument,
UriPath = uriPath
},
RegexString = "regexString",
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} }
},
RegexPatternSetReferenceStatement = new RegexPatternSetReferenceStatementProperty {
Arn = "arn",
FieldToMatch = new FieldToMatchProperty {
AllQueryArguments = allQueryArguments,
Body = new BodyProperty {
OversizeHandling = "oversizeHandling"
},
Cookies = new CookiesProperty {
MatchPattern = new CookieMatchPatternProperty {
All = all,
ExcludedCookies = new [] { "excludedCookies" },
IncludedCookies = new [] { "includedCookies" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Headers = new HeadersProperty {
MatchPattern = new HeaderMatchPatternProperty {
All = all,
ExcludedHeaders = new [] { "excludedHeaders" },
IncludedHeaders = new [] { "includedHeaders" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Ja3Fingerprint = new JA3FingerprintProperty {
FallbackBehavior = "fallbackBehavior"
},
JsonBody = new JsonBodyProperty {
MatchPattern = new JsonMatchPatternProperty {
All = all,
IncludedPaths = new [] { "includedPaths" }
},
MatchScope = "matchScope",
// the properties below are optional
InvalidFallbackBehavior = "invalidFallbackBehavior",
OversizeHandling = "oversizeHandling"
},
Method = method,
QueryString = queryString,
SingleHeader = singleHeader,
SingleQueryArgument = singleQueryArgument,
UriPath = uriPath
},
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} }
},
SizeConstraintStatement = new SizeConstraintStatementProperty {
ComparisonOperator = "comparisonOperator",
FieldToMatch = new FieldToMatchProperty {
AllQueryArguments = allQueryArguments,
Body = new BodyProperty {
OversizeHandling = "oversizeHandling"
},
Cookies = new CookiesProperty {
MatchPattern = new CookieMatchPatternProperty {
All = all,
ExcludedCookies = new [] { "excludedCookies" },
IncludedCookies = new [] { "includedCookies" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Headers = new HeadersProperty {
MatchPattern = new HeaderMatchPatternProperty {
All = all,
ExcludedHeaders = new [] { "excludedHeaders" },
IncludedHeaders = new [] { "includedHeaders" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Ja3Fingerprint = new JA3FingerprintProperty {
FallbackBehavior = "fallbackBehavior"
},
JsonBody = new JsonBodyProperty {
MatchPattern = new JsonMatchPatternProperty {
All = all,
IncludedPaths = new [] { "includedPaths" }
},
MatchScope = "matchScope",
// the properties below are optional
InvalidFallbackBehavior = "invalidFallbackBehavior",
OversizeHandling = "oversizeHandling"
},
Method = method,
QueryString = queryString,
SingleHeader = singleHeader,
SingleQueryArgument = singleQueryArgument,
UriPath = uriPath
},
Size = 123,
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} }
},
SqliMatchStatement = new SqliMatchStatementProperty {
FieldToMatch = new FieldToMatchProperty {
AllQueryArguments = allQueryArguments,
Body = new BodyProperty {
OversizeHandling = "oversizeHandling"
},
Cookies = new CookiesProperty {
MatchPattern = new CookieMatchPatternProperty {
All = all,
ExcludedCookies = new [] { "excludedCookies" },
IncludedCookies = new [] { "includedCookies" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Headers = new HeadersProperty {
MatchPattern = new HeaderMatchPatternProperty {
All = all,
ExcludedHeaders = new [] { "excludedHeaders" },
IncludedHeaders = new [] { "includedHeaders" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Ja3Fingerprint = new JA3FingerprintProperty {
FallbackBehavior = "fallbackBehavior"
},
JsonBody = new JsonBodyProperty {
MatchPattern = new JsonMatchPatternProperty {
All = all,
IncludedPaths = new [] { "includedPaths" }
},
MatchScope = "matchScope",
// the properties below are optional
InvalidFallbackBehavior = "invalidFallbackBehavior",
OversizeHandling = "oversizeHandling"
},
Method = method,
QueryString = queryString,
SingleHeader = singleHeader,
SingleQueryArgument = singleQueryArgument,
UriPath = uriPath
},
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} },
// the properties below are optional
SensitivityLevel = "sensitivityLevel"
},
XssMatchStatement = new XssMatchStatementProperty {
FieldToMatch = new FieldToMatchProperty {
AllQueryArguments = allQueryArguments,
Body = new BodyProperty {
OversizeHandling = "oversizeHandling"
},
Cookies = new CookiesProperty {
MatchPattern = new CookieMatchPatternProperty {
All = all,
ExcludedCookies = new [] { "excludedCookies" },
IncludedCookies = new [] { "includedCookies" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Headers = new HeadersProperty {
MatchPattern = new HeaderMatchPatternProperty {
All = all,
ExcludedHeaders = new [] { "excludedHeaders" },
IncludedHeaders = new [] { "includedHeaders" }
},
MatchScope = "matchScope",
OversizeHandling = "oversizeHandling"
},
Ja3Fingerprint = new JA3FingerprintProperty {
FallbackBehavior = "fallbackBehavior"
},
JsonBody = new JsonBodyProperty {
MatchPattern = new JsonMatchPatternProperty {
All = all,
IncludedPaths = new [] { "includedPaths" }
},
MatchScope = "matchScope",
// the properties below are optional
InvalidFallbackBehavior = "invalidFallbackBehavior",
OversizeHandling = "oversizeHandling"
},
Method = method,
QueryString = queryString,
SingleHeader = singleHeader,
SingleQueryArgument = singleQueryArgument,
UriPath = uriPath
},
TextTransformations = new [] { new TextTransformationProperty {
Priority = 123,
Type = "type"
} }
}
},
VisibilityConfig = new VisibilityConfigProperty {
CloudWatchMetricsEnabled = false,
MetricName = "metricName",
SampledRequestsEnabled = false
},
// the properties below are optional
Action = new RuleActionProperty {
Allow = allow,
Block = block,
Captcha = captcha,
Challenge = challenge,
Count = count
},
CaptchaConfig = new CaptchaConfigProperty {
ImmunityTimeProperty = new ImmunityTimePropertyProperty {
ImmunityTime = 123
}
},
ChallengeConfig = new ChallengeConfigProperty {
ImmunityTimeProperty = new ImmunityTimePropertyProperty {
ImmunityTime = 123
}
},
RuleLabels = new [] { new LabelProperty {
Name = "name"
} }
} },
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} }
});
Synopsis
Constructors
CfnRuleGroup(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnRuleGroup(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CfnRuleGroup(Construct, String, ICfnRuleGroupProps) |
Properties
AttrArn | The Amazon Resource Name (ARN) of the rule group. |
AttrId | The ID of the rule group. |
AttrLabelNamespace | The label namespace prefix for this rule group. |
AvailableLabels | The labels that one or more rules in this rule group add to matching web requests. |
Capacity | The web ACL capacity units (WCUs) required for this rule group. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
ConsumedLabels | The labels that one or more rules in this rule group match against in label match statements. |
CustomResponseBodies | A map of custom response keys and content bodies. |
Description | A description of the rule group that helps with identification. |
Name | The name of the rule group. |
Rules | The rule statements used to identify the web requests that you want to allow, block, or count. |
Scope | Specifies whether this is for an Amazon CloudFront distribution or for a regional application. |
Tags | Tag Manager which manages the tags for this resource. |
TagsRaw | Key:value pairs associated with an AWS resource. |
VisibilityConfig | Defines and enables Amazon CloudWatch metrics and web request sample collection. |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnRuleGroup(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnRuleGroup(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnRuleGroup(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnRuleGroup(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CfnRuleGroup(Construct, String, ICfnRuleGroupProps)
public CfnRuleGroup(Construct scope, string id, ICfnRuleGroupProps props)
Parameters
- scope Constructs.Construct
Scope in which this resource is defined.
- id System.String
Construct identifier for this resource (unique in its scope).
- props ICfnRuleGroupProps
Resource properties.
Properties
AttrArn
The Amazon Resource Name (ARN) of the rule group.
public virtual string AttrArn { get; }
Property Value
System.String
Remarks
CloudformationAttribute: Arn
AttrId
The ID of the rule group.
public virtual string AttrId { get; }
Property Value
System.String
Remarks
CloudformationAttribute: Id
AttrLabelNamespace
The label namespace prefix for this rule group.
public virtual string AttrLabelNamespace { get; }
Property Value
System.String
Remarks
All labels added by rules in this rule group have this prefix.
The syntax for the label namespace prefix for a rule group is the following: awswaf:<account ID>:rule group:<rule group name>:
When a rule with a label matches a web request, AWS WAF adds the fully qualified label to the request. A fully qualified label is made up of the label namespace from the rule group or web ACL where the rule is defined and the label from the rule, separated by a colon.
CloudformationAttribute: LabelNamespace
AvailableLabels
The labels that one or more rules in this rule group add to matching web requests.
public virtual object AvailableLabels { get; set; }
Property Value
System.Object
Capacity
The web ACL capacity units (WCUs) required for this rule group.
public virtual double Capacity { get; set; }
Property Value
System.Double
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
ConsumedLabels
The labels that one or more rules in this rule group match against in label match statements.
public virtual object ConsumedLabels { get; set; }
Property Value
System.Object
CustomResponseBodies
A map of custom response keys and content bodies.
public virtual object CustomResponseBodies { get; set; }
Property Value
System.Object
Description
A description of the rule group that helps with identification.
public virtual string Description { get; set; }
Property Value
System.String
Name
The name of the rule group.
public virtual string Name { get; set; }
Property Value
System.String
Rules
The rule statements used to identify the web requests that you want to allow, block, or count.
public virtual object Rules { get; set; }
Property Value
System.Object
Scope
Specifies whether this is for an Amazon CloudFront distribution or for a regional application.
public virtual string Scope { get; set; }
Property Value
System.String
Tags
Tag Manager which manages the tags for this resource.
public virtual TagManager Tags { get; }
Property Value
TagsRaw
Key:value pairs associated with an AWS resource.
public virtual ICfnTag[] TagsRaw { get; set; }
Property Value
ICfnTag[]
VisibilityConfig
Defines and enables Amazon CloudWatch metrics and web request sample collection.
public virtual object VisibilityConfig { get; set; }
Property Value
System.Object
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>