AWS SDK effect driver.
$ npm install @koax/aws
import {aws, awsEffect} from '@koax/aws'
import koax from 'koax'
const io = koax()
io.use(awsEffect())
// run update
io(testableUpdate)
// Action creator that updates an s3 object.
function * testableUpdate () {
// get object
let data = yield aws('S3', 'getObject', {
Bucket: 'test-bucket.weo.io',
Key: 'test.json'
})
let obj = JSON.parse(data.BODY.toString())
// update
obj.foo = 'qux'
// put object
yield aws('S3', 'putObject', {
Bucket: 'test-bucket.we.io',
Key: 'test.json',
Body: JSON.stringify(obj)
})
}
Effect driver.
config
- global AWS config (e.g. region, output...)
Returns: redux effects middleware
Action creator.
service
- The aws service. Optionally can be an object with the signature: {service, options}, if you need to specify service options.method
- Method to call on service.params
- Params to use for call.
MIT