api

package
v0.0.0-...-b0852c1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package api defines the interaction that is done between the aditional runtime (the current running extension) and the main business logic function running along aside it.

For further infomation regarding lambda extensions:

https://docs.aws.amazon.com/lambda/latest/dg/runtimes-extensions-api.html#runtimes-extensions-registration-api

Index

Constants

View Source
const (
	EnvLambdaAPIHostname = "AWS_LAMBDA_RUNTIME_API"
	// Version defines the used OpenAPI spec being adhere to
	// by the connecting client. It is used as part of the
	// generated URI to be used to issue connections.
	Version = "2020-01-01"

	RegisterEndpoint  LambdaPath = "/" + Version + "/extension/register"
	EventEndpoint     LambdaPath = "/" + Version + "/extension/event/next"
	InitErrorEndpoint LambdaPath = "/" + Version + "/extension/init/error"
	ExitErrorEndpoint LambdaPath = "/" + Version + "/extension/exit/error"

	Invoke   Event = "INVOKE"
	Shutdown Event = "SHUTDOWN"

	LambdaExtensionNameHeaderKey       = "Lambda-Extension-Name"
	LambdaExtensionIdentifierHeaderKey = "Lambda-Extension-Identifier"
	LambdaErrorHeaderKey               = "Lambda-Extension-Function-Error-Type"
	LambdaExtensionEventIdentifer      = "Lambda-Extension-Event-Identifier"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorRequest

type ErrorRequest struct {
	Message    string   `json:"errorMessage"`
	Type       string   `json:"errorType"`
	StackTrace []string `json:"stackTrace"`
}

Defining the types used when processing errors

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"errorMessage"`
	Type    string `json:"errorType"`
}

type Event

type Event string

Defining types used within the initialise phase of the extension

type EventNextPayload

type EventNextPayload struct {
	EventType          Event             `json:"eventType"`
	Deadline           int64             `json:"deadlineMs"`
	RequestID          string            `json:"requestId"`
	InvokedFunctionARN string            `json:"invokedFunctionArn"`
	Tracing            map[string]string `json:"tracing"`
	ShutdownReason     string            `json:"shutdownReason"`
}

Defining types used within the next phase of the extension

type LambdaPath

type LambdaPath string

func (LambdaPath) GetUrl

func (lp LambdaPath) GetUrl(domain string) string

func (LambdaPath) String

func (lp LambdaPath) String() string

type RegisterRequestPayload

type RegisterRequestPayload struct {
	Events []Event `json:"events"`
}

type RegisterResponsePayload

type RegisterResponsePayload struct {
	FunctionName    string `json:"functionName"`
	FunctionVersion string `json:"functionVersion"`
	Handler         string `json:"handler"`
}

type StatusResponse

type StatusResponse struct {
	Status string `json:"status"`
}

Jump to

Keyboard shortcuts

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