Skip to main content

S3 Client

S3 Client

Service Suite canallows you to use the Amazon S3 as(https://aws.amazon.com/s3/) which is a highly stable file repository.

Create

In order to create an S3 Client from Service Suite you need to create a client with:

 s3client = createS3Client(filename) 

The filename is a properties file containswith the access key and secret key values:values. Similar to

AWS_ACCESS_KEY_ID=xxxxxxx
AWS_SECRET_ACCESS_KEY=yyyyyyyyyyyyyyyyyyyyyyy

TheseThe access key and secret access key are standardusual AWS access keys.keys See(https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html AWS 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: OctoberApril 15,14, 20262023

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