function

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2016 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package function implements function-level operations.

Index

Constants

View Source
const (
	RequestResponse InvocationType = "RequestResponse"
	Event                          = "Event"
	DryRun                         = "DryRun"
)

Invocation types.

View Source
const CurrentAlias = "current"

Current alias name.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config for a Lambda function.

type Function

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

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

func (*Function) Clean added in v0.1.0

func (f *Function) Clean() error

Clean removes build artifacts from compiled runtimes.

func (*Function) Create

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

Create the function with the given `zip`.

func (*Function) Delete added in v0.1.0

func (f *Function) Delete() error

Delete the function including all its versions

func (*Function) Deploy

func (f *Function) Deploy() error

Deploy code and then configuration.

func (*Function) DeployCode added in v0.2.0

func (f *Function) DeployCode() error

DeployCode generates a zip and creates or updates the function.

func (*Function) DeployConfig added in v0.1.0

func (f *Function) DeployConfig() error

DeployConfig deploys changes to configuration.

func (*Function) Info

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

Info returns the function information.

func (*Function) Invoke added in v0.1.0

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

Invoke the remote Lambda function, returning the response and logs, if any.

func (*Function) Open

func (f *Function) Open() error

Open the function.json file and prime the config.

func (*Function) Rollback added in v0.2.0

func (f *Function) Rollback() error

Rollback the function to the previous.

func (*Function) RollbackVersion added in v0.3.0

func (f *Function) RollbackVersion(version string) error

RollbackVersion the function to the specified version.

func (*Function) SetEnv added in v0.1.0

func (f *Function) SetEnv(name, value string)

SetEnv sets environment variable `name` to `value`.

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 InvocationType added in v0.1.0

type InvocationType string

InvocationType determines how an invocation request is made.

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