src

package
v0.0.0-...-3c02852 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Application

func Application(cfg *config.Config) interfaces.Application

Application func, initialize the App

Types

type LambdaResponder

type LambdaResponder struct {
	Echo *echo.Echo
}

LambdaResponder managing lambda response

func (*LambdaResponder) Handler

Handler for lambda

func (*LambdaResponder) ProxyEventToHTTPRequest

func (a *LambdaResponder) ProxyEventToHTTPRequest(req events.APIGatewayProxyRequest) (*http.Request, error)

ProxyEventToHTTPRequest proxy to event handler

type ProxyResponseWriter

type ProxyResponseWriter struct {
	Headers http.Header `json:"headers"`
	Body    []byte      `json:"body"`
	Status  int         `json:"statusCode"`
}

ProxyResponseWriter implements http.ResponseWriter and adds the method necessary to return an events.APIGatewayProxyResponse object

func NewProxyResponseWriter

func NewProxyResponseWriter() *ProxyResponseWriter

NewProxyResponseWriter returns a new ProxyResponseWriter object. The object is initialized with an empty map of headers and a status code of -1

func (*ProxyResponseWriter) GetProxyResponse

func (r *ProxyResponseWriter) GetProxyResponse() (events.APIGatewayProxyResponse, error)

GetProxyResponse converts the data passed to the response writer into an events.APIGatewayProxyResponse object. Returns a populated proxy response object. If the reponse is invalid, for example has no headers or an invalid status code returns an error.

func (*ProxyResponseWriter) Header

func (r *ProxyResponseWriter) Header() http.Header

Header implementation from the http.ResponseWriter interface.

func (*ProxyResponseWriter) Write

func (r *ProxyResponseWriter) Write(body []byte) (int, error)

Write sets the response body in the object. If no status code was set before with the WriteHeader method it sets the status for the response to 200 OK.

func (*ProxyResponseWriter) WriteHeader

func (r *ProxyResponseWriter) WriteHeader(status int)

WriteHeader sets a status code for the response. This method is used for error responses.

Directories

Path Synopsis
module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL