@mapbox/cloudfriend 7.2.0-1 → 7.2.0-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nyc_output/11f7164b-7ffe-482b-97df-1421dd64f11d.json +1 -0
- package/.nyc_output/1fd23852-2043-434f-bb39-a9052f67b4a6.json +1 -0
- package/.nyc_output/processinfo/{ee3bde6e-e139-45e3-8559-dd8d9fa90e13.json → 11f7164b-7ffe-482b-97df-1421dd64f11d.json} +1 -1
- package/.nyc_output/processinfo/{e5f117ab-047a-4a8e-b56e-6dd4198a5fab.json → 1fd23852-2043-434f-bb39-a9052f67b4a6.json} +1 -1
- package/.nyc_output/processinfo/index.json +1 -1
- package/lib/shortcuts/api.md +0 -33
- package/lib/shortcuts/event-lambda.js +0 -34
- package/lib/shortcuts/scheduled-lambda.js +5 -2
- package/package.json +1 -1
- package/test/fixtures/shortcuts/event-lambda-defaults.json +0 -1
- package/test/fixtures/shortcuts/event-lambda-full.json +0 -1
- package/test/fixtures/shortcuts/hookshot-github-secret-ref.json +2 -2
- package/test/fixtures/shortcuts/hookshot-github-secret-string.json +2 -2
- package/test/fixtures/shortcuts/hookshot-github.json +2 -2
- package/test/fixtures/shortcuts/hookshot-passthrough-access-log-format.json +2 -2
- package/test/fixtures/shortcuts/hookshot-passthrough-alarms.json +2 -2
- package/test/fixtures/shortcuts/hookshot-passthrough-enhanced-logging.json +2 -2
- package/test/fixtures/shortcuts/hookshot-passthrough-full-blown-logging.json +2 -2
- package/test/fixtures/shortcuts/hookshot-passthrough-logging.json +2 -2
- package/test/fixtures/shortcuts/hookshot-passthrough.json +2 -2
- package/test/fixtures/shortcuts/scheduled-lambda-defaults.json +5 -2
- package/test/fixtures/shortcuts/scheduled-lambda-full.json +5 -2
- package/test/shortcuts.test.js +1 -25
- package/.nyc_output/e5f117ab-047a-4a8e-b56e-6dd4198a5fab.json +0 -1
- package/.nyc_output/ee3bde6e-e139-45e3-8559-dd8d9fa90e13.json +0 -1
package/lib/shortcuts/api.md
CHANGED
|
@@ -142,7 +142,6 @@ a Lambda permission.
|
|
|
142
142
|
| --- | --- | --- | --- |
|
|
143
143
|
| options | <code>Object</code> | | Extends the options for [`Lambda`](#lambda) with the following additional attributes: |
|
|
144
144
|
| options.EventPattern | <code>String</code> | | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-eventpattern). |
|
|
145
|
-
| [options.EventBusName] | <code>String</code> | <code>'default'</code> | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-eventbusname). |
|
|
146
145
|
| [options.State] | <code>String</code> | <code>'ENABLED'</code> | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-state). |
|
|
147
146
|
|
|
148
147
|
**Example**
|
|
@@ -166,38 +165,6 @@ const lambda = new cf.shortcuts.EventLambda({
|
|
|
166
165
|
}
|
|
167
166
|
});
|
|
168
167
|
|
|
169
|
-
module.exports = cf.merge(myTemplate, lambda);
|
|
170
|
-
```
|
|
171
|
-
**Example**
|
|
172
|
-
```js
|
|
173
|
-
const cf = require('@mapbox/cloudfriend');
|
|
174
|
-
|
|
175
|
-
const myTemplate = {
|
|
176
|
-
...
|
|
177
|
-
Resources: {
|
|
178
|
-
MyEventBus: {
|
|
179
|
-
Type: 'AWS::Events::EventBus',
|
|
180
|
-
Properties: { ... }
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const lambda = new cf.shortcuts.EventLambda({
|
|
186
|
-
LogicalName: 'MyLambda',
|
|
187
|
-
Code: {
|
|
188
|
-
S3Bucket: 'my-code-bucket',
|
|
189
|
-
S3Key: 'path/to/code.zip'
|
|
190
|
-
},
|
|
191
|
-
EventBusName: cf.ref('MyEventBus'),
|
|
192
|
-
EventPattern: {
|
|
193
|
-
'detail-type': ['AWS Console Sign In via CloudTrail'],
|
|
194
|
-
detail: {
|
|
195
|
-
eventSource: ['signin.amazonaws.com'],
|
|
196
|
-
eventName: ['ConsoleLogin']
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
|
|
201
168
|
module.exports = cf.merge(myTemplate, lambda);
|
|
202
169
|
```
|
|
203
170
|
<a name="GlueDatabase"></a>
|
|
@@ -10,7 +10,6 @@ const Lambda = require('./lambda');
|
|
|
10
10
|
* @param {Object} options - Extends the options for [`Lambda`](#lambda)
|
|
11
11
|
* with the following additional attributes:
|
|
12
12
|
* @param {String} options.EventPattern - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-eventpattern).
|
|
13
|
-
* @param {String} [options.EventBusName='default'] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-eventbusname).
|
|
14
13
|
* @param {String} [options.State='ENABLED'] - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-state).
|
|
15
14
|
*
|
|
16
15
|
* @example
|
|
@@ -34,37 +33,6 @@ const Lambda = require('./lambda');
|
|
|
34
33
|
* });
|
|
35
34
|
*
|
|
36
35
|
* module.exports = cf.merge(myTemplate, lambda);
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* const cf = require('@mapbox/cloudfriend');
|
|
40
|
-
*
|
|
41
|
-
* const myTemplate = {
|
|
42
|
-
* ...
|
|
43
|
-
* Resources: {
|
|
44
|
-
* MyEventBus: {
|
|
45
|
-
* Type: 'AWS::Events::EventBus',
|
|
46
|
-
* Properties: { ... }
|
|
47
|
-
* }
|
|
48
|
-
* }
|
|
49
|
-
* };
|
|
50
|
-
*
|
|
51
|
-
* const lambda = new cf.shortcuts.EventLambda({
|
|
52
|
-
* LogicalName: 'MyLambda',
|
|
53
|
-
* Code: {
|
|
54
|
-
* S3Bucket: 'my-code-bucket',
|
|
55
|
-
* S3Key: 'path/to/code.zip'
|
|
56
|
-
* },
|
|
57
|
-
* EventBusName: cf.ref('MyEventBus'),
|
|
58
|
-
* EventPattern: {
|
|
59
|
-
* 'detail-type': ['AWS Console Sign In via CloudTrail'],
|
|
60
|
-
* detail: {
|
|
61
|
-
* eventSource: ['signin.amazonaws.com'],
|
|
62
|
-
* eventName: ['ConsoleLogin']
|
|
63
|
-
* }
|
|
64
|
-
* }
|
|
65
|
-
* });
|
|
66
|
-
*
|
|
67
|
-
* module.exports = cf.merge(myTemplate, lambda);
|
|
68
36
|
*/
|
|
69
37
|
class EventLambda extends Lambda {
|
|
70
38
|
constructor(options) {
|
|
@@ -73,7 +41,6 @@ class EventLambda extends Lambda {
|
|
|
73
41
|
|
|
74
42
|
const {
|
|
75
43
|
EventPattern,
|
|
76
|
-
EventBusName = 'default',
|
|
77
44
|
State = 'ENABLED'
|
|
78
45
|
} = options;
|
|
79
46
|
|
|
@@ -93,7 +60,6 @@ class EventLambda extends Lambda {
|
|
|
93
60
|
]
|
|
94
61
|
},
|
|
95
62
|
State,
|
|
96
|
-
EventBusName,
|
|
97
63
|
EventPattern,
|
|
98
64
|
Targets: [
|
|
99
65
|
{
|
|
@@ -42,7 +42,7 @@ class ScheduledLambda extends Lambda {
|
|
|
42
42
|
throw new Error('You must provide a ScheduleExpression');
|
|
43
43
|
|
|
44
44
|
this.Resources[`${this.LogicalName}Schedule`] = {
|
|
45
|
-
Type: 'AWS::
|
|
45
|
+
Type: 'AWS::Scheduler::Schedule',
|
|
46
46
|
Condition: this.Condition,
|
|
47
47
|
Properties: {
|
|
48
48
|
Name: this.FunctionName,
|
|
@@ -54,7 +54,10 @@ class ScheduledLambda extends Lambda {
|
|
|
54
54
|
},
|
|
55
55
|
State,
|
|
56
56
|
ScheduleExpression,
|
|
57
|
-
|
|
57
|
+
FlexibleTimeWindow: {
|
|
58
|
+
Mode: 'OFF'
|
|
59
|
+
},
|
|
60
|
+
Target: [
|
|
58
61
|
{
|
|
59
62
|
Id: this.FunctionName,
|
|
60
63
|
Arn: {
|
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"Type": "AWS::ApiGateway::Stage",
|
|
29
29
|
"Properties": {
|
|
30
30
|
"DeploymentId": {
|
|
31
|
-
"Ref": "
|
|
31
|
+
"Ref": "PassDeployment01229d54"
|
|
32
32
|
},
|
|
33
33
|
"StageName": "hookshot",
|
|
34
34
|
"RestApiId": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
"
|
|
50
|
+
"PassDeployment01229d54": {
|
|
51
51
|
"Type": "AWS::ApiGateway::Deployment",
|
|
52
52
|
"DependsOn": "PassMethod",
|
|
53
53
|
"Properties": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"Type": "AWS::ApiGateway::Stage",
|
|
25
25
|
"Properties": {
|
|
26
26
|
"DeploymentId": {
|
|
27
|
-
"Ref": "
|
|
27
|
+
"Ref": "PassDeployment01229d54"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment01229d54": {
|
|
47
47
|
"Type": "AWS::ApiGateway::Deployment",
|
|
48
48
|
"DependsOn": "PassMethod",
|
|
49
49
|
"Properties": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"Type": "AWS::ApiGateway::Stage",
|
|
25
25
|
"Properties": {
|
|
26
26
|
"DeploymentId": {
|
|
27
|
-
"Ref": "
|
|
27
|
+
"Ref": "PassDeployment01229d54"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment01229d54": {
|
|
47
47
|
"Type": "AWS::ApiGateway::Deployment",
|
|
48
48
|
"DependsOn": "PassMethod",
|
|
49
49
|
"Properties": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"Type": "AWS::ApiGateway::Stage",
|
|
25
25
|
"Properties": {
|
|
26
26
|
"DeploymentId": {
|
|
27
|
-
"Ref": "
|
|
27
|
+
"Ref": "PassDeployment01229d54"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
-
"
|
|
55
|
+
"PassDeployment01229d54": {
|
|
56
56
|
"Type": "AWS::ApiGateway::Deployment",
|
|
57
57
|
"DependsOn": "PassMethod",
|
|
58
58
|
"Properties": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"Type": "AWS::ApiGateway::Stage",
|
|
25
25
|
"Properties": {
|
|
26
26
|
"DeploymentId": {
|
|
27
|
-
"Ref": "
|
|
27
|
+
"Ref": "PassDeployment01229d54"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment01229d54": {
|
|
47
47
|
"Type": "AWS::ApiGateway::Deployment",
|
|
48
48
|
"DependsOn": "PassMethod",
|
|
49
49
|
"Properties": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"Type": "AWS::ApiGateway::Stage",
|
|
25
25
|
"Properties": {
|
|
26
26
|
"DeploymentId": {
|
|
27
|
-
"Ref": "
|
|
27
|
+
"Ref": "PassDeployment01229d54"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment01229d54": {
|
|
47
47
|
"Type": "AWS::ApiGateway::Deployment",
|
|
48
48
|
"DependsOn": "PassMethod",
|
|
49
49
|
"Properties": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"Type": "AWS::ApiGateway::Stage",
|
|
25
25
|
"Properties": {
|
|
26
26
|
"DeploymentId": {
|
|
27
|
-
"Ref": "
|
|
27
|
+
"Ref": "PassDeployment01229d54"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment01229d54": {
|
|
47
47
|
"Type": "AWS::ApiGateway::Deployment",
|
|
48
48
|
"DependsOn": "PassMethod",
|
|
49
49
|
"Properties": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"Type": "AWS::ApiGateway::Stage",
|
|
25
25
|
"Properties": {
|
|
26
26
|
"DeploymentId": {
|
|
27
|
-
"Ref": "
|
|
27
|
+
"Ref": "PassDeployment01229d54"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment01229d54": {
|
|
47
47
|
"Type": "AWS::ApiGateway::Deployment",
|
|
48
48
|
"DependsOn": "PassMethod",
|
|
49
49
|
"Properties": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"Type": "AWS::ApiGateway::Stage",
|
|
25
25
|
"Properties": {
|
|
26
26
|
"DeploymentId": {
|
|
27
|
-
"Ref": "
|
|
27
|
+
"Ref": "PassDeployment01229d54"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment01229d54": {
|
|
47
47
|
"Type": "AWS::ApiGateway::Deployment",
|
|
48
48
|
"DependsOn": "PassMethod",
|
|
49
49
|
"Properties": {
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
"MyLambdaSchedule": {
|
|
132
|
-
"Type": "AWS::
|
|
132
|
+
"Type": "AWS::Scheduler::Schedule",
|
|
133
133
|
"Properties": {
|
|
134
134
|
"Name": {
|
|
135
135
|
"Fn::Sub": "${AWS::StackName}-MyLambda"
|
|
@@ -146,7 +146,10 @@
|
|
|
146
146
|
},
|
|
147
147
|
"State": "ENABLED",
|
|
148
148
|
"ScheduleExpression": "rate(1 hour)",
|
|
149
|
-
"
|
|
149
|
+
"FlexibleTimeWindow": {
|
|
150
|
+
"Mode": "OFF"
|
|
151
|
+
},
|
|
152
|
+
"Target": [
|
|
150
153
|
{
|
|
151
154
|
"Id": {
|
|
152
155
|
"Fn::Sub": "${AWS::StackName}-MyLambda"
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
"MyLambdaSchedule": {
|
|
132
|
-
"Type": "AWS::
|
|
132
|
+
"Type": "AWS::Scheduler::Schedule",
|
|
133
133
|
"Properties": {
|
|
134
134
|
"Name": {
|
|
135
135
|
"Fn::Sub": "${AWS::StackName}-MyLambda"
|
|
@@ -146,7 +146,10 @@
|
|
|
146
146
|
},
|
|
147
147
|
"State": "DISABLED",
|
|
148
148
|
"ScheduleExpression": "rate(1 hour)",
|
|
149
|
-
"
|
|
149
|
+
"FlexibleTimeWindow": {
|
|
150
|
+
"Mode": "OFF"
|
|
151
|
+
},
|
|
152
|
+
"Target": [
|
|
150
153
|
{
|
|
151
154
|
"Id": {
|
|
152
155
|
"Fn::Sub": "${AWS::StackName}-MyLambda"
|
package/test/shortcuts.test.js
CHANGED
|
@@ -345,6 +345,7 @@ test('[shortcuts] scheduled-lambda', (assert) => {
|
|
|
345
345
|
fixtures.get('scheduled-lambda-full'),
|
|
346
346
|
'expected resources generated without defaults'
|
|
347
347
|
);
|
|
348
|
+
|
|
348
349
|
assert.end();
|
|
349
350
|
});
|
|
350
351
|
|
|
@@ -420,31 +421,6 @@ test('[shortcuts] event-lambda', (assert) => {
|
|
|
420
421
|
'expected resources generated without defaults'
|
|
421
422
|
);
|
|
422
423
|
|
|
423
|
-
lambda = new cf.shortcuts.EventLambda({
|
|
424
|
-
LogicalName: 'MyLambda',
|
|
425
|
-
Code: {
|
|
426
|
-
S3Bucket: 'my-code-bucket',
|
|
427
|
-
S3Key: 'path/to/code.zip'
|
|
428
|
-
},
|
|
429
|
-
EventBusName: 'my-cool-eventbus',
|
|
430
|
-
EventPattern: {
|
|
431
|
-
source: ['aws.ec2'],
|
|
432
|
-
'detail-type': ['EC2 Instance State-change Notification'],
|
|
433
|
-
detail: {
|
|
434
|
-
state: ['running']
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
State: 'DISABLED'
|
|
438
|
-
});
|
|
439
|
-
|
|
440
|
-
template = cf.merge(lambda);
|
|
441
|
-
if (update) fixtures.update('event-lambda-custom-eventbus', template);
|
|
442
|
-
assert.deepEqual(
|
|
443
|
-
noUndefined(template),
|
|
444
|
-
fixtures.get('event-lambda-custom-eventbus'),
|
|
445
|
-
'expected resources generated without defaults and a custom eventbus'
|
|
446
|
-
);
|
|
447
|
-
|
|
448
424
|
assert.end();
|
|
449
425
|
});
|
|
450
426
|
|