lambdaapi

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a simple client for the Lambda Extensions API

func NewClient

func NewClient(awsLambdaRuntimeAPI, extensionName string) *Client

NewClient returns a Lambda Extensions API client

func (*Client) ExitError

func (client *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 (client *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) MakeRequest

func (client *Client) MakeRequest(headers map[string]string, request *bytes.Buffer, methodType, URL string) ([]byte, error)

MakeRequest is to hit the URL and get the response with the content, method, headers, URL and request provided.

func (*Client) MakeRequestWithContext

func (client *Client) MakeRequestWithContext(ctx context.Context, headers map[string]string, request *bytes.Buffer, methodType, URL string) ([]byte, error)

MakeRequestWithContext is to hit the URL and get the response with the content, method, headers, URL and request provided.

func (*Client) NextEvent

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

NextEvent is - Call the following method when the extension is ready to receive the next invocation and there is no job it needs to execute beforehand. blocks while long polling for the next lambda invoke or shutdown

func (*Client) RegisterExtension

func (client *Client) RegisterExtension(ctx context.Context) (*RegisterResponse, error)

RegisterExtension is to register extension to Run Time API client. Call the following method on initialization as early as possible, otherwise you may get a timeout error. Runtime initialization will start after all extensions are registered.

func (*Client) SubscribeToLogsAPI

func (client *Client) SubscribeToLogsAPI(ctx context.Context, logEvents []string) ([]byte, error)

SubscribeToLogsAPI is - Subscribe to Logs API to receive the Lambda Logs.

func (*Client) SubscribeToTelemetryAPI added in v1.1.0

func (client *Client) SubscribeToTelemetryAPI(ctx context.Context, logEvents []string) ([]byte, error)

SubscribeToLogsAPI is - Subscribe to Logs API to receive the Lambda Logs.

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 {
	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 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