Class CfnRule
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.rbin.CfnRule
- All Implemented Interfaces:
IInspectable,ITaggableV2,IRuleRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:46.761Z")
@Stability(Stable)
public class CfnRule
extends CfnResource
implements IInspectable, IRuleRef, ITaggableV2
Creates a Recycle Bin retention rule. You can create two types of retention rules:.
- Tag-level retention rules - These retention rules use resource tags to identify the resources to protect. For each retention rule, you specify one or more tag key and value pairs. Resources (of the specified type) that have at least one of these tag key and value pairs are automatically retained in the Recycle Bin upon deletion. Use this type of retention rule to protect specific resources in your account based on their tags.
- Region-level retention rules - These retention rules, by default, apply to all of the resources (of the specified type) in the Region, even if the resources are not tagged. However, you can specify exclusion tags to exclude resources that have specific tags. Use this type of retention rule to protect all resources of a specific type in a Region.
For more information, see Create Recycle Bin retention rules in the Amazon EBS User Guide .
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.rbin.*;
CfnRule cfnRule = CfnRule.Builder.create(this, "MyCfnRule")
.resourceType("resourceType")
.retentionPeriod(RetentionPeriodProperty.builder()
.retentionPeriodUnit("retentionPeriodUnit")
.retentionPeriodValue(123)
.build())
// the properties below are optional
.description("description")
.excludeResourceTags(List.of(ResourceTagProperty.builder()
.resourceTagKey("resourceTagKey")
.resourceTagValue("resourceTagValue")
.build()))
.lockConfiguration(UnlockDelayProperty.builder()
.unlockDelayUnit("unlockDelayUnit")
.unlockDelayValue(123)
.build())
.resourceTags(List.of(ResourceTagProperty.builder()
.resourceTagKey("resourceTagKey")
.resourceTagValue("resourceTagValue")
.build()))
.status("status")
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnRule.static interface[Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.static interfaceInformation about the retention period for which the retention rule is to retain resources.static interfaceInformation about the retention rule unlock delay.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.rbin.IRuleRef
IRuleRef.Jsii$Default, IRuleRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggableV2
ITaggableV2.Jsii$Default, ITaggableV2.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnRule(software.amazon.jsii.JsiiObjectRef objRef) CfnRule(software.constructs.Construct scope, String id, CfnRuleProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe Amazon Resource Name (ARN) of the retention rule.The unique ID of the retention rule.[Region-level retention rules only] The lock state for the retention rule.Tag Manager which manages the tags for this resource.The retention rule description.[Region-level retention rules only] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule.Information about the retention rule lock configuration.[Tag-level retention rules only] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule.The resource type to be retained by the retention rule.Information about the retention period for which the retention rule is to retain resources.A reference to a Rule resource.The state of the retention rule.getTags()Information about the tags to assign to the retention rule.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetDescription(String value) The retention rule description.voidsetExcludeResourceTags(List<Object> value) [Region-level retention rules only] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule.void[Region-level retention rules only] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule.voidsetLockConfiguration(IResolvable value) Information about the retention rule lock configuration.voidInformation about the retention rule lock configuration.voidsetResourceTags(List<Object> value) [Tag-level retention rules only] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule.voidsetResourceTags(IResolvable value) [Tag-level retention rules only] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule.voidsetResourceType(String value) The resource type to be retained by the retention rule.voidsetRetentionPeriod(IResolvable value) Information about the retention period for which the retention rule is to retain resources.voidInformation about the retention period for which the retention rule is to retain resources.voidThe state of the retention rule.voidInformation about the tags to assign to the retention rule.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnRule
protected CfnRule(software.amazon.jsii.JsiiObjectRef objRef) -
CfnRule
protected CfnRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnRule
@Stability(Stable) public CfnRule(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnRuleProps 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. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- 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:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrArn
The Amazon Resource Name (ARN) of the retention rule. -
getAttrIdentifier
The unique ID of the retention rule. -
getAttrLockState
[Region-level retention rules only] The lock state for the retention rule.locked- The retention rule is locked and can't be modified or deleted.pending_unlock- The retention rule has been unlocked but it is still within the unlock delay period. The retention rule can be modified or deleted only after the unlock delay period has expired.unlocked- The retention rule is unlocked and it can be modified or deleted by any user with the required permissions.null- The retention rule has never been locked. Once a retention rule has been locked, it can transition between thelockedandunlockedstates only; it can never transition back tonull.
-
getCdkTagManager
Tag Manager which manages the tags for this resource.- Specified by:
getCdkTagManagerin interfaceITaggableV2
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getRuleRef
A reference to a Rule resource.- Specified by:
getRuleRefin interfaceIRuleRef
-
getResourceType
The resource type to be retained by the retention rule. -
setResourceType
The resource type to be retained by the retention rule. -
getRetentionPeriod
Information about the retention period for which the retention rule is to retain resources.Returns union: either
IResolvableorCfnRule.RetentionPeriodProperty -
setRetentionPeriod
Information about the retention period for which the retention rule is to retain resources. -
setRetentionPeriod
Information about the retention period for which the retention rule is to retain resources. -
getDescription
The retention rule description. -
setDescription
The retention rule description. -
getExcludeResourceTags
[Region-level retention rules only] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnRule.ResourceTagProperty> -
setExcludeResourceTags
[Region-level retention rules only] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. -
setExcludeResourceTags
[Region-level retention rules only] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. -
getLockConfiguration
Information about the retention rule lock configuration.Returns union: either
IResolvableorCfnRule.UnlockDelayProperty -
setLockConfiguration
Information about the retention rule lock configuration. -
setLockConfiguration
Information about the retention rule lock configuration. -
getResourceTags
[Tag-level retention rules only] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnRule.ResourceTagProperty> -
setResourceTags
[Tag-level retention rules only] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule. -
setResourceTags
[Tag-level retention rules only] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule. -
getStatus
The state of the retention rule. -
setStatus
The state of the retention rule. -
getTags
Information about the tags to assign to the retention rule. -
setTags
Information about the tags to assign to the retention rule.
-