Class ObjectLockRetention
The default retention settings for an S3 Object Lock configuration.
Inheritance
Namespace: Amazon.CDK.AWS.S3
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ObjectLockRetention : DeputyBase
Syntax (vb)
Public Class ObjectLockRetention
Inherits DeputyBase
Remarks
See: https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-overview.html
ExampleMetadata: infused
Examples
// Configure for governance mode with a duration of 7 years
// Configure for governance mode with a duration of 7 years
new Bucket(this, "Bucket1", new BucketProps {
ObjectLockDefaultRetention = ObjectLockRetention.Governance(Duration.Days(7 * 365))
});
// Configure for compliance mode with a duration of 1 year
// Configure for compliance mode with a duration of 1 year
new Bucket(this, "Bucket2", new BucketProps {
ObjectLockDefaultRetention = ObjectLockRetention.Compliance(Duration.Days(365))
});
Synopsis
Constructors
ObjectLockRetention(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
ObjectLockRetention(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Duration | The default period for which objects should be retained. |
Mode | The retention mode to use for the object lock configuration. |
Methods
Compliance(Duration) | Configure for Compliance retention for a specified duration. |
Governance(Duration) | Configure for Governance retention for a specified duration. |
Constructors
ObjectLockRetention(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected ObjectLockRetention(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
ObjectLockRetention(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected ObjectLockRetention(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Duration
The default period for which objects should be retained.
public virtual Duration Duration { get; }
Property Value
Mode
The retention mode to use for the object lock configuration.
public virtual ObjectLockMode Mode { get; }
Property Value
Remarks
Methods
Compliance(Duration)
Configure for Compliance retention for a specified duration.
public static ObjectLockRetention Compliance(Duration duration)
Parameters
- duration Duration
the length of time for which objects should be retained.
Returns
the ObjectLockRetention configuration
Remarks
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.
Governance(Duration)
Configure for Governance retention for a specified duration.
public static ObjectLockRetention Governance(Duration duration)
Parameters
- duration Duration
the length of time for which objects should retained.
Returns
the ObjectLockRetention configuration
Remarks
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.