Object Storage Service (OSS) allows you to suspend versioning for a bucket so that no additional versions are generated for the objects in the bucket. When versioning is suspended for a bucket, you can upload objects to the bucket and download or delete previous versions of objects in the bucket by specifying the version IDs.
Upload objects
When you upload an object to a versioning-suspended bucket, OSS stores the uploaded object as a version whose ID is null. Each object in a versioning-suspended bucket has only one version whose ID is null.
- In the following figure, when you use the PutObject operation to upload an object to a versioning-suspended bucket, OSS stores the uploaded object as a version whose ID is null.
- In the following figure, an object named example.jpg in a versioning-suspended bucket has a version whose ID is 111111. When you use the PutObject operation to upload an object that has the same name as the existing object, OSS stores the uploaded object as the current version of example.jpg and assigns the ID null for the current version. Version 111111 of the object is saved as a previous version.
- In the following figure, an object named example.jpg in a versioning-suspended bucket has a version whose ID is null. When you use the PutObject operation to upload an object that has the same name, the version whose ID is null is overwritten.
You can use the cp command provided by ossutil and the following OSS SDKs to upload objects to a versioning-suspended bucket: OSS SDK for Java, OSS SDK for PHP, OSS SDK for Node.js, OSS SDK for Python,OSS SDK for .NET, OSS SDK for Go, and OSS SDK for C++.
Download objects
OSS allows you to download the current or specified version of an object from a versioning-suspended bucket.
- By default, if no version ID is specified in the request, the current version of the object is returned. In the following figure, the current version of the object, whose ID is null, is returned.
- If you specify a version ID in the GetObject request, the specified version of the object is returned. In the following figure, the version whose ID is 222222 is returned.
You can use the cp command provided by ossutil and the following OSS SDKs to download objects from a versioning-suspended bucket: OSS SDK for Java, OSS SDK for PHP, OSS SDK for Node.js, OSS SDK for Python,OSS SDK for .NET, OSS SDK for Go, and OSS SDK for C++.
Delete objects
The following examples describe how an object is deleted from a versioning-suspended bucket in different scenarios:
- When you use the DeleteObject operation to delete an object whose current version ID is not null, OSS adds a delete marker whose ID is null as the current version of the object.
- When you use the DeleteObject operation to delete an object whose current version ID is null, OSS adds a delete marker whose ID is null as the current version of the object. An object can have only one version whose ID is null. Therefore, the original current version of the object is overwritten by the newly-added delete marker whose ID is null.
- If you specify a version ID in the DeleteObject request, the specified version of the object is permanently deleted. In the following figure, the version whose ID is 333333 is deleted.
You can use the rm command provided by ossutil and the following OSS SDKs to delete objects from a versioning-suspended bucket: OSS SDK for Java, OSS SDK for PHP, OSS SDK for Node.js, OSS SDK for Python,OSS SDK for .NET, OSS SDK for Go, and OSS SDK for C++.