diff --git a/integration-sns-to-lambda/example.go b/integration-sns-to-lambda/example.go new file mode 100644 index 0000000..7d902e2 --- /dev/null +++ b/integration-sns-to-lambda/example.go @@ -0,0 +1,26 @@ +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handler(ctx context.Context, snsEvent events.SNSEvent) { + for _, record := range snsEvent.Records { + processMessage(record) + } + fmt.Println("done") +} + +func processMessage(record events.SNSEventRecord) { + message := record.SNS.Message + fmt.Printf("Processed message: %s\n", message) + // TODO: Process your record here +} + +func main() { + lambda.Start(handler) +} diff --git a/integration-sns-to-lambda/snippet-data.json b/integration-sns-to-lambda/snippet-data.json index 9394456..90c6219 100644 --- a/integration-sns-to-lambda/snippet-data.json +++ b/integration-sns-to-lambda/snippet-data.json @@ -53,6 +53,17 @@ } ] }, + { + "id": "Go", + "title": "Usage Example with Go:", + "description": "Consuming an SNS event with Lambda using Go.", + "snippets": [ + { + "snippetPath": "example.go", + "language": "go" + } + ] + }, { "id": "Python", "title": "Usage Example with Python:",