Skip to content

Commit

Permalink
Merge pull request #3 from j-d-ha/request-id
Browse files Browse the repository at this point in the history
added UUID for request id
  • Loading branch information
j-d-ha authored Aug 7, 2024
2 parents 6064bc5 + e378a5f commit 2d2937c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,7 @@ go.work.sum
**/env.json

# AWS
**./.aws-sam
**./.aws-sam


/sample_request.txt
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.22

require (
github.com/aws/aws-lambda-go v1.47.0
github.com/google/uuid v1.6.0
github.com/stretchr/testify v1.8.4
github.com/urfave/cli/v3 v3.0.0-alpha9
gopkg.in/yaml.v3 v3.0.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/aws/aws-lambda-go v1.47.0/go.mod h1:dpMpZgvWx5vuQJfBt0zqBha60q7Dd7Rfg
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
4 changes: 3 additions & 1 deletion invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/aws/aws-lambda-go/lambda/messages"
"github.com/google/uuid"
)

type Option func(*LambdaRPC)
Expand Down Expand Up @@ -45,7 +46,8 @@ func NewLambdaRPC(address string, executionLimit time.Duration, options ...Optio
func (l LambdaRPC) Invoke(data []byte) (messages.InvokeResponse, error) {
deadline := time.Now().Add(l.executionLimit)
request := messages.InvokeRequest{
Payload: data,
Payload: data,
RequestId: uuid.New().String(),
Deadline: messages.InvokeRequest_Timestamp{
Seconds: deadline.Unix(),
Nanos: int64(deadline.Nanosecond()),
Expand Down
6 changes: 3 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

.PHONEY: run_event
run_event:
go run ./cmd/cli/ \
go run . \
--parse-json \
event \
--file "./example/api-gateway-basic/events/event.json"
--file "./example/api-gateway-basic/event.json"

.PHONEY: run_api
run_api:
go run ./cmd/cli/ \
go run . \
--parse-json \
api \
--template "./example/api-gateway-basic/template.yaml"

0 comments on commit 2d2937c

Please sign in to comment.