diff --git a/cmd/tegola_lambda/main.go b/cmd/tegola_lambda/main.go index 6c723b5a1..7cb234bdc 100644 --- a/cmd/tegola_lambda/main.go +++ b/cmd/tegola_lambda/main.go @@ -7,27 +7,40 @@ import ( "net/url" "os" - "github.com/arolek/algnhsa" + "github.com/akrylysov/algnhsa" + "github.com/dimfeld/httptreemux" + "github.com/go-spatial/tegola/atlas" "github.com/go-spatial/tegola/cmd/internal/register" "github.com/go-spatial/tegola/config" "github.com/go-spatial/tegola/dict" - "github.com/go-spatial/tegola/mvt" "github.com/go-spatial/tegola/server" ) -// set at build time via the CI -var Version = "version not set" +var ( + // Version set at build time via the CI + Version = "version not set" + // mux is a reference to the http muxer. it's stored as a package + // var so we can take advantage of Lambda's "Global State". + mux *httptreemux.TreeMux +) + +const DefaultConfLocation = "config.toml" +// instantiate the server during the init() function and then store +// the muxer in a package variable. This allows us to take advantage +// of "Global State" to avoid needing to re-parse the config, connect +// to databases, tile caches, etc. on each function invocation. +// +// For more info, see Using Global State: +// https://docs.aws.amazon.com/lambda/latest/dg/go-programming-model-handler-types.html func init() { + var err error + // override the URLRoot func with a lambda specific one server.URLRoot = URLRoot -} -func main() { - var err error - - confLocation := "config.toml" + confLocation := DefaultConfLocation // check if the env TEGOLA_CONFIG is set if os.Getenv("TEGOLA_CONFIG") != "" { @@ -98,13 +111,18 @@ func main() { } // http route setup - mux := server.NewRouter(nil) + mux = server.NewRouter(nil) +} +func main() { // the second argument here tells algnhasa to watch for the MVT MimeType Content-Type headers // if it detects this in the response the payload will be base64 encoded. Lambda needs to be configured // to handle binary responses so it can convert the base64 encoded payload back into binary prior // to sending to the client - algnhsa.ListenAndServe(mux, []string{mvt.MimeType}) + algnhsa.ListenAndServe(mux, &algnhsa.Options{ + BinaryContentTypes: []string{"application/vnd.mapbox-vector-tile"}, + UseProxyPath: true, + }) } // URLRoot overrides the default server.URLRoot function in order to include the "stage" part of the root diff --git a/vendor/github.com/akrylysov/algnhsa/CHANGELOG.md b/vendor/github.com/akrylysov/algnhsa/CHANGELOG.md new file mode 100644 index 000000000..d7dd1e552 --- /dev/null +++ b/vendor/github.com/akrylysov/algnhsa/CHANGELOG.md @@ -0,0 +1,39 @@ +# Changelog + +## [0.12.1] - 2019-09-26 +### Added +- Fixed compatibility with Go versions older than 1.13. + +## [0.12.0] - 2019-09-26 +### Added +- ALB support (thanks @adimarco and @ARolek for feedback). + +## [0.11.0] - 2019-03-18 +### Added +- Go Modules support. + +## [0.10] - 2019-02-03 +### Changed +- Set RequestURI on request (@RossHammer). +- Unescape Path (@RossHammer). +- Multi-value header support implemented using APIGatewayProxyResponse.MultiValueHeaders. + +## [0.9] - 2018-12-10 +### Added +- Support multi-value query string parameters and headers in requests. + +## [0.8] - 2018-07-29 +### Added +- Workaround for API Gateway not supporting headers with multiple values (@mspiegel). + +## [0.7] - 2018-06-08 +### Added +- UseProxyPath option - strips the base path mapping when using a custom domain with API Gateway. + +## [0.6] - 2018-05-30 +### Changed +- Set Host header for requests (@rvdwijngaard). + +## [0.5] - 2018-02-05 +### Added +- Context support. diff --git a/vendor/github.com/arolek/algnhsa/LICENSE b/vendor/github.com/akrylysov/algnhsa/LICENSE similarity index 100% rename from vendor/github.com/arolek/algnhsa/LICENSE rename to vendor/github.com/akrylysov/algnhsa/LICENSE diff --git a/vendor/github.com/arolek/algnhsa/README.md b/vendor/github.com/akrylysov/algnhsa/README.md similarity index 55% rename from vendor/github.com/arolek/algnhsa/README.md rename to vendor/github.com/akrylysov/algnhsa/README.md index 83560244b..db5dc9df1 100644 --- a/vendor/github.com/arolek/algnhsa/README.md +++ b/vendor/github.com/akrylysov/algnhsa/README.md @@ -2,7 +2,7 @@ algnhsa is an AWS Lambda Go `net/http` server adapter. -algnhsa enables running Go web applications on AWS Lambda/API Gateway without changing the existing HTTP handlers: +algnhsa enables running Go web applications on AWS Lambda and API Gateway or ALB without changing the existing HTTP handlers: ```go package main @@ -26,14 +26,22 @@ func addHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "%d", f+s) } +func contextHandler(w http.ResponseWriter, r *http.Request) { + proxyReq, ok := algnhsa.ProxyRequestFromContext(r.Context()) + if ok { + fmt.Fprint(w, proxyReq.RequestContext.AccountID) + } +} + func main() { http.HandleFunc("/", indexHandler) http.HandleFunc("/add", addHandler) + http.HandleFunc("/context", contextHandler) algnhsa.ListenAndServe(http.DefaultServeMux, nil) } ``` -Plug in a third-party HTTP router: +## Plug in a third-party HTTP router ```go package main @@ -54,4 +62,20 @@ func main() { } ``` -More details at http://artem.krylysov.com/blog/2018/01/18/porting-go-web-applications-to-aws-lambda/. +## Setting up API Gateway + +1. Create a new REST API. + +2. In the "Resources" section create a new `ANY` method to handle requests to `/` (check "Use Lambda Proxy Integration"). + + ![API Gateway index](https://akrylysov.github.io/algnhsa/apigateway-index.png) + +3. Add a catch-all `{proxy+}` resource to handle requests to every other path (check "Configure as proxy resource"). + + ![API Gateway catch-all](https://akrylysov.github.io/algnhsa/apigateway-catchall.png) + +## Setting up ALB + +1. Create a new ALB and point it to your Lambda function. + +2. In the target group settings enable "Multi value headers". diff --git a/vendor/github.com/akrylysov/algnhsa/adapter.go b/vendor/github.com/akrylysov/algnhsa/adapter.go new file mode 100644 index 000000000..ef0e4e550 --- /dev/null +++ b/vendor/github.com/akrylysov/algnhsa/adapter.go @@ -0,0 +1,51 @@ +package algnhsa + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + + "github.com/aws/aws-lambda-go/lambda" +) + +var defaultOptions = &Options{} + +type lambdaHandler struct { + httpHandler http.Handler + opts *Options +} + +func (handler lambdaHandler) Invoke(ctx context.Context, payload []byte) ([]byte, error) { + resp, err := handler.handleEvent(ctx, payload) + if err != nil { + return nil, err + } + return json.Marshal(resp) +} + +func (handler lambdaHandler) handleEvent(ctx context.Context, payload []byte) (lambdaResponse, error) { + eventReq, err := newLambdaRequest(ctx, payload, handler.opts) + if err != nil { + return lambdaResponse{}, err + } + r, err := newHTTPRequest(eventReq) + if err != nil { + return lambdaResponse{}, err + } + w := httptest.NewRecorder() + handler.httpHandler.ServeHTTP(w, r) + return newLambdaResponse(w, handler.opts.binaryContentTypeMap) +} + +// ListenAndServe starts the AWS Lambda runtime (aws-lambda-go lambda.Start) with a given handler. +func ListenAndServe(handler http.Handler, opts *Options) { + if handler == nil { + handler = http.DefaultServeMux + } + if opts == nil { + opts = defaultOptions + } + opts.setBinaryContentTypeMap() + lambda.StartHandler(lambdaHandler{httpHandler: handler, opts: opts}) +} diff --git a/vendor/github.com/akrylysov/algnhsa/alb.go b/vendor/github.com/akrylysov/algnhsa/alb.go new file mode 100644 index 000000000..eccb96764 --- /dev/null +++ b/vendor/github.com/akrylysov/algnhsa/alb.go @@ -0,0 +1,53 @@ +package algnhsa + +import ( + "context" + "encoding/json" + "errors" + "strings" + + "github.com/aws/aws-lambda-go/events" +) + +var ( + errALBUnexpectedRequest = errors.New("expected ALBTargetGroupRequest") + errALBExpectedMultiValueHeaders = errors.New("expected multi value headers; enable Multi value headers in target group settings") +) + +func getALBSourceIP(event events.ALBTargetGroupRequest) string { + if xff, ok := event.MultiValueHeaders["x-forwarded-for"]; ok && len(xff) > 0 { + ips := strings.SplitN(xff[0], ",", 2) + if len(ips) > 0 { + return ips[0] + } + } + return "" +} + +func newALBRequest(ctx context.Context, payload []byte, opts *Options) (lambdaRequest, error) { + var event events.ALBTargetGroupRequest + if err := json.Unmarshal(payload, &event); err != nil { + return lambdaRequest{}, err + } + if event.RequestContext.ELB.TargetGroupArn == "" { + return lambdaRequest{}, errALBUnexpectedRequest + } + if len(event.MultiValueHeaders) == 0 { + return lambdaRequest{}, errALBExpectedMultiValueHeaders + } + + req := lambdaRequest{ + HTTPMethod: event.HTTPMethod, + Path: event.Path, + QueryStringParameters: event.QueryStringParameters, + MultiValueQueryStringParameters: event.MultiValueQueryStringParameters, + Headers: event.Headers, + MultiValueHeaders: event.MultiValueHeaders, + Body: event.Body, + IsBase64Encoded: event.IsBase64Encoded, + SourceIP: getALBSourceIP(event), + Context: newTargetGroupRequestContext(ctx, event), + } + + return req, nil +} diff --git a/vendor/github.com/akrylysov/algnhsa/apigw.go b/vendor/github.com/akrylysov/algnhsa/apigw.go new file mode 100644 index 000000000..8414aba13 --- /dev/null +++ b/vendor/github.com/akrylysov/algnhsa/apigw.go @@ -0,0 +1,43 @@ +package algnhsa + +import ( + "context" + "encoding/json" + "errors" + "path" + + "github.com/aws/aws-lambda-go/events" +) + +var ( + errAPIGatewayUnexpectedRequest = errors.New("expected APIGatewayProxyRequest event") +) + +func newAPIGatewayRequest(ctx context.Context, payload []byte, opts *Options) (lambdaRequest, error) { + var event events.APIGatewayProxyRequest + if err := json.Unmarshal(payload, &event); err != nil { + return lambdaRequest{}, err + } + if event.RequestContext.AccountID == "" { + return lambdaRequest{}, errAPIGatewayUnexpectedRequest + } + + req := lambdaRequest{ + HTTPMethod: event.HTTPMethod, + Path: event.Path, + QueryStringParameters: event.QueryStringParameters, + MultiValueQueryStringParameters: event.MultiValueQueryStringParameters, + Headers: event.Headers, + MultiValueHeaders: event.MultiValueHeaders, + Body: event.Body, + IsBase64Encoded: event.IsBase64Encoded, + SourceIP: event.RequestContext.Identity.SourceIP, + Context: newProxyRequestContext(ctx, event), + } + + if opts.UseProxyPath { + req.Path = path.Join("/", event.PathParameters["proxy"]) + } + + return req, nil +} diff --git a/vendor/github.com/akrylysov/algnhsa/context.go b/vendor/github.com/akrylysov/algnhsa/context.go new file mode 100644 index 000000000..048318030 --- /dev/null +++ b/vendor/github.com/akrylysov/algnhsa/context.go @@ -0,0 +1,42 @@ +package algnhsa + +import ( + "context" + + "github.com/aws/aws-lambda-go/events" +) + +type contextKey int + +const ( + proxyRequestContextKey contextKey = iota + albRequestContextKey +) + +func newProxyRequestContext(ctx context.Context, event events.APIGatewayProxyRequest) context.Context { + return context.WithValue(ctx, proxyRequestContextKey, event) +} + +// ProxyRequestFromContext extracts the APIGatewayProxyRequest event from ctx. +func ProxyRequestFromContext(ctx context.Context) (events.APIGatewayProxyRequest, bool) { + val := ctx.Value(proxyRequestContextKey) + if val == nil { + return events.APIGatewayProxyRequest{}, false + } + event, ok := val.(events.APIGatewayProxyRequest) + return event, ok +} + +func newTargetGroupRequestContext(ctx context.Context, event events.ALBTargetGroupRequest) context.Context { + return context.WithValue(ctx, albRequestContextKey, event) +} + +// TargetGroupRequestFromContext extracts the ALBTargetGroupRequest event from ctx. +func TargetGroupRequestFromContext(ctx context.Context) (events.ALBTargetGroupRequest, bool) { + val := ctx.Value(albRequestContextKey) + if val == nil { + return events.ALBTargetGroupRequest{}, false + } + event, ok := val.(events.ALBTargetGroupRequest) + return event, ok +} diff --git a/vendor/github.com/akrylysov/algnhsa/go.mod b/vendor/github.com/akrylysov/algnhsa/go.mod new file mode 100644 index 000000000..4ee8b752a --- /dev/null +++ b/vendor/github.com/akrylysov/algnhsa/go.mod @@ -0,0 +1,8 @@ +module github.com/akrylysov/algnhsa + +go 1.12 + +require ( + github.com/aws/aws-lambda-go v1.9.0 + github.com/stretchr/testify v1.3.0 +) diff --git a/vendor/github.com/akrylysov/algnhsa/go.sum b/vendor/github.com/akrylysov/algnhsa/go.sum new file mode 100644 index 000000000..0f8e9f840 --- /dev/null +++ b/vendor/github.com/akrylysov/algnhsa/go.sum @@ -0,0 +1,9 @@ +github.com/aws/aws-lambda-go v1.9.0 h1:r9TWtk8ozLYdMW+aelUeWny8z2mjghJCMx6/uUwOLNo= +github.com/aws/aws-lambda-go v1.9.0/go.mod h1:zUsUQhAUjYzR8AuduJPCfhBuKWUaDbQiPOG+ouzmE1A= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/github.com/akrylysov/algnhsa/options.go b/vendor/github.com/akrylysov/algnhsa/options.go new file mode 100644 index 000000000..348547a6e --- /dev/null +++ b/vendor/github.com/akrylysov/algnhsa/options.go @@ -0,0 +1,33 @@ +package algnhsa + +type RequestType int + +const ( + RequestTypeAuto RequestType = iota + RequestTypeAPIGateway + RequestTypeALB +) + +// Options holds the optional parameters. +type Options struct { + // RequestType sets the expected request type. + // By default algnhsa deduces the request type from the lambda function payload. + RequestType RequestType + + // BinaryContentTypes sets content types that should be treated as binary types. + // The "*/* value makes algnhsa treat any content type as binary. + BinaryContentTypes []string + binaryContentTypeMap map[string]bool + + // Use API Gateway PathParameters["proxy"] when constructing the request url. + // Strips the base path mapping when using a custom domain with API Gateway. + UseProxyPath bool +} + +func (opts *Options) setBinaryContentTypeMap() { + types := map[string]bool{} + for _, contentType := range opts.BinaryContentTypes { + types[contentType] = true + } + opts.binaryContentTypeMap = types +} diff --git a/vendor/github.com/akrylysov/algnhsa/request.go b/vendor/github.com/akrylysov/algnhsa/request.go new file mode 100644 index 000000000..f1d11e5c2 --- /dev/null +++ b/vendor/github.com/akrylysov/algnhsa/request.go @@ -0,0 +1,116 @@ +package algnhsa + +import ( + "context" + "encoding/base64" + "errors" + "io" + "net/http" + "net/url" + "strings" +) + +type lambdaRequest struct { + HTTPMethod string `json:"httpMethod"` + Path string `json:"path"` + QueryStringParameters map[string]string `json:"queryStringParameters,omitempty"` + MultiValueQueryStringParameters map[string][]string `json:"multiValueQueryStringParameters,omitempty"` + Headers map[string]string `json:"headers,omitempty"` + MultiValueHeaders map[string][]string `json:"multiValueHeaders,omitempty"` + IsBase64Encoded bool `json:"isBase64Encoded"` + Body string `json:"body"` + SourceIP string + Context context.Context +} + +func newLambdaRequest(ctx context.Context, payload []byte, opts *Options) (lambdaRequest, error) { + switch opts.RequestType { + case RequestTypeAPIGateway: + return newAPIGatewayRequest(ctx, payload, opts) + case RequestTypeALB: + return newALBRequest(ctx, payload, opts) + } + + // The request type wasn't specified. + // Try to decode the payload as APIGatewayProxyRequest, if it fails try ALBTargetGroupRequest. + req, err := newAPIGatewayRequest(ctx, payload, opts) + if err != nil && err != errAPIGatewayUnexpectedRequest { + return lambdaRequest{}, err + } + if err == nil { + return req, nil + } + + req, err = newALBRequest(ctx, payload, opts) + if err != nil && err != errALBUnexpectedRequest { + return lambdaRequest{}, err + } + if err == nil { + return req, nil + } + + return lambdaRequest{}, errors.New("neither APIGatewayProxyRequest nor ALBTargetGroupRequest received") +} + +func newHTTPRequest(event lambdaRequest) (*http.Request, error) { + // Build request URL. + params := url.Values{} + for k, v := range event.QueryStringParameters { + params.Set(k, v) + } + for k, vals := range event.MultiValueQueryStringParameters { + params[k] = vals + } + + // Set headers. + // https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html + // If you specify values for both headers and multiValueHeaders, API Gateway merges them into a single list. + // If the same key-value pair is specified in both, only the values from multiValueHeaders will appear + // the merged list. + headers := make(http.Header) + for k, v := range event.Headers { + headers.Set(k, v) + } + for k, vals := range event.MultiValueHeaders { + headers[http.CanonicalHeaderKey(k)] = vals + } + + u := url.URL{ + Host: headers.Get("host"), + RawPath: event.Path, + RawQuery: params.Encode(), + } + + // Unescape request path + p, err := url.PathUnescape(u.RawPath) + if err != nil { + return nil, err + } + u.Path = p + + if u.Path == u.RawPath { + u.RawPath = "" + } + + // Handle base64 encoded body. + var body io.Reader = strings.NewReader(event.Body) + if event.IsBase64Encoded { + body = base64.NewDecoder(base64.StdEncoding, body) + } + + // Create a new request. + r, err := http.NewRequest(event.HTTPMethod, u.String(), body) + if err != nil { + return nil, err + } + + // Set remote IP address. + r.RemoteAddr = event.SourceIP + + // Set request URI + r.RequestURI = u.RequestURI() + + r.Header = headers + + return r.WithContext(event.Context), nil +} diff --git a/vendor/github.com/akrylysov/algnhsa/response.go b/vendor/github.com/akrylysov/algnhsa/response.go new file mode 100644 index 000000000..c08c3c301 --- /dev/null +++ b/vendor/github.com/akrylysov/algnhsa/response.go @@ -0,0 +1,37 @@ +package algnhsa + +import ( + "encoding/base64" + "net/http/httptest" +) + +const acceptAllContentType = "*/*" + +type lambdaResponse struct { + StatusCode int `json:"statusCode"` + Headers map[string]string `json:"headers"` + MultiValueHeaders map[string][]string `json:"multiValueHeaders"` + Body string `json:"body"` + IsBase64Encoded bool `json:"isBase64Encoded,omitempty"` +} + +func newLambdaResponse(w *httptest.ResponseRecorder, binaryContentTypes map[string]bool) (lambdaResponse, error) { + event := lambdaResponse{} + + // Set status code. + event.StatusCode = w.Code + + // Set headers. + event.MultiValueHeaders = w.Result().Header + + // Set body. + contentType := w.Header().Get("Content-Type") + if binaryContentTypes[acceptAllContentType] || binaryContentTypes[contentType] { + event.Body = base64.StdEncoding.EncodeToString(w.Body.Bytes()) + event.IsBase64Encoded = true + } else { + event.Body = w.Body.String() + } + + return event, nil +} diff --git a/vendor/github.com/arolek/algnhsa/CHANGELOG.md b/vendor/github.com/arolek/algnhsa/CHANGELOG.md deleted file mode 100644 index 563e14d6b..000000000 --- a/vendor/github.com/arolek/algnhsa/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Changelog - -## [0.5] - 2018-02-05 -### Added -- Context support. diff --git a/vendor/github.com/arolek/algnhsa/adapter.go b/vendor/github.com/arolek/algnhsa/adapter.go deleted file mode 100644 index 9f5391b1f..000000000 --- a/vendor/github.com/arolek/algnhsa/adapter.go +++ /dev/null @@ -1,36 +0,0 @@ -package algnhsa - -import ( - "context" - "net/http" - "net/http/httptest" - - "github.com/aws/aws-lambda-go/events" - "github.com/aws/aws-lambda-go/lambda" -) - -func handleEvent(ctx context.Context, event events.APIGatewayProxyRequest, handler http.Handler, binaryContentTypes map[string]bool) (events.APIGatewayProxyResponse, error) { - r, err := newHTTPRequest(ctx, event) - if err != nil { - return events.APIGatewayProxyResponse{}, err - } - w := httptest.NewRecorder() - handler.ServeHTTP(w, r) - return newAPIGatewayResponse(w, binaryContentTypes) -} - -// ListenAndServe starts the AWS Lambda runtime (aws-lambda-go lambda.Start) with a given handler. -// It accepts a slice of content types that should be treated as binary types by the API Gateway. -// The "*/* value makes algnhsa treat any content type as binary. -func ListenAndServe(handler http.Handler, binaryContentTypes []string) { - if handler == nil { - handler = http.DefaultServeMux - } - types := map[string]bool{} - for _, contentType := range binaryContentTypes { - types[contentType] = true - } - lambda.Start(func(ctx context.Context, event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - return handleEvent(ctx, event, handler, types) - }) -} diff --git a/vendor/github.com/arolek/algnhsa/context.go b/vendor/github.com/arolek/algnhsa/context.go deleted file mode 100644 index 99135f3bb..000000000 --- a/vendor/github.com/arolek/algnhsa/context.go +++ /dev/null @@ -1,21 +0,0 @@ -package algnhsa - -import ( - "context" - - "github.com/aws/aws-lambda-go/events" -) - -type key int - -const requestContextKey key = 0 - -func newContext(ctx context.Context, event events.APIGatewayProxyRequest) context.Context { - return context.WithValue(ctx, requestContextKey, event) -} - -// ProxyRequestFromContext extracts the APIGatewayProxyRequest event from ctx. -func ProxyRequestFromContext(ctx context.Context) (events.APIGatewayProxyRequest, bool) { - event, ok := ctx.Value(requestContextKey).(events.APIGatewayProxyRequest) - return event, ok -} diff --git a/vendor/github.com/arolek/algnhsa/request.go b/vendor/github.com/arolek/algnhsa/request.go deleted file mode 100644 index ef2d30874..000000000 --- a/vendor/github.com/arolek/algnhsa/request.go +++ /dev/null @@ -1,47 +0,0 @@ -package algnhsa - -import ( - "context" - "encoding/base64" - "io" - "net/http" - "net/url" - "path" - "strings" - - "github.com/aws/aws-lambda-go/events" -) - -func newHTTPRequest(ctx context.Context, event events.APIGatewayProxyRequest) (*http.Request, error) { - // Build request URL. - params := url.Values{} - for k, v := range event.QueryStringParameters { - params.Set(k, v) - } - u := url.URL{ - Host: event.Headers["Host"], - Path: path.Join("/", event.PathParameters["proxy"]), - RawQuery: params.Encode(), - } - // Handle base64 encoded body. - var body io.Reader = strings.NewReader(event.Body) - if event.IsBase64Encoded { - body = base64.NewDecoder(base64.StdEncoding, body) - } - - // Create a new request. - r, err := http.NewRequest(event.HTTPMethod, u.String(), body) - if err != nil { - return nil, err - } - - // Set headers. - for k, v := range event.Headers { - r.Header.Set(k, v) - } - - // Set remote IP address. - r.RemoteAddr = event.RequestContext.Identity.SourceIP - - return r.WithContext(newContext(ctx, event)), nil -} diff --git a/vendor/github.com/arolek/algnhsa/response.go b/vendor/github.com/arolek/algnhsa/response.go deleted file mode 100644 index 8bc853c2c..000000000 --- a/vendor/github.com/arolek/algnhsa/response.go +++ /dev/null @@ -1,35 +0,0 @@ -package algnhsa - -import ( - "encoding/base64" - "net/http/httptest" - - "github.com/aws/aws-lambda-go/events" -) - -const acceptAllContentType = "*/*" - -func newAPIGatewayResponse(w *httptest.ResponseRecorder, binaryContentTypes map[string]bool) (events.APIGatewayProxyResponse, error) { - event := events.APIGatewayProxyResponse{} - - // Set status code. - event.StatusCode = w.Code - - // Set headers. - respHeaders := map[string]string{} - for k, v := range w.HeaderMap { - respHeaders[k] = v[0] - } - event.Headers = respHeaders - - // Set body. - contentType := w.Header().Get("Content-Type") - if binaryContentTypes[acceptAllContentType] || binaryContentTypes[contentType] { - event.Body = base64.StdEncoding.EncodeToString(w.Body.Bytes()) - event.IsBase64Encoded = true - } else { - event.Body = w.Body.String() - } - - return event, nil -} diff --git a/vendor/github.com/aws/aws-lambda-go/events/README.md b/vendor/github.com/aws/aws-lambda-go/events/README.md index 7821a28b6..d1a50f92d 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/README.md +++ b/vendor/github.com/aws/aws-lambda-go/events/README.md @@ -10,12 +10,22 @@ This package provides input types for Lambda functions that process AWS events. [API Gateway Custom Authorizer](README_ApiGatewayCustomAuthorizer.md) +[AppSync](README_AppSync.md) + [CloudFormation Events](../cfn/README.md) +[Chime Bot Events](README_Chime_Bots.md) + [Code Commit Events](README_CodeCommit.md) [Cognito Events](README_Cognito.md) +[Cognito PostConfirmation](README_Cognito_UserPools_PostConfirmation.md) + +[Cognito PreSignup](README_Cognito_UserPools_PreSignup.md) + +[Cognito PreTokenGen](README_Cognito_UserPools_PreTokenGen.md) + [Config Events](README_Config.md) [DynamoDB Events](README_DynamoDB.md) @@ -24,6 +34,12 @@ This package provides input types for Lambda functions that process AWS events. [Kinesis Firehose Events](README_KinesisFirehose.md) +[Lex Events](README_Lex.md) + [S3 Events](README_S3.md) +[SES Events](README_SES.md) + [SNS Events](README_SNS.md) + +[SQS Events](README_SQS.md) diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_ALBTargetGroupEvents.md b/vendor/github.com/aws/aws-lambda-go/events/README_ALBTargetGroupEvents.md new file mode 100644 index 000000000..eb240e8c2 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_ALBTargetGroupEvents.md @@ -0,0 +1,38 @@ +# Overview + +ALB Target Group events consist of a request that was routed to a Lambda function which is a registered target of an Application Load Balancer Target Group. When this happens, ALB expects the result of the function to be the response that ALB should respond with. + +https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html + +# Sample Function + +The following is a sample class and Lambda function that receives an ALB Target Group event as an input, writes some of the incoming data to CloudWatch Logs, and responds with a 200 status and the same body as the request. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go + +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handleRequest(ctx context.Context, request events.ALBTargetGroupRequest) (events.ALBTargetGroupResponse, error) { + fmt.Printf("Processing request data for traceId %s.\n", request.Headers["x-amzn-trace-id"]) + fmt.Printf("Body size = %d.\n", len(request.Body)) + + fmt.Println("Headers:") + for key, value := range request.Headers { + fmt.Printf(" %s: %s\n", key, value) + } + + return events.ALBTargetGroupResponse{Body: request.Body, StatusCode: 200, StatusDescription: "200 OK", IsBase64Encoded: false, Headers: map[string]string{}}}, nil +} + +func main() { + lambda.Start(handleRequest) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_AppSync.md b/vendor/github.com/aws/aws-lambda-go/events/README_AppSync.md new file mode 100644 index 000000000..c4a0e04b0 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_AppSync.md @@ -0,0 +1,30 @@ + +# Sample Function + +The following is a sample class and Lambda function that receives AWS AppSync event message data as input, writes some of the message data to CloudWatch Logs, and responds with a 200 status and the same body as the request. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handler(ctx context.Context, event events.AppSyncResolverTemplate) error { + + fmt.Printf("Version: %s\n", event.Version) + fmt.Printf("Operation: %s\n", event.Operation) + fmt.Printf("Payload: %s\n", string(event.Payload)) + + return nil +} + +func main() { + lambda.Start(handler) +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_AutoScaling.md b/vendor/github.com/aws/aws-lambda-go/events/README_AutoScaling.md index 18a0ec457..dfc648b28 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/README_AutoScaling.md +++ b/vendor/github.com/aws/aws-lambda-go/events/README_AutoScaling.md @@ -1,16 +1,21 @@ # Sample Function -The following is a sample class and Lambda function that receives Amazon S3 event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) +The following is a sample Lambda function that receives an Auto Scaling event as an input and logs the EC2 instance ID to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) ```go - import ( - "strings" - "github.com/aws/aws-lambda-go/events") + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) func handler(ctx context.Context, autoScalingEvent events.AutoScalingEvent) { - fmt.Printf("Instance-Id available in event is %s \n",autoScalingEvent.Detail["EC2InstanceId"]) - } + fmt.Printf("Instance-Id available in event is %s \n", autoScalingEvent.Detail["EC2InstanceId"]) } +func main() { + lambda.Start(handler) +} ``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Chime_Bots.md b/vendor/github.com/aws/aws-lambda-go/events/README_Chime_Bots.md new file mode 100644 index 000000000..d5d933d84 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Chime_Bots.md @@ -0,0 +1,67 @@ +# Sample Function + +The following is a sample class and Lambda function that receives a Amazon Chime Bot event and handles the various event types accordingly. + +```go + +package main + +import ( + "fmt" + "context" + "net/http" + "bytes" + "encoding/json" + "errors" + "strconv" + + "github.com/aws/aws-lambda-go/events" +) + +func handler(_ context.Context, chimeBotEvent events.ChimeBotEvent) error { + switch chimeBotEvent.EventType { + case "Invite": + if err := message(chimeBotEvent.InboundHTTPSEndpoint.URL, "Thanks for inviting me to this room " + chimeBotEvent.Sender.SenderID); err != nil { + return fmt.Errorf("failed to send webhook message: %v", err) + } + return nil + case "Mention": + if err := message(chimeBotEvent.InboundHTTPSEndpoint.URL, "Thanks for mentioning me " + chimeBotEvent.Sender.SenderID); err != nil { + return fmt.Errorf("failed to send webhook message: %v", err) + } + return nil + case "Remove": + fmt.Printf("I have been removed from %q by %q", chimeBotEvent.Discussion.DiscussionType, chimeBotEvent.Sender.SenderID) + return nil + default: + return fmt.Errorf("event type %q is unsupported", chimeBotEvent.EventType) + } +} + +func message(url, content string) (error) { + input := &bytes.Buffer{} + if err := json.NewEncoder(input).Encode(webhookInput{Content:content}); err != nil { + return errors.New("failed to marshal request: " + err.Error()) + } + + resp, err := http.Post("POST", url, input) + if err != nil { + return errors.New("failed to execute post http request: " + err.Error()) + } + + if resp != nil && resp.Body != nil { + defer resp.Body.Close() + } + + if resp.StatusCode != http.StatusOK { + return errors.New("bad response: status code not is " + strconv.Itoa(http.StatusOK) + " not " + strconv.Itoa(resp.StatusCode)) + } + + return nil +} + +type webhookInput struct { + Content string `json:"Content"` +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_CodeBuild.md b/vendor/github.com/aws/aws-lambda-go/events/README_CodeBuild.md new file mode 100644 index 000000000..729eaa463 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_CodeBuild.md @@ -0,0 +1,15 @@ +# Sample Function + +The following is a sample Lambda function that receives an Amazon CodeBuild event +and writes it to standard output. + +```go +import ( + "fmt" + "github.com/aws/aws-lambda-go/events" +) + +func handleRequest(evt events.CodeBuildEvent) { + fmt.Println(evt) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_CodeDeploy.md b/vendor/github.com/aws/aws-lambda-go/events/README_CodeDeploy.md new file mode 100644 index 000000000..761c0b01e --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_CodeDeploy.md @@ -0,0 +1,15 @@ +# Sample Function + +The following is a sample Lambda function that receives an Amazon CodeDeploy event +and writes it to standard output. + +```go +import ( + "fmt" + "github.com/aws/aws-lambda-go/events" +) + +func handleRequest(evt events.CodeDeployEvent) { + fmt.Println(evt) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Cognito.md b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito.md index ff0500cd1..a8ee5867c 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/README_Cognito.md +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito.md @@ -1,15 +1,19 @@ # Sample Function -The following is a sample Lambda function that receives Amazon Cognito event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) +The following is a sample Lambda function that receives Amazon Cognito Sync event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) ```go +package main + import ( - "strings" + "fmt" + + "github.com/aws/aws-lambda-go/lambda" "github.com/aws/aws-lambda-go/events" ) -func handleRequest(ctx context.Context, cognitoEvent events.CognitoEvent) { +func handler(cognitoEvent events.CognitoEvent) error { for datasetName, datasetRecord := range cognitoEvent.DatasetRecords { fmt.Printf("[%s -- %s] %s -> %s -> %s \n", cognitoEvent.EventType, @@ -18,5 +22,11 @@ func handleRequest(ctx context.Context, cognitoEvent events.CognitoEvent) { datasetRecord.Op, datasetRecord.NewValue) } + return nil } + +func main() { + lambda.Start(handler) +} + ``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_CustomAuthLambdaTriggers.md b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_CustomAuthLambdaTriggers.md new file mode 100644 index 000000000..737339cbb --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_CustomAuthLambdaTriggers.md @@ -0,0 +1,69 @@ +# Sample Function + +The following is a sample Lambda functions that are used for custom authentication with Cognito User Pools. +These Lambda triggers issue and verify their own challenges as part of a user pool [custom authentication flow](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-authentication-flow.html#amazon-cognito-user-pools-custom-authentication-flow). + +Please see instructions for setting up the Cognito triggers at https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-challenge.html + +Define Auth Challenge Lambda Trigger: +```go +package main + +import ( + "fmt" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" +) + +func handler(event *events.CognitoEventUserPoolsDefineAuthChallenge) (*events.CognitoEventUserPoolsDefineAuthChallenge, error) { + fmt.Printf("Define Auth Challenge: %+v\n", event) + return event, nil +} + +func main() { + lambda.Start(handler) +} +``` + +Create Auth Challenge Lambda Trigger: +```go +package main + +import ( + "fmt" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" +) + +func handler(event *events.CognitoEventUserPoolsCreateAuthChallenge) (*events.CognitoEventUserPoolsCreateAuthChallenge, error) { + fmt.Printf("Create Auth Challenge: %+v\n", event) + return event, nil +} + +func main() { + lambda.Start(handler) +} +``` + +Verify Auth Challenge Response Lambda Trigger: +```go +package main + +import ( + "fmt" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" +) + +func handler(event *events.CognitoEventUserPoolsVerifyAuthChallenge) (*events.CognitoEventUserPoolsVerifyAuthChallenge, error) { + fmt.Printf("Verify Auth Challenge: %+v\n", event) + return event, nil +} + +func main() { + lambda.Start(handler) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PostConfirmation.md b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PostConfirmation.md new file mode 100644 index 000000000..347183744 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PostConfirmation.md @@ -0,0 +1,25 @@ +# Sample Function + +The following is a sample Lambda function that receives Amazon Cognito User Pools post-confirmation event as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +Please see instructions for setting up the Cognito triggers at https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html . + +```go +package main + +import ( + "fmt" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" +) + +func handler(event events.CognitoEventUserPoolsPostConfirmation) (events.CognitoEventUserPoolsPostConfirmation, error) { + fmt.Printf("PostConfirmation for user: %s\n", event.UserName) + return event, nil +} + +func main() { + lambda.Start(handler) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreAuthentication.md b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreAuthentication.md new file mode 100644 index 000000000..1717508a3 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreAuthentication.md @@ -0,0 +1,25 @@ +# Sample Function + +The following is a sample Lambda function that receives Amazon Cognito User Pools pre-authentication event as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +Please see instructions for setting up the Cognito triggers at https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html . + +```go +package main + +import ( + "fmt" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" +) + +func handler(event events.CognitoEventUserPoolsPreAuthentication) (events.CognitoEventUserPoolsPreAuthentication, error) { + fmt.Printf("PreAuthentication of user: %s\n", event.UserName) + return event, nil +} + +func main() { + lambda.Start(handler) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreSignup.md b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreSignup.md new file mode 100644 index 000000000..9e782fcca --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreSignup.md @@ -0,0 +1,26 @@ +# Sample Function + +The following is a sample Lambda function that receives Amazon Cognito User Pools pre-signup event as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +Please see instructions for setting up the Cognito triggers at https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html . + +```go +package main + +import ( + "fmt" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" +) + +func handler(event events.CognitoEventUserPoolsPreSignup) (events.CognitoEventUserPoolsPreSignup, error) { + fmt.Printf("PreSignup of user: %s\n", event.UserName) + event.Response.AutoConfirmUser = true + return event, nil +} + +func main() { + lambda.Start(handler) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreTokenGen.md b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreTokenGen.md new file mode 100644 index 000000000..eddfcb4e1 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreTokenGen.md @@ -0,0 +1,26 @@ +# Sample Function + +The following is a sample Lambda function that receives Amazon Cognito User Pools pre-token-gen event as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +Please see instructions for setting up the Cognito triggers at https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html . + +```go +package main + +import ( + "fmt" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" +) + +func handler(event events.CognitoEventUserPoolsPreTokenGen) (events.CognitoEventUserPoolsPreTokenGen, error) { + fmt.Printf("PreTokenGen of user: %s\n", event.UserName) + event.Response.ClaimOverrideDetails.ClaimsToSupress = []string{"family_name"} + return event, nil +} + +func main() { + lambda.Start(handler) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Connect.md b/vendor/github.com/aws/aws-lambda-go/events/README_Connect.md new file mode 100644 index 000000000..e33b144a6 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Connect.md @@ -0,0 +1,35 @@ +# Sample Function + +The following is a sample Lambda function that receives an Amazon Connect event as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func main() { + lambda.Start(handler) +} + +func handler(ctx context.Context, connectEvent events.ConnectEvent) (events.ConnectResponse, error) { + fmt.Printf("Processing Connect event with ContactID %s.\n", connectEvent.Details.ContactData.ContactID) + + fmt.Printf("Invoked with %d parameters\n", len(connectEvent.Details.Parameters)) + for k, v := range connectEvent.Details.Parameters { + fmt.Printf("%s : %s\n", k, v) + } + + resp := events.ConnectResponse{ + "Result": "Success", + "NewAttribute": "NewValue", + } + + return resp, nil +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_KinesisDataAnalytics.md b/vendor/github.com/aws/aws-lambda-go/events/README_KinesisDataAnalytics.md new file mode 100644 index 000000000..3789f97e3 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_KinesisDataAnalytics.md @@ -0,0 +1,45 @@ +# Sample function + +The following is an example for an Application Destination Lambda function that receives Amazon Kinesis Data Analytics event records as an input. To send Kinesis Data Analytics output records the Lamdbda function must be compliant with the (required input and return data models)[https://docs.aws.amazon.com/kinesisanalytics/latest/dev/how-it-works-output-lambda.html], so the handler returns a list of delivery statuses for each record. + +The following Lambda function receives Amazon Kinesis Data Analytics event record data as an input and writes some of the record data to CloudWatch Logs. For each entry it adds an element to the response slice, marking it delivered. When the logic considers the delivery to be failed the `events.KinesisAnalyticsOutputDeliveryFailed` value should be used for the response `Result` field. + + +```go +package main + +import ( + "context" + "encoding/json" + "fmt" + "log" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handler(ctx context.Context, kinesisAnalyticsEvent events.KinesisAnalyticsOutputDeliveryEvent) (events.KinesisAnalyticsOutputDeliveryResponse, error) { + var err error + + var responses events.KinesisAnalyticsOutputDeliveryResponse + responses.Records = make([]events.KinesisAnalyticsOutputDeliveryResponseRecord, len(kinesisAnalyticsEvent.Records)) + + for i, record := range kinesisAnalyticsEvent.Records { + responses.Records[i] = events.KinesisAnalyticsOutputDeliveryResponseRecord{ + RecordID: record.RecordID, + Result: events.KinesisAnalyticsOutputDeliveryOK, + } + + dataBytes := record.Data + dataText := string(dataBytes) + + fmt.Printf("%s Data = %s \n", record.RecordID, dataText) + } + return responses, err +} + +func main() { + lambda.Start(handler) +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Lex.md b/vendor/github.com/aws/aws-lambda-go/events/README_Lex.md new file mode 100644 index 000000000..abcc07aa5 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Lex.md @@ -0,0 +1,31 @@ + +# Sample Function + +The following is a sample class and Lambda function that receives Amazon Lex event data as input, writes some of the record data to CloudWatch Logs, and responds back to Lex. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" +) + +func Handler(ctx context.Context, event events.LexEvent) (*lex.LexResponse, error) { + fmt.Printf("Received an input from Amazon Lex. Current Intent: %s", event.CurrentIntent.Name) + + messageContent := "Hello from AWS Lambda!" + + return &LexResponse{ + SessionAttributes: event.SessionAttributes, + DialogAction: events.LexDialogAction{ + Type: "Close", + Message: map[string]string{ + "content": messageContent, + "contentType": "PlainText", + }, + FulfillmentState: "Fulfilled", + }, + }, nil +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_S3.md b/vendor/github.com/aws/aws-lambda-go/events/README_S3.md index a8f746f7a..e533176ec 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/README_S3.md +++ b/vendor/github.com/aws/aws-lambda-go/events/README_S3.md @@ -4,17 +4,27 @@ The following is a sample class and Lambda function that receives Amazon S3 even ```go +// main.go +package main + import ( - "fmt" - "context" - "github.com/aws/aws-lambda-go/events" + "fmt" + "context" + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" ) func handler(ctx context.Context, s3Event events.S3Event) { - for _, record := range s3Event.Records { - s3 := record.S3 - fmt.Printf("[%s - %s] Bucket = %s, Key = %s \n", record.EventSource, record.EventTime, s3.Bucket.Name, s3.Object.Key) - } + for _, record := range s3Event.Records { + s3 := record.S3 + fmt.Printf("[%s - %s] Bucket = %s, Key = %s \n", record.EventSource, record.EventTime, s3.Bucket.Name, s3.Object.Key) + } +} + + +func main() { + // Make the handler available for Remote Procedure Call by AWS Lambda + lambda.Start(handler) } ``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_S3_Batch_Job.md b/vendor/github.com/aws/aws-lambda-go/events/README_S3_Batch_Job.md new file mode 100644 index 000000000..589bd27ac --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_S3_Batch_Job.md @@ -0,0 +1,39 @@ +# Sample Function + +The following is a sample class and Lambda function that receives Amazon S3 event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go + +import ( + "fmt" + "context" + "github.com/aws/aws-lambda-go/events" +) + +func handler(ctx context.Context, e events.S3BatchJobEvent) (response events.S3BatchJobResponse, err error) { + fmt.Printf("InvocationSchemaVersion: %s\n", e.InvocationSchemaVersion) + fmt.Printf("InvocationID: %s\n", e.InvocationID) + fmt.Printf("Job.ID: %s\n", e.Job.ID) + + for _, task := range e.Tasks { + fmt.Printf("TaskID: %s\n", task.TaskID) + fmt.Printf("S3Key: %s\n", task.S3Key) + fmt.Printf("S3VersionID: %s\n", task.S3VersionID) + fmt.Printf("S3BucketARN: %s\n", task.S3BucketARN) + + } + + fmt.Printf("InvocationSchemaVersion: %s\n", response.InvocationSchemaVersion) + fmt.Printf("TreatMissingKeysAs: %s\n", response.TreatMissingKeysAs) + fmt.Printf("InvocationID: %s\n", response.InvocationID) + + for _, result := range response.Results { + fmt.Printf("TaskID: %s\n", result.TaskID) + fmt.Printf("ResultCode: %s\n", result.ResultCode) + fmt.Printf("ResultString: %s\n", result.ResultString) + } + + return +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_SES.md b/vendor/github.com/aws/aws-lambda-go/events/README_SES.md new file mode 100644 index 000000000..ddfaed943 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_SES.md @@ -0,0 +1,30 @@ + +# Sample Function + +The following is a sample class and Lambda function that receives Amazon SES event message data as input, writes some of the message data to CloudWatch Logs, and responds with a 200 status and the same body as the request. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handler(ctx context.Context, sesEvent events.SimpleEmailEvent) error { + for _, record := range sesEvent.Records { + ses := record.SES + fmt.Printf("[%s - %s] Mail = %+v, Receipt = %+v \n", record.EventVersion, record.EventSource, ses.Mail, ses.Receipt) + } + + return nil +} + +func main() { + lambda.Start(handler) +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_SQS.md b/vendor/github.com/aws/aws-lambda-go/events/README_SQS.md new file mode 100644 index 000000000..e5340f3a4 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_SQS.md @@ -0,0 +1,29 @@ + +# Sample Function + +The following is a sample class and Lambda function that receives Amazon SQS event message data as input, writes some of the message data to CloudWatch Logs, and responds with a 200 status and the same body as the request. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handler(ctx context.Context, sqsEvent events.SQSEvent) error { + for _, message := range sqsEvent.Records { + fmt.Printf("The message %s for event source %s = %s \n", message.MessageId, message.EventSource, message.Body) + } + + return nil +} + +func main() { + lambda.Start(handler) +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/alb.go b/vendor/github.com/aws/aws-lambda-go/events/alb.go new file mode 100644 index 000000000..5c1742d25 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/alb.go @@ -0,0 +1,34 @@ +package events + +// ALBTargetGroupRequest contains data originating from the ALB Lambda target group integration +type ALBTargetGroupRequest struct { + HTTPMethod string `json:"httpMethod"` + Path string `json:"path"` + QueryStringParameters map[string]string `json:"queryStringParameters,omitempty"` + MultiValueQueryStringParameters map[string][]string `json:"multiValueQueryStringParameters,omitempty"` + Headers map[string]string `json:"headers,omitempty"` + MultiValueHeaders map[string][]string `json:"multiValueHeaders,omitempty"` + RequestContext ALBTargetGroupRequestContext `json:"requestContext"` + IsBase64Encoded bool `json:"isBase64Encoded"` + Body string `json:"body"` +} + +// ALBTargetGroupRequestContext contains the information to identify the load balancer invoking the lambda +type ALBTargetGroupRequestContext struct { + ELB ELBContext `json:"elb"` +} + +// ELBContext contains the information to identify the ARN invoking the lambda +type ELBContext struct { + TargetGroupArn string `json:"targetGroupArn"` +} + +// ALBTargetGroupResponse configures the response to be returned by the ALB Lambda target group for the request +type ALBTargetGroupResponse struct { + StatusCode int `json:"statusCode"` + StatusDescription string `json:"statusDescription"` + Headers map[string]string `json:"headers"` + MultiValueHeaders map[string][]string `json:"multiValueHeaders"` + Body string `json:"body"` + IsBase64Encoded bool `json:"isBase64Encoded"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/apigw.go b/vendor/github.com/aws/aws-lambda-go/events/apigw.go index e77753ddd..6ed7fe2e9 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/apigw.go +++ b/vendor/github.com/aws/aws-lambda-go/events/apigw.go @@ -4,38 +4,42 @@ package events // APIGatewayProxyRequest contains data coming from the API Gateway proxy type APIGatewayProxyRequest struct { - Resource string `json:"resource"` // The resource path defined in API Gateway - Path string `json:"path"` // The url path for the caller - HTTPMethod string `json:"httpMethod"` - Headers map[string]string `json:"headers"` - QueryStringParameters map[string]string `json:"queryStringParameters"` - PathParameters map[string]string `json:"pathParameters"` - StageVariables map[string]string `json:"stageVariables"` - RequestContext APIGatewayProxyRequestContext `json:"requestContext"` - Body string `json:"body"` - IsBase64Encoded bool `json:"isBase64Encoded,omitempty"` + Resource string `json:"resource"` // The resource path defined in API Gateway + Path string `json:"path"` // The url path for the caller + HTTPMethod string `json:"httpMethod"` + Headers map[string]string `json:"headers"` + MultiValueHeaders map[string][]string `json:"multiValueHeaders"` + QueryStringParameters map[string]string `json:"queryStringParameters"` + MultiValueQueryStringParameters map[string][]string `json:"multiValueQueryStringParameters"` + PathParameters map[string]string `json:"pathParameters"` + StageVariables map[string]string `json:"stageVariables"` + RequestContext APIGatewayProxyRequestContext `json:"requestContext"` + Body string `json:"body"` + IsBase64Encoded bool `json:"isBase64Encoded,omitempty"` } // APIGatewayProxyResponse configures the response to be returned by API Gateway for the request type APIGatewayProxyResponse struct { - StatusCode int `json:"statusCode"` - Headers map[string]string `json:"headers"` - Body string `json:"body"` - IsBase64Encoded bool `json:"isBase64Encoded,omitempty"` + StatusCode int `json:"statusCode"` + Headers map[string]string `json:"headers"` + MultiValueHeaders map[string][]string `json:"multiValueHeaders"` + Body string `json:"body"` + IsBase64Encoded bool `json:"isBase64Encoded,omitempty"` } // APIGatewayProxyRequestContext contains the information to identify the AWS account and resources invoking the // Lambda function. It also includes Cognito identity information for the caller. type APIGatewayProxyRequestContext struct { - AccountID string `json:"accountId"` - ResourceID string `json:"resourceId"` - Stage string `json:"stage"` - RequestID string `json:"requestId"` - Identity APIGatewayRequestIdentity `json:"identity"` - ResourcePath string `json:"resourcePath"` - Authorizer map[string]interface{} `json:"authorizer"` - HTTPMethod string `json:"httpMethod"` - APIID string `json:"apiId"` // The API Gateway rest API Id + AccountID string `json:"accountId"` + ResourceID string `json:"resourceId"` + OperationName string `json:"operationName,omitempty"` + Stage string `json:"stage"` + RequestID string `json:"requestId"` + Identity APIGatewayRequestIdentity `json:"identity"` + ResourcePath string `json:"resourcePath"` + Authorizer map[string]interface{} `json:"authorizer"` + HTTPMethod string `json:"httpMethod"` + APIID string `json:"apiId"` // The API Gateway rest API Id } // APIGatewayRequestIdentity contains identity information for the request caller. @@ -45,6 +49,7 @@ type APIGatewayRequestIdentity struct { CognitoIdentityID string `json:"cognitoIdentityId"` Caller string `json:"caller"` APIKey string `json:"apiKey"` + AccessKey string `json:"accessKey"` SourceIP string `json:"sourceIp"` CognitoAuthenticationType string `json:"cognitoAuthenticationType"` CognitoAuthenticationProvider string `json:"cognitoAuthenticationProvider"` @@ -53,6 +58,50 @@ type APIGatewayRequestIdentity struct { User string `json:"user"` } +// APIGatewayWebsocketProxyRequest contains data coming from the API Gateway proxy +type APIGatewayWebsocketProxyRequest struct { + Resource string `json:"resource"` // The resource path defined in API Gateway + Path string `json:"path"` // The url path for the caller + HTTPMethod string `json:"httpMethod"` + Headers map[string]string `json:"headers"` + MultiValueHeaders map[string][]string `json:"multiValueHeaders"` + QueryStringParameters map[string]string `json:"queryStringParameters"` + MultiValueQueryStringParameters map[string][]string `json:"multiValueQueryStringParameters"` + PathParameters map[string]string `json:"pathParameters"` + StageVariables map[string]string `json:"stageVariables"` + RequestContext APIGatewayWebsocketProxyRequestContext `json:"requestContext"` + Body string `json:"body"` + IsBase64Encoded bool `json:"isBase64Encoded,omitempty"` +} + +// APIGatewayWebsocketProxyRequestContext contains the information to identify +// the AWS account and resources invoking the Lambda function. It also includes +// Cognito identity information for the caller. +type APIGatewayWebsocketProxyRequestContext struct { + AccountID string `json:"accountId"` + ResourceID string `json:"resourceId"` + Stage string `json:"stage"` + RequestID string `json:"requestId"` + Identity APIGatewayRequestIdentity `json:"identity"` + ResourcePath string `json:"resourcePath"` + Authorizer interface{} `json:"authorizer"` + HTTPMethod string `json:"httpMethod"` + APIID string `json:"apiId"` // The API Gateway rest API Id + ConnectedAt int64 `json:"connectedAt"` + ConnectionID string `json:"connectionId"` + DomainName string `json:"domainName"` + Error string `json:"error"` + EventType string `json:"eventType"` + ExtendedRequestID string `json:"extendedRequestId"` + IntegrationLatency string `json:"integrationLatency"` + MessageDirection string `json:"messageDirection"` + MessageID interface{} `json:"messageId"` + RequestTime string `json:"requestTime"` + RequestTimeEpoch int64 `json:"requestTimeEpoch"` + RouteKey string `json:"routeKey"` + Status string `json:"status"` +} + // APIGatewayCustomAuthorizerRequestTypeRequestIdentity contains identity information for the request caller. type APIGatewayCustomAuthorizerRequestTypeRequestIdentity struct { APIKey string `json:"apiKey"` @@ -90,16 +139,18 @@ type APIGatewayCustomAuthorizerRequest struct { // APIGatewayCustomAuthorizerRequestTypeRequest contains data coming in to a custom API Gateway authorizer function. type APIGatewayCustomAuthorizerRequestTypeRequest struct { - Type string `json:"type"` - MethodArn string `json:"methodArn"` - Resource string `json:"resource"` - Path string `json:"path"` - HTTPMethod string `json:"httpMethod"` - Headers map[string]string `json:"headers"` - QueryStringParameters map[string]string `json:"queryStringParameters"` - PathParameters map[string]string `json:"pathParameters"` - StageVariables map[string]string `json:"stageVariables"` - RequestContext APIGatewayCustomAuthorizerRequestTypeRequestContext `json:"requestContext"` + Type string `json:"type"` + MethodArn string `json:"methodArn"` + Resource string `json:"resource"` + Path string `json:"path"` + HTTPMethod string `json:"httpMethod"` + Headers map[string]string `json:"headers"` + MultiValueHeaders map[string][]string `json:"multiValueHeaders"` + QueryStringParameters map[string]string `json:"queryStringParameters"` + MultiValueQueryStringParameters map[string][]string `json:"multiValueQueryStringParameters"` + PathParameters map[string]string `json:"pathParameters"` + StageVariables map[string]string `json:"stageVariables"` + RequestContext APIGatewayCustomAuthorizerRequestTypeRequestContext `json:"requestContext"` } // APIGatewayCustomAuthorizerResponse represents the expected format of an API Gateway authorization response. diff --git a/vendor/github.com/aws/aws-lambda-go/events/appsync.go b/vendor/github.com/aws/aws-lambda-go/events/appsync.go new file mode 100644 index 000000000..3ada83f33 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/appsync.go @@ -0,0 +1,40 @@ +package events + +import "encoding/json" + +// AppSyncResolverTemplate represents the requests from AppSync to Lambda +type AppSyncResolverTemplate struct { + Version string `json:"version"` + Operation AppSyncOperation `json:"operation"` + Payload json.RawMessage `json:"payload"` +} + +// AppSyncIAMIdentity contains information about the caller authed via IAM. +type AppSyncIAMIdentity struct { + AccountID string `json:"accountId"` + CognitoIdentityPoolID string `json:"cognitoIdentityPoolId"` + CognitoIdentityID string `json:"cognitoIdentityId"` + SourceIP []string `json:"sourceIp"` + Username string `json:"username"` + UserARN string `json:"userArn"` +} + +// AppSyncCognitoIdentity contains information about the caller authed via Cognito. +type AppSyncCognitoIdentity struct { + Sub string `json:"sub"` + Issuer string `json:"issuer"` + Username string `json:"username"` + Claims map[string]interface{} `json:"claims"` + SourceIP []string `json:"sourceIp"` + DefaultAuthStrategy string `json:"defaultAuthStrategy"` +} + +// AppSyncOperation specifies the operation type supported by Lambda operations +type AppSyncOperation string + +const ( + // OperationInvoke lets AWS AppSync know to call your Lambda function for every GraphQL field resolver + OperationInvoke AppSyncOperation = "Invoke" + // OperationBatchInvoke instructs AWS AppSync to batch requests for the current GraphQL field + OperationBatchInvoke AppSyncOperation = "BatchInvoke" +) diff --git a/vendor/github.com/aws/aws-lambda-go/events/attributevalue.go b/vendor/github.com/aws/aws-lambda-go/events/attributevalue.go index d1f584c4a..72de66ab1 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/attributevalue.go +++ b/vendor/github.com/aws/aws-lambda-go/events/attributevalue.go @@ -18,6 +18,10 @@ type DynamoDBAttributeValue struct { dataType DynamoDBDataType } +// This struct represents DynamoDBAttributeValue which doesn't +// implement fmt.Stringer interface and safely `fmt.Sprintf`able +type dynamoDbAttributeValue DynamoDBAttributeValue + // Binary provides access to an attribute of type Binary. // Method panics if the attribute is not of type Binary. func (av DynamoDBAttributeValue) Binary() []byte { @@ -98,8 +102,13 @@ func (av DynamoDBAttributeValue) NumberSet() []string { // String provides access to an attribute of type String. // Method panics if the attribute is not of type String. func (av DynamoDBAttributeValue) String() string { - av.ensureType(DataTypeString) - return av.value.(string) + if av.dataType == DataTypeString { + return av.value.(string) + } + // If dataType is not DataTypeString during fmt.Sprintf("%#v", ...) + // compiler confuses with fmt.Stringer interface and panics + // instead of printing the struct. + return fmt.Sprintf("%v", dynamoDbAttributeValue(av)) } // StringSet provides access to an attribute of type String Set. @@ -119,6 +128,69 @@ func (av DynamoDBAttributeValue) DataType() DynamoDBDataType { return av.dataType } +// NewBinaryAttribute creates an DynamoDBAttributeValue containing a Binary +func NewBinaryAttribute(value []byte) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeBinary + return av +} + +// NewBooleanAttribute creates an DynamoDBAttributeValue containing a Boolean +func NewBooleanAttribute(value bool) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeBoolean + return av +} + +// NewBinarySetAttribute creates an DynamoDBAttributeValue containing a BinarySet +func NewBinarySetAttribute(value [][]byte) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeBinarySet + return av +} + +// NewListAttribute creates an DynamoDBAttributeValue containing a List +func NewListAttribute(value []DynamoDBAttributeValue) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeList + return av +} + +// NewMapAttribute creates an DynamoDBAttributeValue containing a Map +func NewMapAttribute(value map[string]DynamoDBAttributeValue) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeMap + return av +} + +// NewNumberAttribute creates an DynamoDBAttributeValue containing a Number +func NewNumberAttribute(value string) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeNumber + return av +} + +// NewNumberSetAttribute creates an DynamoDBAttributeValue containing a NumberSet +func NewNumberSetAttribute(value []string) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeNumberSet + return av +} + +// NewNullAttribute creates an DynamoDBAttributeValue containing a Null +func NewNullAttribute() DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.dataType = DataTypeNull + return av +} + // NewStringAttribute creates an DynamoDBAttributeValue containing a String func NewStringAttribute(value string) DynamoDBAttributeValue { var av DynamoDBAttributeValue @@ -127,6 +199,14 @@ func NewStringAttribute(value string) DynamoDBAttributeValue { return av } +// NewStringSetAttribute creates an DynamoDBAttributeValue containing a StringSet +func NewStringSetAttribute(value []string) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeStringSet + return av +} + // DynamoDBDataType specifies the type supported natively by DynamoDB for an attribute type DynamoDBDataType int diff --git a/vendor/github.com/aws/aws-lambda-go/events/chime_bot.go b/vendor/github.com/aws/aws-lambda-go/events/chime_bot.go new file mode 100644 index 000000000..fa08f003f --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/chime_bot.go @@ -0,0 +1,31 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +import ( + "time" +) + +type ChimeBotEvent struct { + Sender ChimeBotEventSender `json:"Sender"` + Discussion ChimeBotEventDiscussion `json:"Discussion"` + EventType string `json:"EventType"` + InboundHTTPSEndpoint *ChimeBotEventInboundHTTPSEndpoint `json:"InboundHttpsEndpoint,omitempty"` + EventTimestamp time.Time `json:"EventTimestamp"` + Message string `json:"Message,omitempty"` +} + +type ChimeBotEventSender struct { + SenderID string `json:"SenderId"` + SenderIDType string `json:"SenderIdType"` +} + +type ChimeBotEventDiscussion struct { + DiscussionID string `json:"DiscussionId"` + DiscussionType string `json:"DiscussionType"` +} + +type ChimeBotEventInboundHTTPSEndpoint struct { + EndpointType string `json:"EndpointType"` + URL string `json:"Url"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_logs.go b/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_logs.go index 447cbd5fd..bc7bbf8a1 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_logs.go +++ b/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_logs.go @@ -29,11 +29,11 @@ func (c CloudwatchLogsRawData) Parse() (d CloudwatchLogsData, err error) { if err != nil { return } + defer zr.Close() - buf := &bytes.Buffer{} - buf.ReadFrom(zr) + dec := json.NewDecoder(zr) + err = dec.Decode(&d) - err = json.Unmarshal(buf.Bytes(), &d) return } diff --git a/vendor/github.com/aws/aws-lambda-go/events/code_commit.go b/vendor/github.com/aws/aws-lambda-go/events/code_commit.go index 47eefa666..e8672ba38 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/code_commit.go +++ b/vendor/github.com/aws/aws-lambda-go/events/code_commit.go @@ -58,6 +58,7 @@ type CodeCommitRecord struct { EventSource string `json:"eventSource"` AWSRegion string `json:"awsRegion"` EventTotalParts uint64 `json:"eventTotalParts"` + CustomData string `json:"customData,omitempty"` } // String returns a string representation of this object. @@ -67,11 +68,11 @@ func (r CodeCommitRecord) String() string { "{eventId: %v, eventVersion: %v, eventTime: %v, eventTriggerName: %v, "+ "eventPartNumber: %v, codeCommit: %v, eventName: %v, "+ "eventTriggerConfigId: %v, eventSourceARN: %v, userIdentityARN: %v, "+ - "eventSource: %v, awsRegion: %v, eventTotalParts: %v}", + "eventSource: %v, awsRegion: %v, eventTotalParts: %v, customData: %v}", r.EventID, r.EventVersion, r.EventTime, r.EventTriggerName, r.EventPartNumber, r.CodeCommit, r.EventName, r.EventTriggerConfigId, r.EventSourceARN, r.UserIdentityARN, - r.EventSource, r.AWSRegion, r.EventTotalParts) + r.EventSource, r.AWSRegion, r.EventTotalParts, r.CustomData) } // CodeCommitCodeCommit represents a CodeCommit object in a record diff --git a/vendor/github.com/aws/aws-lambda-go/events/codebuild.go b/vendor/github.com/aws/aws-lambda-go/events/codebuild.go new file mode 100644 index 000000000..7a3b0d904 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/codebuild.go @@ -0,0 +1,183 @@ +package events + +import ( + "encoding/json" + "time" +) + +const ( + CodeBuildEventSource = "aws.codebuild" + CodeBuildStateChangeDetailType = "CodeBuild Build State Change" + CodeBuildPhaseChangeDetailType = "CodeBuild Build Phase Change" +) + +type CodeBuildPhaseStatus string + +const ( + CodeBuildPhaseStatusFailed CodeBuildPhaseStatus = "FAILED" + CodeBuildPhaseStatusFault = "FAULT" + CodeBuildPhaseStatusInProgress = "IN_PROGRESS" + CodeBuildPhaseStatusQueued = "QUEUED" + CodeBuildPhaseStatusStopped = "STOPPED" + CodeBuildPhaseStatusSucceeded = "SUCCEEDED" + CodeBuildPhaseStatusTimedOut = "TIMED_OUT" +) + +type CodeBuildPhaseType string + +const ( + CodeBuildPhaseTypeSubmitted CodeBuildPhaseType = "SUBMITTED" + CodeBuildPhaseTypeProvisioning = "PROVISIONING" + CodeBuildPhaseTypeDownloadSource = "DOWNLOAD_SOURCE" + CodeBuildPhaseTypeInstall = "INSTALL" + CodeBuildPhaseTypePreBuild = "PRE_BUILD" + CodeBuildPhaseTypeBuild = "BUILD" + CodeBuildPhaseTypePostBuild = "POST_BUILD" + CodeBuildPhaseTypeUploadArtifacts = "UPLOAD_ARTIFACTS" + CodeBuildPhaseTypeFinalizing = "FINALIZING" + CodeBuildPhaseTypeCompleted = "COMPLETED" +) + +// CodeBuildEvent is documented at: +// https://docs.aws.amazon.com/codebuild/latest/userguide/sample-build-notifications.html#sample-build-notifications-ref +type CodeBuildEvent struct { + // AccountID is the id of the AWS account from which the event originated. + AccountID string `json:"account"` + + // Region is the AWS region from which the event originated. + Region string `json:"region"` + + // DetailType informs the schema of the Detail field. For build state-change + // events, the value will be CodeBuildStateChangeDetailType. For phase-change + // events, it will be CodeBuildPhaseChangeDetailType. + DetailType string `json:"detail-type"` + + // Source should be equal to CodeBuildEventSource. + Source string `json:"source"` + + // Version is the version of the event's schema. + Version string `json:"version"` + + // Time is the event's timestamp. + Time time.Time `json:"time"` + + // ID is the GUID of this event. + ID string `json:"id"` + + // Resources is a list of ARNs of CodeBuild builds that this event pertains to. + Resources []string `json:"resources"` + + // Detail contains information specific to a build state-change or + // build phase-change event. + Detail CodeBuildEventDetail `json:"detail"` +} + +type CodeBuildEventDetail struct { + BuildStatus CodeBuildPhaseStatus `json:"build-status"` + ProjectName string `json:"project-name"` + BuildID string `json:"build-id"` + AdditionalInformation CodeBuildEventAdditionalInformation `json:"additional-information"` + CurrentPhase CodeBuildPhaseStatus `json:"current-phase"` + CurrentPhaseContext string `json:"current-phase-context"` + Version string `json:"version"` + + CompletedPhaseStatus CodeBuildPhaseStatus `json:"completed-phase-status"` + CompletedPhase CodeBuildPhaseStatus `json:"completed-phase"` + CompletedPhaseContext string `json:"completed-phase-context"` + CompletedPhaseDuration DurationSeconds `json:"completed-phase-duration-seconds"` + CompletedPhaseStart CodeBuildTime `json:"completed-phase-start"` + CompletedPhaseEnd CodeBuildTime `json:"completed-phase-end"` +} + +type CodeBuildEventAdditionalInformation struct { + Artifact CodeBuildArtifact `json:"artifact"` + + Environment CodeBuildEnvironment `json:"environment"` + + Timeout DurationMinutes `json:"timeout-in-minutes"` + + BuildComplete bool `json:"build-complete"` + + Initiator string `json:"initiator"` + + BuildStartTime CodeBuildTime `json:"build-start-time"` + + Source CodeBuildSource `json:"source"` + + Logs CodeBuildLogs `json:"logs"` + + Phases []CodeBuildPhase `json:"phases"` +} + +type CodeBuildArtifact struct { + MD5Sum string `json:"md5sum"` + SHA256Sum string `json:"sha256sum"` + Location string `json:"location"` +} + +type CodeBuildEnvironment struct { + Image string `json:"image"` + PrivilegedMode bool `json:"privileged-mode"` + ComputeType string `json:"compute-type"` + Type string `json:"type"` + EnvironmentVariables []CodeBuildEnvironmentVariable `json:"environment-variables"` +} + +type CodeBuildEnvironmentVariable struct { + // Name is the name of the environment variable. + Name string `json:"name"` + + // Type is PLAINTEXT or PARAMETER_STORE. + Type string `json:"type"` + + // Value is the value of the environment variable. + Value string `json:"value"` +} + +type CodeBuildSource struct { + Location string `json:"location"` + Type string `json:"type"` +} + +type CodeBuildLogs struct { + GroupName string `json:"group-name"` + StreamName string `json:"stream-name"` + DeepLink string `json:"deep-link"` +} + +type CodeBuildPhase struct { + PhaseContext []interface{} `json:"phase-context"` + + StartTime CodeBuildTime `json:"start-time"` + + EndTime CodeBuildTime `json:"end-time"` + + Duration DurationSeconds `json:"duration-in-seconds"` + + PhaseType CodeBuildPhaseType `json:"phase-type"` + + PhaseStatus CodeBuildPhaseStatus `json:"phase-status"` +} + +type CodeBuildTime time.Time + +const codeBuildTimeFormat = "Jan 2, 2006 3:04:05 PM" + +func (t CodeBuildTime) MarshalJSON() ([]byte, error) { + return json.Marshal(time.Time(t).Format(codeBuildTimeFormat)) +} + +func (t *CodeBuildTime) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + + ts, err := time.Parse(codeBuildTimeFormat, s) + if err != nil { + return err + } + + *t = CodeBuildTime(ts) + return nil +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/codedeploy.go b/vendor/github.com/aws/aws-lambda-go/events/codedeploy.go new file mode 100644 index 000000000..b805f2882 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/codedeploy.go @@ -0,0 +1,80 @@ +package events + +import ( + "time" +) + +const ( + CodeDeployEventSource = "aws.codedeploy" + CodeDeployDeploymentEventDetailType = "CodeDeploy Deployment State-change Notification" + CodeDeployInstanceEventDetailType = "CodeDeploy Instance State-change Notification" +) + +type CodeDeployDeploymentState string + +const ( + CodeDeployDeploymentStateFailure CodeDeployDeploymentState = "FAILURE" + CodeDeployDeploymentStateReady = "READY" + CodeDeployDeploymentStateStart = "START" + CodeDeployDeploymentStateStop = "STOP" + CodeDeployDeploymentStateSuccess = "SUCCESS" +) + +// CodeDeployEvent is documented at: +// https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#acd_event_types +type CodeDeployEvent struct { + // AccountID is the id of the AWS account from which the event originated. + AccountID string `json:"account"` + + // Region is the AWS region from which the event originated. + Region string `json:"region"` + + // DetailType informs the schema of the Detail field. For deployment state-change + // events, the value should be equal to CodeDeployDeploymentEventDetailType. + // For instance state-change events, the value should be equal to + // CodeDeployInstanceEventDetailType. + DetailType string `json:"detail-type"` + + // Source should be equal to CodeDeployEventSource. + Source string `json:"source"` + + // Version is the version of the event's schema. + Version string `json:"version"` + + // Time is the event's timestamp. + Time time.Time `json:"time"` + + // ID is the GUID of this event. + ID string `json:"id"` + + // Resources is a list of ARNs of CodeDeploy applications and deployment + // groups that this event pertains to. + Resources []string `json:"resources"` + + // Detail contains information specific to a deployment event. + Detail CodeDeployEventDetail `json:"detail"` +} + +type CodeDeployEventDetail struct { + // InstanceGroupID is the ID of the instance group. + InstanceGroupID string `json:"instanceGroupId"` + + // InstanceID is the id of the instance. This field is non-empty only if + // the DetailType of the complete event is CodeDeployInstanceEventDetailType. + InstanceID string `json:"instanceId,omitempty"` + + // Region is the AWS region that the event originated from. + Region string `json:"region"` + + // Application is the name of the CodeDeploy application. + Application string `json:"application"` + + // DeploymentID is the id of the deployment. + DeploymentID string `json:"deploymentId"` + + // State is the new state of the deployment. + State CodeDeployDeploymentState `json:"state"` + + // DeploymentGroup is the name of the deployment group. + DeploymentGroup string `json:"deploymentGroup"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/cognito.go b/vendor/github.com/aws/aws-lambda-go/events/cognito.go index 6624828c8..d8af5c1ae 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/cognito.go +++ b/vendor/github.com/aws/aws-lambda-go/events/cognito.go @@ -1,8 +1,8 @@ -// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. package events -// CognitoEvent contains data from an event sent from AWS Cognito +// CognitoEvent contains data from an event sent from AWS Cognito Sync type CognitoEvent struct { DatasetName string `json:"datasetName"` DatasetRecords map[string]CognitoDatasetRecord `json:"datasetRecords"` @@ -13,9 +13,245 @@ type CognitoEvent struct { Version int `json:"version"` } -// CognitoDatasetRecord represents a record from an AWS Cognito event +// CognitoDatasetRecord represents a record from an AWS Cognito Sync event type CognitoDatasetRecord struct { NewValue string `json:"newValue"` OldValue string `json:"oldValue"` Op string `json:"op"` } + +// CognitoEventUserPoolsPreSignup is sent by AWS Cognito User Pools when a user attempts to register +// (sign up), allowing a Lambda to perform custom validation to accept or deny the registration request +type CognitoEventUserPoolsPreSignup struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsPreSignupRequest `json:"request"` + Response CognitoEventUserPoolsPreSignupResponse `json:"response"` +} + +// CognitoEventUserPoolsPreAuthentication is sent by AWS Cognito User Pools when a user submits their information +// to be authenticated, allowing you to perform custom validations to accept or deny the sign in request. +type CognitoEventUserPoolsPreAuthentication struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsPreAuthenticationRequest `json:"request"` + Response CognitoEventUserPoolsPreAuthenticationResponse `json:"response"` +} + +// CognitoEventUserPoolsPostConfirmation is sent by AWS Cognito User Pools after a user is confirmed, +// allowing the Lambda to send custom messages or add custom logic. +type CognitoEventUserPoolsPostConfirmation struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsPostConfirmationRequest `json:"request"` + Response CognitoEventUserPoolsPostConfirmationResponse `json:"response"` +} + +// CognitoEventUserPoolsPreTokenGen is sent by AWS Cognito User Pools when a user attempts to retrieve +// credentials, allowing a Lambda to perform insert, suppress or override claims +type CognitoEventUserPoolsPreTokenGen struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsPreTokenGenRequest `json:"request"` + Response CognitoEventUserPoolsPreTokenGenResponse `json:"response"` +} + +// CognitoEventUserPoolsPostAuthentication is sent by AWS Cognito User Pools after a user is authenticated, +// allowing the Lambda to add custom logic. +type CognitoEventUserPoolsPostAuthentication struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsPostAuthenticationRequest `json:"request"` + Response CognitoEventUserPoolsPostAuthenticationResponse `json:"response"` +} + +// CognitoEventUserPoolsMigrateUser is sent by AWS Cognito User Pools when a user does not exist in the +// user pool at the time of sign-in with a password, or in the forgot-password flow. +type CognitoEventUserPoolsMigrateUser struct { + CognitoEventUserPoolsHeader + CognitoEventUserPoolsMigrateUserRequest `json:"request"` + CognitoEventUserPoolsMigrateUserResponse `json:"response"` +} + +// CognitoEventUserPoolsCallerContext contains information about the caller +type CognitoEventUserPoolsCallerContext struct { + AWSSDKVersion string `json:"awsSdkVersion"` + ClientID string `json:"clientId"` +} + +// CognitoEventUserPoolsHeader contains common data from events sent by AWS Cognito User Pools +type CognitoEventUserPoolsHeader struct { + Version string `json:"version"` + TriggerSource string `json:"triggerSource"` + Region string `json:"region"` + UserPoolID string `json:"userPoolId"` + CallerContext CognitoEventUserPoolsCallerContext `json:"callerContext"` + UserName string `json:"userName"` +} + +// CognitoEventUserPoolsPreSignupRequest contains the request portion of a PreSignup event +type CognitoEventUserPoolsPreSignupRequest struct { + UserAttributes map[string]string `json:"userAttributes"` + ValidationData map[string]string `json:"validationData"` +} + +// CognitoEventUserPoolsPreSignupResponse contains the response portion of a PreSignup event +type CognitoEventUserPoolsPreSignupResponse struct { + AutoConfirmUser bool `json:"autoConfirmUser"` + AutoVerifyEmail bool `json:"autoVerifyEmail"` + AutoVerifyPhone bool `json:"autoVerifyPhone"` +} + +// CognitoEventUserPoolsPreAuthenticationRequest contains the request portion of a PreAuthentication event +type CognitoEventUserPoolsPreAuthenticationRequest struct { + UserAttributes map[string]string `json:"userAttributes"` + ValidationData map[string]string `json:"validationData"` +} + +// CognitoEventUserPoolsPreAuthenticationResponse contains the response portion of a PreAuthentication event +type CognitoEventUserPoolsPreAuthenticationResponse struct { +} + +// CognitoEventUserPoolsPostConfirmationRequest contains the request portion of a PostConfirmation event +type CognitoEventUserPoolsPostConfirmationRequest struct { + UserAttributes map[string]string `json:"userAttributes"` +} + +// CognitoEventUserPoolsPostConfirmationResponse contains the response portion of a PostConfirmation event +type CognitoEventUserPoolsPostConfirmationResponse struct { +} + +// CognitoEventUserPoolsPreTokenGenRequest contains request portion of PreTokenGen event +type CognitoEventUserPoolsPreTokenGenRequest struct { + UserAttributes map[string]string `json:"userAttributes"` + GroupConfiguration GroupConfiguration `json:"groupConfiguration"` +} + +// CognitoEventUserPoolsPreTokenGenResponse containst the response portion of a PreTokenGen event +type CognitoEventUserPoolsPreTokenGenResponse struct { + ClaimsOverrideDetails ClaimsOverrideDetails `json:"claimsOverrideDetails"` +} + +// CognitoEventUserPoolsPostAuthenticationRequest contains the request portion of a PostAuthentication event +type CognitoEventUserPoolsPostAuthenticationRequest struct { + NewDeviceUsed bool `json:"newDeviceUsed"` + UserAttributes map[string]string `json:"userAttributes"` +} + +// CognitoEventUserPoolsPostAuthenticationResponse contains the response portion of a PostAuthentication event +type CognitoEventUserPoolsPostAuthenticationResponse struct { +} + +// CognitoEventUserPoolsMigrateUserRequest contains the request portion of a MigrateUser event +type CognitoEventUserPoolsMigrateUserRequest struct { + Password string `json:"password"` +} + +// CognitoEventUserPoolsMigrateUserResponse contains the response portion of a MigrateUser event +type CognitoEventUserPoolsMigrateUserResponse struct { + UserAttributes map[string]string `json:"userAttributes"` + FinalUserStatus string `json:"finalUserStatus"` + MessageAction string `json:"messageAction"` + DesiredDeliveryMediums []string `json:"desiredDeliveryMediums"` + ForceAliasCreation bool `json:"forceAliasCreation"` +} + +// ClaimsOverrideDetails allows lambda to add, suppress or override claims in the token +type ClaimsOverrideDetails struct { + GroupOverrideDetails GroupConfiguration `json:"groupOverrideDetails"` + ClaimsToAddOrOverride map[string]string `json:"claimsToAddOrOverride"` + ClaimsToSuppress []string `json:"claimsToSuppress"` +} + +// GroupConfiguration allows lambda to override groups, roles and set a perferred role +type GroupConfiguration struct { + GroupsToOverride []string `json:"groupsToOverride"` + IAMRolesToOverride []string `json:"iamRolesToOverride"` + PreferredRole *string `json:"preferredRole"` +} + +// CognitoEventUserPoolsChallengeResult represents a challenge that is presented to the user in the authentication +// process that is underway, along with the corresponding result. +type CognitoEventUserPoolsChallengeResult struct { + ChallengeName string `json:"challengeName"` + ChallengeResult bool `json:"challengeResult"` + ChallengeMetadata string `json:"challengeMetadata"` +} + +// CognitoEventUserPoolsDefineAuthChallengeRequest defines auth challenge request parameters +type CognitoEventUserPoolsDefineAuthChallengeRequest struct { + UserAttributes map[string]string `json:"userAttributes"` + Session []*CognitoEventUserPoolsChallengeResult `json:"session"` +} + +// CognitoEventUserPoolsDefineAuthChallengeResponse defines auth challenge response parameters +type CognitoEventUserPoolsDefineAuthChallengeResponse struct { + ChallengeName string `json:"challengeName"` + IssueTokens bool `json:"issueTokens"` + FailAuthentication bool `json:"failAuthentication"` +} + +// CognitoEventUserPoolsDefineAuthChallenge sent by AWS Cognito User Pools to initiate custom authentication flow +type CognitoEventUserPoolsDefineAuthChallenge struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsDefineAuthChallengeRequest `json:"request"` + Response CognitoEventUserPoolsDefineAuthChallengeResponse `json:"response"` +} + +// CognitoEventUserPoolsCreateAuthChallengeRequest defines create auth challenge request parameters +type CognitoEventUserPoolsCreateAuthChallengeRequest struct { + UserAttributes map[string]string `json:"userAttributes"` + ChallengeName string `json:"challengeName"` + Session []*CognitoEventUserPoolsChallengeResult `json:"session"` +} + +// CognitoEventUserPoolsCreateAuthChallengeResponse defines create auth challenge response rarameters +type CognitoEventUserPoolsCreateAuthChallengeResponse struct { + PublicChallengeParameters map[string]string `json:"publicChallengeParameters"` + PrivateChallengeParameters map[string]string `json:"privateChallengeParameters"` + ChallengeMetadata string `json:"challengeMetadata"` +} + +// CognitoEventUserPoolsCreateAuthChallenge sent by AWS Cognito User Pools to create a challenge to present to the user +type CognitoEventUserPoolsCreateAuthChallenge struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsCreateAuthChallengeRequest `json:"request"` + Response CognitoEventUserPoolsCreateAuthChallengeResponse `json:"response"` +} + +// CognitoEventUserPoolsVerifyAuthChallengeRequest defines verify auth challenge request parameters +type CognitoEventUserPoolsVerifyAuthChallengeRequest struct { + UserAttributes map[string]string `json:"userAttributes"` + PrivateChallengeParameters map[string]string `json:"privateChallengeParameters"` + ChallengeAnswer interface{} `json:"challengeAnswer"` +} + +// CognitoEventUserPoolsVerifyAuthChallengeResponse defines verify auth challenge response parameters +type CognitoEventUserPoolsVerifyAuthChallengeResponse struct { + AnswerCorrect bool `json:"answerCorrect"` +} + +// CognitoEventUserPoolsVerifyAuthChallenge sent by AWS Cognito User Pools to verify if the response from the end user +// for a custom Auth Challenge is valid or not +type CognitoEventUserPoolsVerifyAuthChallenge struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsVerifyAuthChallengeRequest `json:"request"` + Response CognitoEventUserPoolsVerifyAuthChallengeResponse `json:"response"` +} + +// CognitoEventUserPoolsCustomMessage is sent by AWS Cognito User Pools before a verification or MFA message is sent, +// allowing a user to customize the message dynamically. +type CognitoEventUserPoolsCustomMessage struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsCustomMessageRequest `json:"request"` + Response CognitoEventUserPoolsCustomMessageResponse `json:"response"` +} + +// CognitoEventUserPoolsCustomMessageRequest contains the request portion of a CustomMessage event +type CognitoEventUserPoolsCustomMessageRequest struct { + UserAttributes map[string]interface{} `json:"userAttributes"` + CodeParameter string `json:"codeParameter"` + UsernameParameter string `json:"usernameParameter"` +} + +// CognitoEventUserPoolsCustomMessageResponse contains the response portion of a CustomMessage event +type CognitoEventUserPoolsCustomMessageResponse struct { + SMSMessage string `json:"smsMessage"` + EmailMessage string `json:"emailMessage"` + EmailSubject string `json:"emailSubject"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/connect.go b/vendor/github.com/aws/aws-lambda-go/events/connect.go new file mode 100644 index 000000000..d957392d9 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/connect.go @@ -0,0 +1,50 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +// ConnectEvent contains the data structure for a Connect event. +type ConnectEvent struct { + Details ConnectDetails `json:"Details"` + Name string `json:"Name"` // The name of the event. +} + +// ConnectDetails holds the details of a Connect event +type ConnectDetails struct { + ContactData ConnectContactData `json:"ContactData"` + + // The parameters that have been set in the Connect instance at the time of the Lambda invocation. + Parameters map[string]string `json:"Parameters"` +} + +// ConnectContactData holds all of the contact information for the user that invoked the Connect event. +type ConnectContactData struct { + // The custom attributes from Connect that the Lambda function was invoked with. + Attributes map[string]string `json:"Attributes"` + Channel string `json:"Channel"` + ContactID string `json:"ContactId"` + CustomerEndpoint ConnectEndpoint `json:"CustomerEndpoint"` + InitialContactID string `json:"InitialContactId"` + + // Either: INBOUND/OUTBOUND/TRANSFER/CALLBACK + InitiationMethod string `json:"InitiationMethod"` + PreviousContactID string `json:"PreviousContactId"` + Queue ConnectQueue `json:"Queue"` + SystemEndpoint ConnectEndpoint `json:"SystemEndpoint"` + InstanceARN string `json:"InstanceARN"` +} + +// ConnectEndpoint represents routing information. +type ConnectEndpoint struct { + Address string `json:"Address"` + Type string `json:"Type"` +} + +// ConnectQueue represents a queue object. +type ConnectQueue struct { + Name string `json:"Name"` + ARN string `json:"ARN"` +} + +// ConnectResponse is the structure that Connect expects to get back from Lambda. +// These return values can be used in Connect to perform further routing decisions. +type ConnectResponse map[string]string diff --git a/vendor/github.com/aws/aws-lambda-go/events/duration.go b/vendor/github.com/aws/aws-lambda-go/events/duration.go new file mode 100644 index 000000000..6091b2f7d --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/duration.go @@ -0,0 +1,41 @@ +package events + +import ( + "encoding/json" + "math" + "time" +) + +type DurationSeconds time.Duration + +func (duration *DurationSeconds) UnmarshalJSON(data []byte) error { + var seconds int64 + if err := json.Unmarshal(data, &seconds); err != nil { + return err + } + + *duration = DurationSeconds(time.Duration(seconds) * time.Second) + return nil +} + +func (duration DurationSeconds) MarshalJSON() ([]byte, error) { + seconds := time.Duration(duration).Seconds() + return json.Marshal(int64(math.Ceil(seconds))) +} + +type DurationMinutes time.Duration + +func (duration *DurationMinutes) UnmarshalJSON(data []byte) error { + var minutes int64 + if err := json.Unmarshal(data, &minutes); err != nil { + return err + } + + *duration = DurationMinutes(time.Duration(minutes) * time.Minute) + return nil +} + +func (duration DurationMinutes) MarshalJSON() ([]byte, error) { + minutes := time.Duration(duration).Minutes() + return json.Marshal(int64(math.Ceil(minutes))) +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/firehose.go b/vendor/github.com/aws/aws-lambda-go/events/firehose.go index 293974e7c..9a7a34a25 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/firehose.go +++ b/vendor/github.com/aws/aws-lambda-go/events/firehose.go @@ -4,16 +4,18 @@ package events // KinesisFirehoseEvent represents the input event from Amazon Kinesis Firehose. It is used as the input parameter. type KinesisFirehoseEvent struct { - InvocationID string `json:"invocationId"` - DeliveryStreamArn string `json:"deliveryStreamArn"` - Region string `json:"region"` - Records []KinesisFirehoseEventRecord `json:"records"` + InvocationID string `json:"invocationId"` + DeliveryStreamArn string `json:"deliveryStreamArn"` + SourceKinesisStreamArn string `json:"sourceKinesisStreamArn"` + Region string `json:"region"` + Records []KinesisFirehoseEventRecord `json:"records"` } type KinesisFirehoseEventRecord struct { - RecordID string `json:"recordId"` - ApproximateArrivalTimestamp MilliSecondsEpochTime `json:"approximateArrivalTimestamp"` - Data []byte `json:"data"` + RecordID string `json:"recordId"` + ApproximateArrivalTimestamp MilliSecondsEpochTime `json:"approximateArrivalTimestamp"` + Data []byte `json:"data"` + KinesisFirehoseRecordMetadata KinesisFirehoseRecordMetadata `json:"kinesisRecordMetadata"` } // Constants used for describing the transformation result @@ -32,3 +34,10 @@ type KinesisFirehoseResponseRecord struct { Result string `json:"result"` // The status of the transformation. May be TransformedStateOk, TransformedStateDropped or TransformedStateProcessingFailed Data []byte `json:"data"` } + +type KinesisFirehoseRecordMetadata struct { + ShardID string `json:"shardId"` + PartitionKey string `json:"partitionKey"` + SequenceNumber string `json:"sequenceNumber"` + ApproximateArrivalTimestamp MilliSecondsEpochTime `json:"approximateArrivalTimestamp"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/iot_button.go b/vendor/github.com/aws/aws-lambda-go/events/iot_button.go new file mode 100644 index 000000000..d0e72063e --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/iot_button.go @@ -0,0 +1,9 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +type IoTButtonEvent struct { + SerialNumber string `json:"serialNumber"` + ClickType string `json:"clickType"` + BatteryVoltage string `json:"batteryVoltage"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/kinesis_analytics.go b/vendor/github.com/aws/aws-lambda-go/events/kinesis_analytics.go new file mode 100644 index 000000000..d44a9519a --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/kinesis_analytics.go @@ -0,0 +1,28 @@ +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +type KinesisAnalyticsOutputDeliveryEvent struct { + InvocationID string `json:"invocationId"` + ApplicationARN string `json:"applicationArn"` + Records []KinesisAnalyticsOutputDeliveryEventRecord `json:"records"` +} + +type KinesisAnalyticsOutputDeliveryEventRecord struct { + RecordID string `json:"recordId"` + Data []byte `json:"data"` +} + +type KinesisAnalyticsOutputDeliveryResponse struct { + Records []KinesisAnalyticsOutputDeliveryResponseRecord `json:"records"` +} + +const ( + KinesisAnalyticsOutputDeliveryOK = "Ok" + KinesisAnalyticsOutputDeliveryFailed = "DeliveryFailed" +) + +type KinesisAnalyticsOutputDeliveryResponseRecord struct { + RecordID string `json:"recordId"` + Result string `json:"result"` //possible values include Ok and DeliveryFailed +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/lex.go b/vendor/github.com/aws/aws-lambda-go/events/lex.go index 597cbdf83..dd635fbdc 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/lex.go +++ b/vendor/github.com/aws/aws-lambda-go/events/lex.go @@ -5,7 +5,7 @@ type LexEvent struct { InvocationSource string `json:"invocationSource,omitempty"` UserID string `json:"userId,omitempty"` InputTranscript string `json:"inputTranscript,omitempty"` - SessionAttributes map[string]string `json:"sessionAttributes"` + SessionAttributes SessionAttributes `json:"sessionAttributes,omitempty"` RequestAttributes map[string]string `json:"requestAttributes,omitempty"` Bot *LexBot `json:"bot,omitempty"` OutputDialogMode string `json:"outputDialogMode,omitempty"` @@ -14,47 +14,54 @@ type LexEvent struct { } type LexBot struct { - Name string `json:"name"` - Alias string `json:"alias"` - Version string `json:"version"` + Name string `json:"name,omitempty"` + Alias string `json:"alias,omitempty"` + Version string `json:"version,omitempty"` } type LexCurrentIntent struct { - Name string `json:"name"` - Slots Slots `json:"slots"` - SlotDetails map[string]SlotDetail `json:"slotDetails"` - ConfirmationStatus string `json:"confirmationStatus"` + Name string `json:"name,omitempty"` + Slots Slots `json:"slots,omitempty"` + SlotDetails map[string]SlotDetail `json:"slotDetails,omitempty"` + ConfirmationStatus string `json:"confirmationStatus,omitempty"` } type SlotDetail struct { - Resolutions []map[string]string `json:"resolutions"` - OriginalValue string `json:"originalValue"` + Resolutions []map[string]string `json:"resolutions,omitempty"` + OriginalValue string `json:"originalValue,omitempty"` } type LexDialogAction struct { - Type string `json:"type"` - FulfillmentState string `json:"fulfillmentState"` - Message map[string]string `json:"message"` - IntentName string `json:"intentName"` - Slots Slots `json:"slots"` - SlotToElicit string `json:"slotToElicit"` - ResponseCard LexResponseCard `json:"responseCard"` + Type string `json:"type,omitempty"` + FulfillmentState string `json:"fulfillmentState,omitempty"` + Message map[string]string `json:"message,omitempty"` + IntentName string `json:"intentName,omitempty"` + Slots Slots `json:"slots,omitempty"` + SlotToElicit string `json:"slotToElicit,omitempty"` + ResponseCard *LexResponseCard `json:"responseCard,omitempty"` } -type Slots map[string]string +type SessionAttributes map[string]string + +type Slots map[string]*string + +type LexResponse struct { + SessionAttributes SessionAttributes `json:"sessionAttributes"` + DialogAction LexDialogAction `json:"dialogAction,omitempty"` +} type LexResponseCard struct { - Version int64 `json:"version"` - ContentType string `json:"contentType"` - GenericAttachments []Attachment `json:"genericAttachments"` + Version int64 `json:"version,omitempty"` + ContentType string `json:"contentType,omitempty"` + GenericAttachments []Attachment `json:"genericAttachments,omitempty"` } type Attachment struct { - Title string `json:"title"` - SubTitle string `json:"subTitle"` - ImageURL string `json:"imageUrl"` - AttachmentLinkURL string `json:"attachmentLinkUrl"` - Buttons []map[string]string `json:"buttons"` + Title string `json:"title,omitempty"` + SubTitle string `json:"subTitle,omitempty"` + ImageURL string `json:"imageUrl,omitempty"` + AttachmentLinkURL string `json:"attachmentLinkUrl,omitempty"` + Buttons []map[string]string `json:"buttons,omitempty"` } func (h *LexEvent) Clear() { diff --git a/vendor/github.com/aws/aws-lambda-go/events/s3.go b/vendor/github.com/aws/aws-lambda-go/events/s3.go index a0641a3f8..5af349318 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/s3.go +++ b/vendor/github.com/aws/aws-lambda-go/events/s3.go @@ -51,3 +51,12 @@ type S3Object struct { ETag string `json:"eTag"` Sequencer string `json:"sequencer"` } + +type S3TestEvent struct { + Service string `json:"Service"` + Bucket string `json:"Bucket"` + Event string `json:"Event"` + Time time.Time `json:"Time"` + RequestID string `json:"RequestId"` + HostID string `json:"HostId"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/s3_batch_job.go b/vendor/github.com/aws/aws-lambda-go/events/s3_batch_job.go new file mode 100644 index 000000000..595161267 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/s3_batch_job.go @@ -0,0 +1,34 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +type S3BatchJobEvent struct { + InvocationSchemaVersion string `json:"invocationSchemaVersion"` + InvocationID string `json:"invocationId"` + Job S3BatchJob `json:"job"` + Tasks []S3BatchJobTask `json:"tasks"` +} + +type S3BatchJob struct { + ID string `json:"id"` +} + +type S3BatchJobTask struct { + TaskID string `json:"taskId"` + S3Key string `json:"s3Key"` + S3VersionID string `json:"s3VersionId"` + S3BucketARN string `json:"s3BucketArn"` +} + +type S3BatchJobResponse struct { + InvocationSchemaVersion string `json:"invocationSchemaVersion"` + TreatMissingKeysAs string `json:"treatMissingKeysAs"` + InvocationID string `json:"invocationId"` + Results []S3BatchJobResult `json:"results"` +} + +type S3BatchJobResult struct { + TaskID string `json:"taskId"` + ResultCode string `json:"resultCode"` + ResultString string `json:"resultString"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/ses.go b/vendor/github.com/aws/aws-lambda-go/events/ses.go index 8f8117002..ff8998566 100644 --- a/vendor/github.com/aws/aws-lambda-go/events/ses.go +++ b/vendor/github.com/aws/aws-lambda-go/events/ses.go @@ -33,6 +33,8 @@ type SimpleEmailReceipt struct { Timestamp time.Time `json:"timestamp"` SpamVerdict SimpleEmailVerdict `json:"spamVerdict"` DKIMVerdict SimpleEmailVerdict `json:"dkimVerdict"` + DMARCVerdict SimpleEmailVerdict `json:"dmarcVerdict"` + DMARCPolicy string `json:"dmarcPolicy"` SPFVerdict SimpleEmailVerdict `json:"spfVerdict"` VirusVerdict SimpleEmailVerdict `json:"virusVerdict"` Action SimpleEmailReceiptAction `json:"action"` @@ -53,12 +55,41 @@ type SimpleEmailCommonHeaders struct { Subject string `json:"subject"` } +// SimpleEmailReceiptAction is a logical union of fields present in all action +// Types. For example, the FunctionARN and InvocationType fields are only +// present for the Lambda Type, and the BucketName and ObjectKey fields are only +// present for the S3 Type. type SimpleEmailReceiptAction struct { - Type string `json:"type"` - InvocationType string `json:"invocationType"` - FunctionArn string `json:"functionArn"` + Type string `json:"type"` + TopicARN string `json:"topicArn,omitempty"` + BucketName string `json:"bucketName,omitempty"` + ObjectKey string `json:"objectKey,omitempty"` + SMTPReplyCode string `json:"smtpReplyCode,omitempty"` + StatusCode string `json:"statusCode,omitempty"` + Message string `json:"message,omitempty"` + Sender string `json:"sender,omitempty"` + InvocationType string `json:"invocationType,omitempty"` + FunctionARN string `json:"functionArn,omitempty"` + OrganizationARN string `json:"organizationArn,omitempty"` } type SimpleEmailVerdict struct { Status string `json:"status"` } + +// SimpleEmailDispositionValue enumeration representing the dispostition value for SES +type SimpleEmailDispositionValue string + +const ( + // SimpleEmailContinue represents the CONTINUE disposition which tells the SES Rule Set to continue to the next rule + SimpleEmailContinue SimpleEmailDispositionValue = "CONTINUE" + // SimpleEmailStopRule represents the STOP_RULE disposition which tells the SES Rule Set to stop processing this rule and continue to the next + SimpleEmailStopRule SimpleEmailDispositionValue = "STOP_RULE" + // SimpleEmailStopRuleSet represents the STOP_RULE_SET disposition which tells the SES Rule SEt to stop processing all rules + SimpleEmailStopRuleSet SimpleEmailDispositionValue = "STOP_RULE_SET" +) + +// SimpleEmailDisposition disposition return for SES to control rule functions +type SimpleEmailDisposition struct { + Disposition SimpleEmailDispositionValue `json:"disposition"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/sqs.go b/vendor/github.com/aws/aws-lambda-go/events/sqs.go new file mode 100644 index 000000000..ea1bf7bef --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/sqs.go @@ -0,0 +1,28 @@ +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +type SQSEvent struct { + Records []SQSMessage `json:"Records"` +} + +type SQSMessage struct { + MessageId string `json:"messageId"` + ReceiptHandle string `json:"receiptHandle"` + Body string `json:"body"` + Md5OfBody string `json:"md5OfBody"` + Md5OfMessageAttributes string `json:"md5OfMessageAttributes"` + Attributes map[string]string `json:"attributes"` + MessageAttributes map[string]SQSMessageAttribute `json:"messageAttributes"` + EventSourceARN string `json:"eventSourceARN"` + EventSource string `json:"eventSource"` + AWSRegion string `json:"awsRegion"` +} + +type SQSMessageAttribute struct { + StringValue *string `json:"stringValue,omitempty"` + BinaryValue []byte `json:"binaryValue,omitempty"` + StringListValues []string `json:"stringListValues"` + BinaryListValues [][]byte `json:"binaryListValues"` + DataType string `json:"dataType"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/entry.go b/vendor/github.com/aws/aws-lambda-go/lambda/entry.go index 9db9883e2..581d9bcf9 100644 --- a/vendor/github.com/aws/aws-lambda-go/lambda/entry.go +++ b/vendor/github.com/aws/aws-lambda-go/lambda/entry.go @@ -37,7 +37,7 @@ import ( // Where "TIn" and "TOut" are types compatible with the "encoding/json" standard library. // See https://golang.org/pkg/encoding/json/#Unmarshal for how deserialization behaves func Start(handler interface{}) { - wrappedHandler := newHandler(handler) + wrappedHandler := NewHandler(handler) StartHandler(wrappedHandler) } @@ -53,9 +53,7 @@ func StartHandler(handler Handler) { if err != nil { log.Fatal(err) } - function := new(Function) - function.handler = handler - err = rpc.Register(function) + err = rpc.Register(NewFunction(handler)) if err != nil { log.Fatal("failed to register handler function") } diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/function.go b/vendor/github.com/aws/aws-lambda-go/lambda/function.go index 6a2e33732..50b6ac47b 100644 --- a/vendor/github.com/aws/aws-lambda-go/lambda/function.go +++ b/vendor/github.com/aws/aws-lambda-go/lambda/function.go @@ -16,6 +16,10 @@ type Function struct { handler Handler } +func NewFunction(handler Handler) *Function { + return &Function{handler: handler} +} + func (fn *Function) Ping(req *messages.PingRequest, response *messages.PingResponse) error { *response = messages.PingResponse{} return nil diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/handler.go b/vendor/github.com/aws/aws-lambda-go/lambda/handler.go index bb487f023..f6f931c15 100644 --- a/vendor/github.com/aws/aws-lambda-go/lambda/handler.go +++ b/vendor/github.com/aws/aws-lambda-go/lambda/handler.go @@ -7,6 +7,8 @@ import ( "encoding/json" "fmt" "reflect" + + "github.com/aws/aws-lambda-go/lambda/handlertrace" ) type Handler interface { @@ -56,28 +58,34 @@ func validateArguments(handler reflect.Type) (bool, error) { func validateReturns(handler reflect.Type) error { errorType := reflect.TypeOf((*error)(nil)).Elem() - if handler.NumOut() > 2 { + + switch n := handler.NumOut(); { + case n > 2: return fmt.Errorf("handler may not return more than two values") - } else if handler.NumOut() > 1 { + case n > 1: if !handler.Out(1).Implements(errorType) { return fmt.Errorf("handler returns two values, but the second does not implement error") } - } else if handler.NumOut() == 1 { + case n == 1: if !handler.Out(0).Implements(errorType) { return fmt.Errorf("handler returns a single value, but it does not implement error") } } + return nil } -// newHandler Creates the base lambda handler, which will do basic payload unmarshaling before defering to handlerSymbol. -// If handlerSymbol is not a valid handler, the returned function will be a handler that just reports the validation error. -func newHandler(handlerSymbol interface{}) lambdaHandler { - if handlerSymbol == nil { +// NewHandler creates a base lambda handler from the given handler function. The +// returned Handler performs JSON deserialization and deserialization, and +// delegates to the input handler function. The handler function parameter must +// satisfy the rules documented by Start. If handlerFunc is not a valid +// handler, the returned Handler simply reports the validation error. +func NewHandler(handlerFunc interface{}) Handler { + if handlerFunc == nil { return errorHandler(fmt.Errorf("handler is nil")) } - handler := reflect.ValueOf(handlerSymbol) - handlerType := reflect.TypeOf(handlerSymbol) + handler := reflect.ValueOf(handlerFunc) + handlerType := reflect.TypeOf(handlerFunc) if handlerType.Kind() != reflect.Func { return errorHandler(fmt.Errorf("handler kind %s is not %s", handlerType.Kind(), reflect.Func)) } @@ -91,7 +99,10 @@ func newHandler(handlerSymbol interface{}) lambdaHandler { return errorHandler(err) } - return func(ctx context.Context, payload []byte) (interface{}, error) { + return lambdaHandler(func(ctx context.Context, payload []byte) (interface{}, error) { + + trace := handlertrace.FromContext(ctx) + // construct arguments var args []reflect.Value if takesContext { @@ -104,7 +115,9 @@ func newHandler(handlerSymbol interface{}) lambdaHandler { if err := json.Unmarshal(payload, event.Interface()); err != nil { return nil, err } - + if nil != trace.RequestEvent { + trace.RequestEvent(ctx, event.Elem().Interface()) + } args = append(args, event.Elem()) } @@ -120,8 +133,12 @@ func newHandler(handlerSymbol interface{}) lambdaHandler { var val interface{} if len(response) > 1 { val = response[0].Interface() + + if nil != trace.ResponseEvent { + trace.ResponseEvent(ctx, val) + } } return val, err - } + }) } diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/handlertrace/trace.go b/vendor/github.com/aws/aws-lambda-go/lambda/handlertrace/trace.go new file mode 100644 index 000000000..cdd452ffc --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/lambda/handlertrace/trace.go @@ -0,0 +1,44 @@ +// Package handlertrace allows middleware authors using lambda.NewHandler to +// instrument request and response events. +package handlertrace + +import ( + "context" +) + +// HandlerTrace allows handlers which wrap the return value of lambda.NewHandler +// to access to the request and response events. +type HandlerTrace struct { + RequestEvent func(context.Context, interface{}) + ResponseEvent func(context.Context, interface{}) +} + +func callbackCompose(f1, f2 func(context.Context, interface{})) func(context.Context, interface{}) { + return func(ctx context.Context, event interface{}) { + if nil != f1 { + f1(ctx, event) + } + if nil != f2 { + f2(ctx, event) + } + } +} + +type handlerTraceKey struct{} + +// NewContext adds callbacks to the provided context which allows handlers which +// wrap the return value of lambda.NewHandler to access to the request and +// response events. +func NewContext(ctx context.Context, trace HandlerTrace) context.Context { + existing := FromContext(ctx) + return context.WithValue(ctx, handlerTraceKey{}, HandlerTrace{ + RequestEvent: callbackCompose(existing.RequestEvent, trace.RequestEvent), + ResponseEvent: callbackCompose(existing.ResponseEvent, trace.ResponseEvent), + }) +} + +// FromContext returns the HandlerTrace associated with the provided context. +func FromContext(ctx context.Context) HandlerTrace { + trace, _ := ctx.Value(handlerTraceKey{}).(HandlerTrace) + return trace +} diff --git a/vendor/vendor.json b/vendor/vendor.json index e7a04789a..3c4477f31 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -27,34 +27,40 @@ "revisionTime": "2017-05-07T10:33:33Z" }, { - "checksumSHA1": "stlCSj5YfHbH1fZvziEZtMTxa8I=", - "path": "github.com/arolek/algnhsa", - "revision": "c6c22c361ed25a5b441f4d741573385abc72ccd4", - "revisionTime": "2018-06-06T22:25:14Z" + "checksumSHA1": "3FU3mAcUW5yHJdz2tJsnGVoUrIo=", + "path": "github.com/akrylysov/algnhsa", + "revision": "e8503cf02d256e518f8f8ae2be071d50514aa7bc", + "revisionTime": "2019-09-26T22:36:48Z" }, { - "checksumSHA1": "H+nuubKZtdEPryI/ZiaF3W+hnus=", + "checksumSHA1": "yxAQc0KCtItM8fobSv4XtAaBE/I=", "path": "github.com/aws/aws-lambda-go/events", - "revision": "ea03c2814414b2223eff860ed2286a83ed8a195c", - "revisionTime": "2018-04-08T23:25:24Z" + "revision": "fe4f484f034626157ca7deb2ddb418ffac99a9a6", + "revisionTime": "2019-08-29T20:26:44Z" }, { - "checksumSHA1": "Atnv24CtEnB8ZLGDqFevLMfzLtQ=", + "checksumSHA1": "WMRt5NGacaITs3JFQWJBIOLL1so=", "path": "github.com/aws/aws-lambda-go/lambda", - "revision": "ea03c2814414b2223eff860ed2286a83ed8a195c", - "revisionTime": "2018-04-08T23:25:24Z" + "revision": "fe4f484f034626157ca7deb2ddb418ffac99a9a6", + "revisionTime": "2019-08-29T20:26:44Z" + }, + { + "checksumSHA1": "R5cnUZPkb0MPZnK822yvu4qlTXQ=", + "path": "github.com/aws/aws-lambda-go/lambda/handlertrace", + "revision": "fe4f484f034626157ca7deb2ddb418ffac99a9a6", + "revisionTime": "2019-08-29T20:26:44Z" }, { "checksumSHA1": "d4ehJWLS4YsqFG825pgwdvKDB6A=", "path": "github.com/aws/aws-lambda-go/lambda/messages", - "revision": "ea03c2814414b2223eff860ed2286a83ed8a195c", - "revisionTime": "2018-04-08T23:25:24Z" + "revision": "fe4f484f034626157ca7deb2ddb418ffac99a9a6", + "revisionTime": "2019-08-29T20:26:44Z" }, { "checksumSHA1": "f9MhOwQHveaPVWO6trwfqHa+W0M=", "path": "github.com/aws/aws-lambda-go/lambdacontext", - "revision": "ea03c2814414b2223eff860ed2286a83ed8a195c", - "revisionTime": "2018-04-08T23:25:24Z" + "revision": "fe4f484f034626157ca7deb2ddb418ffac99a9a6", + "revisionTime": "2019-08-29T20:26:44Z" }, { "checksumSHA1": "nv58S9hV7km2wMcP28T3Fla/7wo=",