@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:35.840Z") @Stability(value=Stable) public class CfnResource extends CfnRefElement
Example:
// Example automatically generated from non-compiling source. May contain errors.
Bucket bucket;
CfnResource cfnBucket = (CfnResource)bucket.node.findChild("Resource");
cfnBucket.applyRemovalPolicy(RemovalPolicy.DESTROY);
| Modifier and Type | Class and Description |
|---|---|
static class |
CfnResource.Builder
A fluent builder for
CfnResource. |
| Modifier | Constructor and Description |
|---|---|
|
CfnResource(software.constructs.Construct scope,
String id,
CfnResourceProps props)
Creates a resource construct.
|
protected |
CfnResource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnResource(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDeletionOverride(String path)
Syntactic sugar for `addOverride(path, undefined)`.
|
void |
addDependsOn(CfnResource target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
|
void |
addMetadata(String key,
Object value)
Add a value to the CloudFormation Resource Metadata.
|
void |
addOverride(String path,
Object value)
Adds an override to the synthesized CloudFormation resource.
|
void |
addPropertyDeletionOverride(String propertyPath)
Adds an override that deletes the value of a property from the resource definition.
|
void |
addPropertyOverride(String propertyPath,
Object value)
Adds an override to a resource property.
|
void |
applyRemovalPolicy()
Sets the deletion policy of the resource based on the removal policy specified.
|
void |
applyRemovalPolicy(RemovalPolicy policy)
Sets the deletion policy of the resource based on the removal policy specified.
|
void |
applyRemovalPolicy(RemovalPolicy policy,
RemovalPolicyOptions options)
Sets the deletion policy of the resource based on the removal policy specified.
|
Reference |
getAtt(String attributeName)
Returns a token for an runtime attribute of this resource.
|
ICfnResourceOptions |
getCfnOptions()
Options for this resource, such as condition, update policy etc.
|
protected Map<String,Object> |
getCfnProperties() |
String |
getCfnResourceType()
AWS resource type.
|
Object |
getMetadata(String key)
Retrieve a value value from the CloudFormation Resource Metadata.
|
protected Map<String,Object> |
getUpdatedProperites()
Deprecated.
use `updatedProperties`
Return properties modified after initiation
Resources that expose mutable properties should override this function to
collect and return the properties object for this resource.
|
protected Map<String,Object> |
getUpdatedProperties()
Return properties modified after initiation.
|
static Boolean |
isCfnResource(software.constructs.IConstruct construct)
Check whether the given construct is a CfnResource.
|
protected Map<String,Object> |
renderProperties(Map<String,Object> props) |
protected Boolean |
shouldSynthesize()
Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template.
|
String |
toString()
Returns a string representation of this construct.
|
protected void |
validateProperties(Object _properties) |
getRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected CfnResource(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnResource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnResource(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
CfnResourceProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public static Boolean isCfnResource(@NotNull software.constructs.IConstruct construct)
construct - This parameter is required.@Stability(value=Stable)
public void addDeletionOverride(@NotNull
String path)
path - The path of the value to delete. This parameter is required.@Stability(value=Stable)
public void addDependsOn(@NotNull
CfnResource target)
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
target - This parameter is required.@Stability(value=Stable)
public void addMetadata(@NotNull
String key,
@NotNull
Object value)
key - This parameter is required.value - This parameter is required.@Stability(value=Stable)
public void addOverride(@NotNull
String path,
@NotNull
Object value)
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,
// Example automatically generated from non-compiling source. May contain errors.
cfnResource.addOverride("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", List.of("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.
path - - The path of the property, you can use dot notation to override values in complex types. This parameter is required.value - - The value. This parameter is required.@Stability(value=Stable)
public void addPropertyDeletionOverride(@NotNull
String propertyPath)
propertyPath - The path to the property. This parameter is required.@Stability(value=Stable)
public void addPropertyOverride(@NotNull
String propertyPath,
@NotNull
Object value)
Syntactic sugar for addOverride("Properties.<...>", value).
propertyPath - The path of the property. This parameter is required.value - The value. This parameter is required.@Stability(value=Stable)
public void applyRemovalPolicy(@Nullable
RemovalPolicy policy,
@Nullable
RemovalPolicyOptions options)
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:
policy - options - @Stability(value=Stable)
public void applyRemovalPolicy(@Nullable
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). 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:
@Stability(value=Stable) public void applyRemovalPolicy()
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:
@Stability(value=Stable) @NotNull public Reference getAtt(@NotNull String attributeName)
Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility
in case there is no generated attribute.
attributeName - The name of the attribute. This parameter is required.@Stability(value=Stable) @NotNull public Object getMetadata(@NotNull String key)
key - This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
props - This parameter is required.@Stability(value=Stable) @NotNull protected Boolean shouldSynthesize()
@Stability(value=Stable) @NotNull public String toString()
toString in class software.constructs.Construct@Stability(value=Stable)
protected void validateProperties(@NotNull
Object _properties)
_properties - This parameter is required.@Stability(value=Stable) @NotNull public ICfnResourceOptions getCfnOptions()
@Stability(value=Stable) @NotNull public String getCfnResourceType()
@Stability(value=Deprecated) @Deprecated @NotNull protected Map<String,Object> getUpdatedProperites()
Copyright © 2022. All rights reserved.