Created
June 10, 2018 02:22
-
-
Save SamanShafigh/73e6f193a8925e49d80f1ad48bc3cb10 to your computer and use it in GitHub Desktop.
lambda-f2.go
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
// InEvent defines your lambda input data structure, | |
type InEvent struct { | |
Payload string `json:"payload"` | |
} | |
// OutEvent defines your lambda output data structure, | |
type OutEvent struct { | |
Payload string `json:"payload"` | |
Status int `json:"status"` | |
} | |
// HandleRequest handles the incomming StepFunction request | |
func HandleRequest(e InEvent) (OutEvent, error) { | |
return OutEvent{ | |
Payload: fmt.Sprintf("%s is handled by 2nd function", e.Payload), | |
Status: rand.Intn(100), | |
}, nil | |
} | |
func main() { | |
lambda.Start(HandleRequest) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment