Class ObjectLockRetention
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.s3.ObjectLockRetention
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-11-27T16:51:04.744Z")
@Stability(Stable)
public class ObjectLockRetention
extends software.amazon.jsii.JsiiObject
The default retention settings for an S3 Object Lock configuration.
Example:
// Configure for governance mode with a duration of 7 years // Configure for governance mode with a duration of 7 years Bucket.Builder.create(this, "Bucket1") .objectLockDefaultRetention(ObjectLockRetention.governance(Duration.days(7 * 365))) .build(); // Configure for compliance mode with a duration of 1 year // Configure for compliance mode with a duration of 1 year Bucket.Builder.create(this, "Bucket2") .objectLockDefaultRetention(ObjectLockRetention.compliance(Duration.days(365))) .build();
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
-
Constructor Summary
ModifierConstructorDescriptionprotected
ObjectLockRetention
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
ObjectLockRetention
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectLockRetention
compliance
(Duration duration) Configure for Compliance retention for a specified duration.The default period for which objects should be retained.getMode()
The retention mode to use for the object lock configuration.static ObjectLockRetention
governance
(Duration duration) Configure for Governance retention for a specified duration.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
ObjectLockRetention
protected ObjectLockRetention(software.amazon.jsii.JsiiObjectRef objRef) -
ObjectLockRetention
protected ObjectLockRetention(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
-
Method Details
-
compliance
@Stability(Stable) @NotNull public static ObjectLockRetention compliance(@NotNull Duration duration) Configure for Compliance retention for a specified duration.When an object is locked in compliance mode, its retention mode can't be changed, and its retention period can't be shortened. Compliance mode helps ensure that an object version can't be overwritten or deleted for the duration of the retention period.
- Parameters:
duration
- the length of time for which objects should be retained. This parameter is required.- Returns:
- the ObjectLockRetention configuration
-
governance
@Stability(Stable) @NotNull public static ObjectLockRetention governance(@NotNull Duration duration) Configure for Governance retention for a specified duration.With governance mode, you protect objects against being deleted by most users, but you can still grant some users permission to alter the retention settings or delete the object if necessary. You can also use governance mode to test retention-period settings before creating a compliance-mode retention period.
- Parameters:
duration
- the length of time for which objects should retained. This parameter is required.- Returns:
- the ObjectLockRetention configuration
-
getDuration
The default period for which objects should be retained. -
getMode
The retention mode to use for the object lock configuration.- See Also:
-