Skip to content
v2.278.0

DefaultRetentionProperty Struct ​

The container element for optionally specifying the default Object Lock retention settings for new objects placed in the specified bucket.

  • The DefaultRetention settings require both a mode and a period.
  • The DefaultRetention period can be either Days or Years but you must select one. You cannot specify Days and Years at the same time.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_s3 as s3 } from 'aws-cdk-lib';
const defaultRetentionProperty: s3.CfnBucket.DefaultRetentionProperty = {
  days: 123,
  defaultEventHold: {
    days: 123,
    years: 123,
  },
  mode: 'mode',
  years: 123,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_s3 as s3

default_retention_property = s3.CfnBucket.DefaultRetentionProperty(
    days=123,
    default_event_hold=s3.CfnBucket.DefaultEventHoldProperty(
        days=123,
        years=123
    ),
    mode="mode",
    years=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.s3.*;

DefaultRetentionProperty defaultRetentionProperty = DefaultRetentionProperty.builder()
        .days(123)
        .defaultEventHold(DefaultEventHoldProperty.builder()
                .days(123)
                .years(123)
                .build())
        .mode("mode")
        .years(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.S3;

var defaultRetentionProperty = new DefaultRetentionProperty {
    Days = 123,
    DefaultEventHold = new DefaultEventHoldProperty {
        Days = 123,
        Years = 123
    },
    Mode = "mode",
    Years = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

defaultRetentionProperty := &DefaultRetentionProperty{
	Days: jsii.Number(123),
	DefaultEventHold: &DefaultEventHoldProperty{
		Days: jsii.Number(123),
		Years: jsii.Number(123),
	},
	Mode: jsii.String("mode"),
	Years: jsii.Number(123),
}

Properties ​

daysoptionalnumberdaysoptionalint | floatdaysoptionalNumberDaysoptionaldoubleDaysoptional*float64 #
The number of days that you want to specify for the default retention period.

If Object Lock is turned on, you must specify Mode and specify either Days or Years .

defaultEventHoldoptionalIResolvable | CfnBucket.DefaultEventHoldPropertydefault_event_holdoptionaltyping.Union[IResolvable, DefaultEventHoldProperty]defaultEventHoldoptionalIResolvableDefaultEventHoldoptionalIResolvableDefaultEventHoldoptionalinterface{} #
The default Object Lock event hold duration that you want to apply to new objects placed in the specified bucket, unless an object's upload request specifies its own Object Lock settings.
notes

New object versions are placed under an event hold and remain protected while the hold is active. When the event hold is released, Amazon S3 retains the object version for this duration, measured from the time the hold is released. The DefaultEventHold duration can be specified in either Days or Years, but you must select one. You can't specify Days and Years at the same time.

modeoptionalstringmodeoptionalstrmodeoptionalStringModeoptionalstringModeoptional*string #
The default Object Lock retention mode you want to apply to new objects placed in the specified bucket.

If Object Lock is turned on, you must specify Mode and specify either Days or Years .

yearsoptionalnumberyearsoptionalint | floatyearsoptionalNumberYearsoptionaldoubleYearsoptional*float64 #
The number of years that you want to specify for the default retention period.

If Object Lock is turned on, you must specify Mode and specify either Days or Years .