Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/aws-cdk-lib/core/lib/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { IStringProducer } from './lazy';
import { Lazy } from './lazy';
import { generatePhysicalName, isGeneratedWhenNeededMarker } from './private/physical-name-generator';
import { Reference } from './reference';
import type { RemovalPolicy } from './removal-policy';
import type { RemovalPolicy, RemovalPolicyOptions } from './removal-policy';
import type { IResolveContext } from './resolvable';
import { Stack } from './stack';
import { Token, Tokenization } from './token';
Expand All @@ -37,7 +37,7 @@ export interface IResource extends IConstruct, IEnvironmentAware {
* The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
* account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
*/
applyRemovalPolicy(policy: RemovalPolicy): void;
applyRemovalPolicy(policy: RemovalPolicy, options?: RemovalPolicyOptions): void;
}

/**
Expand Down Expand Up @@ -228,12 +228,12 @@ export abstract class Resource extends Construct implements IResource {
* The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
* account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
*/
public applyRemovalPolicy(policy: RemovalPolicy) {
public applyRemovalPolicy(policy: RemovalPolicy, options?: RemovalPolicyOptions) {
const child = this.node.defaultChild;
if (!child || !CfnResource.isCfnResource(child)) {
throw new ValidationError('CannotApplyRemovalPolicy', 'Cannot apply RemovalPolicy: no child or not a CfnResource. Apply the removal policy on the CfnResource directly.', this);
}
child.applyRemovalPolicy(policy);
child.applyRemovalPolicy(policy, options);
}

protected generatePhysicalName(): string {
Expand Down
Loading