Reputation: 192
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.
Upvotes: 1
Views: 962
Reputation: 13551
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.
Upvotes: 1
Reputation: 21
Just add 'versionId' to your request, with the Objects' version Id. If you wish to remove tags from several versions, then I think a loop would work best.
For more info check this out:
https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjectTagging.html
Cheers.
Upvotes: 0