Problem description
In the XML request body of the PutBucketLifecycle request, a parameter required for the lifecycle rule is missing from the Rule node.
Causes
In the XML request body of the PutBucketLifecycle request, the required parameter Transition or Expiration is missing from the Rule node.
Transition: The storage class of objects that match a lifecycle rule is converted when the objects expire. The expiration is determined based on the date or validity period that is specified in the lifecycle rule.
Expiration: The objects that match a lifecycle rule are deleted when the date or validity period that is specified in the lifecycle rule is reached.
Examples
In the following sample code, the Transition or Expiration parameter is missing.
PUT /?lifecycle HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 336
Date: Mon , 6 May 2019 15:23:20 GMT
Authorization: OSS qn6q**************:77Dv****************
<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration>
<Rule>
<ID>abc</ID>
<Prefix>log/</Prefix>
</Rule>
</LifecycleConfiguration>Solutions
Add the Transition or Expiration parameter to the request.
The following code provides an example of a valid request, which contains the Transition parameter.
PUT /?lifecycle HTTP/1.1 Host: oss-example.oss-cn-hangzhou.aliyuncs.com Content-Length: 336 Date: Mon , 6 May 2019 15:23:20 GMT Authorization: OSS qn6q**************:77Dv**************** <?xml version="1.0" encoding="UTF-8"?> <LifecycleConfiguration> <Rule> <ID>rule</ID> <Prefix>log/</Prefix> <Status>Enabled</Status> <Transition> <Days>30</Days> <StorageClass>IA</StorageClass> </Transition> </Rule> </LifecycleConfiguration>Configure lifecycle rules in the Object Storage Service (OSS) console to automatically create request bodies.