lambda_common

package module
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

README

lambda-common

Simple set of go modules that can be used with aws lambda development

To publish a new version

Run tests

go test

Run build

go build

Update dependencies

go get -u

Tidy dependencies

go mod tidy

Tag branch

git tag v1.x.x

Push Tag

git push origin v1.x.x

Update go indices

GOPROXY=proxy.golang.org go list -m github.com/gksoftware/lambda-common@v1.x.x

Create new release in GitHub

Documentation

Index

Constants

View Source
const (
	ErrorFailedToUnmarshal            = 100
	ErrorFailedToMarshal              = 200
	ErrorFailedToHashSecret           = 300
	ErrorCognitoResourceNotFound      = 400
	ErrorCognitoInvalidParameter      = 401
	ErrorCognitoUserLambdaValidation  = 402
	ErrorCognitoNotAuthorized         = 403
	ErrorCognitoInvalidPassword       = 404
	ErrorCognitoUsernameExists        = 405
	ErrorCognitoTooManyRequests       = 406
	ErrorCognitoLimitExceeded         = 407
	ErrorCognitoForbidden             = 408
	ErrorCognitoUnauthorized          = 409
	ErrorCognitoPasswordResetRequired = 410
	ErrorCognitoUserNotConfirmed      = 411
	ErrorCognitoCodeMismatch          = 412
	ErrorCognitoUnexpected            = 499
)

Variables

This section is empty.

Functions

func CreateResponseError

func CreateResponseError(e error) (events.APIGatewayProxyResponse, error)

func ExtractCookies added in v1.12.0

func ExtractCookies(cookieString string) *map[string]string

func GenerateSecretHash added in v1.2.0

func GenerateSecretHash(username, clientId, clientSecret string) (string, error)

func LogRequest added in v1.2.0

func LogRequest(event events.APIGatewayProxyRequest)

func LogRequestPretty added in v1.2.0

func LogRequestPretty(event events.APIGatewayProxyRequest)

func MarshalResponse added in v1.2.0

func MarshalResponse(payload any) (string, error)

func UnmarshalRequest added in v1.2.0

func UnmarshalRequest(req events.APIGatewayProxyRequest, payload any) error

Types

type ApiError

type ApiError struct {
	Id         int
	Body       ApiErrorBody
	Err        error
	StatusCode int
}

func CreateApiError

func CreateApiError(id int, status int, message string, err error) ApiError

func HandleCognitoError added in v1.4.0

func HandleCognitoError(err error) ApiError

func (ApiError) Error

func (e ApiError) Error() string

type ApiErrorBody

type ApiErrorBody struct {
	Id         int
	Message    string
	StatusCode int
}

type ApiSuccess added in v1.3.0

type ApiSuccess struct {
	Message    string `json:"message"`
	StatusCode int    `json:"status"`
}

Jump to

Keyboard shortcuts

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