Reputation: 11952
I've the folowing code that signs a URL to an object inside an S3 Bucket
https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURLJavaSDK.html
Now, if the Bucket has versioning enabled, how can I sign a specific version of the object link?
Upvotes: 1
Views: 434
Reputation: 57114
Call withVersionId(String)
:
GeneratePresignedUrlRequest generatePresignedUrlRequest =
new GeneratePresignedUrlRequest(bucketName, objectKey)
.withMethod(HttpMethod.GET)
.withExpiration(expiration)
.withVersionId("yourVesionId");
Sets the version ID of the object, only present if versioning has been enabled for the bucket.
Upvotes: 3