Provide role-based authorization for AWS S3. This package helps user to get contents of a file on S3 using the filename. It assumes the user enters the corresponding {fileName, url} tuple in the collection.
This is an ipm package, which contains one or more reusable assets within the ipm Community. The 'package.json' in this repo is a ipm spec's package.json, here, which is a superset of npm's package.json spec, here.
This package contains an example S3 Object to fetch, and can be run upon a fresh install. Run AWSS3ExampleFetchAsset
- Create account: https://aws.amazon.com/documentation/s3/
- Upload objects to provide access control upon
- Place URLs in
aws_s3_resources
collection - Can fetch file contents via the
FetchS3Object
code service
The AWSS3Lib provides user with a method to get contents of file using the filename. It does so under the assumption that the file name exists in the collection with a valid Url.
To test call AWSS3ExampleFetchAsset
with relevant parameters as an Authenticated User.
AWSS3ExampleFetchAsset
- Fetch the contents of an access-controlled AWSS3 Resource.
Note: Make sure to initialize ClearBlade Object, before calling the Library methods. i.e. ClearBlade.init({request:req});
AWSS3Lib
- This library provides a method to get file contents from AWSS3 using a filename. It internally uses a collection to get s3 url for corresponding filename. Note: User needs to add a new file entry in the collections before trying to access it.
s3_resources
- Stores key/value pairs of filenames and their respective URLs in AWSS3
- AWSS3 :
Object
AWS S3 is a file Manager Service Software
- callback :
function
This callback is displayed as part of sgEmail.
AWS S3 is a file Manager Service Software
Kind: global typedef
Param | Type |
---|---|
collectionName | string |
Example
var s3 = AWSS3(collectionName);
Kind: static typedef of AWSS3
Param | Type |
---|---|
fileName | string |
callback | callback |
Example
var s3 = AWSS3(collectionName);
ClearBlade.init({request:req});
s3.GetFile(fileName, function(err, resp){
if(err ){
resp.error("Failed to GET File from AWSS3: " + JSON.stringify(err));
}
resp.success(data);
}
This callback is displayed as part of sgEmail.
Kind: global typedef
Param | Type |
---|---|
err | Object |
resp | Object |