diff --git a/.gitignore b/.gitignore index d48aebc..ac38be5 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,9 @@ *.out .vscode -vendor/*/ gin/aws-lambda-go-api-proxy-gin core/aws-lambda-go-api-proxy-core sample/main -sample/output-sam.yaml \ No newline at end of file +sample/output-sam.yaml +vendor/ +.idea/ \ No newline at end of file diff --git a/README.md b/README.md index 33437cd..82be9db 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ import ( "github.com/aws/aws-lambda-go/events" "github.com/aws/aws-lambda-go/lambda" - "github.com/awslabs/aws-lambda-go-api-proxy/gin" + "github.com/awslabs/aws-lambda-go-api-proxy/proxy" "github.com/gin-gonic/gin" ) -var ginLambda *ginadapter.GinLambda +var adapter *proxy.Adapter func init() { // stdout and stderr are sent to AWS CloudWatch Logs @@ -41,12 +41,12 @@ func init() { }) }) - ginLambda = ginadapter.New(r) + adapter = proxy.NewAdapter(r) } func Handler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { // If no name is provided in the HTTP request body, throw an error - return ginLambda.ProxyWithContext(ctx, req) + return adapter.ProxyWithContext(ctx, req) } func main() { @@ -94,19 +94,6 @@ log.Println(apiGwContext.Stage) stageVarValue := apiGwStageVars["MyStageVar"] ``` -## Supporting other frameworks -The `aws-lambda-go-api-proxy`, alongside the various adapters, declares a `core` package. The `core` package, contains utility methods and interfaces to translate API Gateway proxy events into Go's default `http.Request` and `http.ResponseWriter` objects. - -You can see that the [`ginlambda.go`](gin/adapter.go) file extends the `RequestAccessor` struct defined in the [`request.go`](core/request.go) file. `RequestAccessor` gives you access to the `ProxyEventToHTTPRequest()` method. - -The `GinLambda` object is initialized with an instance of `gin.Engine`. `gin.Engine` implements methods defined in the `http.Handler` interface. - -The `Proxy` method of the `GinLambda` object simply receives the `events.APIGatewayProxyRequest` object and uses the `ProxyEventToHTTPRequest()` method to convert it into an `http.Request` object. Next, it creates a new `ProxyResponseWriter` object (defined in the [`response.go`](core/response.go)) file and passes both request and response writer to the `ServeHTTP` method of the `gin.Engine`. - -The `ProxyResponseWriter` exports a method called `GetProxyResponse()` to generate an `events.APIGatewayProxyResponse` object from the data written to the response writer. - -Support for frameworks other than Gin can rely on the same methods from the `core` package and swap the `gin.Engine` object for the relevant framework's object. - ## License This library is licensed under the Apache 2.0 License. diff --git a/chi/adapter.go b/chi/adapter.go deleted file mode 100644 index f578a1c..0000000 --- a/chi/adapter.go +++ /dev/null @@ -1,62 +0,0 @@ -// Packge chilambda add Chi support for the aws-severless-go-api library. -// Uses the core package behind the scenes and exposes the New method to -// get a new instance and Proxy method to send request to the Chi mux. -package chiadapter - -import ( - "context" - "net/http" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/core" - "github.com/go-chi/chi" -) - -// ChiLambda makes it easy to send API Gateway proxy events to a Chi -// Mux. The library transforms the proxy event into an HTTP request and then -// creates a proxy response object from the http.ResponseWriter -type ChiLambda struct { - core.RequestAccessor - - chiMux *chi.Mux -} - -// New creates a new instance of the ChiLambda object. -// Receives an initialized *chi.Mux object - normally created with chi.NewRouter(). -// It returns the initialized instance of the ChiLambda object. -func New(chi *chi.Mux) *ChiLambda { - return &ChiLambda{chiMux: chi} -} - -// Proxy receives an API Gateway proxy event, transforms it into an http.Request -// object, and sends it to the chi.Mux for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (g *ChiLambda) Proxy(req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - chiRequest, err := g.ProxyEventToHTTPRequest(req) - return g.proxyInternal(chiRequest, err) -} - -// ProxyWithContext receives context and an API Gateway proxy event, -// transforms them into an http.Request object, and sends it to the chi.Mux for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (g *ChiLambda) ProxyWithContext(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - chiRequest, err := g.EventToRequestWithContext(ctx, req) - return g.proxyInternal(chiRequest, err) -} - -func (g *ChiLambda) proxyInternal(chiRequest *http.Request, err error) (events.APIGatewayProxyResponse, error) { - - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Could not convert proxy event to request: %v", err) - } - - respWriter := core.NewProxyResponseWriter() - g.chiMux.ServeHTTP(http.ResponseWriter(respWriter), chiRequest) - - proxyResponse, err := respWriter.GetProxyResponse() - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Error while generating proxy response: %v", err) - } - - return proxyResponse, nil -} diff --git a/chi/chi_suite_test.go b/chi/chi_suite_test.go deleted file mode 100644 index 387fab5..0000000 --- a/chi/chi_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package chiadapter_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestChi(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Chi Suite") -} diff --git a/chi/chilambda_test.go b/chi/chilambda_test.go deleted file mode 100644 index 7e6fba4..0000000 --- a/chi/chilambda_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package chiadapter_test - -import ( - "context" - "log" - "net/http" - - "github.com/aws/aws-lambda-go/events" - chiadapter "github.com/awslabs/aws-lambda-go-api-proxy/chi" - "github.com/go-chi/chi" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("ChiLambda tests", func() { - Context("Simple ping request", func() { - It("Proxies the event correctly", func() { - log.Println("Starting test") - - r := chi.NewRouter() - r.Get("/ping", func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("pong")) - }) - - adapter := chiadapter.New(r) - - req := events.APIGatewayProxyRequest{ - Path: "/ping", - HTTPMethod: "GET", - } - - resp, err := adapter.ProxyWithContext(context.Background(), req) - - Expect(err).To(BeNil()) - Expect(resp.StatusCode).To(Equal(200)) - - resp, err = adapter.Proxy(req) - Expect(err).To(BeNil()) - Expect(resp.StatusCode).To(Equal(200)) - }) - }) -}) diff --git a/core/response.go b/core/response.go index cfe925b..dc7a667 100644 --- a/core/response.go +++ b/core/response.go @@ -18,10 +18,10 @@ const contentTypeHeaderKey = "Content-Type" // ProxyResponseWriter implements http.ResponseWriter and adds the method // necessary to return an events.APIGatewayProxyResponse object type ProxyResponseWriter struct { - headers http.Header - body bytes.Buffer - status int - observers []chan <-bool + headers http.Header + body bytes.Buffer + status int + observers []chan<- bool } // NewProxyResponseWriter returns a new ProxyResponseWriter object. @@ -29,8 +29,8 @@ type ProxyResponseWriter struct { // status code of -1 func NewProxyResponseWriter() *ProxyResponseWriter { return &ProxyResponseWriter{ - headers: make(http.Header), - status: defaultStatusCode, + headers: make(http.Header), + status: defaultStatusCode, observers: make([]chan<- bool, 0), } @@ -111,7 +111,7 @@ func (r *ProxyResponseWriter) GetProxyResponse() (events.APIGatewayProxyResponse return events.APIGatewayProxyResponse{ StatusCode: r.status, - Headers: proxyHeaders, + Headers: proxyHeaders, MultiValueHeaders: http.Header(r.headers), Body: output, IsBase64Encoded: isBase64, diff --git a/echo/adapter.go b/echo/adapter.go deleted file mode 100644 index d8587e1..0000000 --- a/echo/adapter.go +++ /dev/null @@ -1,62 +0,0 @@ -// Packge echolambda add Echo support for the aws-severless-go-api library. -// Uses the core package behind the scenes and exposes the New method to -// get a new instance and Proxy method to send request to the echo.Echo -package echoadapter - -import ( - "context" - "net/http" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/core" - "github.com/labstack/echo" -) - -// EchoLambda makes it easy to send API Gateway proxy events to a echo.Echo. -// The library transforms the proxy event into an HTTP request and then -// creates a proxy response object from the http.ResponseWriter -type EchoLambda struct { - core.RequestAccessor - - Echo *echo.Echo -} - -// New creates a new instance of the EchoLambda object. -// Receives an initialized *echo.Echo object - normally created with echo.New(). -// It returns the initialized instance of the EchoLambda object. -func New(e *echo.Echo) *EchoLambda { - return &EchoLambda{Echo: e} -} - -// Proxy receives an API Gateway proxy event, transforms it into an http.Request -// object, and sends it to the echo.Echo for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (e *EchoLambda) Proxy(req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - echoRequest, err := e.ProxyEventToHTTPRequest(req) - return e.proxyInternal(echoRequest, err) -} - -// ProxyWithContext receives context and an API Gateway proxy event, -// transforms them into an http.Request object, and sends it to the echo.Echo for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (e *EchoLambda) ProxyWithContext(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - echoRequest, err := e.EventToRequestWithContext(ctx, req) - return e.proxyInternal(echoRequest, err) -} - -func (e *EchoLambda) proxyInternal(req *http.Request, err error) (events.APIGatewayProxyResponse, error) { - - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Could not convert proxy event to request: %v", err) - } - - respWriter := core.NewProxyResponseWriter() - e.Echo.ServeHTTP(http.ResponseWriter(respWriter), req) - - proxyResponse, err := respWriter.GetProxyResponse() - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Error while generating proxy response: %v", err) - } - - return proxyResponse, nil -} diff --git a/echo/echo_suite_test.go b/echo/echo_suite_test.go deleted file mode 100644 index 76efb74..0000000 --- a/echo/echo_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package echoadapter_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestEcho(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Echo Suite") -} diff --git a/echo/echolambda_test.go b/echo/echolambda_test.go deleted file mode 100644 index 1ada985..0000000 --- a/echo/echolambda_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package echoadapter_test - -import ( - "log" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/echo" - "github.com/labstack/echo" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("EchoLambda tests", func() { - Context("Simple ping request", func() { - It("Proxies the event correctly", func() { - log.Println("Starting test") - e := echo.New() - e.GET("/ping", func(c echo.Context) error { - log.Println("Handler!!") - return c.String(200, "pong") - }) - - adapter := echoadapter.New(e) - - req := events.APIGatewayProxyRequest{ - Path: "/ping", - HTTPMethod: "GET", - } - - resp, err := adapter.Proxy(req) - - Expect(err).To(BeNil()) - Expect(resp.StatusCode).To(Equal(200)) - }) - }) -}) diff --git a/gin/adapter.go b/gin/adapter.go deleted file mode 100644 index c313e64..0000000 --- a/gin/adapter.go +++ /dev/null @@ -1,62 +0,0 @@ -// Package ginadapter adds Gin support for the aws-severless-go-api library. -// Uses the core package behind the scenes and exposes the New method to -// get a new instance and Proxy method to send request to the Gin engine. -package ginadapter - -import ( - "context" - "net/http" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/core" - "github.com/gin-gonic/gin" -) - -// GinLambda makes it easy to send API Gateway proxy events to a Gin -// Engine. The library transforms the proxy event into an HTTP request and then -// creates a proxy response object from the http.ResponseWriter -type GinLambda struct { - core.RequestAccessor - - ginEngine *gin.Engine -} - -// New creates a new instance of the GinLambda object. -// Receives an initialized *gin.Engine object - normally created with gin.Default(). -// It returns the initialized instance of the GinLambda object. -func New(gin *gin.Engine) *GinLambda { - return &GinLambda{ginEngine: gin} -} - -// Proxy receives an API Gateway proxy event, transforms it into an http.Request -// object, and sends it to the gin.Engine for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (g *GinLambda) Proxy(req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - ginRequest, err := g.ProxyEventToHTTPRequest(req) - return g.proxyInternal(ginRequest, err) -} - -// ProxyWithContext receives context and an API Gateway proxy event, -// transforms them into an http.Request object, and sends it to the gin.Engine for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (g *GinLambda) ProxyWithContext(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - ginRequest, err := g.EventToRequestWithContext(ctx, req) - return g.proxyInternal(ginRequest, err) -} - -func (g *GinLambda) proxyInternal(req *http.Request, err error) (events.APIGatewayProxyResponse, error) { - - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Could not convert proxy event to request: %v", err) - } - - respWriter := core.NewProxyResponseWriter() - g.ginEngine.ServeHTTP(http.ResponseWriter(respWriter), req) - - proxyResponse, err := respWriter.GetProxyResponse() - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Error while generating proxy response: %v", err) - } - - return proxyResponse, nil -} diff --git a/gin/gin_suite_test.go b/gin/gin_suite_test.go deleted file mode 100644 index 21222f8..0000000 --- a/gin/gin_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package ginadapter_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestGin(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Gin Suite") -} diff --git a/gin/ginlambda_test.go b/gin/ginlambda_test.go deleted file mode 100644 index db90c76..0000000 --- a/gin/ginlambda_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package ginadapter_test - -import ( - "context" - "log" - - "github.com/aws/aws-lambda-go/events" - ginadapter "github.com/awslabs/aws-lambda-go-api-proxy/gin" - "github.com/gin-gonic/gin" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("GinLambda tests", func() { - Context("Simple ping request", func() { - It("Proxies the event correctly", func() { - log.Println("Starting test") - r := gin.Default() - r.GET("/ping", func(c *gin.Context) { - log.Println("Handler!!") - c.JSON(200, gin.H{ - "message": "pong", - }) - }) - - adapter := ginadapter.New(r) - - req := events.APIGatewayProxyRequest{ - Path: "/ping", - HTTPMethod: "GET", - } - - resp, err := adapter.ProxyWithContext(context.Background(), req) - - Expect(err).To(BeNil()) - Expect(resp.StatusCode).To(Equal(200)) - - resp, err = adapter.Proxy(req) - - Expect(err).To(BeNil()) - Expect(resp.StatusCode).To(Equal(200)) - }) - }) -}) diff --git a/go.mod b/go.mod index 720e5cb..a2ca635 100644 --- a/go.mod +++ b/go.mod @@ -3,53 +3,16 @@ module github.com/awslabs/aws-lambda-go-api-proxy go 1.12 require ( - github.com/Bowery/prompt v0.0.0-20190419144237-972d0ceb96f5 // indirect - github.com/BurntSushi/toml v0.3.1 // indirect - github.com/Joker/jade v1.0.0 // indirect - github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398 // indirect github.com/aws/aws-lambda-go v0.0.0-20190129190457-dcf76fe64fb6 - github.com/aymerick/raymond v2.0.2+incompatible // indirect - github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185 // indirect - github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 // indirect - github.com/fatih/structs v1.1.0 // indirect - github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4 // indirect - github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 - github.com/gin-gonic/gin v0.0.0-20180126034611-783c7ee9c14e - github.com/go-chi/chi v0.0.0-20180202194135-e223a795a06a - github.com/golang/protobuf v1.0.0 - github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf // indirect - github.com/google/uuid v0.0.0-20171129191014-dec09d789f3d - github.com/gorilla/context v1.1.1 - github.com/gorilla/mux v0.0.0-20180120075819-c0091a029979 - github.com/gorilla/schema v1.1.0 // indirect - github.com/iris-contrib/blackfriday v2.0.0+incompatible // indirect - github.com/iris-contrib/formBinder v5.0.0+incompatible // indirect - github.com/iris-contrib/go.uuid v2.0.0+incompatible // indirect - github.com/json-iterator/go v0.0.0-20180128142709-bca911dae073 - github.com/kardianos/govendor v1.0.9 // indirect - github.com/kataras/golog v0.0.0-20190624001437-99c81de45f40 // indirect - github.com/kataras/iris v11.1.1+incompatible - github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d // indirect - github.com/klauspost/compress v1.7.4 // indirect - github.com/klauspost/cpuid v1.2.1 // indirect - github.com/labstack/echo v3.3.10+incompatible - github.com/labstack/gommon v0.2.8 // indirect - github.com/mattn/go-colorable v0.1.1 // indirect - github.com/mattn/go-isatty v0.0.5 - github.com/microcosm-cc/bluemonday v1.0.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/golang/protobuf v1.0.0 // indirect + github.com/kr/pretty v0.1.0 // indirect github.com/onsi/ginkgo v0.0.0-20180119174237-747514b53ddd github.com/onsi/gomega v1.3.0 - github.com/pkg/errors v0.8.1 // indirect - github.com/ryanuber/columnize v2.1.0+incompatible // indirect - github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect - github.com/stretchr/testify v1.3.0 // indirect - github.com/ugorji/go v0.0.0-20180129160544-d2b24cf3d3b4 - github.com/urfave/negroni v0.0.0-20180130044549-22c5532ea862 - github.com/valyala/fasttemplate v1.0.1 // indirect - golang.org/x/net v0.0.0-20190311183353-d8887717615a - golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 - golang.org/x/text v0.3.0 - golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c // indirect - gopkg.in/go-playground/validator.v8 v8.18.2 - gopkg.in/yaml.v2 v2.2.2 + github.com/stretchr/testify v1.4.0 // indirect + golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect + golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect + golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 // indirect + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + gopkg.in/yaml.v2 v2.2.4 // indirect ) diff --git a/go.sum b/go.sum index 005adfc..047d759 100644 --- a/go.sum +++ b/go.sum @@ -1,126 +1,42 @@ -github.com/Bowery/prompt v0.0.0-20190419144237-972d0ceb96f5 h1:7tNlRGC3pUEPKS3DwgX5L0s+cBloaq/JBoi9ceN1MCM= -github.com/Bowery/prompt v0.0.0-20190419144237-972d0ceb96f5/go.mod h1:4/6eNcqZ09BZ9wLK3tZOjBA1nDj+B0728nlX5YRlSmQ= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Joker/hpp v0.0.0-20180418125244-6893e659854a/go.mod h1:MzD2WMdSxvbHw5fM/OXOFily/lipJWRc9C1px0Mt0ZE= -github.com/Joker/jade v1.0.0 h1:lOCEPvTAtWfLpSZYMOv/g44MGQFAolbKh2khHHGu0Kc= -github.com/Joker/jade v1.0.0/go.mod h1:efZIdO0py/LtcJRSa/j2WEklMSAw84WV0zZVMxNToB8= -github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398 h1:WDC6ySpJzbxGWFh4aMxFFC28wwGp5pEuoTtvA4q/qQ4= -github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= github.com/aws/aws-lambda-go v0.0.0-20190129190457-dcf76fe64fb6 h1:YV5tCBu1MJG2XMDkSvDohTQkZZpc2IeZMXuUFCPwE80= github.com/aws/aws-lambda-go v0.0.0-20190129190457-dcf76fe64fb6/go.mod h1:zUsUQhAUjYzR8AuduJPCfhBuKWUaDbQiPOG+ouzmE1A= -github.com/aymerick/raymond v2.0.2+incompatible h1:VEp3GpgdAnv9B2GFyTvqgcKvY+mfKMjPOA3SbKLtnU0= -github.com/aymerick/raymond v2.0.2+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= +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/dchest/safefile v0.0.0-20151022103144-855e8d98f185 h1:3T8ZyTDp5QxTx3NU48JVb2u+75xc040fofcBaN+6jPA= -github.com/dchest/safefile v0.0.0-20151022103144-855e8d98f185/go.mod h1:cFRxtTwTOJkz2x3rQUNCYKWC93yP1VKjR8NUhqFxZNU= -github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o= -github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= -github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4 h1:GY1+t5Dr9OKADM64SYnQjw/w99HMYvQ0A8/JoUkxVmc= -github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= -github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 h1:AzN37oI0cOS+cougNAV9szl6CVoj2RYwzS3DpUQNtlY= -github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= -github.com/gin-gonic/gin v0.0.0-20180126034611-783c7ee9c14e h1:5CNDPg63TSvbNi3viqFnIywPu2TqLMlWAPuFuuTrFe4= -github.com/gin-gonic/gin v0.0.0-20180126034611-783c7ee9c14e/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= -github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/go-chi/chi v0.0.0-20180202194135-e223a795a06a h1:l4yNPeA/3kNJwE0uDBVXtFX8hfiHrlqkXBLPOrchWzk= -github.com/go-chi/chi v0.0.0-20180202194135-e223a795a06a/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.0.0 h1:lsek0oXi8iFE9L+EXARyHIjU5rlWIhhTkjDz3vHhWWQ= github.com/golang/protobuf v1.0.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf h1:7+FW5aGwISbqUtkfmIpZJGRgNFg2ioYPvFaUxdqpDsg= -github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= -github.com/google/uuid v0.0.0-20171129191014-dec09d789f3d/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v0.0.0-20180120075819-c0091a029979 h1:UsXWMy9j+GSCN/I1/Oyc4wGaeW2CDYqeqAkEvWPu+cs= -github.com/gorilla/mux v0.0.0-20180120075819-c0091a029979/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/schema v1.1.0 h1:CamqUDOFUBqzrvxuz2vEwo8+SUdwsluFh7IlzJh30LY= -github.com/gorilla/schema v1.1.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= -github.com/iris-contrib/blackfriday v2.0.0+incompatible h1:o5sHQHHm0ToHUlAJSTjW9UWicjJSDDauOOQ2AHuIVp4= -github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= -github.com/iris-contrib/formBinder v5.0.0+incompatible h1:jL+H+cCSEV8yzLwVbBI+tLRN/PpVatZtUZGK9ldi3bU= -github.com/iris-contrib/formBinder v5.0.0+incompatible/go.mod h1:i8kTYUOEstd/S8TG0ChTXQdf4ermA/e8vJX0+QruD9w= -github.com/iris-contrib/go.uuid v2.0.0+incompatible h1:XZubAYg61/JwnJNbZilGjf3b3pB80+OQg2qf6c8BfWE= -github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= -github.com/json-iterator/go v0.0.0-20180128142709-bca911dae073 h1:GAEb5ZL9Cd0a56kaWwoFD8ln4/1YUptTOyTiieM/7OE= -github.com/json-iterator/go v0.0.0-20180128142709-bca911dae073/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5 h1:rhqTjzJlm7EbkELJDKMTU7udov+Se0xZkWmugr6zGok= -github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= -github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= -github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= -github.com/kardianos/govendor v1.0.9 h1:WOH3FcVI9eOgnIZYg96iwUwrL4eOVx+aQ66oyX2R8Yc= -github.com/kardianos/govendor v1.0.9/go.mod h1:yvmR6q9ZZ7nSF5Wvh40v0wfP+3TwwL8zYQp+itoZSVM= -github.com/kataras/golog v0.0.0-20190624001437-99c81de45f40 h1:Q/QxpyNBtfkhXE68tnEA4yyqm77eh/3YOjOw875VbBY= -github.com/kataras/golog v0.0.0-20190624001437-99c81de45f40/go.mod h1:PcaEvfvhGsqwXZ6S3CgCbmjcp+4UDUh2MIfF2ZEul8M= -github.com/kataras/iris v11.1.1+incompatible h1:c2iRKvKLpTYMXKdVB8YP/+A67NtZFt9kFFy+ZwBhWD0= -github.com/kataras/iris v11.1.1+incompatible/go.mod h1:ki9XPua5SyAJbIxDdsssxevgGrbpBmmvoQmo/A0IodY= -github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d h1:V5Rs9ztEWdp58oayPq/ulmlqJJZeJP6pP79uP3qjcao= -github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0= -github.com/klauspost/compress v1.7.4 h1:4UqAIzZ1Ns2epCTyJ1d2xMWvxtX+FNSCYWeOFogK9nc= -github.com/klauspost/compress v1.7.4/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w= -github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg= -github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= -github.com/labstack/gommon v0.2.8 h1:JvRqmeZcfrHC5u6uVleB4NxxNbzx6gpbJiQknDbKQu0= -github.com/labstack/gommon v0.2.8/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4= -github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= -github.com/microcosm-cc/bluemonday v1.0.2 h1:5lPfLTTAvAbtS0VqT+94yOtFnGfUWYyx0+iToC3Os3s= -github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/onsi/ginkgo v0.0.0-20180119174237-747514b53ddd h1:b2wg8HW/u55DT7Y/vamdEn/jdvtsGkxzl+0+iHa5YmE= github.com/onsi/ginkgo v0.0.0-20180119174237-747514b53ddd/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.3.0 h1:yPHEatyQC4jN3vdfvqJXG7O9vfC6LhaAV1NEdYpP+h0= github.com/onsi/gomega v1.3.0/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +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/ryanuber/columnize v2.1.0+incompatible h1:j1Wcmh8OrK4Q7GXY+V7SVSY8nUWQxHW5TkBe7YUl+2s= -github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/ugorji/go v0.0.0-20180129160544-d2b24cf3d3b4 h1:euf5tLM++W5h5uyfs6NSMoCGGhw+hRXMLE/DU6hireM= -github.com/ugorji/go v0.0.0-20180129160544-d2b24cf3d3b4/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= -github.com/urfave/negroni v0.0.0-20180130044549-22c5532ea862 h1:eg5xqGZGatsyRpVnFJkdeUWSFk46lDgkXLvOryv5ySg= -github.com/urfave/negroni v0.0.0-20180130044549-22c5532ea862/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= -github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20180124060956-0ed95abb35c4/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180126165840-ff2a66f350ce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.0.0-20171227012246-e19ae1496984/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c h1:97SnQk1GYRXJgvwZ8fadnxDOWfKvkNQHH3CtZntPSrM= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ= -gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= -gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/yaml.v2 v2.0.0 h1:uUkhRGrsEyx/laRdeS6YIQKIys8pg+lRSRdVMTYjivs= -gopkg.in/yaml.v2 v2.0.0/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/gorillamux/adapter.go b/gorillamux/adapter.go deleted file mode 100644 index 33baf6a..0000000 --- a/gorillamux/adapter.go +++ /dev/null @@ -1,53 +0,0 @@ -package gorillamux - -import ( - "context" - "net/http" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/core" - "github.com/gorilla/mux" -) - -type GorillaMuxAdapter struct { - core.RequestAccessor - router *mux.Router -} - -func New(router *mux.Router) *GorillaMuxAdapter { - return &GorillaMuxAdapter{ - router: router, - } -} - -// Proxy receives an API Gateway proxy event, transforms it into an http.Request -// object, and sends it to the mux.Router for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (h *GorillaMuxAdapter) Proxy(event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - req, err := h.ProxyEventToHTTPRequest(event) - return h.proxyInternal(req, err) -} - -// ProxyWithContext receives context and an API Gateway proxy event, -// transforms them into an http.Request object, and sends it to the mux.Router for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (h *GorillaMuxAdapter) ProxyWithContext(ctx context.Context, event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - req, err := h.EventToRequestWithContext(ctx, event) - return h.proxyInternal(req, err) -} - -func (h *GorillaMuxAdapter) proxyInternal(req *http.Request, err error) (events.APIGatewayProxyResponse, error) { - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Could not convert proxy event to request: %v", err) - } - - w := core.NewProxyResponseWriter() - h.router.ServeHTTP(http.ResponseWriter(w), req) - - resp, err := w.GetProxyResponse() - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Error while generating proxy response: %v", err) - } - - return resp, nil -} diff --git a/gorillamux/adapter_test.go b/gorillamux/adapter_test.go deleted file mode 100644 index fbc9a63..0000000 --- a/gorillamux/adapter_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package gorillamux_test - -import ( - "context" - "fmt" - "net/http" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/gorillamux" - "github.com/gorilla/mux" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("GorillaMuxAdapter tests", func() { - Context("Simple ping request", func() { - It("Proxies the event correctly", func() { - homeHandler := func(w http.ResponseWriter, req *http.Request) { - w.Header().Add("unfortunately-required-header", "") - fmt.Fprintf(w, "Home Page") - } - - productsHandler := func(w http.ResponseWriter, req *http.Request) { - w.Header().Add("unfortunately-required-header", "") - fmt.Fprintf(w, "Products Page") - } - - r := mux.NewRouter() - r.HandleFunc("/", homeHandler) - r.HandleFunc("/products", productsHandler) - - adapter := gorillamux.New(r) - - homePageReq := events.APIGatewayProxyRequest{ - Path: "/", - HTTPMethod: "GET", - } - - homePageResp, homePageReqErr := adapter.ProxyWithContext(context.Background(), homePageReq) - - Expect(homePageReqErr).To(BeNil()) - Expect(homePageResp.StatusCode).To(Equal(200)) - Expect(homePageResp.Body).To(Equal("Home Page")) - - productsPageReq := events.APIGatewayProxyRequest{ - Path: "/products", - HTTPMethod: "GET", - } - - productsPageResp, productsPageReqErr := adapter.Proxy(productsPageReq) - - Expect(productsPageReqErr).To(BeNil()) - Expect(productsPageResp.StatusCode).To(Equal(200)) - Expect(productsPageResp.Body).To(Equal("Products Page")) - }) - }) -}) diff --git a/gorillamux/gorilla_suite_test.go b/gorillamux/gorilla_suite_test.go deleted file mode 100644 index 8b996a3..0000000 --- a/gorillamux/gorilla_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package gorillamux_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestGorillaMux(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Gorilla Mux Suite") -} diff --git a/handlerfunc/adapter.go b/handlerfunc/adapter.go deleted file mode 100644 index f4d1eaa..0000000 --- a/handlerfunc/adapter.go +++ /dev/null @@ -1,52 +0,0 @@ -package handlerfunc - -import ( - "context" - "net/http" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/core" -) - -type HandlerFuncAdapter struct { - core.RequestAccessor - handlerFunc http.HandlerFunc -} - -func New(handlerFunc http.HandlerFunc) *HandlerFuncAdapter { - return &HandlerFuncAdapter{ - handlerFunc: handlerFunc, - } -} - -// Proxy receives an API Gateway proxy event, transforms it into an http.Request -// object, and sends it to the http.HandlerFunc for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (h *HandlerFuncAdapter) Proxy(event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - req, err := h.ProxyEventToHTTPRequest(event) - return h.proxyInternal(req, err) -} - -// ProxyWithContext receives context and an API Gateway proxy event, -// transforms them into an http.Request object, and sends it to the http.HandlerFunc for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (h *HandlerFuncAdapter) ProxyWithContext(ctx context.Context, event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - req, err := h.EventToRequestWithContext(ctx, event) - return h.proxyInternal(req, err) -} - -func (h *HandlerFuncAdapter) proxyInternal(req *http.Request, err error) (events.APIGatewayProxyResponse, error) { - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Could not convert proxy event to request: %v", err) - } - - w := core.NewProxyResponseWriter() - h.handlerFunc.ServeHTTP(http.ResponseWriter(w), req) - - resp, err := w.GetProxyResponse() - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Error while generating proxy response: %v", err) - } - - return resp, nil -} diff --git a/handlerfunc/adapter_test.go b/handlerfunc/adapter_test.go deleted file mode 100644 index 15cca0d..0000000 --- a/handlerfunc/adapter_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package handlerfunc_test - -import ( - "context" - "fmt" - "log" - "net/http" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/handlerfunc" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("HandlerFuncAdapter tests", func() { - Context("Simple ping request", func() { - It("Proxies the event correctly", func() { - log.Println("Starting test") - - handler := func(w http.ResponseWriter, req *http.Request) { - w.Header().Add("unfortunately-required-header", "") - fmt.Fprintf(w, "Go Lambda!!") - } - - adapter := handlerfunc.New(handler) - - req := events.APIGatewayProxyRequest{ - Path: "/ping", - HTTPMethod: "GET", - } - - resp, err := adapter.ProxyWithContext(context.Background(), req) - - Expect(err).To(BeNil()) - Expect(resp.StatusCode).To(Equal(200)) - - resp, err = adapter.Proxy(req) - - Expect(err).To(BeNil()) - Expect(resp.StatusCode).To(Equal(200)) - }) - }) -}) diff --git a/handlerfunc/handlerfunc_suite_test.go b/handlerfunc/handlerfunc_suite_test.go deleted file mode 100644 index 84f0fe5..0000000 --- a/handlerfunc/handlerfunc_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package handlerfunc_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestHandlerFunc(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "HandlerFuncAdapter Suite") -} diff --git a/iris/adapter.go b/iris/adapter.go deleted file mode 100644 index 4ce84fc..0000000 --- a/iris/adapter.go +++ /dev/null @@ -1,65 +0,0 @@ -// Package irisLambda add Iris support for the aws-serverless-go-api library. -// Uses the core package behind the scenes and exposes the New method to -// get a new instance and Proxy method to send request to the iris.Application. -package irisadapter - -import ( - "context" - "net/http" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/core" - "github.com/kataras/iris" -) - -// IrisLambda makes it easy to send API Gateway proxy events to a iris.Application. -// The library transforms the proxy event into an HTTP request and then -// creates a proxy response object from the http.ResponseWriter -type IrisLambda struct { - core.RequestAccessor - - application *iris.Application -} - -// New creates a new instance of the IrisLambda object. -// Receives an initialized *iris.Application object - normally created with iris.Default(). -// It returns the initialized instance of the IrisLambda object. -func New(app *iris.Application) *IrisLambda { - return &IrisLambda{application: app} -} - -// Proxy receives an API Gateway proxy event, transforms it into an http.Request -// object, and sends it to the iris.Application for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (i *IrisLambda) Proxy(req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - irisRequest, err := i.ProxyEventToHTTPRequest(req) - return i.proxyInternal(irisRequest, err) -} - -// ProxyWithContext receives context and an API Gateway proxy event, -// transforms them into an http.Request object, and sends it to the iris.Application for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (i *IrisLambda) ProxyWithContext(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - irisRequest, err := i.EventToRequestWithContext(ctx, req) - return i.proxyInternal(irisRequest, err) -} - -func (i *IrisLambda) proxyInternal(req *http.Request, err error) (events.APIGatewayProxyResponse, error) { - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Could not convert proxy event to request: %v", err) - } - - if err := i.application.Build(); err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Iris set up failed: %v", err) - } - - respWriter := core.NewProxyResponseWriter() - i.application.ServeHTTP(http.ResponseWriter(respWriter), req) - - proxyResponse, err := respWriter.GetProxyResponse() - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Error while generating proxy response: %v", err) - } - - return proxyResponse, nil -} diff --git a/iris/iris_suite_test.go b/iris/iris_suite_test.go deleted file mode 100644 index eceb6f1..0000000 --- a/iris/iris_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package irisadapter_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestEcho(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "Iris Suite") -} diff --git a/iris/irislambda_test.go b/iris/irislambda_test.go deleted file mode 100644 index 7abc086..0000000 --- a/iris/irislambda_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package irisadapter_test - -import ( - "context" - "log" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/iris" - "github.com/kataras/iris" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("IrisLambda tests", func() { - Context("Simple ping request", func() { - It("Proxies the event correctly", func() { - log.Println("Starting test") - - app := iris.Default() - app.Get("/ping", func(ctx iris.Context) { - log.Println("Handler!!") - ctx.WriteString("pong") - }) - - adapter := irisadapter.New(app) - - req := events.APIGatewayProxyRequest{ - Path: "/ping", - HTTPMethod: "GET", - } - - resp, err := adapter.ProxyWithContext(context.Background(), req) - - Expect(err).To(BeNil()) - Expect(resp.StatusCode).To(Equal(200)) - - resp, err = adapter.Proxy(req) - - Expect(err).To(BeNil()) - Expect(resp.StatusCode).To(Equal(200)) - }) - }) -}) diff --git a/negroni/adapter.go b/negroni/adapter.go deleted file mode 100644 index ecafdaf..0000000 --- a/negroni/adapter.go +++ /dev/null @@ -1,53 +0,0 @@ -package negroniadapter - -import ( - "context" - "net/http" - - "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/core" - "github.com/urfave/negroni" -) - -type NegroniAdapter struct { - core.RequestAccessor - n *negroni.Negroni -} - -func New(n *negroni.Negroni) *NegroniAdapter { - return &NegroniAdapter{ - n: n, - } -} - -// Proxy receives an API Gateway proxy event, transforms it into an http.Request -// object, and sends it to the negroni.Negroni for routing. -// It returns a proxy response object generated from the http.Handler. -func (h *NegroniAdapter) Proxy(event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - req, err := h.ProxyEventToHTTPRequest(event) - return h.proxyInternal(req, err) -} - -// ProxyWithContext receives context and an API Gateway proxy event, -// transforms them into an http.Request object, and sends it to the negroni.Negroni for routing. -// It returns a proxy response object generated from the http.ResponseWriter. -func (h *NegroniAdapter) ProxyWithContext(ctx context.Context, event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - req, err := h.EventToRequestWithContext(ctx, event) - return h.proxyInternal(req, err) -} - -func (h *NegroniAdapter) proxyInternal(req *http.Request, err error) (events.APIGatewayProxyResponse, error) { - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Could not convert proxy event to request: %v", err) - } - - w := core.NewProxyResponseWriter() - h.n.ServeHTTP(http.ResponseWriter(w), req) - - resp, err := w.GetProxyResponse() - if err != nil { - return core.GatewayTimeout(), core.NewLoggedError("Error while generating proxy response: %v", err) - } - - return resp, nil -} diff --git a/negroni/adapter_test.go b/negroni/adapter_test.go deleted file mode 100644 index b1a8df4..0000000 --- a/negroni/adapter_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package negroniadapter_test - -import ( - "context" - "fmt" - "log" - "net/http" - - "github.com/aws/aws-lambda-go/events" - negroniadapter "github.com/awslabs/aws-lambda-go-api-proxy/negroni" - "github.com/urfave/negroni" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("NegroniAdapter tests", func() { - Context("Tests multiple handlers", func() { - It("Proxies the event correctly", func() { - log.Println("Starting test") - - homeHandler := func(w http.ResponseWriter, req *http.Request) { - w.Header().Add("unfortunately-required-header", "") - fmt.Fprintf(w, "Home Page") - } - - productsHandler := func(w http.ResponseWriter, req *http.Request) { - w.Header().Add("unfortunately-required-header", "") - fmt.Fprintf(w, "Products Page") - } - - mux := http.NewServeMux() - mux.HandleFunc("/", homeHandler) - mux.HandleFunc("/products", productsHandler) - - n := negroni.New() - n.UseHandler(mux) - - adapter := negroniadapter.New(n) - - homePageReq := events.APIGatewayProxyRequest{ - Path: "/", - HTTPMethod: "GET", - } - - homePageResp, homePageReqErr := adapter.ProxyWithContext(context.Background(), homePageReq) - - Expect(homePageReqErr).To(BeNil()) - Expect(homePageResp.StatusCode).To(Equal(200)) - Expect(homePageResp.Body).To(Equal("Home Page")) - - productsPageReq := events.APIGatewayProxyRequest{ - Path: "/products", - HTTPMethod: "GET", - } - - productsPageResp, productsPageReqErr := adapter.Proxy(productsPageReq) - - Expect(productsPageReqErr).To(BeNil()) - Expect(productsPageResp.StatusCode).To(Equal(200)) - Expect(productsPageResp.Body).To(Equal("Products Page")) - }) - }) -}) diff --git a/negroni/negroni_suite_test.go b/negroni/negroni_suite_test.go deleted file mode 100644 index 2afee57..0000000 --- a/negroni/negroni_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package negroniadapter_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestNegroni(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "NegroniAdapter Suite") -} diff --git a/httpadapter/adapter.go b/proxy/adapter.go similarity index 67% rename from httpadapter/adapter.go rename to proxy/adapter.go index e27e827..e5358ed 100644 --- a/httpadapter/adapter.go +++ b/proxy/adapter.go @@ -1,4 +1,4 @@ -package httpadapter +package proxy import ( "context" @@ -8,21 +8,21 @@ import ( "github.com/awslabs/aws-lambda-go-api-proxy/core" ) -type HandlerAdapter struct { +type Adapter struct { core.RequestAccessor handler http.Handler } -func New(handler http.Handler) *HandlerAdapter { - return &HandlerAdapter{ +func NewAdapter(handler http.Handler) *Adapter { + return &Adapter{ handler: handler, } } // Proxy receives an API Gateway proxy event, transforms it into an http.Request -// object, and sends it to the http.HandlerFunc for routing. +// object, and sends it to the http.Handler for routing. // It returns a proxy response object generated from the http.Handler. -func (h *HandlerAdapter) Proxy(event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { +func (h *Adapter) Proxy(event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { req, err := h.ProxyEventToHTTPRequest(event) return h.proxyInternal(req, err) } @@ -30,12 +30,12 @@ func (h *HandlerAdapter) Proxy(event events.APIGatewayProxyRequest) (events.APIG // ProxyWithContext receives context and an API Gateway proxy event, // transforms them into an http.Request object, and sends it to the http.Handler for routing. // It returns a proxy response object generated from the http.ResponseWriter. -func (h *HandlerAdapter) ProxyWithContext(ctx context.Context, event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { +func (h *Adapter) ProxyWithContext(ctx context.Context, event events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { req, err := h.EventToRequestWithContext(ctx, event) return h.proxyInternal(req, err) } -func (h *HandlerAdapter) proxyInternal(req *http.Request, err error) (events.APIGatewayProxyResponse, error) { +func (h *Adapter) proxyInternal(req *http.Request, err error) (events.APIGatewayProxyResponse, error) { if err != nil { return core.GatewayTimeout(), core.NewLoggedError("Could not convert proxy event to request: %v", err) } diff --git a/httpadapter/adapter_test.go b/proxy/adapter_test.go similarity index 89% rename from httpadapter/adapter_test.go rename to proxy/adapter_test.go index 4aa3f3f..62083be 100644 --- a/httpadapter/adapter_test.go +++ b/proxy/adapter_test.go @@ -1,4 +1,4 @@ -package httpadapter_test +package proxy_test import ( "context" @@ -7,7 +7,7 @@ import ( "net/http" "github.com/aws/aws-lambda-go/events" - "github.com/awslabs/aws-lambda-go-api-proxy/httpadapter" + "github.com/awslabs/aws-lambda-go-api-proxy/proxy" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -30,7 +30,7 @@ var _ = Describe("HTTPAdapter tests", func() { fmt.Fprintf(w, "Go Lambda!!") }) - adapter := httpadapter.New(httpHandler) + adapter := proxy.NewAdapter(httpHandler) req := events.APIGatewayProxyRequest{ Path: "/ping", diff --git a/httpadapter/handlerfunc_suite_test.go b/proxy/handlerfunc_suite_test.go similarity index 87% rename from httpadapter/handlerfunc_suite_test.go rename to proxy/handlerfunc_suite_test.go index b9723ef..368e694 100644 --- a/httpadapter/handlerfunc_suite_test.go +++ b/proxy/handlerfunc_suite_test.go @@ -1,4 +1,4 @@ -package httpadapter_test +package proxy_test import ( "testing" diff --git a/sample/go.mod b/sample/go.mod index 4d6ca95..4930b32 100644 --- a/sample/go.mod +++ b/sample/go.mod @@ -4,13 +4,15 @@ go 1.12 require ( github.com/aws/aws-lambda-go v1.10.0 - github.com/awslabs/aws-lambda-go-api-proxy v0.3.0 github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 // indirect github.com/gin-gonic/gin v1.3.0 github.com/golang/protobuf v1.3.1 // indirect github.com/google/uuid v1.1.1 + github.com/json-iterator/go v1.1.9 // indirect github.com/mattn/go-isatty v0.0.7 // indirect + github.com/stretchr/testify v1.5.1 // indirect github.com/ugorji/go v1.1.4 // indirect + golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 // indirect + gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/go-playground/validator.v8 v8.18.2 // indirect - gopkg.in/yaml.v2 v2.2.2 // indirect ) diff --git a/sample/go.sum b/sample/go.sum index f502949..d78fea0 100644 --- a/sample/go.sum +++ b/sample/go.sum @@ -1,22 +1,47 @@ github.com/aws/aws-lambda-go v1.10.0 h1:uafgdfYGQD0UeT7d2uKdyWW8j/ZYRifRPIdmeqLzLCk= github.com/aws/aws-lambda-go v1.10.0/go.mod h1:zUsUQhAUjYzR8AuduJPCfhBuKWUaDbQiPOG+ouzmE1A= -github.com/awslabs/aws-lambda-go-api-proxy v0.3.0 h1:HHYn0RgPacnBqdljaJlwG9rWivKn4GqPLYEDXo4Dba4= -github.com/awslabs/aws-lambda-go-api-proxy v0.3.0/go.mod h1:1WYCl0lFZD+KAqdW+usdz46oShDhOEj3uTw09Qv++28= +github.com/awslabs/aws-lambda-go-api-proxy v0.6.0 h1:wbMkrj4dxSlW9BZ03mKip95YEodNcLGbZuP/ArG6+Ec= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 h1:t8FVkw33L+wilf2QiWkw0UV77qRpcH/JHPKGpKa2E8g= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-gonic/gin v1.3.0 h1:kCmZyPklC0gVdL728E6Aj20uYBJV93nj/TkwBTKhFbs= github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +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/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 h1:WQ8q63x+f/zpC8Ac1s9wLElVoHhm32p6tudrU72n1QA= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= diff --git a/sample/main.go b/sample/main.go index 527b0e5..28c9036 100644 --- a/sample/main.go +++ b/sample/main.go @@ -8,27 +8,25 @@ import ( "github.com/aws/aws-lambda-go/events" "github.com/aws/aws-lambda-go/lambda" - ginadapter "github.com/awslabs/aws-lambda-go-api-proxy/gin" + "github.com/awslabs/aws-lambda-go-api-proxy/proxy" "github.com/gin-gonic/gin" ) -var ginLambda *ginadapter.GinLambda - +var adapter *proxy.Adapter // Handler is the main entry point for Lambda. Receives a proxy request and // returns a proxy response func Handler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { - if ginLambda == nil { + if adapter == nil { // stdout and stderr are sent to AWS CloudWatch Logs log.Printf("Gin cold start") - r := gin.Default() - r.GET("/pets", getPets) - r.GET("/pets/:id", getPet) - r.POST("/pets", createPet) - - ginLambda = ginadapter.New(r) + ginLambda := gin.Default() + ginLambda.GET("/pets", getPets) + ginLambda.GET("/pets/:id", getPet) + ginLambda.POST("/pets", createPet) + adapter = proxy.NewAdapter(ginLambda) } - return ginLambda.ProxyWithContext(ctx, req) + return adapter.ProxyWithContext(ctx, req) } func main() { diff --git a/vendor/vendor.json b/vendor/vendor.json deleted file mode 100644 index 9faf123..0000000 --- a/vendor/vendor.json +++ /dev/null @@ -1,427 +0,0 @@ -{ - "comment": "", - "ignore": "test", - "package": [ - { - "checksumSHA1": "60T22joBzjxNa8yKzW0V4egimZI=", - "path": "github.com/aws/aws-lambda-go/events", - "revision": "dcf76fe64fb68bc66dd3522c904ccf5ff1b2710a", - "revisionTime": "2019-01-29T19:04:57Z" - }, - { - "checksumSHA1": "trfV9u2UzDAypLfWLdFApLNWj0k=", - "path": "github.com/aws/aws-lambda-go/lambda", - "revision": "dcf76fe64fb68bc66dd3522c904ccf5ff1b2710a", - "revisionTime": "2019-01-29T19:04:57Z" - }, - { - "checksumSHA1": "R5cnUZPkb0MPZnK822yvu4qlTXQ=", - "path": "github.com/aws/aws-lambda-go/lambda/handlertrace", - "revision": "dcf76fe64fb68bc66dd3522c904ccf5ff1b2710a", - "revisionTime": "2019-01-29T19:04:57Z" - }, - { - "checksumSHA1": "d4ehJWLS4YsqFG825pgwdvKDB6A=", - "path": "github.com/aws/aws-lambda-go/lambda/messages", - "revision": "dcf76fe64fb68bc66dd3522c904ccf5ff1b2710a", - "revisionTime": "2019-01-29T19:04:57Z" - }, - { - "checksumSHA1": "f9MhOwQHveaPVWO6trwfqHa+W0M=", - "path": "github.com/aws/aws-lambda-go/lambdacontext", - "revision": "dcf76fe64fb68bc66dd3522c904ccf5ff1b2710a", - "revisionTime": "2019-01-29T19:04:57Z" - }, - { - "checksumSHA1": "QeKwBtN2df+j+4stw3bQJ6yO4EY=", - "path": "github.com/gin-contrib/sse", - "revision": "22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae", - "revisionTime": "2017-01-09T09:34:21Z" - }, - { - "checksumSHA1": "s/jI3M5ZfkOD6WMFzZc1ndVPGNw=", - "path": "github.com/gin-gonic/gin", - "revision": "783c7ee9c14eac0e65b501664b4f553291556b43", - "revisionTime": "2018-01-26T03:46:11Z" - }, - { - "checksumSHA1": "3Ttl4CxOEl+NCstutCFyECv0CWs=", - "path": "github.com/gin-gonic/gin/binding", - "revision": "783c7ee9c14eac0e65b501664b4f553291556b43", - "revisionTime": "2018-01-26T03:46:11Z" - }, - { - "checksumSHA1": "woO1qIxIeQ1bcbPSiMfAKk3r4xg=", - "path": "github.com/gin-gonic/gin/json", - "revision": "783c7ee9c14eac0e65b501664b4f553291556b43", - "revisionTime": "2018-01-26T03:46:11Z" - }, - { - "checksumSHA1": "O+2Q4Uc9Vidvc/ctORliL315ZVI=", - "path": "github.com/gin-gonic/gin/render", - "revision": "783c7ee9c14eac0e65b501664b4f553291556b43", - "revisionTime": "2018-01-26T03:46:11Z" - }, - { - "checksumSHA1": "YODbzvhUr0Tzp2/MkXflXph2hdY=", - "path": "github.com/go-chi/chi", - "revision": "e223a795a06a5598451cf022558c17c779f5a7ab", - "revisionTime": "2018-02-02T19:41:35Z" - }, - { - "checksumSHA1": "WX1+2gktHcBmE9MGwFSGs7oqexU=", - "path": "github.com/golang/protobuf/proto", - "revision": "925541529c1fa6821df4e44ce2723319eb2be768", - "revisionTime": "2018-01-25T21:43:03Z" - }, - { - "checksumSHA1": "uFNLkTxk8BkHTk0Jcub2lj2BX4M=", - "path": "github.com/google/uuid", - "revision": "dec09d789f3dba190787f8b4454c7d3c936fed9e", - "revisionTime": "2017-11-29T19:10:14Z" - }, - { - "checksumSHA1": "g/V4qrXjUGG9B+e3hB+4NAYJ5Gs=", - "path": "github.com/gorilla/context", - "revision": "08b5f424b9271eedf6f9f0ce86cb9396ed337a42", - "revisionTime": "2016-08-17T18:46:32Z" - }, - { - "checksumSHA1": "gzYAE/UJ+G7yTqkdJAMActxDdxw=", - "path": "github.com/gorilla/mux", - "revision": "c0091a029979286890368b4c7b301261e448e242", - "revisionTime": "2018-01-20T07:58:19Z" - }, - { - "checksumSHA1": "6L/3XPIhlmbIX4AMgW8UnguuyWo=", - "path": "github.com/json-iterator/go", - "revision": "bca911dae0735b8220ddb30236e11cff9d959f19", - "revisionTime": "2018-01-28T14:27:09Z" - }, - { - "checksumSHA1": "w5RcOnfv5YDr3j2bd1YydkPiZx4=", - "path": "github.com/mattn/go-isatty", - "revision": "6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c", - "revisionTime": "2017-11-07T05:05:31Z" - }, - { - "checksumSHA1": "cwbidLG1ET7YSqlwca+nSfYxIbg=", - "path": "github.com/onsi/ginkgo", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "Tarhbqac6rFsGPugPoQ4lyhfc7Q=", - "path": "github.com/onsi/ginkgo/config", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "T1cZh3UWr4Hnx6fQYp+7KDNvxG4=", - "path": "github.com/onsi/ginkgo/internal/codelocation", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "qvz6/+otRkWa1OHaPMKap9D5Ge4=", - "path": "github.com/onsi/ginkgo/internal/containernode", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "882oWW4FC4Nrd8mrMptsDJSTDds=", - "path": "github.com/onsi/ginkgo/internal/failer", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "IbQFETl8AqMhJ74XP+us5Xk3dS8=", - "path": "github.com/onsi/ginkgo/internal/leafnodes", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "Z9mfsBI9VL7QqwY+doKRhumHIh4=", - "path": "github.com/onsi/ginkgo/internal/remote", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "gD1kOPw9EeDfTNvNqBvYu/qnP1k=", - "path": "github.com/onsi/ginkgo/internal/spec", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "14UQiFkhUmN5vTG+pNApv5OYgoU=", - "path": "github.com/onsi/ginkgo/internal/spec_iterator", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "pDxDXIJ3QPm5UMnzQ+3GedK8WjQ=", - "path": "github.com/onsi/ginkgo/internal/specrunner", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "QZ9ekcsrGBcXz4Tv+L7kXAUfqq8=", - "path": "github.com/onsi/ginkgo/internal/suite", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "TUBH2aNaARtAZ5vz51xMFRsOOo0=", - "path": "github.com/onsi/ginkgo/internal/testingtproxy", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "BB83CfNg6jFoFNMuXFL+f4EOFpw=", - "path": "github.com/onsi/ginkgo/internal/writer", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "m6/gIgdQGdETzUN3JWhAmFNIuNI=", - "path": "github.com/onsi/ginkgo/reporters", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "hdfc3dPx9Jw8v+sd7TEDlboJ1Nc=", - "path": "github.com/onsi/ginkgo/reporters/stenographer", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "QeB8m9WhRUiL0YKj3n5L0t4mLCg=", - "path": "github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "s5EyiKpqSdkyyIUMb226mZc6/Uo=", - "path": "github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "kuzrRJpxmnbuG7VVDIfDcLIRKLU=", - "path": "github.com/onsi/ginkgo/types", - "revision": "747514b53ddd06d5d37d096c1cb313cfe620d7d4", - "revisionTime": "2018-01-19T17:42:37Z" - }, - { - "checksumSHA1": "ZVuYR0BGkdoGGghH6War3Z9FNh8=", - "path": "github.com/onsi/gomega", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "W/l0TJN86WNCAZPm1MPSlqxxWYM=", - "path": "github.com/onsi/gomega/format", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "H4RBR9kcEWh2lECAzBaOTSvgUuA=", - "path": "github.com/onsi/gomega/internal/assertion", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "N7HhJzMN+STfzI315keM9SxFQAE=", - "path": "github.com/onsi/gomega/internal/asyncassertion", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "EsgeBqN2S5wj8aWvGsS162ZK7xI=", - "path": "github.com/onsi/gomega/internal/oraclematcher", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "M2WqXho4fZaeYkyfuiGTlPhcU8I=", - "path": "github.com/onsi/gomega/internal/testingtsupport", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "D7QESRc8hYaX8wHT0ftzvNTMwuk=", - "path": "github.com/onsi/gomega/matchers", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "NMjCfnHie2dgQw0kCObrHRc8S50=", - "path": "github.com/onsi/gomega/matchers/support/goraph/bipartitegraph", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "zjTC6ady0bJUwzTFAKtv63T7Fmg=", - "path": "github.com/onsi/gomega/matchers/support/goraph/edge", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "o2+IscLOPKOiovl2g0/igkD1R4Q=", - "path": "github.com/onsi/gomega/matchers/support/goraph/node", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "yEF1BYQPwS3neYFKiqNQReqnadY=", - "path": "github.com/onsi/gomega/matchers/support/goraph/util", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "2Tp37T34lRvZKYpTE6+dUl7GVS4=", - "path": "github.com/onsi/gomega/types", - "revision": "003f63b7f4cff3fc95357005358af2de0f5fe152", - "revisionTime": "2018-01-05T22:13:10Z" - }, - { - "checksumSHA1": "IraMqoP97RLnA9sNw4Kw/g1oJrA=", - "path": "github.com/ugorji/go/codec", - "revision": "d2b24cf3d3b4fe77f5ca411be71afb460ce4c92d", - "revisionTime": "2018-01-29T16:05:44Z" - }, - { - "checksumSHA1": "wWhBVw5JhTUIbBstf20hucDfY/o=", - "path": "github.com/urfave/negroni", - "revision": "22c5532ea862c34fdad414e90f8cc00b4f6f4cab", - "revisionTime": "2018-01-30T04:45:49Z" - }, - { - "checksumSHA1": "ag6CP2CjfMRiJxDuBDVKytu5sR8=", - "path": "golang.org/x/net/html", - "revision": "0ed95abb35c445290478a5348a7b38bb154135fd", - "revisionTime": "2018-01-24T06:08:02Z" - }, - { - "checksumSHA1": "uMRr2bnIJS+9Xm0FqMBYUTzaSGs=", - "path": "golang.org/x/net/html/atom", - "revision": "0ed95abb35c445290478a5348a7b38bb154135fd", - "revisionTime": "2018-01-24T06:08:02Z" - }, - { - "checksumSHA1": "barUU39reQ7LdgYLA323hQ/UGy4=", - "path": "golang.org/x/net/html/charset", - "revision": "0ed95abb35c445290478a5348a7b38bb154135fd", - "revisionTime": "2018-01-24T06:08:02Z" - }, - { - "checksumSHA1": "b/GxJlD7Iy7nvtGdwpKTnsFMY3s=", - "path": "golang.org/x/sys/unix", - "revision": "ff2a66f350cefa5c93a634eadb5d25bb60c85a9c", - "revisionTime": "2018-01-26T08:34:12Z" - }, - { - "checksumSHA1": "Mr4ur60bgQJnQFfJY0dGtwWwMPE=", - "path": "golang.org/x/text/encoding", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "DSdlK4MKI/a3U8Zaee2XKBe01Fo=", - "path": "golang.org/x/text/encoding/charmap", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "tLQQZEU7qS/eYyCvd76Wqfz1oR8=", - "path": "golang.org/x/text/encoding/htmlindex", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "zeHyHebIZl1tGuwGllIhjfci+wI=", - "path": "golang.org/x/text/encoding/internal", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "7kYqxy64WhMjFIFZgN7tJ3lbKxM=", - "path": "golang.org/x/text/encoding/internal/identifier", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "2YqVpmvjWGEBATyUphTP1MS34JE=", - "path": "golang.org/x/text/encoding/japanese", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "+ErWCAdaMwO4PLtrk9D/Hh+7oQM=", - "path": "golang.org/x/text/encoding/korean", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "mTuZi5urYwgDIO8+Gfql2pv8Vwg=", - "path": "golang.org/x/text/encoding/simplifiedchinese", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "D+VI4j0Wjzr8SeupWdOB5KBdFOw=", - "path": "golang.org/x/text/encoding/traditionalchinese", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "G9LfJI9gySazd+MyyC6QbTHx4to=", - "path": "golang.org/x/text/encoding/unicode", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "hyNCcTwMQnV6/MK8uUW9E5H0J0M=", - "path": "golang.org/x/text/internal/tag", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "Qk7dljcrEK1BJkAEZguxAbG9dSo=", - "path": "golang.org/x/text/internal/utf8internal", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "/N4Gt0BoQcasJJ28JOlzLO5v/ug=", - "path": "golang.org/x/text/language", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "IV4MN7KGBSocu/5NR3le3sxup4Y=", - "path": "golang.org/x/text/runes", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "ziMb9+ANGRJSSIuxYdRbA+cDRBQ=", - "path": "golang.org/x/text/transform", - "revision": "e19ae1496984b1c655b8044a65c0300a3c878dd3", - "revisionTime": "2017-12-24T20:31:28Z" - }, - { - "checksumSHA1": "P/k5ZGf0lEBgpKgkwy++F7K1PSg=", - "path": "gopkg.in/go-playground/validator.v8", - "revision": "5f1438d3fca68893a817e4a66806cea46a9e4ebf", - "revisionTime": "2017-07-30T05:02:35Z" - }, - { - "checksumSHA1": "qOmvuDm+F+2nQQecUZBVkZrTn6Y=", - "path": "gopkg.in/yaml.v2", - "revision": "d670f9405373e636a5a2765eea47fac0c9bc91a4", - "revisionTime": "2018-01-09T11:43:31Z" - } - ], - "rootPath": "github.com/awslabs/aws-lambda-go-api-proxy" -}