1 | var Plugin = require('../../lib/plugin'),
|
2 | AWS = require('aws-sdk');
|
3 |
|
4 | var apigateway = module.exports = Plugin.create({
|
5 | name: 'apigateway',
|
6 | defaults: {
|
7 | sdk: {
|
8 | path: './sdk.js'
|
9 | },
|
10 | aws: {}
|
11 | },
|
12 | cli: [
|
13 | ['s', 'stage[=ARG]', 'Set the stage to deploy']
|
14 | ],
|
15 | deployAPI: function deployAPI(args, options, done) {
|
16 | this.deployRestAPI(args, options, done);
|
17 | },
|
18 | afterConfigure: function afterConfigure() {
|
19 | var _ = this;
|
20 |
|
21 | AWS.config.update(_.aws);
|
22 |
|
23 | if (_.aws.profile) {
|
24 | AWS.config.credentials = new AWS.SharedIniFileCredentials({
|
25 | profile: _.aws.profile
|
26 | });
|
27 | }
|
28 |
|
29 | _.aws.secretAccessKey = AWS.config.credentials.secretAccessKey;
|
30 | _.aws.accessKeyId = AWS.config.credentials.accessKeyId;
|
31 | _.aws.region = AWS.config.region;
|
32 |
|
33 | _.defineProperties({
|
34 | writable: true
|
35 | }, {
|
36 | AWSLambda: new AWS.Lambda()
|
37 | });
|
38 |
|
39 | return _;
|
40 | }
|
41 | });
|
42 |
|
43 | apigateway.defineProperties(require('./access-policies'));
|
44 | apigateway.defineProperties(require('./aws-request'));
|
45 | apigateway.defineProperties(require('./deployments'));
|
46 | apigateway.defineProperties(require('./integrations'));
|
47 | apigateway.defineProperties(require('./methods'));
|
48 | apigateway.defineProperties(require('./resources'));
|
49 | apigateway.defineProperties(require('./rest-api'));
|