Skip to content
v2.275.0

RemovalPolicies Class ​

Manages removal policies for all resources within a construct scope, overriding any existing policies by default.

Example ​

ts
import * as cdk from 'aws-cdk-lib';
declare const cluster: eks.Cluster;

cdk.RemovalPolicies.of(cluster.openIdConnectProvider).apply(cdk.RemovalPolicy.RETAIN);

Methods ​

apply(policy: RemovalPolicy, props?: RemovalPolicyProps): voiddef apply(self, policy: RemovalPolicy, props: typing.Optional[RemovalPolicyProps] = None) -> Nonepublic void apply(RemovalPolicy policy, RemovalPolicyProps props)public void Apply(RemovalPolicy policy, RemovalPolicyProps? props = null)func Apply(Policy RemovalPolicy, Props RemovalPolicyProps)#
Apply a removal policy to all resources within this scope, overriding any existing policies.
2 parameters

Parameters

  • policypolicypolicypolicyPolicy — The removal policy to apply.
  • propspropspropspropsProps — Configuration options.
destroy(props?: RemovalPolicyProps): voiddef destroy(self, props: typing.Optional[RemovalPolicyProps] = None) -> Nonepublic void destroy(RemovalPolicyProps props)public void Destroy(RemovalPolicyProps? props = null)func Destroy(Props RemovalPolicyProps)#
Apply DESTROY removal policy to all resources within this scope.
1 parameter

Parameters

  • propspropspropspropsProps — Configuration options.
of(scope: IConstruct): RemovalPolicies // chainable@staticmethod def of(scope: IConstruct) -> RemovalPoliciespublic static RemovalPolicies of(IConstruct scope)public static RemovalPolicies Of(IConstruct scope)func Of(Scope IConstruct) RemovalPoliciesstatic#
Returns the removal policies API for the given scope.
1 parameter

Parameters

  • scopescopescopescopeScope — The scope.
retain(props?: RemovalPolicyProps): voiddef retain(self, props: typing.Optional[RemovalPolicyProps] = None) -> Nonepublic void retain(RemovalPolicyProps props)public void Retain(RemovalPolicyProps? props = null)func Retain(Props RemovalPolicyProps)#
Apply RETAIN removal policy to all resources within this scope.
1 parameter

Parameters

  • propspropspropspropsProps — Configuration options.
retainOnUpdateOrDelete(props?: RemovalPolicyProps): voiddef retain_on_update_or_delete(self, props: typing.Optional[RemovalPolicyProps] = None) -> Nonepublic void retainOnUpdateOrDelete(RemovalPolicyProps props)public void RetainOnUpdateOrDelete(RemovalPolicyProps? props = null)func RetainOnUpdateOrDelete(Props RemovalPolicyProps)#
Apply RETAIN_ON_UPDATE_OR_DELETE removal policy to all resources within this scope.
1 parameter

Parameters

  • propspropspropspropsProps — Configuration options.
snapshot(props?: RemovalPolicyProps): voiddef snapshot(self, props: typing.Optional[RemovalPolicyProps] = None) -> Nonepublic void snapshot(RemovalPolicyProps props)public void Snapshot(RemovalPolicyProps? props = null)func Snapshot(Props RemovalPolicyProps)#
Apply SNAPSHOT removal policy to all resources within this scope.
1 parameter

Parameters

  • propspropspropspropsProps — Configuration options.