Skip to content

Commit b9f3044

Browse files
committed
docs(eventbridge): add eventbridge usage
1 parent daa1784 commit b9f3044

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This Serverless Framework plugin supports the AWS service proxy integration feat
1919
- [Can use greedy, for deeper Folders](#can-use-greedy--for-deeper-folders)
2020
- [SNS](#sns)
2121
- [DynamoDB](#dynamodb)
22+
- [EventBridge](#eventbridge)
2223
- [Common API Gateway features](#common-api-gateway-features)
2324
- [Enabling CORS](#enabling-cors)
2425
- [Adding Authorization](#adding-authorization)
@@ -47,6 +48,7 @@ Please pull request if you are intersted in it.
4748
- S3
4849
- SNS
4950
- DynamoDB
51+
- EventBridge
5052

5153
## How to use
5254

@@ -376,6 +378,50 @@ curl -XPUT https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/dynamodb/<has
376378
-H 'Content-Type:application/json'
377379
```
378380

381+
382+
### EventBridge
383+
384+
Sample syntax for EventBridge proxy in `serverless.yml`.
385+
386+
```yaml
387+
custom:
388+
apiGatewayServiceProxies:
389+
- eventbridge: # source and detailType is set to apigateway requestid by default
390+
path: /eventbridge
391+
method: post
392+
eventBusName: { Ref: 'YourBusName' }
393+
cors: true
394+
- eventbridge: # source and detailType are hardcoded
395+
path: /eventbridge
396+
method: post
397+
source: 'hardcoded_source'
398+
detailType: 'hardcoded_detailType'
399+
eventBusName: { Ref: 'YourBusName' }
400+
cors: true
401+
- eventbridge: # source and detailType as path parameters
402+
path: /eventbridge/{detailTypeKey}/{sourceKey}
403+
method: post
404+
detailType:
405+
pathParam: detailTypeKey
406+
source:
407+
pathParam: sourceKey
408+
eventBusName: { Ref: 'YourBusName' }
409+
cors: true
410+
411+
resources:
412+
Resources:
413+
YourBus:
414+
Type: AWS::Events::EventBus
415+
Properties:
416+
Name: YourEventBus
417+
```
418+
419+
Sample request after deploying.
420+
421+
```bash
422+
curl https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/eventbridge -d '{"message": "some data"}' -H 'Content-Type:application/json'
423+
```
424+
379425
## Common API Gateway features
380426

381427
### Enabling CORS

0 commit comments

Comments
 (0)