Skip to main content

S3 Client

S3 Client

Service Suite allows you tocan use the Amazon S3 (https://aws.amazon.com/s3/) which isas a highly stable file repository.

In order to createCreate an S3 Clientclient from Service Suite you need to create a clientwith:

 s3client = createS3Client(filename) 

The filename is a properties file withcontains the access key and secret key values. Similar tovalues:

AWS_ACCESS_KEY_ID=xxxxxxx
AWS_SECRET_ACCESS_KEY=yyyyyyyyyyyyyyyyyyyyyyy

The access key and secret access keyThese are usualstandard AWS access keyskeys. (See https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.htmlAWS security credential types ).

The

S3 Client methods

are:

  • download(bucket:String, remoteName:String) → byte[]

downloadFile(bucket:String, remoteName:String, localpath:String) 

downloadFile(bucket:String, remoteName:String, localpath:String)

list(bucket:String, prefix:String) → Set<String>

listFolders(bucket:String, prefix:String) → Set<String>

listFolderNames(bucket:String, prefix:String) → Set<String>

upload(bucket:String, data:byte[], remoteName:String)
uploadPublic(bucket:String,
data:byte[],
remoteName:String)
var client = createS3Client("{ds}/s3.creds");
var bucketName = "myBucket"; // this must exist in S3
var data = "user,pass\njohn,doe";
// client.delete(bucketName, "test.csv"); // delete previous file
client.upload(bucketName, toByteArray(data), "test.csv");

uploadPublic(bucket:String, data:byte[], remoteName:String)


Last updated: AprilOctober 14,15, 20232026

If you have any feedback on this topic, please contact us at documentation@appvance.ai.