Documentation ¶
Overview ¶
Package function implements function-level operations.
Index ¶
- Constants
- func RegisterPlugin(name string, plugin Plugin)
- type Config
- type Function
- func (f *Function) Build() (io.Reader, error)
- func (f *Function) BuildBytes() ([]byte, error)
- func (f *Function) Clean() error
- func (f *Function) Create(zip []byte) error
- func (f *Function) Delete() error
- func (f *Function) Deploy() error
- func (f *Function) DeployCode() error
- func (f *Function) DeployConfig() error
- func (f *Function) GetConfig() (*lambda.GetFunctionOutput, error)
- func (f *Function) Invoke(event, context interface{}, kind InvocationType) (reply, logs io.Reader, err error)
- func (f *Function) Open() error
- func (f *Function) Rollback() error
- func (f *Function) RollbackVersion(version string) error
- func (f *Function) Setenv(name, value string)
- func (f *Function) Update(zip []byte) error
- type Hook
- type InvocationType
- type InvokeError
- type Plugin
Constants ¶
const ( RequestResponse InvocationType = "RequestResponse" Event = "Event" DryRun = "DryRun" )
Invocation types.
const ( // OpenHook is called when the function configuration is first loaded. OpenHook Hook = "open" // BuildHook is called when a build is started. BuildHook = "build" // CleanHook is called when a build is complete. CleanHook = "clean" // DeployHook is called after build and before a deploy. DeployHook = "deploy" )
Hooks available.
const CurrentAlias = "current"
Current alias name.
Variables ¶
This section is empty.
Functions ¶
func RegisterPlugin ¶ added in v0.5.0
RegisterPlugin registers `plugin` by `name`.
Types ¶
type Config ¶
type Config struct { 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"` Handler string `json:"handler" validate:"nonzero"` Shim bool `json:"shim"` Environment map[string]string `json:"environment"` Hooks hooks.Hooks `json:"hooks"` }
Config for a Lambda function.
type Function ¶
type Function struct { Config Name string FunctionName string Path string Service lambdaiface.LambdaAPI Log log.Interface IgnoredPatterns []string }
Function represents a Lambda function, with configuration loaded from the "function.json" file on disk.
func (*Function) BuildBytes ¶ added in v0.5.0
BuildBytes returns the generated zip as bytes.
func (*Function) Clean ¶ added in v0.1.0
Clean invokes the CleanHook, useful for removing build artifacts and so on.
func (*Function) DeployCode ¶ added in v0.2.0
DeployCode generates a zip and creates or updates the function.
func (*Function) DeployConfig ¶ added in v0.1.0
DeployConfig deploys changes to configuration.
func (*Function) GetConfig ¶ added in v0.5.0
func (f *Function) GetConfig() (*lambda.GetFunctionOutput, error)
GetConfig returns the function configuration.
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) RollbackVersion ¶ added in v0.3.0
RollbackVersion the function to the specified version.
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.