Documentation
¶
Index ¶
- func ErrorResponse(message, body string, err error, status int, logger log.Logger, ...) (events.APIGatewayV2HTTPResponse, error)
- func ForbiddenResponse(message, what string, logger log.Logger, logValues ...interface{}) (events.APIGatewayV2HTTPResponse, error)
- func InternalErrorResponseWithLog(message string, err error, logger log.Logger, logValues ...interface{}) (events.APIGatewayV2HTTPResponse, error)
- func JSONResponse(body string, status int) (events.APIGatewayV2HTTPResponse, error)
- func NewResponse() events.APIGatewayV2HTTPResponse
- func NotFoundResponse(message, what string, logger log.Logger, logValues ...interface{}) (events.APIGatewayV2HTTPResponse, error)
- func ResponseWithType(body, contentType string, status int) (events.APIGatewayV2HTTPResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorResponse ¶
func ErrorResponse(message, body string, err error, status int, logger log.Logger, logValues ...interface{}) (events.APIGatewayV2HTTPResponse, error)
ErrorResponse returns a response object with a user defined error. The messane and error are written to the log at Error level. The error return value is *always* nil to satisfy the requirements of the lambda handler. The value of the `body` parameter is used as the body of the response. If this an empty string, the string value of the error will be used instead. Any additional values in logValues are written to the log after the initial values
func ForbiddenResponse ¶
func ForbiddenResponse(message, what string, logger log.Logger, logValues ...interface{}) (events.APIGatewayV2HTTPResponse, error)
ForbiddenResponse returns a response object set to Forbidden. The `what` parameter can be set to the object access is denied to or the user or whatever is convenient. The `message` and `what` parameters are written to the log at Warning level. The error return value is *always* nil to satisfy the requirements of the lambda handler. Any additional values in logValues are written to the log after the initial values
func InternalErrorResponseWithLog ¶
func InternalErrorResponseWithLog(message string, err error, logger log.Logger, logValues ...interface{}) (events.APIGatewayV2HTTPResponse, error)
InternalErrorResponse returns a response object for an internal error. The `message` and `err` parameters are written to the log with Error level. The error return value is *always* nil to satisfy the requirements of the lambda handler. The body is set to "Internal Server Error" Any additional values in logValues are written to the log after the initial values
func JSONResponse ¶
func JSONResponse(body string, status int) (events.APIGatewayV2HTTPResponse, error)
JSONResponse returns a response object with the content type set to "application/json" and the string value as the body. The error return value is *always* nil to satisfy the requirements of the lambda handler.
func NewResponse ¶
func NewResponse() events.APIGatewayV2HTTPResponse
NewResponse creates a new responses object with the pointer type fields initialised
func NotFoundResponse ¶
func NotFoundResponse(message, what string, logger log.Logger, logValues ...interface{}) (events.APIGatewayV2HTTPResponse, error)
NotFoundResponse returns a response object set to NotFound. The `message“ and `what` parameters are written to the log at Warning level. The error return value is *always* nil to satisfy the requirements of the lambda handler. Any additional values in logValues are written to the log after the initial values
func ResponseWithType ¶
func ResponseWithType(body, contentType string, status int) (events.APIGatewayV2HTTPResponse, error)
ResponseWithType returns a response object with the body and content-type set with the required status
Types ¶
This section is empty.