Problem description
The child nodes contained in the XML request body of a PutBucketLifecycle request are mutually exclusive.
Causes
You initialize a PutBucketLifecycle request and specify the AllowSmallFile child node in the Transition node of the XML request body. The AllowSmallFile child node specifies whether to convert the storage class of an object that is smaller than 64 KB in size to infrequent access (IA), Archive, Cold Archive, or Deep Cold Archive when you configure a lifecycle rule based on the last access time. Valid values:
true: converts the storage class of objects that are smaller than 64 KB to IA, Archive, or Cold Archive. Objects that are smaller than 64 KB are charged as 64 KB. Objects that are greater than or equal to 64 KB are charged based on their actual sizes. If you set the AllowSmallFile child node to true, the storage fees may increase.
false: does not convert the storage class of an object that is smaller than 64 KB.
If you specify the AllowSmallFile child node in the XML request body, you cannot specify the Filter/ObjectSizeLessThan or Filter/ObjectSizeGreaterThan child node in the request body. Otherwise, a request error occurs because the XML request body contains mutually exclusive nodes.
Examples
The following sample code provides an example of the XML request body of a PutBucketLifecycle request. In this example, both AllowSmallFile and Filter/ObjectSizeLessThan child nodes are specified.
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>rule2</ID>
<Prefix>abc</Prefix>
<Status>Enabled</Status>
<Filter>
<ObjectSizeLessThan>1024</ObjectSizeLessThan>
</Filter>
<Transition>
<IsAccessTime>true</IsAccessTime>
<Days>200</Days>
<StorageClass>IA</StorageClass>
<ReturnToStdWhenVisit>true</ReturnToStdWhenVisit>
<AllowSmallFile>true</AllowSmallFile>
</Transition>
</Rule>
</LifecycleConfiguration>Solutions
Make sure that the XML request body contains only one of the
Filter/ObjectSizeLessThanandAllowSmallFilechild nodes.Configure lifecycle rules in the Object Storage Service (OSS) console to automatically create request bodies.