-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a39cc6f
commit 04648c8
Showing
3 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...Function/src/main/java/com/levio/awsdemo/resumerequestpreprocessor/service/S3Service.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.levio.awsdemo.resumerequestpreprocessor.service; | ||
|
||
import software.amazon.awssdk.regions.Region; | ||
import software.amazon.awssdk.services.s3.S3Client; | ||
import software.amazon.awssdk.services.s3.model.HeadObjectRequest; | ||
import software.amazon.awssdk.services.s3.model.HeadObjectResponse; | ||
|
||
public class S3Service { | ||
|
||
private static final String BUCKET_NAME = System.getenv("BUCKET_NAME"); | ||
|
||
private final S3Client s3 = S3Client.builder() | ||
.region(Region.US_EAST_1) | ||
.build(); | ||
|
||
public String getEmailMetadata(String key) { | ||
HeadObjectRequest objectRequest = HeadObjectRequest | ||
.builder() | ||
.key(key) | ||
.bucket(BUCKET_NAME) | ||
.build(); | ||
HeadObjectResponse objectHead = s3.headObject(objectRequest); | ||
|
||
return objectHead.metadata().get("email"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters