forked from getndazn/dazn-lambda-powertools
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: updated example with eventbridge & cw events
- Loading branch information
1 parent
7229d04
commit a2f6de3
Showing
7 changed files
with
109 additions
and
3 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const SNS = require('@dazn/lambda-powertools-sns-client') | ||
const wrap = require('@dazn/lambda-powertools-pattern-basic') | ||
const Log = require('@dazn/lambda-powertools-logger') | ||
const CorrelationIds = require('@dazn/lambda-powertools-correlation-ids') | ||
|
||
module.exports.handler = wrap(async (event, context) => { | ||
console.log(JSON.stringify(event)) | ||
|
||
CorrelationIds.set('sns-sender', 'cloudwatchevents') | ||
Log.debug('publishing cloudwatchevents event as SNS message...', { event }) | ||
|
||
const req = { | ||
Message: JSON.stringify(event), | ||
TopicArn: process.env.TOPIC_ARN | ||
} | ||
return SNS.publish(req).promise() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const SNS = require('@dazn/lambda-powertools-sns-client') | ||
const wrap = require('@dazn/lambda-powertools-pattern-basic') | ||
const Log = require('@dazn/lambda-powertools-logger') | ||
const CorrelationIds = require('@dazn/lambda-powertools-correlation-ids') | ||
|
||
module.exports.handler = wrap(async (event, context) => { | ||
console.log(JSON.stringify(event)) | ||
|
||
CorrelationIds.set('sns-sender', 'eventbridge') | ||
Log.debug('publishing eventbridge event as SNS message...', { event }) | ||
|
||
const req = { | ||
Message: JSON.stringify(event), | ||
TopicArn: process.env.TOPIC_ARN | ||
} | ||
return SNS.publish(req).promise() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters