Я пытаюсь загрузить файл в AmazonS3 с помощью SDK, но когда я устанавливаю метаданные x-amz-storage-class, такие как STANDARD_IA, не работает, когда я перечисляю свое ведро, файл возвращается с классом хранения STANDARD..
try {
s3Client = AuthService.GetClient();
// Upload a file as a new object with ContentType and title specified.
PutObjectRequest request = new PutObjectRequest(bucketName, fileDirectory+fileName, new File(filePath));
ObjectMetadata metadata = new ObjectMetadata();
metadata.addUserMetadata("x-amz-storage-class", "STANDARD_IA");
request.setMetadata(metadata);
s3Client.putObject(request);
}
catch(AmazonServiceException e) {
// The call was transmitted successfully, but Amazon S3 couldn't process
// it, so it returned an error response.
e.printStackTrace();
}
catch(SdkClientException e) {
// Amazon S3 couldn't be contacted for a response, or the client
// couldn't parse the response from Amazon S3.
e.printStackTrace();
}
Проблема решена, request.setStorageClass (StorageClass.StandardInfrequentAccess);