function

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2015 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package function implements higher-level functionality for dealing with Lambda functions.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnchanged = errors.New("function: unchanged")
)

Errors.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Runtime     string `json:"runtime"`
	Memory      int64  `json:"memory"`
	Timeout     int64  `json:"timeout"`
	Role        string `json:"role"`
}

Config for a Lambda function.

type Function

type Function struct {
	Config
	Path    string
	Service lambdaiface.LambdaAPI
	// contains filtered or unexported fields
}

Function represents a Lambda function, with configuration loaded from the "package.json" file on disk. Operations are performed against the function directory as the CWD, so os.Chdir() first.

func (*Function) Create

func (f *Function) Create(zip []byte) error

Create the function with the given `zip`.

func (*Function) Deploy

func (f *Function) Deploy() error

Deploy generates a zip and creates or updates the function.

func (*Function) Info

func (f *Function) Info() (*lambda.GetFunctionOutput, error)

Info returns the function information.

func (*Function) Open

func (f *Function) Open() error

Open the package.json file and prime the config.

func (*Function) Request

func (f *Function) Request(event, context interface{}) (reply, logs io.Reader, err error)

Request invokes the remote Lambda function, returning the response and logs.

func (*Function) Update

func (f *Function) Update(zip []byte) error

Update the function with the given `zip`.

func (*Function) Zip

func (f *Function) Zip() (io.Reader, error)

Zip returns the zipped contents of the function.

func (*Function) ZipBytes

func (f *Function) ZipBytes() ([]byte, error)

ZipBytes returns the generated zip as bytes.

type InvokeError

type InvokeError struct {
	Message string   `json:"errorMessage"`
	Type    string   `json:"errorType"`
	Stack   []string `json:"stackTrace"`
	Handled bool
}

InvokeError records an error from an invocation.

func (*InvokeError) Error

func (e *InvokeError) Error() string

Error message.

Jump to

Keyboard shortcuts

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