Documentation ¶
Index ¶
Constants ¶
const ( // CustomHostVariable is the name of the environment variable that contains // the custom hostname for the request. If this variable is not set the framework // reverts to `DefaultServerAddress`. The value for a custom host should include // a protocol: http://my-custom.host.com CustomHostVariable = "GO_API_HOST" // DefaultServerAddress is prepended to the path of each incoming reuqest DefaultServerAddress = "https://aws-serverless-go-api.com" // APIGwContextHeader is the custom header key used to store the // API Gateway context. To access the Context properties use the // GetAPIGatewayContext method of the RequestAccessor object. APIGwContextHeader = "X-GoLambdaProxy-ApiGw-Context" // APIGwStageVarsHeader is the custom header key used to store the // API Gateway stage variables. To access the stage variable values // use the GetAPIGatewayStageVars method of the RequestAccessor object. APIGwStageVarsHeader = "X-GoLambdaProxy-ApiGw-StageVars" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdapterRequest ¶
type AdapterRequest struct { Resource string `json:"resource"` Path string `json:"path"` HTTPMethod string `json:"httpMethod"` Headers map[string]string `json:"headers,omitempty"` MultiValueHeaders map[string][]string `json:"multiValueHeaders,omitempty"` QueryStringParameters map[string]string `json:"queryStringParameters,omitempty"` MultiValueQueryStringParameters map[string][]string `json:"multiValueQueryStringParameters,omitempty"` PathParameters map[string]string `json:"pathParameters"` StageVariables map[string]string `json:"stageVariables"` RequestContext interface{} `json:"requestContext"` Body string `json:"body"` IsBase64Encoded bool `json:"isBase64Encoded,omitempty"` // contains filtered or unexported fields }
AdapterRequest is a struct that contains fields required to produce either an events.APIGatewayResponse or events.ALBTargetGroupResponse
func (*AdapterRequest) Proxy ¶
func (ar *AdapterRequest) Proxy(ctx context.Context, handler http.Handler) (*AdapterResponse, error)
Proxy takes the handler from your flavor of framework and processes it into an AdapterResponse which can be cast to the required event.Response type
func (*AdapterRequest) StripBasePath ¶
func (ar *AdapterRequest) StripBasePath(basePath string) string
StripBasePath used to satisfy base path mappings in API Gateway
type AdapterResponse ¶
type AdapterResponse struct { StatusCode int `json:"statusCode"` StatusDescription string `json:"statusDescription"` Headers map[string]string `json:"headers"` MultiValueHeaders map[string][]string `json:"multiValueHeaders"` Body string `json:"body"` IsBase64Encoded bool `json:"isBase64Encoded,omitempty"` }
AdapterResponse is a struct that contains fields required to produce either an events.APIGatewayResponse or events.ALBTargetGroupResponse
func NewAdapterResponse ¶
func NewAdapterResponse(r *http.Response) (*AdapterResponse, error)
NewAdapterResponse converts an http.Response into an AdapterResponse
func (*AdapterResponse) ALBTargetGroupResponse ¶
func (ar *AdapterResponse) ALBTargetGroupResponse() (events.ALBTargetGroupResponse, error)
ALBTargetGroupResponse returns an events.ALBTargetGroupResponse from the AdapterResponse
func (*AdapterResponse) APIGatewayProxyResponse ¶
func (ar *AdapterResponse) APIGatewayProxyResponse() (events.APIGatewayProxyResponse, error)
APIGatewayProxyResponse returns an events.APIGatewayProxyResponse from the AdapterResponse