All Products
Search
Document Center

ENS:PutBucketLifecycle

Last Updated:Mar 12, 2024

Configures lifecycle rules for objects.

Operation description

  • You can configure up to 1000 rules.

  • If an object meets multiple rules, the rule that has the earliest expiration time prevails.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
BucketNamestringYes

The name of the bucket.

test
RuleIdstringNo

The unique ID of the rule. The ID of a lifecycle rule can be up to 255 bytes in length.

  • You do not need to configure this parameter when you create a rule. The system automatically generates a unique ID.
  • When you update a rule, you need to specify the rule ID, and the rule must exist. Otherwise, an error occurs.
1
StatusstringYes

The status of the rule. Valid values:

  • Enabled: The rule is periodically executed.
  • Disabled: The rule is ignored.
Enabled
PrefixstringNo

The prefix of a rule. The prefix must be unique.

  • If you specify a prefix, the rule applies only to objects in the bucket that match the prefix.
  • If you do not specify a prefix, the rule applies to all objects in the bucket.
image
CreatedBeforeDatestringNo

The expiration data. EOS executes a lifecycle rule for objects that were last updated before the expiration date.

Specify the time that follows the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC.

Note ExpirationDays and CreateBeforeDate are mutually exclusive.
2023-10-12T05:45:00Z
ExpirationDayslongNo

The number of days from when the objects were last modified to when the lifecycle rule takes effect. The value must be a positive integer that is greater than 0.

Note ExpirationDays and CreateBeforeDate are mutually exclusive.
5
AllowSameActionOverlapstringNo

Specifies whether to allow overlapped prefixes. Valid values:

  • true
  • false (default)
false

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The ID of the request.

62373E71-5521-4620-8AAB-133CCE49357A

Examples

Sample success responses

JSONformat

{
  "RequestId": "62373E71-5521-4620-8AAB-133CCE49357A"
}

Error codes

HTTP status codeError codeError message
400Invalid%sThe specified parameter %s is invalid.
400InvalidArgumentDays and createBeforeDate can only choose one
400InvalidArgumentOne bucket not allow exceed one thousand items of LifecycleRules.
400InvalidArgumentOverlap for same action type.
400InvalidBucketNameSpecified parameter BucketName is not valid.
400InvalidLifecycleSchemeSpecified parameter LifecycleScheme is not valid.
400InvalidTypeSpecified parameter Type is not valid.
400OperationDeniedEngine lifecycle scheme does't support replication lifecycle rule configuration.
400NoPermissionPermission denied.
400InvalidParameter.%sThe specified field %s invalid. Please check it again.
403AccessDeniedauth is not valid
404NoSuchBucketThe specified bucket does not exist.
404NoSuchLifecycleThe bucket lifecycle does not exist.

For a list of error codes, visit the Service error codes.