Problem description
Calling PutBucketVersioning to enable versioning on a bucket fails because the bucket has a retention policy configured.
Causes
Versioning and retention policies are mutually exclusive on the same bucket. A bucket with a retention policy configured cannot have versioning enabled.
Examples
The following request attempts to enable versioning on oss-example, which has a retention policy configured:
PUT /?versioning HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue
<?xml version="1.0" encoding="UTF-8"?>
<VersioningConfiguration>
<Status>Enabled</Status>
</VersioningConfiguration>The request fails because oss-example has a retention policy.
Solutions
Before enabling versioning, confirm that the bucket has no retention policy. Call GetBucketWorm to query the retention policy configuration for the bucket. If no retention policy exists, the response indicates that no WORM policy is configured.
References
该文章对您有帮助吗?