Add lambda code for replace API Destination#1
Open
ramgopalsiddh wants to merge 5 commits intooptiowl-cloud:mainfrom
Open
Add lambda code for replace API Destination#1ramgopalsiddh wants to merge 5 commits intooptiowl-cloud:mainfrom
ramgopalsiddh wants to merge 5 commits intooptiowl-cloud:mainfrom
Conversation
| processed_message_ids.add(message_hash) | ||
|
|
||
| # Forward the entire SQS message to the external API | ||
| response = requests.post('https://webhook.site/f7274881-d5c1-43f3-9a30-de0a0a255cdd', json=record) |
Contributor
There was a problem hiding this comment.
the webhook URL need to be given from the UI itself, record body etc,...
Author
There was a problem hiding this comment.
- we have 2 way to Add URL from UI :-
1.Add URL in Lambda Environment variables
2. Send URL with SQS message and extract that url in Lambda function and use it
3. We can use Parameter Store, Webhook URL store in Parameter Store and use url from Parameter Store
ramgopalsiddh
commented
Aug 5, 2024
Author
There was a problem hiding this comment.
- This code in Go lang this Lambda function is used to replace API Destination
- In this we enter url in SQS message like this
- {
"url": "< url >",
"message_body": "This is a simple text message."
}
- {
- This help us to easy to change url without change in code
go_lang_lambda_function/main.go
Outdated
| var processedMessageIDs = make(map[string]struct{}) | ||
|
|
||
| // Record represents an SQS record | ||
| type Record struct { |
Contributor
There was a problem hiding this comment.
we should replace API Destination in a generic way i.e we should accept all kinds of records i.e not just SQS
go_lang_lambda_function/main.go
Outdated
| var records []Record | ||
|
|
||
| // Determine the type of event and unmarshal accordingly | ||
| switch e := event.(type) { |
Contributor
There was a problem hiding this comment.
is there any standard event type that we can accept directly in the handler, probably input transformer is a good feature to checkout for this lambda target
…L in Lambda's Environment variables
Author
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Lambda is used to replace API Destination.
Why use this Lambda?
In this function, use AWS SQS as the source and this Lambda function as the target. This Lambda receives messages from SQS and sends them to the webhook.
In This we have Go lang and Python 2 language code