lambda

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(stream io.WriteCloser, msg string)

Types

type Config

type Config struct {
	Debug        *Debug
	AccountID    int
	FuncLocation string
	LogLocation  string
	Secret       *scy.Resource
	AccessSecret *scy.Resource

	Functions []*FunctionConfig
	Port      int
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(port int, fnLocation, logLocation string, opts ...ConfigOption) *Config

NewConfig creates a config

func (*Config) AccessCred

func (c *Config) AccessCred(ctx context.Context) (*cred.Aws, error)

func (*Config) AddEnv

func (c *Config) AddEnv(ctx context.Context, env *[]string) error

func (*Config) BaseHandlerLocation

func (c *Config) BaseHandlerLocation() string

func (*Config) BaseLogLocation

func (c *Config) BaseLogLocation() string

func (*Config) Cred

func (c *Config) Cred(ctx context.Context) (*cred.Aws, error)

func (*Config) Init

func (c *Config) Init()

func (*Config) Lookup

func (c *Config) Lookup(fnName string) *FunctionConfig

type ConfigOption

type ConfigOption func(c *Config)

func WithFunction

func WithFunction(config *FunctionConfig) ConfigOption

type Context

type Context struct {
	RequestID          string
	FnName             string
	Version            string
	MemSize            string
	Timeout            string
	Region             string
	AccountID          string
	XAmznTraceID       string
	InvokedFunctionArn string
	ClientContext      string
	CognitoIdentity    string
	Start              time.Time
	InvokeWait         time.Time
	InitEnd            time.Time
	TimeoutDuration    time.Duration
	InvokePayload      []byte
	InvokeResponse     []byte
	InvokeError        string
	MaxMem             uint64
	LogType            string
}

func (*Context) Deadline

func (c *Context) Deadline() time.Time

func (*Context) HasExpired

func (c *Context) HasExpired() bool

func (*Context) Message

func (c *Context) Message(msg string) string

func (*Context) ParseTimeout

func (c *Context) ParseTimeout()

type Debug

type Debug struct {
	Enabled bool
	Delve   Delve
}

type Delve

type Delve struct {
	Port     int
	Location string
	API      string
}

type Function

type Function struct {
	Config    *FunctionConfig
	Cmd       *exec.Cmd
	Port      int
	LogStream io.WriteCloser
	// contains filtered or unexported fields
}

func NewFunction

func NewFunction(config *FunctionConfig) (*Function, error)

NewFunction creates a function

func (*Function) Call

func (*Function) Client

func (f *Function) Client() (*rpc.Client, error)

func (*Function) Start

func (f *Function) Start(ctx context.Context, port int) error

func (*Function) Stop

func (f *Function) Stop() error

type FunctionConfig

type FunctionConfig struct {
	lambda.FunctionConfiguration
	*Config
	CodeURI string
}

func NewFunctionConfig

func NewFunctionConfig(name, handler string, opts ...FunctionConfigOption) *FunctionConfig

func (*FunctionConfig) AddEnv

func (c *FunctionConfig) AddEnv(ctx context.Context, env *[]string, port int, xAmznTraceID string) error

func (*FunctionConfig) Init

func (c *FunctionConfig) Init(cfg *Config)

func (*FunctionConfig) MergeFrom

func (c *FunctionConfig) MergeFrom(config *lambda.FunctionConfiguration)

type FunctionConfigOption

type FunctionConfigOption func(c *FunctionConfig)

type Router

type Router struct{}

func (*Router) Configure

func (r *Router) Configure(service *Service) *http.ServeMux

type Service

type Service struct {
	Config *Config
	// contains filtered or unexported fields
}

func New

func New(config *Config) *Service

New creates a service

func (*Service) Function

func (s *Service) Function(functionName string) (*Function, error)

func (*Service) Handle

func (s *Service) Handle(writer http.ResponseWriter, request *http.Request)

func (*Service) Init

func (s *Service) Init()

func (*Service) Shutdown

func (s *Service) Shutdown()

func (*Service) Start

func (s *Service) Start()

type URI

type URI string

func (URI) Info

func (u URI) Info() (string, string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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