All Products
Search
Document Center

ENS:PutBucketLifecycle

Last Updated:Dec 25, 2024

Configures lifecycle rules for objects.

Operation description

  • You can configure up to 1,000 rules.
  • If an object meets multiple rules, the rule that has the earliest expiration time prevails.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ens:PutBucketLifecyclenone
*All Resources
*
    none
none

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 this parameter. Make sure that the rule specified by RuleId exists. Otherwise, an error occurs.
1
StatusstringYes

The status of the rule. Valid values:

  • Enabled
  • Disabled
Enabled
PrefixstringNo

The prefix of a object name. 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 time. EOS executes a lifecycle rule for objects that were last updated before the expiration time.

Specify the time in 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",
  "RuleId": ""
}

Error codes

HTTP status codeError codeError messageDescription
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.The requested bucket does not exist.
404NoSuchLifecycleThe bucket lifecycle does not exist.-

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

Change history

Change timeSummary of changesOperation
2024-08-12The Error code has changed. The response structure of the API has changedView Change Details
2024-04-17The Error code has changedView Change Details