lambdautils

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: GPL-2.0-or-later Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultStatusMessages = map[int][]string{
		http.StatusBadRequest:          []string{"invalid request, please check your parameters and try again"},
		http.StatusNotImplemented:      []string{"not implemented"},
		http.StatusInternalServerError: []string{"An error occurred on the server.  Please report this error, an administrator will have to examine the logs to determine the cause of the error."},
		http.StatusNotFound:            []string{"not found"},
	}
)

Functions

func AwsConfigFromContext

func AwsConfigFromContext(ctx context.Context) ([]*aws.Config, bool)

func AwsContextConfigProvider

func AwsContextConfigProvider(ctx context.Context) client.ConfigProvider

func ErrBadRequest

func ErrBadRequest(msgs ...string) (*events.APIGatewayProxyResponse, error)

func ErrInternalServerError

func ErrInternalServerError(msgs ...string) (*events.APIGatewayProxyResponse, error)

func ErrNotFound

func ErrNotFound(msgs ...string) (*events.APIGatewayProxyResponse, error)

func ErrNotImplemented

func ErrNotImplemented(msgs ...string) (*events.APIGatewayProxyResponse, error)

func ErrResponse

func ErrResponse(statusCode int, err error) (*events.APIGatewayProxyResponse, error)

func ErrStringResponse

func ErrStringResponse(statusCode int, msgs ...string) (*events.APIGatewayProxyResponse, error)

func NewAwsConfigContext

func NewAwsConfigContext(parentCtx context.Context, configs ...*aws.Config) context.Context

func NewJSONAPIGatewayProxyResponse

func NewJSONAPIGatewayProxyResponse(statusCode int, headers map[string]string, bodyObj interface{}) (*events.APIGatewayProxyResponse, error)

NewJSONAPIGatewayProxyResponse builds a APIGatewayProxyResponse struct assuming the provided body can be marshaled into json as a map[string]interface{}

func SimpleOKResponse

func SimpleOKResponse(result interface{}) (*events.APIGatewayProxyResponse, error)

Types

type ErrorResponse

type ErrorResponse struct {
	Status       string `json:"status"`
	ErrorMessage string `json:"error"`
}

ErrorResponse type is what we'll use to return error objects

func NewErrorResponse

func NewErrorResponse(status int, msgs ...string) ErrorResponse

Jump to

Keyboard shortcuts

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