Package software.amazon.awscdk
Interface RemovalPolicyProps
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
RemovalPolicyProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:31.045Z")
@Stability(Stable)
public interface RemovalPolicyProps
extends software.amazon.jsii.JsiiSerializable
Properties for applying a removal policy.
Example:
Construct scope;
Construct parent;
CfnBucket bucket;
// Apply DESTROY policy to all resources in a scope
RemovalPolicies.of(scope).destroy();
// Apply RETAIN policy to all resources in a scope
RemovalPolicies.of(scope).retain();
// Apply SNAPSHOT policy to all resources in a scope
RemovalPolicies.of(scope).snapshot();
// Apply RETAIN_ON_UPDATE_OR_DELETE policy to all resources in a scope
RemovalPolicies.of(scope).retainOnUpdateOrDelete();
// Apply RETAIN policy only to specific resource types
RemovalPolicies.of(parent).retain(RemovalPolicyProps.builder()
.applyToResourceTypes(List.of("AWS::DynamoDB::Table", bucket.getCfnResourceType(), CfnDBInstance.CFN_RESOURCE_TYPE_NAME))
.build());
// Apply SNAPSHOT policy excluding specific resource types
RemovalPolicies.of(scope).snapshot(RemovalPolicyProps.builder()
.excludeResourceTypes(List.of("AWS::Test::Resource"))
.build());
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forRemovalPolicyPropsstatic final classAn implementation forRemovalPolicyProps -
Method Summary
Modifier and TypeMethodDescriptionstatic RemovalPolicyProps.Builderbuilder()Apply the removal policy only to specific resource types.Exclude specific resource types from the removal policy.default NumberThe priority to use when applying this policy.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getApplyToResourceTypes
Apply the removal policy only to specific resource types.Can be a CloudFormation resource type string (e.g., 'AWS::S3::Bucket').
Default: - apply to all resources
-
getExcludeResourceTypes
Exclude specific resource types from the removal policy.Can be a CloudFormation resource type string (e.g., 'AWS::S3::Bucket').
Default: - no exclusions
-
getPriority
The priority to use when applying this policy.The priority affects only the order in which aspects are applied during synthesis. For RemovalPolicies, the last applied policy will override previous ones.
NOTE: Priority does NOT determine which policy "wins" when there are conflicts. The order of application determines the final policy, with later policies overriding earlier ones.
Default: - AspectPriority.MUTATING
-
builder
- Returns:
- a
RemovalPolicyProps.BuilderofRemovalPolicyProps
-