@mapbox/cloudfriend 7.2.0-0 → 7.2.0-2
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/881a67e7-f7cd-472c-8f14-42b00abcec0b.json +1 -0
- package/.nyc_output/b6a6ce03-918d-4ce9-be37-e15395e32aa7.json +1 -0
- package/.nyc_output/processinfo/881a67e7-f7cd-472c-8f14-42b00abcec0b.json +1 -0
- package/.nyc_output/processinfo/b6a6ce03-918d-4ce9-be37-e15395e32aa7.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/lib/shortcuts/api.md +0 -27
- package/lib/shortcuts/event-lambda.js +2 -5
- package/lib/shortcuts/scheduled-lambda.js +4 -33
- package/package.json +1 -1
- package/test/fixtures/shortcuts/event-lambda-custom-eventbus.json +2 -2
- package/test/fixtures/shortcuts/event-lambda-defaults.json +1 -0
- package/test/fixtures/shortcuts/event-lambda-full.json +1 -0
- 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 +4 -1
- package/test/fixtures/shortcuts/scheduled-lambda-full.json +4 -1
- package/test/shortcuts.test.js +0 -18
- package/.nyc_output/c85e6e5a-f842-4bd6-ad20-6f04ab728aac.json +0 -1
- package/.nyc_output/f52017b2-43bd-4f2e-a740-f75421866b4a.json +0 -1
- package/.nyc_output/processinfo/c85e6e5a-f842-4bd6-ad20-6f04ab728aac.json +0 -1
- package/.nyc_output/processinfo/f52017b2-43bd-4f2e-a740-f75421866b4a.json +0 -1
|
@@ -73,7 +73,7 @@ class EventLambda extends Lambda {
|
|
|
73
73
|
|
|
74
74
|
const {
|
|
75
75
|
EventPattern,
|
|
76
|
-
EventBusName,
|
|
76
|
+
EventBusName = 'default',
|
|
77
77
|
State = 'ENABLED'
|
|
78
78
|
} = options;
|
|
79
79
|
|
|
@@ -93,6 +93,7 @@ class EventLambda extends Lambda {
|
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
95
|
State,
|
|
96
|
+
EventBusName,
|
|
96
97
|
EventPattern,
|
|
97
98
|
Targets: [
|
|
98
99
|
{
|
|
@@ -105,10 +106,6 @@ class EventLambda extends Lambda {
|
|
|
105
106
|
}
|
|
106
107
|
};
|
|
107
108
|
|
|
108
|
-
if (EventBusName) {
|
|
109
|
-
this.Resources[`${this.LogicalName}Trigger`].Properties.EventBusName = EventBusName;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
109
|
this.Resources[`${this.LogicalName}Permission`] = {
|
|
113
110
|
Type: 'AWS::Lambda::Permission',
|
|
114
111
|
Condition: this.Condition,
|
|
@@ -9,7 +9,6 @@ const Lambda = require('./lambda');
|
|
|
9
9
|
*
|
|
10
10
|
* @param {Object} options - Extends the options for [`Lambda`](#lambda) with the following additional attributes:
|
|
11
11
|
* @param {String} options.ScheduleExpression - See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-scheduleexpression).
|
|
12
|
-
* @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).
|
|
13
12
|
* @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).
|
|
14
13
|
*
|
|
15
14
|
* @example
|
|
@@ -27,32 +26,6 @@ const Lambda = require('./lambda');
|
|
|
27
26
|
* });
|
|
28
27
|
*
|
|
29
28
|
* module.exports = cf.merge(myTemplate, lambda);
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* const cf = require('@mapbox/cloudfriend');
|
|
33
|
-
*
|
|
34
|
-
* const myTemplate = {
|
|
35
|
-
* ...
|
|
36
|
-
* Resources: {
|
|
37
|
-
* MyEventBus: {
|
|
38
|
-
* Type: 'AWS::Events::EventBus',
|
|
39
|
-
* Properties: { ... }
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
* };
|
|
43
|
-
*
|
|
44
|
-
* const lambda = new cf.shortcuts.ScheduledLambda({
|
|
45
|
-
* LogicalName: 'MyLambda',
|
|
46
|
-
* Code: {
|
|
47
|
-
* S3Bucket: 'my-code-bucket',
|
|
48
|
-
* S3Key: 'path/to/code.zip'
|
|
49
|
-
* },
|
|
50
|
-
* EventBusName: cf.ref('MyEventBus'),
|
|
51
|
-
* ScheduleExpression: 'cron(45 * * * ? *)',
|
|
52
|
-
* });
|
|
53
|
-
*
|
|
54
|
-
* module.exports = cf.merge(myTemplate, lambda);
|
|
55
|
-
*
|
|
56
29
|
*/
|
|
57
30
|
class ScheduledLambda extends Lambda {
|
|
58
31
|
constructor(options) {
|
|
@@ -60,7 +33,6 @@ class ScheduledLambda extends Lambda {
|
|
|
60
33
|
super(options);
|
|
61
34
|
|
|
62
35
|
const {
|
|
63
|
-
EventBusName,
|
|
64
36
|
ScheduleExpression,
|
|
65
37
|
State = 'ENABLED'
|
|
66
38
|
} = options;
|
|
@@ -70,7 +42,7 @@ class ScheduledLambda extends Lambda {
|
|
|
70
42
|
throw new Error('You must provide a ScheduleExpression');
|
|
71
43
|
|
|
72
44
|
this.Resources[`${this.LogicalName}Schedule`] = {
|
|
73
|
-
Type: 'AWS::
|
|
45
|
+
Type: 'AWS::Scheduler::Schedule',
|
|
74
46
|
Condition: this.Condition,
|
|
75
47
|
Properties: {
|
|
76
48
|
Name: this.FunctionName,
|
|
@@ -82,6 +54,9 @@ class ScheduledLambda extends Lambda {
|
|
|
82
54
|
},
|
|
83
55
|
State,
|
|
84
56
|
ScheduleExpression,
|
|
57
|
+
FlexibleTimeWindow: {
|
|
58
|
+
Mode: 'OFF'
|
|
59
|
+
},
|
|
85
60
|
Targets: [
|
|
86
61
|
{
|
|
87
62
|
Id: this.FunctionName,
|
|
@@ -93,10 +68,6 @@ class ScheduledLambda extends Lambda {
|
|
|
93
68
|
}
|
|
94
69
|
};
|
|
95
70
|
|
|
96
|
-
if (EventBusName) {
|
|
97
|
-
this.Resources[`${this.LogicalName}Schedule`].Properties.EventBusName = EventBusName;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
71
|
this.Resources[`${this.LogicalName}Permission`] = {
|
|
101
72
|
Type: 'AWS::Lambda::Permission',
|
|
102
73
|
Condition: this.Condition,
|
package/package.json
CHANGED
|
@@ -145,6 +145,7 @@
|
|
|
145
145
|
]
|
|
146
146
|
},
|
|
147
147
|
"State": "DISABLED",
|
|
148
|
+
"EventBusName": "my-cool-eventbus",
|
|
148
149
|
"EventPattern": {
|
|
149
150
|
"source": [
|
|
150
151
|
"aws.ec2"
|
|
@@ -170,8 +171,7 @@
|
|
|
170
171
|
]
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
|
-
]
|
|
174
|
-
"EventBusName": "my-cool-eventbus"
|
|
174
|
+
]
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
177
|
"MyLambdaPermission": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"Type": "AWS::ApiGateway::Stage",
|
|
29
29
|
"Properties": {
|
|
30
30
|
"DeploymentId": {
|
|
31
|
-
"Ref": "
|
|
31
|
+
"Ref": "PassDeployment9a222625"
|
|
32
32
|
},
|
|
33
33
|
"StageName": "hookshot",
|
|
34
34
|
"RestApiId": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
-
"
|
|
50
|
+
"PassDeployment9a222625": {
|
|
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": "PassDeployment9a222625"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment9a222625": {
|
|
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": "PassDeployment9a222625"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment9a222625": {
|
|
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": "PassDeployment9a222625"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
-
"
|
|
55
|
+
"PassDeployment9a222625": {
|
|
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": "PassDeployment9a222625"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment9a222625": {
|
|
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": "PassDeployment9a222625"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment9a222625": {
|
|
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": "PassDeployment9a222625"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment9a222625": {
|
|
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": "PassDeployment9a222625"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment9a222625": {
|
|
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": "PassDeployment9a222625"
|
|
28
28
|
},
|
|
29
29
|
"StageName": "hookshot",
|
|
30
30
|
"RestApiId": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
"
|
|
46
|
+
"PassDeployment9a222625": {
|
|
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,6 +146,9 @@
|
|
|
146
146
|
},
|
|
147
147
|
"State": "ENABLED",
|
|
148
148
|
"ScheduleExpression": "rate(1 hour)",
|
|
149
|
+
"FlexibleTimeWindow": {
|
|
150
|
+
"Mode": "OFF"
|
|
151
|
+
},
|
|
149
152
|
"Targets": [
|
|
150
153
|
{
|
|
151
154
|
"Id": {
|
|
@@ -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,6 +146,9 @@
|
|
|
146
146
|
},
|
|
147
147
|
"State": "DISABLED",
|
|
148
148
|
"ScheduleExpression": "rate(1 hour)",
|
|
149
|
+
"FlexibleTimeWindow": {
|
|
150
|
+
"Mode": "OFF"
|
|
151
|
+
},
|
|
149
152
|
"Targets": [
|
|
150
153
|
{
|
|
151
154
|
"Id": {
|
package/test/shortcuts.test.js
CHANGED
|
@@ -345,24 +345,6 @@ test('[shortcuts] scheduled-lambda', (assert) => {
|
|
|
345
345
|
fixtures.get('scheduled-lambda-full'),
|
|
346
346
|
'expected resources generated without defaults'
|
|
347
347
|
);
|
|
348
|
-
|
|
349
|
-
lambda = new cf.shortcuts.ScheduledLambda({
|
|
350
|
-
LogicalName: 'MyLambda',
|
|
351
|
-
Code: {
|
|
352
|
-
S3Bucket: 'my-code-bucket',
|
|
353
|
-
S3Key: 'path/to/code.zip'
|
|
354
|
-
},
|
|
355
|
-
EventBusName: 'my-cool-eventbus',
|
|
356
|
-
ScheduleExpression: 'rate(1 hour)',
|
|
357
|
-
State: 'DISABLED'
|
|
358
|
-
});
|
|
359
|
-
template = cf.merge(lambda);
|
|
360
|
-
if (update) fixtures.update('scheduled-lambda-custom-eventbus', template);
|
|
361
|
-
assert.deepEqual(
|
|
362
|
-
noUndefined(template),
|
|
363
|
-
fixtures.get('scheduled-lambda-custom-eventbus'),
|
|
364
|
-
'expected resources generated without defaults and a custom eventbus'
|
|
365
|
-
);
|
|
366
348
|
assert.end();
|
|
367
349
|
});
|
|
368
350
|
|