Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HandlerFunc ¶
HandlerFunc is a generic HandlerFunc for incoming http requests/events incoming request will be run through http server which will return the response.
type ProxyResponseWriter ¶
type ProxyResponseWriter struct {
// contains filtered or unexported fields
}
ProxyResponseWriter implements http.ResponseWriter and adds the method necessary to return an events.ALBTargetGroupResponse 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) CloseNotify ¶
func (r *ProxyResponseWriter) CloseNotify() <-chan bool
func (*ProxyResponseWriter) GetLambdaResponse ¶
func (r *ProxyResponseWriter) GetLambdaResponse() (Response, error)
GetLambdaResponse converts the data passed to the response writer into an Response object. Returns a populated lambda response object. If the response 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.
type Request ¶
type Request struct {
events.ALBTargetGroupRequest
events.APIGatewayV2HTTPRequest //nolint:govet
// Added to resolve "ambiguous selectors" error
Headers map[string]string `json:"headers"`
QueryStringParameters map[string]string `json:"queryStringParameters"`
RequestContext RequestContext `json:"requestContext"`
Body string `json:"body"`
IsBase64Encoded bool `json:"isBase64Encoded"`
}
Request wraps ALBTargetGroupRequest and APIGatewayV2HTTPRequest into a generic request struct.
type RequestContext ¶
type RequestContext struct {
events.ALBTargetGroupRequestContext
events.APIGatewayV2HTTPRequestContext
}
type Response ¶
type Response 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"`
Cookies []string `json:"cookies"`
}
Request mimics ALBTargetGroupResponse and APIGatewayV2HTTPResponse into a generic response struct.