Servoy Methods Summary | |
---|---|
Boolean | addObject( JSFile, String, String ) |
void | connect( ) |
Boolean | deleteObject( String, String ) |
void | disconnect( ) |
byte[] | getObject( String, String ) |
Array<StorageFile> | listObjects( String ) |
void | setCredentials( String, String ) |
void | setEndpoint( String ) |
void | setOverrides( Properties ) |
void | setRegion( String ) |
Servoy Methods Details |
---|
addObject
Boolean addObject( JSFile, String, String )
Uploads the given file to S3 at the provided path.Parameters
JSFile file plugins.file.JSFile to upload
String container container/bucket name
String path Path inside container (include the desired file name in the path!)
Returns
Boolean boolean indicator of whether the upload was successful or not
Supported Clients
SmartClient, WebClient, NGClient
Sample
var myFile = plugins.file.convertToJSFile("C:\\path\\to\\my\\file.txt");
var provider = plugins.it2be_cloudtools.newProvider(plugins.it2be_cloudtools.PROVIDERS.AZURE);
provider.setCredentials(AccountName, AccountKey);
provider.connect()
var success = provider.addObject(myFile, "my-bucket-name", "/path/inside/bucket/new_file.txt")
provider.disconnect();
connect
void connect( )
Connect to the cloud storage providerReturns
void
Supported Clients
SmartClient, WebClient, NGClient
deleteObject
Boolean deleteObject( String, String )
Deletes the given file from S3 at the provided path.Parameters
String container container/bucket name
String path Path inside container path
Returns
Boolean boolean indicator of whether the upload was successful or not
Supported Clients
SmartClient, WebClient, NGClient
Sample
var provider = plugins.it2be_cloudtools.newProvider(plugins.it2be_cloudtools.PROVIDERS.AZURE);
provider.setCredentials(AccountName, AccountKey);
provider.connect()
var success = provider.deleteObject("my-bucket-name", "/path/inside/bucket/file.txt")
provider.disconnect();
disconnect
void disconnect( )
Close all connectionsReturns
void byte array if successful, otherwise null
Supported Clients
SmartClient, WebClient, NGClient
Sample
var provider = plugins.it2be_cloudtools.newProvider(plugins.it2be_cloudtools.PROVIDERS.AZURE);
provider.setCredentials(AccountName, AccountKey);
provider.connect()
var fileBytes = provider.getObject("my-bucket-name", "/path/inside/bucket/file.txt")
provider.disconnect();
getObject
byte[] getObject( String, String )
Retrieves the bytes of the given file from S3 at the provided path.Parameters
String container container name
String path Path inside container
Returns
byte[] byte array if successful, otherwise null
Supported Clients
SmartClient, WebClient, NGClient
Sample
var provider = plugins.it2be_cloudtools.newProvider(plugins.it2be_cloudtools.PROVIDERS.AZURE);
provider.setCredentials(AccountName, AccountKey);
provider.connect()
var fileBytes = provider.getObject("my-bucket-name", "/path/inside/bucket/file.txt")
provider.disconnect();
listObjects
Array<StorageFile> listObjects( String )
Lists the objects in the provided bucket.Parameters
String container container/bucket name
Returns
Array<StorageFile> CloudStorageFile objects, or null if there was an error.
Supported Clients
SmartClient, WebClient, NGClient
Sample
var provider = plugins.it2be_cloudtools.newProvider(plugins.it2be_cloudtools.PROVIDERS.AZURE);
provider.setCredentials(AccountName, AccountKey);
provider.connect()
var objects = provider.listObjects("my-bucket-name");
provider.disconnect();
setCredentials
void setCredentials( String, String )
Set credentials for the provider NOTE: Please store the access key and secret key securely.Parameters
String identity AWS access key, Azure account name, Google email, etc
String credential AWS secret key, Azure account key, Google private key, Google path to json private key, etc
Returns
void
Supported Clients
SmartClient, WebClient, NGClient
setEndpoint
void setEndpoint( String )
Set the endpoint. Used when using generic providers like S3Parameters
String endpoint endpoint url
Returns
void
Supported Clients
SmartClient, WebClient, NGClient
setOverrides
void setOverrides( Properties )
Override connection propertiesParameters
Properties overrides overrides properties
Returns
void
Supported Clients
SmartClient, WebClient, NGClient
setRegion
void setRegion( String )
Set the region. Avoid using on most providers.Parameters
String region region id
Returns
void
Supported Clients
SmartClient, WebClient, NGClient