Class S3Utils
java.lang.Object
com.kingsrook.qqq.backend.module.filesystem.s3.utils.S3Utils
Utility methods for working with AWS S3.
Note: May need a constructor (or similar) in the future that takes the
S3BackendMetaData - e.g., if we need some metaData to construct the AmazonS3
(api client) object, such as region, or authentication.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteObject
(String bucketName, String key) Delete an object (file) from a bucketcom.amazonaws.services.s3.AmazonS3
Getter for AmazonS3 client object.getObjectAsInputStream
(com.amazonaws.services.s3.model.S3ObjectSummary s3ObjectSummary) Get the contents (as an InputStream) for an object in s3List
<com.amazonaws.services.s3.model.S3ObjectSummary> listObjectsInBucketMatchingGlob
(String bucketName, String path, String glob) List the objects in an S3 bucket matching a glob, per: https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String)List
<com.amazonaws.services.s3.model.S3ObjectSummary> listObjectsInBucketMatchingGlob
(String bucketName, String path, String glob, String requestedPath, AbstractFilesystemTableBackendDetails tableDetails) List the objects in an S3 bucket matching a glob, per: https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String) and also - (possibly) apply a file-name filter (based on the table's details).void
moveObject
(String bucketName, String source, String destination) Move an object (file) within a bucketvoid
setAmazonS3
(com.amazonaws.services.s3.AmazonS3 amazonS3) Setter for AmazonS3 client object.void
Write a file
-
Constructor Details
-
S3Utils
public S3Utils()
-
-
Method Details
-
listObjectsInBucketMatchingGlob
public List<com.amazonaws.services.s3.model.S3ObjectSummary> listObjectsInBucketMatchingGlob(String bucketName, String path, String glob) throws QException List the objects in an S3 bucket matching a glob, per: https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String)- Throws:
QException
-
listObjectsInBucketMatchingGlob
public List<com.amazonaws.services.s3.model.S3ObjectSummary> listObjectsInBucketMatchingGlob(String bucketName, String path, String glob, String requestedPath, AbstractFilesystemTableBackendDetails tableDetails) throws QException List the objects in an S3 bucket matching a glob, per: https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String) and also - (possibly) apply a file-name filter (based on the table's details).- Throws:
QException
-
getObjectAsInputStream
public InputStream getObjectAsInputStream(com.amazonaws.services.s3.model.S3ObjectSummary s3ObjectSummary) Get the contents (as an InputStream) for an object in s3 -
writeFile
-
deleteObject
Delete an object (file) from a bucket- Throws:
FilesystemException
-
moveObject
public void moveObject(String bucketName, String source, String destination) throws FilesystemException Move an object (file) within a bucket- Throws:
FilesystemException
-
setAmazonS3
public void setAmazonS3(com.amazonaws.services.s3.AmazonS3 amazonS3) Setter for AmazonS3 client object. -
getAmazonS3
public com.amazonaws.services.s3.AmazonS3 getAmazonS3()Getter for AmazonS3 client object.
-