Set object tags with versioning (Java SDK V2)
This topic describes how to set tags for a specific version of an object in a versioned bucket by using OSS Java SDK V2.
Prerequisites
OSS Java SDK V2 is installed. If you use Maven, add the following dependency to the pom.xml file:
com.aliyun:alibabacloud-oss-v2.Access credentials are configured by using environment variables. The examples in this topic use
EnvironmentVariableCredentialsProviderto read credentials from theOSS_ACCESS_KEY_IDandOSS_ACCESS_KEY_SECRETenvironment variables.
Permissions
By default, an Alibaba Cloud account has full permissions. RAM users and RAM roles have no permissions by default. The Alibaba Cloud account owner or an administrator must grant the required permissions.
API | Actions | Description |
PutObjectTagging |
| Sets tags for a specific object version. |
Sample code
References
For the synchronous sample code, see PutObjectTagging.java.
For the asynchronous sample code, see PutObjectTaggingAsync.java.