Skip to content

Commit

Permalink
new commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgealvarezro committed Oct 20, 2023
1 parent f24a9b6 commit 1b46a8c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
Binary file modified bin/main/com/shipmentEvents/handlers/EventHandler.class
Binary file not shown.
Binary file modified bin/main/com/shipmentEvents/util/Constants.class
Binary file not shown.
Binary file modified bin/main/com/shipmentEvents/util/S3ClientUtil.class
Binary file not shown.
Binary file added bin/main/com/shipmentEvents/util/S3Events.class
Binary file not shown.
34 changes: 34 additions & 0 deletions src/main/java/com/shipmentEvents/util/S3Events.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.shipmentEvents.util;

import com.amazonaws.services.s3.AmazonS3;

public class S3Events {

AmazonS3 s3Client = S3ClientUtil.getS3Client();

//Create method to upload file to S3
public void uploadFile(String bucketName, String key, String filePath) {
s3Client.putObject(bucketName, key, filePath);
}

//Create method to delete a file in S3
public void deleteFile(String bucketName, String key) {
s3Client.deleteObject(bucketName, key);
}

//Create a method to list all files in a bucket
public void listFiles(String bucketName) {
s3Client.listObjects(bucketName);
}

//create method to iterate accross all the different s3 objects
public void iterateS3Objects() {
s3Client.listBuckets().forEach(bucket -> {
bucket.getName();
bucket.getCreationDate();
bucket.getOwner();
bucket.getOwner().getDisplayName();
}
);
}
}

0 comments on commit 1b46a8c

Please sign in to comment.