@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.
Files changed (25) hide show
  1. package/.nyc_output/11f7164b-7ffe-482b-97df-1421dd64f11d.json +1 -0
  2. package/.nyc_output/1fd23852-2043-434f-bb39-a9052f67b4a6.json +1 -0
  3. package/.nyc_output/processinfo/{ee3bde6e-e139-45e3-8559-dd8d9fa90e13.json → 11f7164b-7ffe-482b-97df-1421dd64f11d.json} +1 -1
  4. package/.nyc_output/processinfo/{e5f117ab-047a-4a8e-b56e-6dd4198a5fab.json → 1fd23852-2043-434f-bb39-a9052f67b4a6.json} +1 -1
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/lib/shortcuts/api.md +0 -33
  7. package/lib/shortcuts/event-lambda.js +0 -34
  8. package/lib/shortcuts/scheduled-lambda.js +5 -2
  9. package/package.json +1 -1
  10. package/test/fixtures/shortcuts/event-lambda-defaults.json +0 -1
  11. package/test/fixtures/shortcuts/event-lambda-full.json +0 -1
  12. package/test/fixtures/shortcuts/hookshot-github-secret-ref.json +2 -2
  13. package/test/fixtures/shortcuts/hookshot-github-secret-string.json +2 -2
  14. package/test/fixtures/shortcuts/hookshot-github.json +2 -2
  15. package/test/fixtures/shortcuts/hookshot-passthrough-access-log-format.json +2 -2
  16. package/test/fixtures/shortcuts/hookshot-passthrough-alarms.json +2 -2
  17. package/test/fixtures/shortcuts/hookshot-passthrough-enhanced-logging.json +2 -2
  18. package/test/fixtures/shortcuts/hookshot-passthrough-full-blown-logging.json +2 -2
  19. package/test/fixtures/shortcuts/hookshot-passthrough-logging.json +2 -2
  20. package/test/fixtures/shortcuts/hookshot-passthrough.json +2 -2
  21. package/test/fixtures/shortcuts/scheduled-lambda-defaults.json +5 -2
  22. package/test/fixtures/shortcuts/scheduled-lambda-full.json +5 -2
  23. package/test/shortcuts.test.js +1 -25
  24. package/.nyc_output/e5f117ab-047a-4a8e-b56e-6dd4198a5fab.json +0 -1
  25. package/.nyc_output/ee3bde6e-e139-45e3-8559-dd8d9fa90e13.json +0 -1
@@ -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>&#x27;default&#x27;</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>&#x27;ENABLED&#x27;</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::Events::Rule',
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
- Targets: [
57
+ FlexibleTimeWindow: {
58
+ Mode: 'OFF'
59
+ },
60
+ Target: [
58
61
  {
59
62
  Id: this.FunctionName,
60
63
  Arn: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapbox/cloudfriend",
3
- "version": "7.2.0-1",
3
+ "version": "7.2.0-3",
4
4
  "description": "Helper functions for assembling CloudFormation templates in JavaScript",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -145,7 +145,6 @@
145
145
  ]
146
146
  },
147
147
  "State": "ENABLED",
148
- "EventBusName": "default",
149
148
  "EventPattern": {
150
149
  "source": [
151
150
  "aws.ec2"
@@ -145,7 +145,6 @@
145
145
  ]
146
146
  },
147
147
  "State": "DISABLED",
148
- "EventBusName": "default",
149
148
  "EventPattern": {
150
149
  "source": [
151
150
  "aws.ec2"
@@ -28,7 +28,7 @@
28
28
  "Type": "AWS::ApiGateway::Stage",
29
29
  "Properties": {
30
30
  "DeploymentId": {
31
- "Ref": "PassDeployment2d092515"
31
+ "Ref": "PassDeployment01229d54"
32
32
  },
33
33
  "StageName": "hookshot",
34
34
  "RestApiId": {
@@ -47,7 +47,7 @@
47
47
  ]
48
48
  }
49
49
  },
50
- "PassDeployment2d092515": {
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": "PassDeployment2d092515"
27
+ "Ref": "PassDeployment01229d54"
28
28
  },
29
29
  "StageName": "hookshot",
30
30
  "RestApiId": {
@@ -43,7 +43,7 @@
43
43
  ]
44
44
  }
45
45
  },
46
- "PassDeployment2d092515": {
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": "PassDeployment2d092515"
27
+ "Ref": "PassDeployment01229d54"
28
28
  },
29
29
  "StageName": "hookshot",
30
30
  "RestApiId": {
@@ -43,7 +43,7 @@
43
43
  ]
44
44
  }
45
45
  },
46
- "PassDeployment2d092515": {
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": "PassDeployment2d092515"
27
+ "Ref": "PassDeployment01229d54"
28
28
  },
29
29
  "StageName": "hookshot",
30
30
  "RestApiId": {
@@ -52,7 +52,7 @@
52
52
  }
53
53
  }
54
54
  },
55
- "PassDeployment2d092515": {
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": "PassDeployment2d092515"
27
+ "Ref": "PassDeployment01229d54"
28
28
  },
29
29
  "StageName": "hookshot",
30
30
  "RestApiId": {
@@ -43,7 +43,7 @@
43
43
  ]
44
44
  }
45
45
  },
46
- "PassDeployment2d092515": {
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": "PassDeployment2d092515"
27
+ "Ref": "PassDeployment01229d54"
28
28
  },
29
29
  "StageName": "hookshot",
30
30
  "RestApiId": {
@@ -43,7 +43,7 @@
43
43
  ]
44
44
  }
45
45
  },
46
- "PassDeployment2d092515": {
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": "PassDeployment2d092515"
27
+ "Ref": "PassDeployment01229d54"
28
28
  },
29
29
  "StageName": "hookshot",
30
30
  "RestApiId": {
@@ -43,7 +43,7 @@
43
43
  ]
44
44
  }
45
45
  },
46
- "PassDeployment2d092515": {
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": "PassDeployment2d092515"
27
+ "Ref": "PassDeployment01229d54"
28
28
  },
29
29
  "StageName": "hookshot",
30
30
  "RestApiId": {
@@ -43,7 +43,7 @@
43
43
  ]
44
44
  }
45
45
  },
46
- "PassDeployment2d092515": {
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": "PassDeployment2d092515"
27
+ "Ref": "PassDeployment01229d54"
28
28
  },
29
29
  "StageName": "hookshot",
30
30
  "RestApiId": {
@@ -43,7 +43,7 @@
43
43
  ]
44
44
  }
45
45
  },
46
- "PassDeployment2d092515": {
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::Events::Rule",
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
- "Targets": [
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::Events::Rule",
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
- "Targets": [
149
+ "FlexibleTimeWindow": {
150
+ "Mode": "OFF"
151
+ },
152
+ "Target": [
150
153
  {
151
154
  "Id": {
152
155
  "Fn::Sub": "${AWS::StackName}-MyLambda"
@@ -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