extension

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version = "1.1.0"
)

Variables

This section is empty.

Functions

func PrettyPrint

func PrettyPrint(v interface{}) string

PrettyPrint prints formatted, legible json data.

func ProcessEnv

func ProcessEnv(manager secretManager, log *zap.SugaredLogger) *extensionConfig

ProcessEnv extracts ENV variables into globals

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"`
	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 SendStrategy

type SendStrategy string

SendStrategy represents the type of sending strategy the extension uses

const (
	// Background send strategy allows the extension to send remaining buffered
	// agent data on the next function invocation
	Background SendStrategy = "background"

	// SyncFlush send strategy indicates that the extension will synchronously
	// flush remaining buffered agent data when it receives a signal that the
	// function is complete
	SyncFlush SendStrategy = "syncflush"
)

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