import { P6CDKS3Protector } from 'p6-cdk-s3-protector'
new P6CDKS3Protector(scope: Construct, id: string)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
- Type: constructs.Construct
- Type: string
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
applyRemovalPolicy |
Apply the given removal policy to this resource. |
public toString(): string
Returns a string representation of this construct.
public applyRemovalPolicy(policy: RemovalPolicy): void
Apply the given removal policy to this resource.
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
).
- Type: aws-cdk-lib.RemovalPolicy
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isOwnedResource |
Returns true if the construct was created by CDK, and false otherwise. |
isResource |
Check whether the given construct is a Resource. |
import { P6CDKS3Protector } from 'p6-cdk-s3-protector'
P6CDKS3Protector.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
- Type: any
Any object.
import { P6CDKS3Protector } from 'p6-cdk-s3-protector'
P6CDKS3Protector.isOwnedResource(construct: IConstruct)
Returns true if the construct was created by CDK, and false otherwise.
- Type: constructs.IConstruct
import { P6CDKS3Protector } from 'p6-cdk-s3-protector'
P6CDKS3Protector.isResource(construct: IConstruct)
Check whether the given construct is a Resource.
- Type: constructs.IConstruct
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
env |
aws-cdk-lib.ResourceEnvironment |
The environment this resource belongs to. |
stack |
aws-cdk-lib.Stack |
The stack in which this resource is defined. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly env: ResourceEnvironment;
- Type: aws-cdk-lib.ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
public readonly stack: Stack;
- Type: aws-cdk-lib.Stack
The stack in which this resource is defined.