@koax/aws

0.1.1 • Public • Published

aws

Build status Git tag NPM version Code style

AWS SDK effect driver.

Installation

$ npm install @koax/aws

Usage

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)
  })
}

API

awsEffect (config)

Effect driver.

  • config - global AWS config (e.g. region, output...)

Returns: redux effects middleware

aws (service, method, params)

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.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @koax/aws

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • koax