AWScala
AWScala copied to clipboard
Expiration time not working
I'm trying to upload a file and set a expiration time to it.
val metadata: ObjectMetadata = new ObjectMetadata()
metadata.setContentLength(file.length)
metadata.setExpirationTime(DateTime.now().plusMinutes(10).toDate)
bucket.get.putObjectAsPublicRead(filename, file, metadata)
But when I check the file in the s3 bucket it doesn't have expiry date. It's some bug in AWScala or am I using it wrong?
It's some bug in AWScala or am I using it wrong?
I'm not sure. Please figure out the cause if you have time.
I need to debug it. But looks like a bug in AWScala
This does not seem to be a bug in AWScala but a very poorly designed AWS SDK:
/**
* For internal use only. This will *not* set the object's expiration time,
* and is only used to set the value in the object after receiving the value
* in a response from S3.
*
* @param expirationTime
* The expiration time for the object.
*/
public void setExpirationTime(Date expirationTime) {
this.expirationTime = expirationTime;
}