Skip to content

Commit dcd6e5f

Browse files
authored
Merge pull request #2 from failsafe-engineering/feature/implement-dynamic-trigger
Patch: Remove auto doc generation
2 parents 5e1a969 + a09675e commit dcd6e5f

File tree

4 files changed

+35
-1782
lines changed

4 files changed

+35
-1782
lines changed

README.md

Lines changed: 27 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,48 @@
1-
## Modules
1+
# serverless-aws-lambda-dynamic-trigger
22

3-
<dl>
4-
<dt><a href="#index.module_js">js</a></dt>
5-
<dd><p>The plugin can register triggers (events) for a lambda function dynamically. At deployment time</p>
6-
<ol>
7-
<li>It fetches the value of a parameter in the Parameters. The value must be a list ARNs sepearted by comma.</li>
8-
<li>Parses the individual ARNs.</li>
9-
<li>Register the ARNs as triggers with the configured lambda function or functions.</li>
10-
</ol>
11-
<p>Please note that currently you can only use the plugin with sns, sqs or kinesis triggers (events).</p>
12-
<p>The original idea is to make the same lambda function triggered by different events on different environments (stages).
13-
Like on <em>dev</em> foo lambda function is triggered by</p>
14-
<ul>
15-
<li>arn:aws:sns:eu-west-2:123456654321:topic1</li>
16-
<li>arn:aws:sns:eu-west-2:123456654321:topic2</li>
17-
<li>arn:aws:sns:eu-west-2:123456654321:topic3
18-
while on <em>prod</em> foo lambda function is triggered by</li>
19-
<li>arn:aws:sns:eu-west-2:123456654321:topic1</li>
20-
<li>arn:aws:sns:eu-west-2:123456654321:topic2
21-
This way we can switch features on and off on different stages.</li>
22-
</ul>
23-
<p>The dynamic trigger sets needs to ne stored in the Parameter Store of the Systems Manager (SSM) and it should look somewhat like this:
24-
Name: /dev/dynamic-trigger
25-
Value: arn:aws:sns:eu-west-2:123456654321:topic1,arn:aws:sns:eu-west-2:123456654321:topic2,arn:aws:sns:eu-west-2:123456654321:topic3
26-
or
27-
Name: /prod/dynamic-trigger
28-
Value: arn:aws:sns:eu-west-2:123456654321:topic1,arn:aws:sns:eu-west-2:123456654321:topic2</p>
29-
<p>The config parameters:</p>
30-
<ul>
31-
<li>region: the region of the Systems Manager -&gt; Parameter Store</li>
32-
<li>functions:<ul>
33-
<li>name: The name of the function</li>
34-
</ul>
35-
</li>
36-
</ul>
37-
<p>plugins:</p>
38-
<ul>
39-
<li>@kakkuk/serverless-aws-lambda-dynamic-trigger
40-
custom:
41-
dynamicTrigger:
42-
region: &quot;eu-west-2&quot; // !!! Optional !!! It&#39;ll fall back to AWS_DEFAULT_REGION if it&#39;s not set
43-
functions:<ul>
44-
<li>name: &quot;handler&quot;
45-
ssmPath: &quot;{/path/to/triggers}&quot;</li>
46-
</ul>
47-
</li>
48-
</ul>
49-
</dd>
50-
</dl>
51-
52-
## Members
53-
54-
<dl>
55-
<dt><a href="#Package @kakkuk/serverless-aws-lambda-dynamic-trigger">Package @kakkuk/serverless-aws-lambda-dynamic-trigger</a></dt>
56-
<dd><p>Serverless plugin registers a set of events stored in the AWS Parameter Store.</p>
57-
</dd>
58-
</dl>
59-
60-
<a name="index.module_js"></a>
61-
62-
## js
63-
The plugin can register triggers (events) for a lambda function dynamically. At deployment time
64-
1. It fetches the value of a parameter in the Parameters. The value must be a list ARNs sepearted by comma.
65-
2. Parses the individual ARNs.
3+
The plugin can register triggers (events) for a lambda function dynamically at the time of the deployment.
4+
1. It fetches the value of a parameter form the Parameter Store. The value must be a list ARNs separated by commas.
5+
2. Parses the individual ARNs and pulls out the name of the aws service.
666
3. Register the ARNs as triggers with the configured lambda function or functions.
677

68-
Please note that currently you can only use the plugin with sns, sqs or kinesis triggers (events).
8+
Please note that you can only use the plugin with **sns**, **sqs** or **kinesis** triggers.
699

7010
The original idea is to make the same lambda function triggered by different events on different environments (stages).
71-
Like on *dev* foo lambda function is triggered by
11+
Like on **dev** foo lambda function is triggered by
7212
- arn:aws:sns:eu-west-2:123456654321:topic1
7313
- arn:aws:sns:eu-west-2:123456654321:topic2
7414
- arn:aws:sns:eu-west-2:123456654321:topic3
75-
while on *prod* foo lambda function is triggered by
15+
while on **prod** foo lambda function is triggered by
7616
- arn:aws:sns:eu-west-2:123456654321:topic1
7717
- arn:aws:sns:eu-west-2:123456654321:topic2
7818
This way we can switch features on and off on different stages.
7919

80-
The dynamic trigger sets needs to ne stored in the Parameter Store of the Systems Manager (SSM) and it should look somewhat like this:
81-
Name: /dev/dynamic-trigger
82-
Value: arn:aws:sns:eu-west-2:123456654321:topic1,arn:aws:sns:eu-west-2:123456654321:topic2,arn:aws:sns:eu-west-2:123456654321:topic3
20+
The dynamic trigger sets need to ne stored in the Parameter Store of the Systems Manager (SSM) and it should look somewhat like this:
21+
22+
- **Name**: /dev/dynamic-trigger
23+
- **Value**: arn:aws:sns:eu-west-2:123456654321:topic1,arn:aws:sns:eu-west-2:123456654321:topic2,arn:aws:sns:eu-west-2:123456654321:topic3
24+
8325
or
84-
Name: /prod/dynamic-trigger
85-
Value: arn:aws:sns:eu-west-2:123456654321:topic1,arn:aws:sns:eu-west-2:123456654321:topic2
8626

87-
The config parameters:
88-
- region: the region of the Systems Manager -> Parameter Store
89-
- functions:
90-
- name: The name of the function
27+
- **Name**: /prod/dynamic-trigger
28+
- **Value**: arn:aws:sns:eu-west-2:123456654321:topic1,arn:aws:sns:eu-west-2:123456654321:topic2
29+
30+
## The config parameters:
31+
- **region**: {string} the region of the Systems Manager -> Parameter Store
32+
- **functions**: {Array<name: string, ssmPath: string>}
33+
- **name**: {string} The name of the function
34+
- **ssmPath**: {string} It's actually the name of the parameter in the Parameter Store
9135

36+
## Example
37+
```yml
9238
plugins:
9339
- @kakkuk/serverless-aws-lambda-dynamic-trigger
9440
custom:
9541
dynamicTrigger:
9642
region: "eu-west-2" // !!! Optional !!! It'll fall back to AWS_DEFAULT_REGION if it's not set
9743
functions:
98-
- name: "handler"
99-
ssmPath: "{/path/to/triggers}"
100-
101-
<a name="Package @kakkuk/serverless-aws-lambda-dynamic-trigger"></a>
102-
103-
## Package @kakkuk/serverless-aws-lambda-dynamic-trigger
104-
Serverless plugin registers a set of events stored in the AWS Parameter Store.
105-
106-
**Kind**: global variable
44+
- name: "handler1"
45+
ssmPath: "/prod/tigger-set1"
46+
- name: "handler2"
47+
ssmPath: "/prod/tigger-set2"
48+
```

0 commit comments

Comments
 (0)