Adaptive AWS S3
The Adaptive AWS S3 namespace for the CCDS API and Custom Cloud Loader scripts.
ai.awss3
Method | Parameters | Returns | Description |
---|---|---|---|
getFile(bucketName, key, region, awsAccessKey, AwsSecretKey) |
bucketName: String key: String region: String awsAcceskey: String awsSecretKey: String |
Retrieves a file from an AWS S3 bucket. | |
putFile(bucketName, key, region, awsAccessKey, AwsSecretKey) |
bucketName: String key: String region: String awsAcceskey: String awsSecretKey: String |
Puts a file into an AWS S3 bucket. | |
listKeys(bucketName, key, region, awsAccessKey, AwsSecretKey) |
bucketName: String key: String region: String awsAcceskey: String awsSecretKey: String |
Lists the keys (files) in an AWS S3 bucket |
Examples
// Manually invoke this method via 'Test connection' function testConnection(context) { return true; } // Manually invoke this method via 'Run manually' function exportData(context) { var bucketName = 'XXX'; var key = 'XXX'; var awsAccessKey = 'XXX'; var awsSecretKey = 'XXX'; var region = 'us-west-1'; // Step 1: Get the data var reader = context.createTableReader(); // Step 2: Process and export the data var result = "Column,Heading,Names\n"; var row = null; while ((row = reader.readRow()) !== null) { // remove meta columns we don't need row.length = row.length - 2; result += row.join() + '\n'; } ai.awss3.putFile(bucketName, key, result, region, awsAccessKey, awsSecretKey); }