List of usage examples for com.amazonaws.services.s3 AmazonS3 changeObjectStorageClass
@Deprecated void changeObjectStorageClass(String bucketName, String key, StorageClass newStorageClass) throws SdkClientException, AmazonServiceException;
Changes the Amazon S3 storage class for a specified object.
From source file:org.alanwilliamson.amazon.s3.ChangeObjectStorageClass.java
License:Open Source License
public cfData execute(cfSession _session, cfArgStructData argStruct) throws cfmRunTimeException { AmazonKey amazonKey = getAmazonKey(_session, argStruct); AmazonS3 s3Client = getAmazonS3(amazonKey); String bucket = getNamedStringParam(argStruct, "bucket", null); String key = getNamedStringParam(argStruct, "key", null); String storageclass = getNamedStringParam(argStruct, "storageclass", null); if (key != null && key.charAt(0) == '/') key = key.substring(1);//from w w w .j ava 2 s .co m try { s3Client.changeObjectStorageClass(bucket, key, amazonKey.getAmazonStorageClass(storageclass)); } catch (Exception e) { throwException(_session, "AmazonS3: " + e.getMessage()); } return cfBooleanData.TRUE; }