use of com.amazonaws.services.s3.model.InstructionFileId in project aws-sdk-android by aws-amplify.
the class S3CryptoModuleBase method createInstructionPutRequest.
protected final PutObjectRequest createInstructionPutRequest(String bucketName, String key, ContentCryptoMaterial cekMaterial) {
final byte[] bytes = cekMaterial.toJsonString(cryptoConfig.getCryptoMode()).getBytes(UTF8);
final InputStream is = new ByteArrayInputStream(bytes);
final ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(bytes.length);
metadata.addUserMetadata(Headers.CRYPTO_INSTRUCTION_FILE, "");
final InstructionFileId ifileId = new S3ObjectId(bucketName, key).instructionFileId();
return new PutObjectRequest(ifileId.getBucket(), ifileId.getKey(), is, metadata);
}
use of com.amazonaws.services.s3.model.InstructionFileId in project aws-sdk-android by aws-amplify.
the class AmazonS3EncryptionClient method deleteObject.
@Override
public void deleteObject(DeleteObjectRequest req) {
req.getRequestClientOptions().appendUserAgent(USER_AGENT);
// Delete the object
super.deleteObject(req);
// If it exists, delete the instruction file.
InstructionFileId ifid = new S3ObjectId(req.getBucketName(), req.getKey()).instructionFileId();
DeleteObjectRequest instructionDeleteRequest = (DeleteObjectRequest) req.clone();
instructionDeleteRequest.withBucketName(ifid.getBucket()).withKey(ifid.getKey());
super.deleteObject(instructionDeleteRequest);
}
Aggregations