Manage versioning (Swift SDK)
Versioning applies to all objects in a bucket. After versioning is enabled, you can restore an object to any previous version if it is accidentally overwritten or deleted.
Notes
-
The sample code in this topic uses the China (Hangzhou) region ID
cn-hangzhouand a public endpoint by default. To access OSS from other Alibaba Cloud services in the same region, use an internal endpoint. For more information about the mappings between regions and endpoints, see Regions and endpoints. -
To set the versioning state of a bucket, you must have the
oss:PutBucketVersioningpermission. To retrieve the versioning state of a bucket, you must have theoss:GetBucketVersioningpermission. For more information, see Grant custom permissions to a RAM user.
Sample code
References
-
For the API operation that sets the versioning state of a bucket, see PutBucketVersioning.
-
For the API operation that retrieves the versioning state of a bucket, see GetBucketVersioning.