apigateway

package module
v0.0.0-...-ed62fdd Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDebug

func WithDebug(fn func(ctx context.Context, event Request) (Response, error)) func(ctx context.Context, event Request) (Response, error)

WithDebug allows dumps raw content

func Wrap

func Wrap(handler http.Handler, paths ...string) func(ctx context.Context, event Request) (Response, error)

Types

type Request

type Request struct {
	Cookies         []string          `json:"cookies,omitempty"`
	Version         string            `json:"version,omitempty"`
	RouteKey        string            `json:"routeKey,omitempty"`
	RawPath         string            `json:"rawPath,omitempty"`
	RawQueryString  string            `json:"rawQueryString,omitempty"`
	Headers         map[string]string `json:"headers,omitempty"`
	RequestContext  RequestContext    `json:"requestContext,omitempty"`
	StageVariables  map[string]string `json:"stageVariables,omitempty"`
	Body            string            `json:"body,omitempty"`
	IsBase64Encoded bool              `json:"isBase64Encoded,omitempty"`

	// Version 1 Parameters
	HttpMethod            string            `json:"httpMethod,omitempty"`
	Path                  string            `json:"path,omitempty"`
	QueryStringParameters map[string]string `json:"queryStringParameters,omitempty"`
}

type RequestContext

type RequestContext struct {
	AccountID    string `json:"accountId"`
	ApiId        string `json:"apiId"`
	DomainName   string `json:"domainName"`
	DomainPrefix string `json:"domainPrefix"`
	Http         struct {
		Method    string `json:"method"`
		Path      string `json:"path"`
		Protocol  string `json:"protocol"`
		SourceIp  string `json:"sourceIp"`
		UserAgent string `json:"userAgent"`
	} `json:"http"`
	QueryStringParameters map[string]string `json:"queryStringParameters"`
	RequestId             string            `json:"requestId"`
	RouteKey              string            `json:"routeKey"`
	Stage                 string            `json:"stage"`
	Time                  string            `json:"time"`
	TimeEpoch             int64             `json:"timeEpoch"`
}

type Response

type Response struct {
	StatusCode      int               `json:"statusCode,omitempty"`
	Headers         map[string]string `json:"headers,omitempty"`
	Body            string            `json:"body,omitempty"`
	IsBase64Encoded bool              `json:"isBase64Encoded,omitempty"`
}

Jump to

Keyboard shortcuts

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