Class: AWSCDK::RemovalPolicyProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
removal_policy_props.rb

Overview

Properties for applying a removal policy.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(apply_to_resource_types: nil, exclude_resource_types: nil, priority: nil) ⇒ RemovalPolicyProps

Returns a new instance of RemovalPolicyProps.

Parameters:

  • apply_to_resource_types (Array<String>, nil) (defaults to: nil)

    Apply the removal policy only to specific resource types.

  • exclude_resource_types (Array<String>, nil) (defaults to: nil)

    Exclude specific resource types from the removal policy.

  • priority (Numeric, nil) (defaults to: nil)

    The priority to use when applying this policy.



10
11
12
13
14
15
16
17
# File 'removal_policy_props.rb', line 10

def initialize(apply_to_resource_types: nil, exclude_resource_types: nil, priority: nil)
  @apply_to_resource_types = apply_to_resource_types
  Jsii::Type.check_type(@apply_to_resource_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "applyToResourceTypes") unless @apply_to_resource_types.nil?
  @exclude_resource_types = exclude_resource_types
  Jsii::Type.check_type(@exclude_resource_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "excludeResourceTypes") unless @exclude_resource_types.nil?
  @priority = priority
  Jsii::Type.check_type(@priority, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "priority") unless @priority.nil?
end

Instance Attribute Details

#apply_to_resource_typesArray<String>? (readonly)

Note:

Default: - apply to all resources

Apply the removal policy only to specific resource types.

Can be a CloudFormation resource type string (e.g., 'AWS::S3::Bucket').

Returns:

  • (Array<String>, nil)


25
26
27
# File 'removal_policy_props.rb', line 25

def apply_to_resource_types
  @apply_to_resource_types
end

#exclude_resource_typesArray<String>? (readonly)

Note:

Default: - no exclusions

Exclude specific resource types from the removal policy.

Can be a CloudFormation resource type string (e.g., 'AWS::S3::Bucket').

Returns:

  • (Array<String>, nil)


32
33
34
# File 'removal_policy_props.rb', line 32

def exclude_resource_types
  @exclude_resource_types
end

#priorityNumeric? (readonly)

Note:

Default: - AspectPriority.MUTATING

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.

Returns:

  • (Numeric, nil)


44
45
46
# File 'removal_policy_props.rb', line 44

def priority
  @priority
end

Class Method Details

.jsii_propertiesObject



46
47
48
49
50
51
52
# File 'removal_policy_props.rb', line 46

def self.jsii_properties
  {
    :apply_to_resource_types => "applyToResourceTypes",
    :exclude_resource_types => "excludeResourceTypes",
    :priority => "priority",
  }
end

Instance Method Details

#to_jsiiObject



54
55
56
57
58
59
60
61
62
# File 'removal_policy_props.rb', line 54

def to_jsii
  result = {}
  result.merge!({
    "applyToResourceTypes" => @apply_to_resource_types,
    "excludeResourceTypes" => @exclude_resource_types,
    "priority" => @priority,
  })
  result.compact
end