This repository was archived by the owner on Dec 11, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ ## Launching a KLR based function with ` tm `
2+
3+ Check the ` serverless.yaml ` file which describes the function deployment.
4+
5+ See how the Cron Job trigger is defined
6+
7+ ```
8+ tm deploy
9+ ```
10+
11+ This will do the build of the function in the Knative cluster, deploy it as a Service and create a CronJob event source.
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "fmt"
5+ "context"
6+ "github.com/aws/aws-lambda-go/lambda"
7+ )
8+
9+ type MyEvent struct {
10+ Name string `json:"name"`
11+ }
12+
13+ func HandleRequest (ctx context.Context , name MyEvent ) (string , error ) {
14+ return fmt .Sprintf ("Hello %s!" , name .Name ), nil
15+ }
16+
17+ func main () {
18+ lambda .Start (HandleRequest )
19+ }
Original file line number Diff line number Diff line change 1+ service : serverless-foo
2+ description : " cron test with KLR"
3+
4+ provider :
5+ name : triggermesh
6+
7+ functions :
8+ goklr :
9+ source : main.go
10+ runtime : https://raw.githubusercontent.com/triggermesh/knative-lambda-runtime/master/go-1.x/buildtemplate.yaml
11+ description : " klr go"
12+ environment :
13+ FUNCTION : go-klr
14+ events :
15+ - schedule :
16+ rate : " */1 * * * *"
17+ data : ' {"Name":"sebgoa"}'
You can’t perform that action at this time.
0 commit comments