Documentation ¶
Index ¶
- func CacheControlMaxAgeValue(duration time.Duration) string
- func Error(statusCode int, opts ...Opt) events.APIGatewayV2HTTPResponse
- func ErrorWithMessage(statusCode int, message string, opts ...Opt) events.APIGatewayV2HTTPResponse
- func Errorf(statusCode int, layout string, v ...interface{}) events.APIGatewayV2HTTPResponse
- func JSONError(statusCode int, opts ...Opt) events.APIGatewayV2HTTPResponse
- func JSONErrorWithMessage(statusCode int, message string, opts ...Opt) events.APIGatewayV2HTTPResponse
- func JSONErrorf(statusCode int, layout string, v ...interface{}) events.APIGatewayV2HTTPResponse
- func ProxyS3(ctx context.Context, client *s3.Client, method, bucket, key string, ...) (events.APIGatewayV2HTTPResponse, error)
- func ProxyS3GET(ctx context.Context, client *s3.Client, bucket, key string, opts ...Opt) (events.APIGatewayV2HTTPResponse, error)
- func ProxyS3GETWithRequestHeaders(ctx context.Context, client *s3.Client, bucket, key string, header http.Header, ...) (events.APIGatewayV2HTTPResponse, error)
- func ProxyS3HEAD(ctx context.Context, client *s3.Client, bucket, key string, opts ...Opt) (events.APIGatewayV2HTTPResponse, error)
- func ProxyS3HEADWithRequestHeaders(ctx context.Context, client *s3.Client, bucket, key string, header http.Header, ...) (events.APIGatewayV2HTTPResponse, error)
- func ProxyS3WithRequestHeaders(ctx context.Context, client *s3.Client, method, bucket, key string, ...) (events.APIGatewayV2HTTPResponse, error)
- func Start(handler Handler, options ...start.Option)
- type Handler
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheControlMaxAgeValue ¶
func ErrorWithMessage ¶
func ErrorWithMessage(statusCode int, message string, opts ...Opt) events.APIGatewayV2HTTPResponse
func Errorf ¶
func Errorf(statusCode int, layout string, v ...interface{}) events.APIGatewayV2HTTPResponse
func JSONErrorWithMessage ¶
func JSONErrorWithMessage(statusCode int, message string, opts ...Opt) events.APIGatewayV2HTTPResponse
func JSONErrorf ¶
func JSONErrorf(statusCode int, layout string, v ...interface{}) events.APIGatewayV2HTTPResponse
func ProxyS3 ¶
func ProxyS3(ctx context.Context, client *s3.Client, method, bucket, key string, opts ...Opt) (events.APIGatewayV2HTTPResponse, error)
ProxyS3 will call S3 with the appropriate GET or HEAD method and return the response as either plain text or base64-encoded data.
The argument method will determine whether ProxyS3GET or ProxyS3HEAD will be used. If the method is not recognized, http.StatusMethodNotAllowed will be returned.
func ProxyS3GET ¶
func ProxyS3GET(ctx context.Context, client *s3.Client, bucket, key string, opts ...Opt) (events.APIGatewayV2HTTPResponse, error)
ProxyS3GET is ProxyS3 for http.MethodGet and will call S3's GetObject.
func ProxyS3GETWithRequestHeaders ¶
func ProxyS3GETWithRequestHeaders(ctx context.Context, client *s3.Client, bucket, key string, header http.Header, opts ...Opt) (events.APIGatewayV2HTTPResponse, error)
ProxyS3GETWithRequestHeaders is a variant of ProxyS3GET with request headers.
Only these headers are proxied: If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, and Range.
func ProxyS3HEAD ¶
func ProxyS3HEAD(ctx context.Context, client *s3.Client, bucket, key string, opts ...Opt) (events.APIGatewayV2HTTPResponse, error)
ProxyS3HEAD is ProxyS3 for http.MethodHead and will call S3's HeadObject.
func ProxyS3HEADWithRequestHeaders ¶
func ProxyS3HEADWithRequestHeaders(ctx context.Context, client *s3.Client, bucket, key string, header http.Header, opts ...Opt) (events.APIGatewayV2HTTPResponse, error)
ProxyS3HEADWithRequestHeaders is a variant of ProxyS3HEAD with request headers.
Only these headers are proxied: If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, and Range.
func ProxyS3WithRequestHeaders ¶
func ProxyS3WithRequestHeaders(ctx context.Context, client *s3.Client, method, bucket, key string, header http.Header, opts ...Opt) (events.APIGatewayV2HTTPResponse, error)
ProxyS3WithRequestHeaders is a variant of ProxyS3 that is given an extra http.Header whose values will be passed into the S3's respective requests if the action supports it.
Types ¶
type Handler ¶
type Handler func(ctx context.Context, request events.APIGatewayV2HTTPRequest) (events.APIGatewayV2HTTPResponse, error)
Handler for API Gateway HTTP API requests using V2 payload request and response format.
type Opt ¶
type Opt func(*events.APIGatewayV2HTTPResponse)
Modifiers to change the response such as adding headers thereto.
func SetCacheControlMaxAge ¶
Sets the cache control header with the specified max age duration.