Class CfnLifecyclePolicy

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-31T21:09:05.128Z") @Stability(Stable) public class CfnLifecyclePolicy extends CfnResource implements IInspectable, ITaggable
Specifies a lifecycle policy, which is used to automate operations on Amazon EBS resources.

The properties are required when you add a lifecycle policy and optional when you update a lifecycle policy.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.dlm.*;
 Object crossRegionCopyTargets;
 Object excludeTags;
 Object excludeVolumeTypes;
 CfnLifecyclePolicy cfnLifecyclePolicy = CfnLifecyclePolicy.Builder.create(this, "MyCfnLifecyclePolicy")
         .copyTags(false)
         .createInterval(123)
         .crossRegionCopyTargets(crossRegionCopyTargets)
         .defaultPolicy("defaultPolicy")
         .description("description")
         .exclusions(ExclusionsProperty.builder()
                 .excludeBootVolumes(false)
                 .excludeTags(excludeTags)
                 .excludeVolumeTypes(excludeVolumeTypes)
                 .build())
         .executionRoleArn("executionRoleArn")
         .extendDeletion(false)
         .policyDetails(PolicyDetailsProperty.builder()
                 .actions(List.of(ActionProperty.builder()
                         .crossRegionCopy(List.of(CrossRegionCopyActionProperty.builder()
                                 .encryptionConfiguration(EncryptionConfigurationProperty.builder()
                                         .encrypted(false)
                                         // the properties below are optional
                                         .cmkArn("cmkArn")
                                         .build())
                                 .target("target")
                                 // the properties below are optional
                                 .retainRule(CrossRegionCopyRetainRuleProperty.builder()
                                         .interval(123)
                                         .intervalUnit("intervalUnit")
                                         .build())
                                 .build()))
                         .name("name")
                         .build()))
                 .copyTags(false)
                 .createInterval(123)
                 .crossRegionCopyTargets(crossRegionCopyTargets)
                 .eventSource(EventSourceProperty.builder()
                         .type("type")
                         // the properties below are optional
                         .parameters(EventParametersProperty.builder()
                                 .eventType("eventType")
                                 .snapshotOwner(List.of("snapshotOwner"))
                                 // the properties below are optional
                                 .descriptionRegex("descriptionRegex")
                                 .build())
                         .build())
                 .exclusions(ExclusionsProperty.builder()
                         .excludeBootVolumes(false)
                         .excludeTags(excludeTags)
                         .excludeVolumeTypes(excludeVolumeTypes)
                         .build())
                 .extendDeletion(false)
                 .parameters(ParametersProperty.builder()
                         .excludeBootVolume(false)
                         .excludeDataVolumeTags(List.of(CfnTag.builder()
                                 .key("key")
                                 .value("value")
                                 .build()))
                         .noReboot(false)
                         .build())
                 .policyLanguage("policyLanguage")
                 .policyType("policyType")
                 .resourceLocations(List.of("resourceLocations"))
                 .resourceType("resourceType")
                 .resourceTypes(List.of("resourceTypes"))
                 .retainInterval(123)
                 .schedules(List.of(ScheduleProperty.builder()
                         .archiveRule(ArchiveRuleProperty.builder()
                                 .retainRule(ArchiveRetainRuleProperty.builder()
                                         .retentionArchiveTier(RetentionArchiveTierProperty.builder()
                                                 .count(123)
                                                 .interval(123)
                                                 .intervalUnit("intervalUnit")
                                                 .build())
                                         .build())
                                 .build())
                         .copyTags(false)
                         .createRule(CreateRuleProperty.builder()
                                 .cronExpression("cronExpression")
                                 .interval(123)
                                 .intervalUnit("intervalUnit")
                                 .location("location")
                                 .scripts(List.of(ScriptProperty.builder()
                                         .executeOperationOnScriptFailure(false)
                                         .executionHandler("executionHandler")
                                         .executionHandlerService("executionHandlerService")
                                         .executionTimeout(123)
                                         .maximumRetryCount(123)
                                         .stages(List.of("stages"))
                                         .build()))
                                 .times(List.of("times"))
                                 .build())
                         .crossRegionCopyRules(List.of(CrossRegionCopyRuleProperty.builder()
                                 .encrypted(false)
                                 // the properties below are optional
                                 .cmkArn("cmkArn")
                                 .copyTags(false)
                                 .deprecateRule(CrossRegionCopyDeprecateRuleProperty.builder()
                                         .interval(123)
                                         .intervalUnit("intervalUnit")
                                         .build())
                                 .retainRule(CrossRegionCopyRetainRuleProperty.builder()
                                         .interval(123)
                                         .intervalUnit("intervalUnit")
                                         .build())
                                 .target("target")
                                 .targetRegion("targetRegion")
                                 .build()))
                         .deprecateRule(DeprecateRuleProperty.builder()
                                 .count(123)
                                 .interval(123)
                                 .intervalUnit("intervalUnit")
                                 .build())
                         .fastRestoreRule(FastRestoreRuleProperty.builder()
                                 .availabilityZones(List.of("availabilityZones"))
                                 .count(123)
                                 .interval(123)
                                 .intervalUnit("intervalUnit")
                                 .build())
                         .name("name")
                         .retainRule(RetainRuleProperty.builder()
                                 .count(123)
                                 .interval(123)
                                 .intervalUnit("intervalUnit")
                                 .build())
                         .shareRules(List.of(ShareRuleProperty.builder()
                                 .targetAccounts(List.of("targetAccounts"))
                                 .unshareInterval(123)
                                 .unshareIntervalUnit("unshareIntervalUnit")
                                 .build()))
                         .tagsToAdd(List.of(CfnTag.builder()
                                 .key("key")
                                 .value("value")
                                 .build()))
                         .variableTags(List.of(CfnTag.builder()
                                 .key("key")
                                 .value("value")
                                 .build()))
                         .build()))
                 .targetTags(List.of(CfnTag.builder()
                         .key("key")
                         .value("value")
                         .build()))
                 .build())
         .retainInterval(123)
         .state("state")
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnLifecyclePolicy

      protected CfnLifecyclePolicy(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnLifecyclePolicy

      protected CfnLifecyclePolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnLifecyclePolicy

      @Stability(Stable) public CfnLifecyclePolicy(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnLifecyclePolicyProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties.
    • CfnLifecyclePolicy

      @Stability(Stable) public CfnLifecyclePolicy(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The Amazon Resource Name (ARN) of the lifecycle policy.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getCopyTags

      @Stability(Stable) @Nullable public Object getCopyTags()
      [Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.
    • setCopyTags

      @Stability(Stable) public void setCopyTags(@Nullable Boolean value)
      [Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.
    • setCopyTags

      @Stability(Stable) public void setCopyTags(@Nullable IResolvable value)
      [Default policies only] Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.
    • getCreateInterval

      @Stability(Stable) @Nullable public Number getCreateInterval()
      [Default policies only] Specifies how often the policy should run and create snapshots or AMIs.
    • setCreateInterval

      @Stability(Stable) public void setCreateInterval(@Nullable Number value)
      [Default policies only] Specifies how often the policy should run and create snapshots or AMIs.
    • getCrossRegionCopyTargets

      @Stability(Stable) @Nullable public Object getCrossRegionCopyTargets()
      [Default policies only] Specifies destination Regions for snapshot or AMI copies.
    • setCrossRegionCopyTargets

      @Stability(Stable) public void setCrossRegionCopyTargets(@Nullable Object value)
      [Default policies only] Specifies destination Regions for snapshot or AMI copies.
    • getDefaultPolicy

      @Stability(Stable) @Nullable public String getDefaultPolicy()
      [Default policies only] Specify the type of default policy to create.
    • setDefaultPolicy

      @Stability(Stable) public void setDefaultPolicy(@Nullable String value)
      [Default policies only] Specify the type of default policy to create.
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      A description of the lifecycle policy.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      A description of the lifecycle policy.
    • getExclusions

      @Stability(Stable) @Nullable public Object getExclusions()
      [Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs.
    • setExclusions

      @Stability(Stable) public void setExclusions(@Nullable IResolvable value)
      [Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs.
    • setExclusions

      @Stability(Stable) public void setExclusions(@Nullable CfnLifecyclePolicy.ExclusionsProperty value)
      [Default policies only] Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs.
    • getExecutionRoleArn

      @Stability(Stable) @Nullable public String getExecutionRoleArn()
      The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
    • setExecutionRoleArn

      @Stability(Stable) public void setExecutionRoleArn(@Nullable String value)
      The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.
    • getExtendDeletion

      @Stability(Stable) @Nullable public Object getExtendDeletion()
      [Default policies only] Defines the snapshot or AMI retention behavior for the policy if the source volume or instance is deleted, or if the policy enters the error, disabled, or deleted state.
    • setExtendDeletion

      @Stability(Stable) public void setExtendDeletion(@Nullable Boolean value)
      [Default policies only] Defines the snapshot or AMI retention behavior for the policy if the source volume or instance is deleted, or if the policy enters the error, disabled, or deleted state.
    • setExtendDeletion

      @Stability(Stable) public void setExtendDeletion(@Nullable IResolvable value)
      [Default policies only] Defines the snapshot or AMI retention behavior for the policy if the source volume or instance is deleted, or if the policy enters the error, disabled, or deleted state.
    • getPolicyDetails

      @Stability(Stable) @Nullable public Object getPolicyDetails()
      The configuration details of the lifecycle policy.
    • setPolicyDetails

      @Stability(Stable) public void setPolicyDetails(@Nullable IResolvable value)
      The configuration details of the lifecycle policy.
    • setPolicyDetails

      @Stability(Stable) public void setPolicyDetails(@Nullable CfnLifecyclePolicy.PolicyDetailsProperty value)
      The configuration details of the lifecycle policy.
    • getRetainInterval

      @Stability(Stable) @Nullable public Number getRetainInterval()
      [Default policies only] Specifies how long the policy should retain snapshots or AMIs before deleting them.
    • setRetainInterval

      @Stability(Stable) public void setRetainInterval(@Nullable Number value)
      [Default policies only] Specifies how long the policy should retain snapshots or AMIs before deleting them.
    • getState

      @Stability(Stable) @Nullable public String getState()
      The activation state of the lifecycle policy.
    • setState

      @Stability(Stable) public void setState(@Nullable String value)
      The activation state of the lifecycle policy.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      The tags to apply to the lifecycle policy during creation.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      The tags to apply to the lifecycle policy during creation.