aws

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Lambda event type compatibility layer for AWS Application Load Balancer target group mode.

See lambda event detail: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html#receive-event-from-load-balancer

Lambda event type compatibility layer for AWS API Gateway with HTTP API mode.

See lambda event detail: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html

Lambda event type compatibility layer for AWS API Gateway with REST API mode.

See lambda event detail: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format

Lambda event type compatibility layer for AWS API Gateway with REST API mode.

See lambda event detail: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultWebsocketPathPrefix      = "websocket"
	DefaultRouteSelectionExpression = "$request.body.action"
)

Functions

func ALBTargetResponse

func ALBTargetResponse(w *ResponseWriter, multiValue bool) (r *events.ALBTargetGroupResponse, err error)

Response writer for Application Load Balancer target group mode.

func ExpandJSONPath added in v0.2.0

func ExpandJSONPath(s string, obj interface{}) string

func GetALBTargetGroupRequestContext added in v0.1.1

func GetALBTargetGroupRequestContext(ctx context.Context) (req *events.ALBTargetGroupRequestContext, ok bool)

func GetProxyRequestContext added in v0.1.1

func GetProxyRequestContext(ctx context.Context) (req *events.APIGatewayProxyRequestContext, ok bool)

func GetRawRequestContext added in v0.1.1

func GetRawRequestContext(ctx context.Context) interface{}

func GetV2HTTPRequestContext added in v0.1.1

func GetV2HTTPRequestContext(ctx context.Context) (req *events.APIGatewayV2HTTPRequestContext, ok bool)

func GetWebsocketRequestContext added in v0.2.0

func GetWebsocketRequestContext(ctx context.Context) (req *events.APIGatewayWebsocketProxyRequestContext, ok bool)

func HTTPAPIResponse

func HTTPAPIResponse(w *ResponseWriter) (r *events.APIGatewayV2HTTPResponse, err error)

Response writer for API Gateway with HTTP API mode.

func LambdaDetector

func LambdaDetector() bool

func NewALBTargetGroupRequest

func NewALBTargetGroupRequest(ctx context.Context, e *events.ALBTargetGroupRequest) (r *http.Request, multiValue bool, err error)

Lambda event type to http.Request converter for Application Load Balancer target group mode.

func NewAPIGatewayManagementClient added in v0.2.0

func NewAPIGatewayManagementClient(sess *session.Session, domain, stage string) *apigatewaymanagementapi.ApiGatewayManagementApi

NewAPIGatewayManagementClient creates a new API Gateway Management Client instance from the provided parameters. The new client will have a custom endpoint that resolves to the application's deployed API.

func NewHTTPAPIRequest

func NewHTTPAPIRequest(ctx context.Context, e *events.APIGatewayV2HTTPRequest) (r *http.Request, err error)

Lambda event type to http.Request converter for API Gateway with HTTP API mode.

func NewLambdaAdaptor

func NewLambdaAdaptor(addr string, h http.Handler, options []interface{}) types.Adaptor

func NewLambdaHandler

func NewLambdaHandler(h http.Handler) lambda.Handler

func NewLambdaHandlerWithOption added in v0.2.0

func NewLambdaHandlerWithOption(h http.Handler, options []interface{}) lambda.Handler

func NewRESTAPIRequest

func NewRESTAPIRequest(ctx context.Context, e *events.APIGatewayProxyRequest) (r *http.Request, multiValue bool, err error)

Lambda event type to http.Request converter for API Gateway with REST API mode.

func NewWebsocketRequest added in v0.2.0

func NewWebsocketRequest(ctx context.Context, e *events.APIGatewayWebsocketProxyRequest, pathPrefix string) (r *http.Request, multiValue bool, err error)

Lambda event type to http.Request converter for API Gateway with REST API mode.

func RESTAPITargetResponse

func RESTAPITargetResponse(w *ResponseWriter, multiValue bool) (r *events.APIGatewayProxyResponse, err error)

Response writer for API Gateway with REST API mode.

func StripStageVar added in v0.2.0

func StripStageVar(next http.Handler) http.Handler

Strip stage var from Request path under the AWS API Gateway environment with deployment stage feature.

func WebsocketResponse added in v0.2.0

func WebsocketResponse(w *WebsocketResponseWriter, multiValue bool) (r *events.APIGatewayProxyResponse, err error)

Response writer for API Gateway with REST API mode.

func WebsocketRouter added in v0.2.0

func WebsocketRouter(next http.Handler, routeExpression string) http.Handler

Types

type LambdaAdaptor

type LambdaAdaptor struct {
	// contains filtered or unexported fields
}

func (LambdaAdaptor) ListenAndServe

func (l LambdaAdaptor) ListenAndServe() error

func (LambdaAdaptor) Shutdown

func (l LambdaAdaptor) Shutdown(ctx context.Context) error

type LambdaHandler

type LambdaHandler struct {
	// contains filtered or unexported fields
}

func (*LambdaHandler) Invoke

func (l *LambdaHandler) Invoke(ctx context.Context, payload []byte) ([]byte, error)

func (*LambdaHandler) InvokeALBTargetGroup

func (l *LambdaHandler) InvokeALBTargetGroup(ctx context.Context, request *events.ALBTargetGroupRequest) (r *events.ALBTargetGroupResponse, err error)

func (*LambdaHandler) InvokeHTTPAPI

func (*LambdaHandler) InvokeRESTAPI

func (*LambdaHandler) InvokeWebsocketAPI added in v0.2.0

type LambdaHandlerOption added in v0.2.0

type LambdaHandlerOption func(handler *LambdaHandler)

func WithAWSSessionProvider added in v0.2.0

func WithAWSSessionProvider(sp SDKSessionProvider) LambdaHandlerOption

type LambdaIntegrationType

type LambdaIntegrationType int
const (
	UnknownLambdaIntegrationType LambdaIntegrationType = iota
	APIGatewayRESTIntegration
	APIGatewayWebsocketIntegration
	APIGatewayHTTPIntegration
	ALBTargetGroupIntegration
)

type ResponseWriter

type ResponseWriter struct {
	// contains filtered or unexported fields
}

func NewResponseWriter

func NewResponseWriter() *ResponseWriter

func (*ResponseWriter) CloseNotify

func (r *ResponseWriter) CloseNotify() <-chan bool

func (*ResponseWriter) Done

func (r *ResponseWriter) Done()

func (*ResponseWriter) Header

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

func (*ResponseWriter) Write

func (r *ResponseWriter) Write(i []byte) (int, error)

func (*ResponseWriter) WriteHeader

func (r *ResponseWriter) WriteHeader(statusCode int)

type SDKSessionProvider added in v0.2.0

type SDKSessionProvider func() (*session.Session, error)

type WebsocketResponseWriter added in v0.2.0

type WebsocketResponseWriter struct {
	// contains filtered or unexported fields
}

func (*WebsocketResponseWriter) CloseNotify added in v0.2.0

func (w *WebsocketResponseWriter) CloseNotify() <-chan bool

func (*WebsocketResponseWriter) Done added in v0.2.0

func (w *WebsocketResponseWriter) Done()

func (*WebsocketResponseWriter) Header added in v0.2.0

func (w *WebsocketResponseWriter) Header() http.Header

func (*WebsocketResponseWriter) Write added in v0.2.0

func (w *WebsocketResponseWriter) Write(i []byte) (int, error)

func (*WebsocketResponseWriter) WriteHeader added in v0.2.0

func (w *WebsocketResponseWriter) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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