in src/main/java/software/amazon/encryption/s3/S3EncryptionClient.java [375:397]
public DeleteObjectResponse deleteObject(DeleteObjectRequest deleteObjectRequest) throws AwsServiceException,
SdkClientException {
DeleteObjectRequest actualRequest = deleteObjectRequest.toBuilder()
.overrideConfiguration(API_NAME_INTERCEPTOR)
.build();
try {
// Delete the object
DeleteObjectResponse deleteObjectResponse = _wrappedAsyncClient.deleteObject(actualRequest).join();
// If Instruction file exists, delete the instruction file as well.
String instructionObjectKey = deleteObjectRequest.key() + INSTRUCTION_FILE_SUFFIX;
_wrappedAsyncClient.deleteObject(builder -> builder
.overrideConfiguration(API_NAME_INTERCEPTOR)
.bucket(deleteObjectRequest.bucket())
.key(instructionObjectKey)).join();
// Return original deletion
return deleteObjectResponse;
} catch (CompletionException e) {
throw new S3EncryptionClientException(e.getCause().getMessage(), e.getCause());
} catch (Exception e) {
throw new S3EncryptionClientException("Unable to delete object.", e);
}
}