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
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ens:PutBucketLifecycle | none | *All Resources * |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
BucketName | string | Yes | The name of the bucket. | test |
RuleId | string | No | The unique ID of the rule. The ID of a lifecycle rule can be up to 255 bytes in length.
| 1 |
Status | string | Yes | The status of the rule. Valid values:
| Enabled |
Prefix | string | No | The prefix of a object name. The prefix must be unique.
| image |
CreatedBeforeDate | string | No | 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 |
ExpirationDays | long | No | 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 |
AllowSameActionOverlap | string | No | Specifies whether to allow overlapped prefixes. Valid values:
| false |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "62373E71-5521-4620-8AAB-133CCE49357A",
"RuleId": ""
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | Invalid%s | The specified parameter %s is invalid. | - |
400 | InvalidArgument | Days and createBeforeDate can only choose one | - |
400 | InvalidArgument | One bucket not allow exceed one thousand items of LifecycleRules. | - |
400 | InvalidArgument | Overlap for same action type. | - |
400 | InvalidBucketName | Specified parameter BucketName is not valid. | - |
400 | InvalidLifecycleScheme | Specified parameter LifecycleScheme is not valid. | - |
400 | InvalidType | Specified parameter Type is not valid. | - |
400 | OperationDenied | Engine lifecycle scheme does't support replication lifecycle rule configuration. | - |
400 | NoPermission | Permission denied. | - |
400 | InvalidParameter.%s | The specified field %s invalid. Please check it again. | - |
403 | AccessDenied | auth is not valid | - |
404 | NoSuchBucket | The specified bucket does not exist. | The requested bucket does not exist. |
404 | NoSuchLifecycle | The bucket lifecycle does not exist. | - |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-08-12 | The Error code has changed. The response structure of the API has changed | View Change Details |
2024-04-17 | The Error code has changed | View Change Details |