I trying to delete s3 tags for some versions of an s3 object. I have the s3 object versions list.
I am able to delete tags using bucket and key alone using the below code.
final AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withRegion(clientRegion)
.build();
s3Client.deleteObjectTagging(new DeleteObjectTaggingRequest(bucket, key));
Kindly help me with deleting s3 tag for a specified version.
See the documentation.
The DeleteObjectTaggingRequest
constructor only requests about bucket name and object key but you can select the version by withVersionId(String versionId)
. So,
DeleteObjectTaggingRequest req = new DeleteObjectTaggingRequest(bucket, key).withVersionId(version)
would work.