Retention policies with OSS SDK for Go 2.0
You can configure a time-based retention policy for a bucket. The retention period can range from one day to 70 years. This topic describes how to create, query, and lock a retention policy.
Usage notes
-
The sample code in this topic uses the region ID
cn-hangzhoufor the China (Hangzhou) region. By default, a public endpoint is used to access resources in a bucket. If you want to use other Alibaba Cloud services to access resources in a bucket from the same region, use an internal endpoint. For more information about the regions and endpoints that Object Storage Service (OSS) supports, see OSS regions and endpoints. -
In this topic, access credentials are obtained from environment variables. For more information about how to configure access credentials, see Configure access credentials.
Sample code
References
-
For more information about how to create a retention policy, see InitiateBucketWorm.
-
For more information about how to cancel an unlocked retention policy, see AbortBucketWorm.
-
For more information about how to lock a retention policy, see CompleteBucketWorm.
-
For more information about how to query a retention policy, see GetBucketWorm.
-
For more information about how to extend the retention period of an object, see ExtendBucketWorm.