Class CfnLegalHold

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

@Generated(value="jsii-pacmak/1.138.0 (build 0ca7ee8)", date="2026-08-10T14:50:57.494Z") @Stability(Stable) public class CfnLegalHold extends CfnResource implements IInspectable, ILegalHoldRef, ITaggableV2
Creates a legal hold on recovery points (backups).

A legal hold prevents backups from being deleted while under hold.

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.backup.*;
 CfnLegalHold cfnLegalHold = CfnLegalHold.Builder.create(this, "MyCfnLegalHold")
         .description("description")
         .recoveryPointSelection(RecoveryPointSelectionProperty.builder()
                 .dateRange(DateRangeProperty.builder()
                         .fromDate("fromDate")
                         .toDate("toDate")
                         .build())
                 .resourceIdentifiers(List.of("resourceIdentifiers"))
                 .vaultNames(List.of("vaultNames"))
                 .build())
         .title("title")
         // the properties below are optional
         .tags(List.of(TagsItemsProperty.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

    • CfnLegalHold

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

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

      @Stability(Stable) public CfnLegalHold(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnLegalHoldProps props)
      Create a new AWS::Backup::LegalHold.

      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. This parameter is required.
  • Method Details

    • arnForLegalHold

      @Stability(Stable) @NotNull public static String arnForLegalHold(@NotNull ILegalHoldRef resource)
      Parameters:
      resource - This parameter is required.
    • isCfnLegalHold

      @Stability(Stable) @NotNull public static Boolean isCfnLegalHold(@NotNull Object x)
      Checks whether the given object is a CfnLegalHold.

      Parameters:
      x - This parameter is required.
    • 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 legal hold.
    • getAttrCreationDate

      @Stability(Stable) @NotNull public String getAttrCreationDate()
      The time when the legal hold was created.
    • getAttrLegalHoldId

      @Stability(Stable) @NotNull public String getAttrLegalHoldId()
      The ID of the legal hold.
    • getAttrStatus

      @Stability(Stable) @NotNull public String getAttrStatus()
      The status of the legal hold.
    • getCdkTagManager

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

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

      @Stability(Stable) @NotNull protected Map<String,String> getCfnPropertyNames()
      Overrides:
      getCfnPropertyNames in class CfnResource
    • getLegalHoldRef

      @Stability(Stable) @NotNull public LegalHoldReference getLegalHoldRef()
      A reference to a LegalHold resource.
      Specified by:
      getLegalHoldRef in interface ILegalHoldRef
    • getDescription

      @Stability(Stable) @NotNull public String getDescription()
      The description of the legal hold.
    • setDescription

      @Stability(Stable) public void setDescription(@NotNull String value)
      The description of the legal hold.
    • getRecoveryPointSelection

      @Stability(Stable) @NotNull public Object getRecoveryPointSelection()
      The criteria to assign a set of resources, such as resource types or backup vaults.

      Returns union: either IResolvable or CfnLegalHold.RecoveryPointSelectionProperty

    • setRecoveryPointSelection

      @Stability(Stable) public void setRecoveryPointSelection(@NotNull IResolvable value)
      The criteria to assign a set of resources, such as resource types or backup vaults.
    • setRecoveryPointSelection

      @Stability(Stable) public void setRecoveryPointSelection(@NotNull CfnLegalHold.RecoveryPointSelectionProperty value)
      The criteria to assign a set of resources, such as resource types or backup vaults.
    • getTitle

      @Stability(Stable) @NotNull public String getTitle()
      The title of the legal hold.
    • setTitle

      @Stability(Stable) public void setTitle(@NotNull String value)
      The title of the legal hold.
    • getTags

      @Stability(Stable) @Nullable public List<CfnLegalHold.TagsItemsProperty> getTags()
      Optional tags to include.
    • setTags

      @Stability(Stable) public void setTags(@Nullable List<CfnLegalHold.TagsItemsProperty> value)
      Optional tags to include.