lambda

package
v0.0.0-...-44b4573 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DecryptionPasswordStageVar is the name of API gateway stage variable that feeds laitos program data decryption password.
	DecryptionPasswordStageVar = "LAITOS_PROGRAM_DATA_DECRYPTION_PASSWORD"
	// UpstreamWebServerPort is the port number where lambda handler expects to find laitos web server.
	UpstreamWebServerPort = 52535
)

Variables

View Source
var IsProgramDataDecrypted bool

IsProgramDataDecrypted is set to true after an attempt has been made to decrypt laitos program data using password fed through API gateway stage variable DecryptionPasswordStageVar.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is an AWS Lambda handler function that looks for incoming HTTP requests from lambda invocation event data, proxies them to laitos web server, and sends the responses back to lambda. It behaves similar to one of the laitos daemon programs, and uses a similar convention in its interface.

func (*Handler) Initialise

func (hand *Handler) Initialise()

func (*Handler) StartAndBlock

func (hand *Handler) StartAndBlock()

StartAndBlock continuously handles lambda invocations, each of which represents an HTTP request coming from API gateway intended for the laitos web server. The function blocks caller indefinitely.

type InvocationInput

type InvocationInput struct {
	StageVariables                  map[string]string   `json:"stageVariables"`
	RequestContext                  RequestContext      `json:"requestContext"`
	MultiValueQueryStringParameters url.Values          `json:"multiValueQueryStringParameters"`
	MultiValueHeaders               map[string][]string `json:"multiValueHeaders"`
	IsBase64Encoded                 bool                `json:"isBase64Encoded"`
	Body                            string              `json:"body"`
}

InvocationInput describes an HTTP request coming from AWS API gateway to be processed by lambda function.

type InvocationOutput

type InvocationOutput struct {
	StatusCode int `json:"statusCode"`
	/*
		Headers are HTTP response headers for API gateway.
		Contrary to convention, API gateway consider multi-value header as malformed.
	*/
	Headers         map[string]string `json:"headers"`
	IsBase64Encoded bool              `json:"isBase64Encoded"`
	Body            string            `json:"body"`
}

InvocationOutput describes a lambda function response translated from laitos web server response.

type RequestContext

type RequestContext struct {
	Stage      string `json:"stage"`
	Path       string `json:"path"`
	HTTPMethod string `json:"httpMethod"`
}

RequestContext is a component of HTTP request coming from AWS API gateway.

Jump to

Keyboard shortcuts

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