Class LifecycleRule
Declaration of a Life cycle rule.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.S3
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class LifecycleRule : ILifecycleRule
Syntax (vb)
Public Class LifecycleRule Implements ILifecycleRule
Remarks
ExampleMetadata: fixture=_generated
Examples
// 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()
} }
};
Synopsis
Constructors
LifecycleRule() | Declaration of a Life cycle rule. |
Properties
AbortIncompleteMultipartUploadAfter | Specifies a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket. |
Enabled | Whether this rule is enabled. |
Expiration | Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon Glacier. |
ExpirationDate | Indicates when objects are deleted from Amazon S3 and Amazon Glacier. |
ExpiredObjectDeleteMarker | Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. |
Id | A unique identifier for this rule. |
NoncurrentVersionExpiration | Time between when a new version of the object is uploaded to the bucket and when old versions of the object expire. |
NoncurrentVersionTransitions | One or more transition rules that specify when non-current objects transition to a specified storage class. |
NoncurrentVersionsToRetain | Indicates a maximum number of noncurrent versions to retain. |
ObjectSizeGreaterThan | Specifies the minimum object size in bytes for this rule to apply to. |
ObjectSizeLessThan | Specifies the maximum object size in bytes for this rule to apply to. |
Prefix | Object key prefix that identifies one or more objects to which this rule applies. |
TagFilters | The TagFilter property type specifies tags to use to identify a subset of objects for an Amazon S3 bucket. |
Transitions | One or more transition rules that specify when an object transitions to a specified storage class. |
Constructors
LifecycleRule()
Declaration of a Life cycle rule.
public LifecycleRule()
Remarks
ExampleMetadata: fixture=_generated
Examples
// 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()
} }
};
Properties
AbortIncompleteMultipartUploadAfter
Specifies a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket.
public Duration? AbortIncompleteMultipartUploadAfter { get; set; }
Property Value
Remarks
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.
Default: - Incomplete uploads are never aborted
Enabled
Whether this rule is enabled.
public bool? Enabled { get; set; }
Property Value
bool?
Remarks
Default: true
Expiration
Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon Glacier.
public Duration? Expiration { get; set; }
Property Value
Remarks
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.
Default: - No expiration timeout
ExpirationDate
Indicates when objects are deleted from Amazon S3 and Amazon Glacier.
public DateTime? ExpirationDate { get; set; }
Property Value
Remarks
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.
Default: - No expiration date
ExpiredObjectDeleteMarker
Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions.
public bool? ExpiredObjectDeleteMarker { get; set; }
Property Value
bool?
Remarks
If set to true, the delete marker will be expired.
Default: false
Id
A unique identifier for this rule.
public string? Id { get; set; }
Property Value
Remarks
The value cannot be more than 255 characters.
NoncurrentVersionExpiration
Time between when a new version of the object is uploaded to the bucket and when old versions of the object expire.
public Duration? NoncurrentVersionExpiration { get; set; }
Property Value
Remarks
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.
Default: - No noncurrent version expiration
NoncurrentVersionTransitions
One or more transition rules that specify when non-current objects transition to a specified storage class.
public INoncurrentVersionTransition[]? NoncurrentVersionTransitions { get; set; }
Property Value
INoncurrentVersionTransition[]
Remarks
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.
NoncurrentVersionsToRetain
Indicates a maximum number of noncurrent versions to retain.
public double? NoncurrentVersionsToRetain { get; set; }
Property Value
Remarks
If there are this many more noncurrent versions, Amazon S3 permanently deletes them.
Default: - No noncurrent versions to retain
ObjectSizeGreaterThan
Specifies the minimum object size in bytes for this rule to apply to.
public double? ObjectSizeGreaterThan { get; set; }
Property Value
Remarks
Objects must be larger than this value in bytes.
Default: - No rule
ObjectSizeLessThan
Specifies the maximum object size in bytes for this rule to apply to.
public double? ObjectSizeLessThan { get; set; }
Property Value
Remarks
Objects must be smaller than this value in bytes.
Default: - No rule
Prefix
Object key prefix that identifies one or more objects to which this rule applies.
public string? Prefix { get; set; }
Property Value
Remarks
Default: - Rule applies to all objects
TagFilters
The TagFilter property type specifies tags to use to identify a subset of objects for an Amazon S3 bucket.
public IDictionary<string, object>? TagFilters { get; set; }
Property Value
Remarks
Default: - Rule applies to all objects
Transitions
One or more transition rules that specify when an object transitions to a specified storage class.
public ITransition[]? Transitions { get; set; }
Property Value
Remarks
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.
Default: - No transition rules