1 | module.exports.validCloudFormationEvent = validCloudFormationEvent;
|
2 |
|
3 | /**
|
4 | * Determines if an invocation event originated from CloudFormation
|
5 | * @param {object} event - a Lambda invocation event
|
6 | * @returns {boolean} indication of whether the event originated from CloudFormation
|
7 | * @private
|
8 | */
|
9 | function validCloudFormationEvent(event) {
|
10 | var required = [
|
11 | 'RequestType',
|
12 | 'ResourceProperties',
|
13 | 'StackId',
|
14 | 'LogicalResourceId',
|
15 | 'RequestId',
|
16 | 'ResponseURL'
|
17 | ];
|
18 |
|
19 | return required.reduce(function(valid, key) {
|
20 | if (!(key in event)) return false;
|
21 | return key;
|
22 | }, true);
|
23 | }
|