awslambdacustomruntimekit

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 6 Imported by: 2

README

aws-lambda-custom-runtime-kit

AWS Lambda Custom Runtime create kit.

test status MIT license

Install

go get github.com/WinterYukky/aws-lambda-custom-runtime-kit

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSLambdaCustomRuntime

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

AWS Lambda Custom Runtime

func NewAWSLambdaCustomRuntime

func NewAWSLambdaCustomRuntime(runtime AWSLambdaRuntime) *AWSLambdaCustomRuntime

Initialize AWSLambdaCustomRuntime

func (*AWSLambdaCustomRuntime) Invoke

func (a *AWSLambdaCustomRuntime) Invoke() error

Invoke the runtime handler

type AWSLambdaRuntime

type AWSLambdaRuntime interface {
	// Setup before invoke the function handler.
	Setup(env *AWSLambdaRuntimeEnvironemnt) error
	// Invoke the function handler and return the result.
	Invoke(event []byte, context *Context) (interface{}, error)
	// Cleanup after invoke the function handler.
	Cleanup(env *AWSLambdaRuntimeEnvironemnt)
}

AWSLambdaRuntime is interface of any runtime.

type AWSLambdaRuntimeEnvironemnt

type AWSLambdaRuntimeEnvironemnt struct {
	AWSLambdaRuntimeAPI string
	LambdaTaskRoot      string
	Handler             string
}

AWSLambdaRuntimeEnvironemnt is needy environment info for to invoke handler

type AWSLambdaRuntimeError

type AWSLambdaRuntimeError struct {
	ErrorMessage string   `json:"errorMessage"`
	ErrorType    string   `json:"errorType"`
	StackTrace   []string `json:"stackTrace"`
}

AWSLambdaRuntimeError is error of AWS Lambda runtime error.

func (AWSLambdaRuntimeError) Error

func (a AWSLambdaRuntimeError) Error() string

type Context

type Context struct {
	// The request ID, which identifies the request that triggered the function invocation.
	//  // example
	//  "8476a536-e9f4-11e8-9739-2dfe598c3fcd"
	RequestID string
	// The date that the function times out in Unix time milliseconds.
	//  // example
	//  "1542409706888"
	DeadlineMs string
	// The ARN of the Lambda function, version, or alias that's specified in the invocation.
	//  // example
	//  "arn:aws:lambda:us-east-2:123456789012:function:custom-runtime"
	InvokedFunctionArn string
	// AWS X-Ray tracing header.
	//  // example
	//  "Root=1-5bef4de7-ad49b0e87f6ef6c87fc2e700;Parent=9a9197af755a6419;Sampled=1"
	TraceID string
	// For invocations from the AWS Mobile SDK, data about the client application and device.
	ClientContext string
	// For invocations from the AWS Mobile SDK, data about the Amazon Cognito identity provider.
	CognitoIdentity string
	AWSLambdaRuntimeEnvironemnt
}

Context is AWS Lambda event.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is dependency of AWSLambdaCustomRuntime.

Jump to

Keyboard shortcuts

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