Skip to content

Instantly share code, notes, and snippets.

@SamanShafigh
Created June 10, 2018 02:22
Show Gist options
  • Save SamanShafigh/73e6f193a8925e49d80f1ad48bc3cb10 to your computer and use it in GitHub Desktop.
Save SamanShafigh/73e6f193a8925e49d80f1ad48bc3cb10 to your computer and use it in GitHub Desktop.
lambda-f2.go
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