Set Lifecycle Rules

Replace the lifecycle configuration of a bucket you own.
EndpointMethodAdmin Required
/api/v1/buckets/:bucketName/lifecyclePUTNo

Replaces the lifecycle rules of a bucket you own, overwriting the existing configuration entirely, like S3's PutBucketLifecycleConfiguration. To remove every rule use Delete Lifecycle Rules - an empty rules array is rejected.

Alarik implements the Prefix-based subset of the S3 lifecycle model: expiration of current objects, expiration of noncurrent versions, and aborting of incomplete multipart uploads. There are no storage classes, so there are no transitions. The rules are validated by the same code path as the S3 PUT ?lifecycle subresource, so the two can never accept different configurations.

Path Parameters

bucketName
string required
The name of the bucket.

Request Body

rules
array required
One to 1000 rules. Each rule has the fields below.

Rule fields

id
string required
Rule identifier, 1-255 characters, unique within the configuration. Send an empty string for a new rule and the server assigns a UUID.
enabled
boolean required
Whether the rule is applied. Disabled rules are stored but never act.
prefix
string required
Key prefix the rule applies to. Empty string for the whole bucket.
expirationDays
integer | null
Permanently delete current objects (or create a delete marker on a versioning-enabled bucket) this many days after they were written. Must be greater than 0 when set.
noncurrentVersionExpirationDays
integer | null
Permanently delete noncurrent versions this many days after they stopped being current. Must be greater than 0 when set.
abortIncompleteMultipartUploadDays
integer | null
Abort multipart uploads that were started this many days ago and never completed. Must be greater than 0 when set.

Every rule must set at least one of the three actions.

Example

{
    "rules": [
        {
            "id": "",
            "enabled": true,
            "prefix": "logs/",
            "expirationDays": 30,
            "noncurrentVersionExpirationDays": null,
            "abortIncompleteMultipartUploadDays": 7
        }
    ]
}

Response

Returns the saved rules, with any server-assigned id:

{
    "rules": [
        {
            "id": "6FF08747-4EC0-48FD-A0B1-F5ADDA6D3161",
            "enabled": true,
            "prefix": "logs/",
            "expirationDays": 30,
            "noncurrentVersionExpirationDays": null,
            "abortIncompleteMultipartUploadDays": 7
        }
    ]
}

Errors

StatusReason
400Missing bucket name; rules empty or more than 1000; an id longer than 255 characters or used twice; a rule with no action; a days value that is not a positive integer
404Bucket not found (or not owned by you)