use of com.amazonaws.s3.model.DeleteObjectRequest in project aws-lambda-powertools-java by awslabs.
the class SqsLargeMessageAspectTest method testLargeMessage.
@Test
public void testLargeMessage() {
when(s3Client.getObject(any(GetObjectRequest.class))).thenReturn(s3ObjectWithLargeMessage());
SQSEvent sqsEvent = messageWithBody("[\"software.amazon.payloadoffloading.PayloadS3Pointer\",{\"s3BucketName\":\"" + BUCKET_NAME + "\",\"s3Key\":\"" + BUCKET_KEY + "\"}]");
String response = requestHandler.handleRequest(sqsEvent, context);
assertThat(response).isEqualTo("A big message");
ArgumentCaptor<DeleteObjectRequest> delete = ArgumentCaptor.forClass(DeleteObjectRequest.class);
verify(s3Client).deleteObject(delete.capture());
Assertions.assertThat(delete.getValue()).satisfies((Consumer<DeleteObjectRequest>) deleteObjectRequest -> {
assertThat(deleteObjectRequest.bucket()).isEqualTo(BUCKET_NAME);
assertThat(deleteObjectRequest.key()).isEqualTo(BUCKET_KEY);
});
}
use of com.amazonaws.s3.model.DeleteObjectRequest in project FinalProject-Spring by HangHae99-FinalProject.
the class AwsS3UploadService method deleteFile.
// DeleteObject를 통해 S3 파일 삭제
public void deleteFile(String fileName) {
DeleteObjectRequest deleteObjectRequest = new DeleteObjectRequest(bucket, fileName);
amazonS3.deleteObject(deleteObjectRequest);
}
use of com.amazonaws.s3.model.DeleteObjectRequest in project OT148-JAVA by alkemyTech.
the class AmazonService method deleteFileFromS3Bucket.
public String deleteFileFromS3Bucket(String fileUrl) {
String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
s3client.deleteObject(new DeleteObjectRequest(bucketName + "/", fileName));
return "Successfully deleted";
}
use of com.amazonaws.s3.model.DeleteObjectRequest in project library-of-alexandria by bottomless-archive-project.
the class S3VaultLocation method clear.
/**
* {@inheritDoc}
*/
@Override
public void clear() {
final DeleteObjectRequest deleteObjectRequest = DeleteObjectRequest.builder().bucket(bucketName).key(fileName).build();
s3Client.deleteObject(deleteObjectRequest);
}
Aggregations