@Generated(value="jsii-pacmak/1.52.1 (build 5ccc8f6)", date="2022-01-20T19:49:54.182Z") @Stability(value=Stable) public abstract class Resource extends Construct implements IResource
Example:
import software.amazon.awscdk.core.*; public class MyConstruct extends Resource implements ITaggable { public final Object tags; public MyConstruct(Construct scope, String id) { super(scope, id); CfnResource.Builder.create(this, "Resource") .type("Whatever::The::Type") .properties(Map.of( // ... "Tags", this.tags.getRenderedTags())) .build(); } }
software.constructs.Construct.Builder
software.amazon.jsii.JsiiObject.InitializationMode
IResource.Jsii$Default
Modifier | Constructor and Description |
---|---|
protected |
Resource(software.constructs.Construct scope,
String id) |
protected |
Resource(software.constructs.Construct scope,
String id,
ResourceProps props) |
protected |
Resource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Resource(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
void |
applyRemovalPolicy(RemovalPolicy policy)
Apply the given removal policy to this resource.
|
protected String |
generatePhysicalName() |
ResourceEnvironment |
getEnv()
The environment this resource belongs to.
|
protected String |
getPhysicalName()
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
|
protected String |
getResourceArnAttribute(String arnAttr,
ArnComponents arnComponents)
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g.
|
protected String |
getResourceNameAttribute(String nameAttr)
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g.
|
Stack |
getStack()
The stack in which this resource is defined.
|
static Boolean |
isResource(IConstruct construct)
Check whether the given construct is a Resource.
|
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getNode
protected Resource(software.amazon.jsii.JsiiObjectRef objRef)
protected Resource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) protected Resource(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable ResourceProps props)
scope
- This parameter is required.id
- This parameter is required.props
- @Stability(value=Stable) protected Resource(@NotNull software.constructs.Construct scope, @NotNull String id)
scope
- This parameter is required.id
- This parameter is required.@Stability(value=Stable) @NotNull public static Boolean isResource(@NotNull IConstruct construct)
construct
- This parameter is required.@Stability(value=Stable) public void applyRemovalPolicy(@NotNull RemovalPolicy policy)
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
).
applyRemovalPolicy
in interface IResource
policy
- This parameter is required.@Stability(value=Stable) @NotNull protected String generatePhysicalName()
@Stability(value=Stable) @NotNull protected String getResourceArnAttribute(@NotNull String arnAttr, @NotNull ArnComponents arnComponents)
Normally, this token will resolve to arnAttr
, but if the resource is
referenced across environments, arnComponents
will be used to synthesize
a concrete ARN with the resource's physical name. Make sure to reference
this.physicalName
in arnComponents
.
arnAttr
- The CFN attribute which resolves to the ARN of the resource. This parameter is required.arnComponents
- The format of the ARN of this resource. This parameter is required.@Stability(value=Stable) @NotNull protected String getResourceNameAttribute(@NotNull String nameAttr)
Normally, this token will resolve to nameAttr
, but if the resource is
referenced across environments, it will be resolved to this.physicalName
,
which will be a concrete name.
nameAttr
- The CFN attribute which resolves to the resource's name. This parameter is required.@Stability(value=Stable) @NotNull public ResourceEnvironment getEnv()
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.
@Stability(value=Stable) @NotNull protected String getPhysicalName()
This value will resolve to one of the following:
"my-awesome-bucket"
)undefined
, when a name should be generated by CloudFormationCopyright © 2022. All rights reserved.