import { WafGeoRestrictRuleGroup } from '@gammarers/aws-waf-geo-restriction-rule-group'
new WafGeoRestrictRuleGroup(scope: Construct, id: string, props: WafGeoRestrictRuleGroupProps)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
Specifies whether this is for an Amazon CloudFront distribution or for a regional application. |
id |
string |
No description. |
props |
WafGeoRestrictRuleGroupProps |
No description. |
- Type: constructs.Construct
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
and REGIONAL
.
For
CLOUDFRONT
, you must create your WAFv2 resources in the US East (N. Virginia) Region,us-east-1
.
- Type: string
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
overrideLogicalId |
Overrides the auto-generated logical ID with a specific ID. |
addDeletionOverride |
Syntactic sugar for addOverride(path, undefined) . |
addDependency |
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. |
addDependsOn |
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. |
addMetadata |
Add a value to the CloudFormation Resource Metadata. |
addOverride |
Adds an override to the synthesized CloudFormation resource. |
addPropertyDeletionOverride |
Adds an override that deletes the value of a property from the resource definition. |
addPropertyOverride |
Adds an override to a resource property. |
applyRemovalPolicy |
Sets the deletion policy of the resource based on the removal policy specified. |
getAtt |
Returns a token for an runtime attribute of this resource. |
getMetadata |
Retrieve a value value from the CloudFormation Resource Metadata. |
obtainDependencies |
Retrieves an array of resources this resource depends on. |
obtainResourceDependencies |
Get a shallow copy of dependencies between this resource and other resources in the same stack. |
removeDependency |
Indicates that this resource no longer depends on another resource. |
replaceDependency |
Replaces one dependency with another. |
inspect |
Examines the CloudFormation resource and discloses attributes. |
public toString(): string
Returns a string representation of this construct.
public overrideLogicalId(newLogicalId: string): void
Overrides the auto-generated logical ID with a specific ID.
- Type: string
The new logical ID to use for this stack element.
public addDeletionOverride(path: string): void
Syntactic sugar for addOverride(path, undefined)
.
- Type: string
The path of the value to delete.
public addDependency(target: CfnResource): void
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Type: aws-cdk-lib.CfnResource
public addDependsOn(target: CfnResource): void
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Type: aws-cdk-lib.CfnResource
public addMetadata(key: string, value: any): void
Add a value to the CloudFormation Resource Metadata.
[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)
- Type: string
- Type: any
public addOverride(path: string, value: any): void
Adds an override to the synthesized CloudFormation resource.
To add a
property override, either use addPropertyOverride
or prefix path
with
"Properties." (i.e. Properties.TopicName
).
If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal .
in the property name, prefix with a \
. In most
programming languages you will need to write this as "\\."
because the
\
itself will need to be escaped.
For example,
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
would add the overrides
"Properties": {
"GlobalSecondaryIndexes": [
{
"Projection": {
"NonKeyAttributes": [ "myattribute" ]
...
}
...
},
{
"ProjectionType": "INCLUDE"
...
},
]
...
}
The value
argument to addOverride
will not be processed or translated
in any way. Pass raw JSON values in here with the correct capitalization
for CloudFormation. If you pass CDK classes or structs, they will be
rendered with lowercased key names, and CloudFormation will reject the
template.
- Type: string
The path of the property, you can use dot notation to override values in complex types.
Any intermediate keys will be created as needed.
- Type: any
The value.
Could be primitive or complex.
public addPropertyDeletionOverride(propertyPath: string): void
Adds an override that deletes the value of a property from the resource definition.
- Type: string
The path to the property.
public addPropertyOverride(propertyPath: string, value: any): void
Adds an override to a resource property.
Syntactic sugar for addOverride("Properties.<...>", value)
.
- Type: string
The path of the property.
- Type: any
The value.
public applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
). In some
cases, a snapshot can be taken of the resource prior to deletion
(RemovalPolicy.SNAPSHOT
). A list of resources that support this policy
can be found in the following link:
- Type: aws-cdk-lib.RemovalPolicy
- Type: aws-cdk-lib.RemovalPolicyOptions
public getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Reference
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g. resource.arn
), but this can be used for future compatibility
in case there is no generated attribute.
- Type: string
The name of the attribute.
- Type: aws-cdk-lib.ResolutionTypeHint
public getMetadata(key: string): any
Retrieve a value value from the CloudFormation Resource Metadata.
[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)
- Type: string
public obtainDependencies(): Stack | CfnResource[]
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
public obtainResourceDependencies(): CfnResource[]
Get a shallow copy of dependencies between this resource and other resources in the same stack.
public removeDependency(target: CfnResource): void
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Type: aws-cdk-lib.CfnResource
public replaceDependency(target: CfnResource, newTarget: CfnResource): void
Replaces one dependency with another.
- Type: aws-cdk-lib.CfnResource
The dependency to replace.
- Type: aws-cdk-lib.CfnResource
The new dependency to add.
public inspect(inspector: TreeInspector): void
Examines the CloudFormation resource and discloses attributes.
- Type: aws-cdk-lib.TreeInspector
tree inspector to collect and process attributes.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isCfnElement |
Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template). |
isCfnResource |
Check whether the given construct is a CfnResource. |
import { WafGeoRestrictRuleGroup } from '@gammarers/aws-waf-geo-restriction-rule-group'
WafGeoRestrictRuleGroup.isConstruct(x: any)
Checks if x
is a construct.
- Type: any
Any object.
import { WafGeoRestrictRuleGroup } from '@gammarers/aws-waf-geo-restriction-rule-group'
WafGeoRestrictRuleGroup.isCfnElement(x: any)
Returns true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of instanceof
to allow stack elements from different
versions of this library to be included in the same stack.
- Type: any
import { WafGeoRestrictRuleGroup } from '@gammarers/aws-waf-geo-restriction-rule-group'
WafGeoRestrictRuleGroup.isCfnResource(construct: IConstruct)
Check whether the given construct is a CfnResource.
- Type: constructs.IConstruct
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
creationStack |
string[] |
No description. |
logicalId |
string |
The logical ID for this CloudFormation stack element. |
stack |
aws-cdk-lib.Stack |
The stack in which this element is defined. |
ref |
string |
Return a string that will be resolved to a CloudFormation { Ref } for this element. |
cfnOptions |
aws-cdk-lib.ICfnResourceOptions |
Options for this resource, such as condition, update policy etc. |
cfnResourceType |
string |
AWS resource type. |
attrArn |
string |
The Amazon Resource Name (ARN) of the rule group. |
attrId |
string |
The ID of the rule group. |
attrLabelNamespace |
string |
The label namespace prefix for this rule group. |
tags |
aws-cdk-lib.TagManager |
Key:value pairs associated with an AWS resource. |
capacity |
number |
The web ACL capacity units (WCUs) required for this rule group. |
scope |
string |
Specifies whether this is for an Amazon CloudFront distribution or for a regional application. |
visibilityConfig |
aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnRuleGroup.VisibilityConfigProperty |
Defines and enables Amazon CloudWatch metrics and web request sample collection. |
availableLabels |
aws-cdk-lib.IResolvable | aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnRuleGroup.LabelSummaryProperty[] |
The labels that one or more rules in this rule group add to matching web requests. |
consumedLabels |
aws-cdk-lib.IResolvable | aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnRuleGroup.LabelSummaryProperty[] |
The labels that one or more rules in this rule group match against in label match statements. |
customResponseBodies |
aws-cdk-lib.IResolvable | {[ key: string ]: aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnRuleGroup.CustomResponseBodyProperty} |
A map of custom response keys and content bodies. |
description |
string |
A description of the rule group that helps with identification. |
name |
string |
The name of the rule group. |
rules |
aws-cdk-lib.IResolvable | aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnRuleGroup.RuleProperty[] |
The rule statements used to identify the web requests that you want to allow, block, or count. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly creationStack: string[];
- Type: string[]
public readonly logicalId: string;
- Type: string
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use overrideLogicalId(newLogicalId)
.
public readonly stack: Stack;
- Type: aws-cdk-lib.Stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
public readonly ref: string;
- Type: string
Return a string that will be resolved to a CloudFormation { Ref }
for this element.
If, by any chance, the intrinsic reference of a resource is not a string, you could
coerce it to an IResolvable through Lazy.any({ produce: resource.ref })
.
public readonly cfnOptions: ICfnResourceOptions;
- Type: aws-cdk-lib.ICfnResourceOptions
Options for this resource, such as condition, update policy etc.
public readonly cfnResourceType: string;
- Type: string
AWS resource type.
public readonly attrArn: string;
- Type: string
The Amazon Resource Name (ARN) of the rule group.
public readonly attrId: string;
- Type: string
The ID of the rule group.
public readonly attrLabelNamespace: string;
- Type: string
The label namespace prefix for this rule group.
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.
public readonly tags: TagManager;
- Type: aws-cdk-lib.TagManager
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.
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.
public readonly capacity: number;
- Type: number
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.
public readonly scope: string;
- Type: string
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
and REGIONAL
.
For
CLOUDFRONT
, you must create your WAFv2 resources in the US East (N. Virginia) Region,us-east-1
.
public readonly visibilityConfig: IResolvable | VisibilityConfigProperty;
- Type: aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnRuleGroup.VisibilityConfigProperty
Defines and enables Amazon CloudWatch metrics and web request sample collection.
public readonly availableLabels: IResolvable | IResolvable | LabelSummaryProperty[];
- Type: aws-cdk-lib.IResolvable | aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnRuleGroup.LabelSummaryProperty[]
The labels that one or more rules in this rule group add to matching web requests.
These labels are defined in the RuleLabels
for a Rule
.
public readonly consumedLabels: IResolvable | IResolvable | LabelSummaryProperty[];
- Type: aws-cdk-lib.IResolvable | aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnRuleGroup.LabelSummaryProperty[]
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 the Statement
definition of a rule.
public readonly customResponseBodies: IResolvable | {[ key: string ]: IResolvable | CustomResponseBodyProperty};
- Type: aws-cdk-lib.IResolvable | {[ key: string ]: aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnRuleGroup.CustomResponseBodyProperty}
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 .
public readonly description: string;
- Type: string
A description of the rule group that helps with identification.
public readonly name: string;
- Type: string
The name of the rule group.
You cannot change the name of a rule group after you create it.
public readonly rules: IResolvable | IResolvable | RuleProperty[];
- Type: aws-cdk-lib.IResolvable | aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnRuleGroup.RuleProperty[]
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.
Name | Type | Description |
---|---|---|
CFN_RESOURCE_TYPE_NAME |
string |
The CloudFormation resource type name for this resource class. |
public readonly CFN_RESOURCE_TYPE_NAME: string;
- Type: string
The CloudFormation resource type name for this resource class.
import { IpRateLimitingProperty } from '@gammarers/aws-waf-geo-restriction-rule-group'
const ipRateLimitingProperty: IpRateLimitingProperty = { ... }
Name | Type | Description |
---|---|---|
count |
number |
No description. |
enable |
boolean |
No description. |
public readonly count: number;
- Type: number
public readonly enable: boolean;
- Type: boolean
import { WafGeoRestrictRuleGroupProps } from '@gammarers/aws-waf-geo-restriction-rule-group'
const wafGeoRestrictRuleGroupProps: WafGeoRestrictRuleGroupProps = { ... }
Name | Type | Description |
---|---|---|
allowCountries |
string[] |
No description. |
scope |
Scope |
No description. |
allowIpSetArn |
string |
No description. |
ipRateLimiting |
IpRateLimitingProperty |
No description. |
name |
string |
No description. |
public readonly allowCountries: string[];
- Type: string[]
public readonly scope: Scope;
- Type: Scope
public readonly allowIpSetArn: string;
- Type: string
public readonly ipRateLimiting: IpRateLimitingProperty;
- Type: IpRateLimitingProperty
public readonly name: string;
- Type: string
Name | Description |
---|---|
GLOBAL |
No description. |
REGIONAL |
No description. |