apigatewayv2

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(handler http.Handler) engine.Handler[HTTPRequest, HTTPResponse]

Types

type HTTPRequest

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

HTTPRequest contains data coming from the new HTTP API Gateway

type HTTPRequestContext

type HTTPRequestContext struct {
	RouteKey       string                                   `json:"routeKey"`
	AccountID      string                                   `json:"accountId"`
	Stage          string                                   `json:"stage"`
	RequestID      string                                   `json:"requestId"`
	Authorizer     *HTTPRequestContextAuthorizerDescription `json:"authorizer,omitempty"`
	APIID          string                                   `json:"apiId"` // The API Gateway HTTP API Id
	DomainName     string                                   `json:"domainName"`
	DomainPrefix   string                                   `json:"domainPrefix"`
	Time           string                                   `json:"time"`
	TimeEpoch      int64                                    `json:"timeEpoch"`
	HTTP           HTTPRequestContextHTTPDescription        `json:"http"`
	Authentication HTTPRequestContextAuthentication         `json:"authentication,omitempty"`
}

HTTPRequestContext contains the information to identify the AWS account and resources invoking the Lambda function.

type HTTPRequestContextAuthentication

type HTTPRequestContextAuthentication struct {
	ClientCert HTTPRequestContextAuthenticationClientCert `json:"clientCert"`
}

HTTPRequestContextAuthentication contains authentication context information for the request caller including client certificate information if using mTLS.

type HTTPRequestContextAuthenticationClientCert

type HTTPRequestContextAuthenticationClientCert struct {
	ClientCertPem string                                             `json:"clientCertPem"`
	IssuerDN      string                                             `json:"issuerDN"`
	SerialNumber  string                                             `json:"serialNumber"`
	SubjectDN     string                                             `json:"subjectDN"`
	Validity      HTTPRequestContextAuthenticationClientCertValidity `json:"validity"`
}

HTTPRequestContextAuthenticationClientCert contains client certificate information for the request caller if using mTLS.

type HTTPRequestContextAuthenticationClientCertValidity

type HTTPRequestContextAuthenticationClientCertValidity struct {
	NotAfter  string `json:"notAfter"`
	NotBefore string `json:"notBefore"`
}

HTTPRequestContextAuthenticationClientCertValidity contains client certificate validity information for the request caller if using mTLS.

type HTTPRequestContextAuthorizerCognitoIdentity

type HTTPRequestContextAuthorizerCognitoIdentity struct {
	AMR            []string `json:"amr"`
	IdentityID     string   `json:"identityId"`
	IdentityPoolID string   `json:"identityPoolId"`
}

HTTPRequestContextAuthorizerCognitoIdentity contains Cognito identity information for the request context.

type HTTPRequestContextAuthorizerDescription

type HTTPRequestContextAuthorizerDescription struct {
	JWT    *HTTPRequestContextAuthorizerJWTDescription `json:"jwt,omitempty"`
	Lambda map[string]any                              `json:"lambda,omitempty"`
	IAM    *HTTPRequestContextAuthorizerIAMDescription `json:"iam,omitempty"`
}

HTTPRequestContextAuthorizerDescription contains authorizer information for the request context.

type HTTPRequestContextAuthorizerIAMDescription

type HTTPRequestContextAuthorizerIAMDescription struct {
	AccessKey       string                                      `json:"accessKey"`
	AccountID       string                                      `json:"accountId"`
	CallerID        string                                      `json:"callerId"`
	CognitoIdentity HTTPRequestContextAuthorizerCognitoIdentity `json:"cognitoIdentity,omitempty"`
	PrincipalOrgID  string                                      `json:"principalOrgId"`
	UserARN         string                                      `json:"userArn"`
	UserID          string                                      `json:"userId"`
}

HTTPRequestContextAuthorizerIAMDescription contains IAM information for the request context.

type HTTPRequestContextAuthorizerJWTDescription

type HTTPRequestContextAuthorizerJWTDescription struct {
	Claims map[string]string `json:"claims"`
	Scopes []string          `json:"scopes,omitempty"`
}

HTTPRequestContextAuthorizerJWTDescription contains JWT authorizer information for the request context.

type HTTPRequestContextHTTPDescription

type HTTPRequestContextHTTPDescription struct {
	Method    string `json:"method"`
	Path      string `json:"path"`
	Protocol  string `json:"protocol"`
	SourceIP  string `json:"sourceIp"`
	UserAgent string `json:"userAgent"`
}

HTTPRequestContextHTTPDescription contains HTTP information for the request context.

type HTTPResponse

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

HTTPResponse configures the response to be returned by API Gateway V2 for the request

func (*HTTPResponse) SetBody

func (r *HTTPResponse) SetBody(body string)

func (*HTTPResponse) SetCookies

func (r *HTTPResponse) SetCookies(cookies []string)

func (*HTTPResponse) SetHeaders

func (r *HTTPResponse) SetHeaders(headers map[string]string)

func (*HTTPResponse) SetIsBase64Encoded

func (r *HTTPResponse) SetIsBase64Encoded(b64 bool)

func (*HTTPResponse) SetMultiValueHeaders

func (r *HTTPResponse) SetMultiValueHeaders(mvHeaders map[string][]string)

func (*HTTPResponse) SetStatusCode

func (r *HTTPResponse) SetStatusCode(statusCode int)

Jump to

Keyboard shortcuts

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