Skip to content

Latest commit

 

History

History
989 lines (602 loc) · 44.4 KB

File metadata and controls

989 lines (602 loc) · 44.4 KB

API Reference

Constructs

WafGeoRestrictRuleGroup

Initializers

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.

scopeRequired
  • 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 .


idRequired
  • Type: string

propsRequired

Methods

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.

toString
public toString(): string

Returns a string representation of this construct.

overrideLogicalId
public overrideLogicalId(newLogicalId: string): void

Overrides the auto-generated logical ID with a specific ID.

newLogicalIdRequired
  • Type: string

The new logical ID to use for this stack element.


addDeletionOverride
public addDeletionOverride(path: string): void

Syntactic sugar for addOverride(path, undefined).

pathRequired
  • Type: string

The path of the value to delete.


addDependency
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.

targetRequired
  • Type: aws-cdk-lib.CfnResource

addDependsOn
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.

targetRequired
  • Type: aws-cdk-lib.CfnResource

addMetadata
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.)

keyRequired
  • Type: string

valueRequired
  • Type: any

addOverride
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.

pathRequired
  • 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.


valueRequired
  • Type: any

The value.

Could be primitive or complex.


addPropertyDeletionOverride
public addPropertyDeletionOverride(propertyPath: string): void

Adds an override that deletes the value of a property from the resource definition.

propertyPathRequired
  • Type: string

The path to the property.


addPropertyOverride
public addPropertyOverride(propertyPath: string, value: any): void

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

propertyPathRequired
  • Type: string

The path of the property.


valueRequired
  • Type: any

The value.


applyRemovalPolicy
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:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options

policyOptional
  • Type: aws-cdk-lib.RemovalPolicy

optionsOptional
  • Type: aws-cdk-lib.RemovalPolicyOptions

getAtt
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.

attributeNameRequired
  • Type: string

The name of the attribute.


typeHintOptional
  • Type: aws-cdk-lib.ResolutionTypeHint

getMetadata
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.)

keyRequired
  • Type: string

obtainDependencies
public obtainDependencies(): Stack | CfnResource[]

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.

obtainResourceDependencies
public obtainResourceDependencies(): CfnResource[]

Get a shallow copy of dependencies between this resource and other resources in the same stack.

removeDependency
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.

targetRequired
  • Type: aws-cdk-lib.CfnResource

replaceDependency
public replaceDependency(target: CfnResource, newTarget: CfnResource): void

Replaces one dependency with another.

targetRequired
  • Type: aws-cdk-lib.CfnResource

The dependency to replace.


newTargetRequired
  • Type: aws-cdk-lib.CfnResource

The new dependency to add.


inspect
public inspect(inspector: TreeInspector): void

Examines the CloudFormation resource and discloses attributes.

inspectorRequired
  • Type: aws-cdk-lib.TreeInspector

tree inspector to collect and process attributes.


Static Functions

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.

isConstruct
import { WafGeoRestrictRuleGroup } from '@gammarers/aws-waf-geo-restriction-rule-group'

WafGeoRestrictRuleGroup.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


isCfnElement
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.

xRequired
  • Type: any

isCfnResource
import { WafGeoRestrictRuleGroup } from '@gammarers/aws-waf-geo-restriction-rule-group'

WafGeoRestrictRuleGroup.isCfnResource(construct: IConstruct)

Check whether the given construct is a CfnResource.

constructRequired
  • Type: constructs.IConstruct

Properties

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.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


creationStackRequired
public readonly creationStack: string[];
  • Type: string[]

logicalIdRequired
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).


stackRequired
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).


refRequired
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 }).


cfnOptionsRequired
public readonly cfnOptions: ICfnResourceOptions;
  • Type: aws-cdk-lib.ICfnResourceOptions

Options for this resource, such as condition, update policy etc.


cfnResourceTypeRequired
public readonly cfnResourceType: string;
  • Type: string

AWS resource type.


attrArnRequired
public readonly attrArn: string;
  • Type: string

The Amazon Resource Name (ARN) of the rule group.


attrIdRequired
public readonly attrId: string;
  • Type: string

The ID of the rule group.


attrLabelNamespaceRequired
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.


tagsRequired
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.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html#cfn-wafv2-rulegroup-tags


capacityRequired
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.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html#cfn-wafv2-rulegroup-capacity


scopeRequired
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 .

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html#cfn-wafv2-rulegroup-scope


visibilityConfigRequired
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.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html#cfn-wafv2-rulegroup-visibilityconfig


availableLabelsOptional
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 .

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html#cfn-wafv2-rulegroup-availablelabels


consumedLabelsOptional
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.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html#cfn-wafv2-rulegroup-consumedlabels


customResponseBodiesOptional
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 .

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html#cfn-wafv2-rulegroup-customresponsebodies


descriptionOptional
public readonly description: string;
  • Type: string

A description of the rule group that helps with identification.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html#cfn-wafv2-rulegroup-description


nameOptional
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.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html#cfn-wafv2-rulegroup-name


rulesOptional
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.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-rulegroup.html#cfn-wafv2-rulegroup-rules


Constants

Name Type Description
CFN_RESOURCE_TYPE_NAME string The CloudFormation resource type name for this resource class.

CFN_RESOURCE_TYPE_NAMERequired
public readonly CFN_RESOURCE_TYPE_NAME: string;
  • Type: string

The CloudFormation resource type name for this resource class.


Structs

IpRateLimitingProperty

Initializer

import { IpRateLimitingProperty } from '@gammarers/aws-waf-geo-restriction-rule-group'

const ipRateLimitingProperty: IpRateLimitingProperty = { ... }

Properties

Name Type Description
count number No description.
enable boolean No description.

countRequired
public readonly count: number;
  • Type: number

enableRequired
public readonly enable: boolean;
  • Type: boolean

WafGeoRestrictRuleGroupProps

Initializer

import { WafGeoRestrictRuleGroupProps } from '@gammarers/aws-waf-geo-restriction-rule-group'

const wafGeoRestrictRuleGroupProps: WafGeoRestrictRuleGroupProps = { ... }

Properties

Name Type Description
allowCountries string[] No description.
scope Scope No description.
allowIpSetArn string No description.
ipRateLimiting IpRateLimitingProperty No description.
name string No description.

allowCountriesRequired
public readonly allowCountries: string[];
  • Type: string[]

scopeRequired
public readonly scope: Scope;

allowIpSetArnOptional
public readonly allowIpSetArn: string;
  • Type: string

ipRateLimitingOptional
public readonly ipRateLimiting: IpRateLimitingProperty;

nameOptional
public readonly name: string;
  • Type: string

Enums

Scope

Members

Name Description
GLOBAL No description.
REGIONAL No description.

GLOBAL

REGIONAL