All Products
Search
Document Center

Object Storage Service:0014-00000047

Last Updated:Apr 28, 2024

Problem description

When you configure a lifecycle rule based on the latest access time, the invalid CreatedBeforeDate child node is included in the Transition node of the XML request body.

Causes

You initiate a PutBucketLifecycle request. However, the IsAccessTime child node that is based on the latest access time is included in the Transition node of the XML request body. After you configure the IsAccessTime child node, you cannot configure the CreatedBeforeDate child node in the Transition node.

Examples

The following code provides an example. In this example, the IsAccessTime and CreatedBeforeDate child nodes are added to the Transition node of the XML request body.

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>test</Prefix>
    <Status>Enabled</Status>
    <Transition>
      <IsAccessTime>true</IsAccessTime>
      <CreatedBeforeDate>2021-12-30T00:00:00.000Z</CreatedBeforeDate>
      <StorageClass>IA</StorageClass>
      <ReturnToStdWhenVisit>true</ReturnToStdWhenVisit>
    </Transition>
  </Rule>
</LifecycleConfiguration>

Solutions

  • When you configure a lifecycle rule based on the last access time, configure only the Days child node in the Transition node. The Days child node specifies the number of days for which objects can be retained after they are last accessed. The following code provides a correct example:

    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>test</Prefix>
        <Status>Enabled</Status>
        <Transition>
          <IsAccessTime>true</IsAccessTime>
          <Days>200</Days>
          <StorageClass>IA</StorageClass>
          <ReturnToStdWhenVisit>true</ReturnToStdWhenVisit>
        </Transition>
      </Rule>
    </LifecycleConfiguration>
  • Configure lifecycle rules by using the Object Storage Service (OSS) console to avoid manually constructing request bodies.

References