Class LifecycleRule
Declaration of a Life cycle rule.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.S3
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class LifecycleRule : Object, ILifecycleRule
Syntax (vb)
Public Class LifecycleRule
Inherits Object
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() |
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. |
NoncurrentVersionsToRetain | Indicates a maximum number of noncurrent versions to retain. |
NoncurrentVersionTransitions | One or more transition rules that specify when non-current objects transition to a specified storage class. |
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()
public LifecycleRule()
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 Nullable<bool> Enabled { get; set; }
Property Value
System.Nullable<System.Boolean>
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 Nullable<DateTime> ExpirationDate { get; set; }
Property Value
System.Nullable<System.DateTime>
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 Nullable<bool> ExpiredObjectDeleteMarker { get; set; }
Property Value
System.Nullable<System.Boolean>
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
System.String
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
NoncurrentVersionsToRetain
Indicates a maximum number of noncurrent versions to retain.
public Nullable<double> NoncurrentVersionsToRetain { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
If there are this many more noncurrent versions, Amazon S3 permanently deletes them.
Default: - No noncurrent versions to retain
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 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.
ObjectSizeGreaterThan
Specifies the minimum object size in bytes for this rule to apply to.
public Nullable<double> ObjectSizeGreaterThan { get; set; }
Property Value
System.Nullable<System.Double>
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 Nullable<double> ObjectSizeLessThan { get; set; }
Property Value
System.Nullable<System.Double>
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
System.String
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
System.Collections.Generic.IDictionary<System.String, System.Object>
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