extension

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrettyPrint

func PrettyPrint(v interface{}) string

PrettyPrint prints formatted, legible json data.

Types

type Client

type Client struct {
	ExtensionID string
	// contains filtered or unexported fields
}

Client is a simple Client for the Lambda Extensions API

func NewClient

func NewClient(awsLambdaRuntimeAPI string, logger *zap.SugaredLogger) *Client

NewClient returns a Lambda Extensions API Client

func (*Client) ExitError

func (e *Client) ExitError(ctx context.Context, errorType string) (*StatusResponse, error)

ExitError reports an error to the platform before exiting. Call it when you encounter an unexpected failure

func (*Client) InitError

func (e *Client) InitError(ctx context.Context, errorType string) (*StatusResponse, error)

InitError reports an initialization error to the platform. Call it when you registered but failed to initialize

func (*Client) NextEvent

func (e *Client) NextEvent(ctx context.Context) (*NextEventResponse, error)

NextEvent blocks while long polling for the next lambda invoke or shutdown

func (*Client) Register

func (e *Client) Register(ctx context.Context, filename string) (*RegisterResponse, error)

Register will register the extension with the Extensions API

type EventType

type EventType string

EventType represents the type of events recieved from /event/next

const (
	// Invoke is a lambda invoke
	Invoke EventType = "INVOKE"

	// Shutdown is a shutdown event for the environment
	Shutdown EventType = "SHUTDOWN"
)

type NextEventResponse

type NextEventResponse struct {
	Timestamp          time.Time `json:"timestamp,omitempty"`
	EventType          EventType `json:"eventType"`
	ShutdownReason     string    `json:"shutdownReason,omitempty"`
	DeadlineMs         int64     `json:"deadlineMs"`
	RequestID          string    `json:"requestId"`
	InvokedFunctionArn string    `json:"invokedFunctionArn"`
	Tracing            Tracing   `json:"tracing"`
}

NextEventResponse is the response for /event/next

type RegisterResponse

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

RegisterResponse is the body of the response for /register

type StatusResponse

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

StatusResponse is the body of the response for /init/error and /exit/error

type Tracing

type Tracing struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

Tracing is part of the response for /event/next

Jump to

Keyboard shortcuts

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