LifecycleRule Struct
Declaration of a Life cycle rule.
| Source | aws-s3/lib/rule.ts |
|---|---|
| Type last changed |
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';
declare const storageClass: s3.StorageClass;
declare const tagFilters: any;
const lifecycleRule: s3.LifecycleRule = {
abortIncompleteMultipartUploadAfter: cdk.Duration.minutes(30),
enabled: false,
expiration: cdk.Duration.minutes(30),
expirationDate: new Date(),
expiredObjectDeleteMarker: false,
id: 'id',
noncurrentVersionExpiration: cdk.Duration.minutes(30),
noncurrentVersionsToRetain: 123,
noncurrentVersionTransitions: [{
storageClass: storageClass,
transitionAfter: cdk.Duration.minutes(30),
// the properties below are optional
noncurrentVersionsToRetain: 123,
}],
objectSizeGreaterThan: 123,
objectSizeLessThan: 123,
prefix: 'prefix',
tagFilters: {
tagFiltersKey: tagFilters,
},
transitions: [{
storageClass: storageClass,
// the properties below are optional
transitionAfter: cdk.Duration.minutes(30),
transitionDate: new Date(),
}],
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_s3 as s3
# storage_class: s3.StorageClass
# tag_filters: Any
lifecycle_rule = s3.LifecycleRule(
abort_incomplete_multipart_upload_after=cdk.Duration.minutes(30),
enabled=False,
expiration=cdk.Duration.minutes(30),
expiration_date=Date(),
expired_object_delete_marker=False,
id="id",
noncurrent_version_expiration=cdk.Duration.minutes(30),
noncurrent_versions_to_retain=123,
noncurrent_version_transitions=[s3.NoncurrentVersionTransition(
storage_class=storage_class,
transition_after=cdk.Duration.minutes(30),
# the properties below are optional
noncurrent_versions_to_retain=123
)],
object_size_greater_than=123,
object_size_less_than=123,
prefix="prefix",
tag_filters={
"tag_filters_key": tag_filters
},
transitions=[s3.Transition(
storage_class=storage_class,
# the properties below are optional
transition_after=cdk.Duration.minutes(30),
transition_date=Date()
)]
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.s3.*;
StorageClass storageClass;
Object tagFilters;
LifecycleRule lifecycleRule = LifecycleRule.builder()
.abortIncompleteMultipartUploadAfter(Duration.minutes(30))
.enabled(false)
.expiration(Duration.minutes(30))
.expirationDate(new Date())
.expiredObjectDeleteMarker(false)
.id("id")
.noncurrentVersionExpiration(Duration.minutes(30))
.noncurrentVersionsToRetain(123)
.noncurrentVersionTransitions(List.of(NoncurrentVersionTransition.builder()
.storageClass(storageClass)
.transitionAfter(Duration.minutes(30))
// the properties below are optional
.noncurrentVersionsToRetain(123)
.build()))
.objectSizeGreaterThan(123)
.objectSizeLessThan(123)
.prefix("prefix")
.tagFilters(Map.of(
"tagFiltersKey", tagFilters))
.transitions(List.of(Transition.builder()
.storageClass(storageClass)
// the properties below are optional
.transitionAfter(Duration.minutes(30))
.transitionDate(new Date())
.build()))
.build();
// 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;
using Amazon.CDK.AWS.S3;
StorageClass storageClass;
var tagFilters;
var lifecycleRule = new LifecycleRule {
AbortIncompleteMultipartUploadAfter = Duration.Minutes(30),
Enabled = false,
Expiration = Duration.Minutes(30),
ExpirationDate = new Date(),
ExpiredObjectDeleteMarker = false,
Id = "id",
NoncurrentVersionExpiration = Duration.Minutes(30),
NoncurrentVersionsToRetain = 123,
NoncurrentVersionTransitions = new [] { new NoncurrentVersionTransition {
StorageClass = storageClass,
TransitionAfter = Duration.Minutes(30),
// the properties below are optional
NoncurrentVersionsToRetain = 123
} },
ObjectSizeGreaterThan = 123,
ObjectSizeLessThan = 123,
Prefix = "prefix",
TagFilters = new Dictionary<string, object> {
{ "tagFiltersKey", tagFilters }
},
Transitions = new [] { new Transition {
StorageClass = storageClass,
// the properties below are optional
TransitionAfter = Duration.Minutes(30),
TransitionDate = new Date()
} }
};
// 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"
import "github.com/aws/aws-cdk-go/awscdk"
var storageClass StorageClass
var tagFilters interface{}
lifecycleRule := &LifecycleRule{
AbortIncompleteMultipartUploadAfter: cdk.Duration_Minutes(jsii.Number(30)),
Enabled: jsii.Boolean(false),
Expiration: cdk.Duration_*Minutes(jsii.Number(30)),
ExpirationDate: NewDate(),
ExpiredObjectDeleteMarker: jsii.Boolean(false),
Id: jsii.String("id"),
NoncurrentVersionExpiration: cdk.Duration_*Minutes(jsii.Number(30)),
NoncurrentVersionsToRetain: jsii.Number(123),
NoncurrentVersionTransitions: []NoncurrentVersionTransition{
&NoncurrentVersionTransition{
StorageClass: storageClass,
TransitionAfter: cdk.Duration_*Minutes(jsii.Number(30)),
// the properties below are optional
NoncurrentVersionsToRetain: jsii.Number(123),
},
},
ObjectSizeGreaterThan: jsii.Number(123),
ObjectSizeLessThan: jsii.Number(123),
Prefix: jsii.String("prefix"),
TagFilters: map[string]interface{}{
"tagFiltersKey": tagFilters,
},
Transitions: []Transition{
&Transition{
StorageClass: storageClass,
// the properties below are optional
TransitionAfter: cdk.Duration_*Minutes(jsii.Number(30)),
TransitionDate: NewDate(),
},
},
}
Properties
abortIncompleteMultipartUploadAfteroptionalDurationabort_incomplete_multipart_upload_afteroptionalDurationabortIncompleteMultipartUploadAfteroptionalDurationAbortIncompleteMultipartUploadAfteroptionalDurationAbortIncompleteMultipartUploadAfteroptionalDuration #Default: Incomplete uploads are never aborted
notes
The AbortIncompleteMultipartUpload property type creates a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket. When Amazon S3 aborts a multipart upload, it deletes all parts associated with the multipart upload.
The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error.
enabledoptionalbooleanenabledoptionalboolenabledoptionalBooleanEnabledoptionalboolEnabledoptional*bool = true #expirationoptionalDurationexpirationoptionalDurationexpirationoptionalDurationExpirationoptionalDurationExpirationoptionalDuration #Default: No expiration timeout
notes
If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.
The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error.
expirationDateoptionaldateexpiration_dateoptionaldatetimeexpirationDateoptionalInstantExpirationDateoptionalDateTimeExpirationDateoptional*time.Time #Default: No expiration date
notes
The date value must be in ISO 8601 format. The time is always midnight UTC.
If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.
expiredObjectDeleteMarkeroptionalbooleanexpired_object_delete_markeroptionalboolexpiredObjectDeleteMarkeroptionalBooleanExpiredObjectDeleteMarkeroptionalboolExpiredObjectDeleteMarkeroptional*bool = false #If set to true, the delete marker will be expired.
The value cannot be more than 255 characters.
noncurrentVersionExpirationoptionalDurationnoncurrent_version_expirationoptionalDurationnoncurrentVersionExpirationoptionalDurationNoncurrentVersionExpirationoptionalDurationNoncurrentVersionExpirationoptionalDuration #Default: No noncurrent version expiration
notes
For buckets with versioning enabled (or suspended), specifies the time, in days, between when a new version of the object is uploaded to the bucket and when old versions of the object expire. When object versions expire, Amazon S3 permanently deletes them. If you specify a transition and expiration time, the expiration time must be later than the transition time.
The underlying configuration is expressed in whole numbers of days. Providing a Duration that does not represent a whole number of days will result in a runtime or deployment error.
noncurrentVersionsToRetainoptionalnumbernoncurrent_versions_to_retainoptionalint | floatnoncurrentVersionsToRetainoptionalNumberNoncurrentVersionsToRetainoptionaldoubleNoncurrentVersionsToRetainoptional*float64 #Default: No noncurrent versions to retain
If there are this many more noncurrent versions, Amazon S3 permanently deletes them.
noncurrentVersionTransitionsoptionalNoncurrentVersionTransition[]noncurrent_version_transitionsoptionaltyping.List[NoncurrentVersionTransition]noncurrentVersionTransitionsoptionalList<NoncurrentVersionTransition>NoncurrentVersionTransitionsoptionalNoncurrentVersionTransition[]NoncurrentVersionTransitionsoptional*[]NoncurrentVersionTransition #Only for buckets with versioning enabled (or suspended).
If you specify a transition and expiration time, the expiration time must be later than the transition time.
objectSizeGreaterThanoptionalnumberobject_size_greater_thanoptionalint | floatobjectSizeGreaterThanoptionalNumberObjectSizeGreaterThanoptionaldoubleObjectSizeGreaterThanoptional*float64 #Default: No rule
Objects must be larger than this value in bytes.
objectSizeLessThanoptionalnumberobject_size_less_thanoptionalint | floatobjectSizeLessThanoptionalNumberObjectSizeLessThanoptionaldoubleObjectSizeLessThanoptional*float64 #Default: No rule
Objects must be smaller than this value in bytes.
prefixoptionalstringprefixoptionalstrprefixoptionalStringPrefixoptionalstringPrefixoptional*string #Default: Rule applies to all objects
tagFiltersoptional{ [key: string]: any }tag_filtersoptionaltyping.Mapping[str, Any]tagFiltersoptionalMap<String, Object>TagFiltersoptionalIDictionary<string, object>TagFiltersoptional*map[string]interface{} #Default: Rule applies to all objects
transitionsoptionalTransition[]transitionsoptionaltyping.List[Transition]transitionsoptionalList<Transition>TransitionsoptionalTransition[]Transitionsoptional*[]Transition #Default: No transition rules
If you specify an expiration and transition time, you must use the same time unit for both properties (either in days or by date). The expiration time must also be later than the transition time.