Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package function implements function-level operations.
Index ¶
- Constants
 - func RegisterPlugin(name string, plugin Plugin)
 - type Builder
 - type Cleaner
 - type Config
 - type Deployer
 - type Function
 - func (f *Function) AWSConfig() *aws.Config
 - 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) CreateOrUpdateAlias(alias, version string) error
 - func (f *Function) Delete() error
 - func (f *Function) Deploy() error
 - func (f *Function) DeployCode(zip []byte, config *lambda.GetFunctionOutput) error
 - func (f *Function) DeployConfigAndCode(zip []byte) error
 - func (f *Function) GetAliases() (*lambda.ListAliasesOutput, error)
 - func (f *Function) GetConfig() (*lambda.GetFunctionOutput, error)
 - func (f *Function) GetConfigCurrent() (*lambda.GetFunctionOutput, error)
 - func (f *Function) GetConfigQualifier(s string) (*lambda.GetFunctionOutput, error)
 - func (f *Function) GetVersionFromAlias(alias string) (string, error)
 - func (f *Function) GroupName() string
 - func (f *Function) Invoke(event, context interface{}) (reply, logs io.Reader, err error)
 - func (f *Function) Open(environment string) 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
 - func (f *Function) ZipBytes() ([]byte, error)
 
- type InvocationType
 - type InvokeError
 - type Opener
 - type Plugin
 
Constants ¶
const ( RequestResponse InvocationType = "RequestResponse" Event = "Event" DryRun = "DryRun" )
Invocation types.
const CurrentAlias = "current"
    CurrentAlias name.
Variables ¶
This section is empty.
Functions ¶
func RegisterPlugin ¶
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"`
	RetainedVersions *int              `json:"retainedVersions"`
	VPC              vpc.VPC           `json:"vpc"`
	KMSKeyArn        string            `json:"kms_arn"`
	DeadLetterARN    string            `json:"deadletter_arn"`
	Region           string            `json:"region"`
	Edge             bool              `json:"edge"`
	Zip              string            `json:"zip"`
}
    Config for a Lambda function.
type Function ¶
type Function struct {
	Config
	Name         string
	FunctionName string
	Path         string
	Service      lambdaiface.LambdaAPI
	Log          log.Interface
	IgnoreFile   []byte
	Plugins      []string
	Alias        string
}
    Function represents a Lambda function, with configuration loaded from the "function.json" file on disk.
func (*Function) BuildBytes ¶
BuildBytes returns the generated zip as bytes.
func (*Function) Clean ¶
Clean invokes the CleanHook, useful for removing build artifacts and so on.
func (*Function) CreateOrUpdateAlias ¶
CreateOrUpdateAlias attempts creating the alias, or updates if it already exists.
func (*Function) Deploy ¶
Deploy generates a zip and creates or deploy the function. If the configuration hasn't been changed it will deploy only code, otherwise it will deploy both configuration and code.
func (*Function) DeployCode ¶
func (f *Function) DeployCode(zip []byte, config *lambda.GetFunctionOutput) error
DeployCode deploys function code when changed.
func (*Function) DeployConfigAndCode ¶
DeployConfigAndCode updates config and updates function code.
func (*Function) GetAliases ¶
func (f *Function) GetAliases() (*lambda.ListAliasesOutput, error)
GetAliases fetches a list of aliases for the function.
func (*Function) GetConfig ¶
func (f *Function) GetConfig() (*lambda.GetFunctionOutput, error)
GetConfig returns the function configuration.
func (*Function) GetConfigCurrent ¶
func (f *Function) GetConfigCurrent() (*lambda.GetFunctionOutput, error)
GetConfigCurrent returns the function configuration for the current version.
func (*Function) GetConfigQualifier ¶
func (f *Function) GetConfigQualifier(s string) (*lambda.GetFunctionOutput, error)
GetConfigQualifier returns the function configuration for the given qualifier.
func (*Function) GetVersionFromAlias ¶
Return function version from alias name, if alias not found, return the input
func (*Function) Invoke ¶
Invoke the remote Lambda function, returning the response and logs, if any.
func (*Function) RollbackVersion ¶
RollbackVersion the function to the specified version.
type InvocationType ¶
type InvocationType string
InvocationType determines how an invocation request is made.