Skip to content

Commit

Permalink
Feature | #10 | @YongsHub | 이미지 삭제 애플리케이션 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
YongsHub committed May 7, 2024
1 parent 7f87a26 commit 82c37db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

@Configuration
public class S3Config {

private final String accessKey;
private final String secretKey;
private final String region;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.amazonaws.AmazonServiceException;
import com.amazonaws.HttpMethod;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.s3.AmazonS3;
Expand Down Expand Up @@ -48,6 +49,14 @@ public PresignedUrl getPresignedUrlWithImagePath() {
}
}

public void deleteObject(String imagePath) {
try {
amazonS3.deleteObject(bucket, imagePath);
} catch (AmazonServiceException e) {
throw new CakkException(ReturnCode.EXTERNAL_SERVER_ERROR);
}
}

private GeneratePresignedUrlRequest createGeneratePresignedUrlRequestInstance(String imagePath) {
Date expiration = new Date();
long expirationInMs = expiration.getTime();
Expand Down

This file was deleted.

0 comments on commit 82c37db

Please sign in to comment.