-
Notifications
You must be signed in to change notification settings - Fork 50
/
index.js
36 lines (29 loc) · 931 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
const DashboardGenerator = require('./src/dashboardGenerator');
const PipelineEventHandler = require('./src/pipelineEventHandler');
const AWS = require('aws-sdk');
if(!AWS.config.region) {
AWS.config.region = process.env.AWS_DEFAULT_REGION;
}
exports.handlePipelineEvent = (event, context, callback) => {
let statePromise = Promise.resolve({
event: event,
cloudwatch: new AWS.CloudWatch(),
codepipeline: new AWS.CodePipeline()
});
new PipelineEventHandler()
.run(statePromise)
.then(() => callback())
.catch(callback);
};
exports.generateDashboard = (event, context, callback) => {
let statePromise = Promise.resolve({
event: event,
region: AWS.config.region,
cloudwatch: new AWS.CloudWatch()
});
new DashboardGenerator()
.run(statePromise)
.then(() => callback())
.catch(callback);
};