{"modulePath":"github.com/nmcclain/apex","version":"v0.6.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package function\n\nPackage function implements function-level operations.\n\n## Constants\n\n```go\nconst (\n\tRequestResponse InvocationType = \"RequestResponse\"\n\tEvent                          = \"Event\"\n\tDryRun                         = \"DryRun\"\n)\n```\nInvocation types.\n\n```go\nconst CurrentAlias = \"current\"\n```\nCurrentAlias name.\n\n## Functions\n\n```go\nfunc RegisterPlugin(name string, plugin Plugin)\n```\nRegisterPlugin registers \\`plugin\\` by \\`name\\`.\n\n## Types\n\n```go\ntype Builder interface {\n\tBuild(*Function, *archive.Archive) error\n}\n```\nBuilder reacts to the Build hook.\n\n```go\ntype Cleaner interface {\n\tClean(*Function) error\n}\n```\nCleaner reacts to the Clean hook.\n\n```go\ntype Config struct {\n\tDescription string            `json:\"description\"`\n\tRuntime     string            `json:\"runtime\" validate:\"nonzero\"`\n\tMemory      int64             `json:\"memory\" validate:\"nonzero\"`\n\tTimeout     int64             `json:\"timeout\" validate:\"nonzero\"`\n\tRole        string            `json:\"role\" validate:\"nonzero\"`\n\tHandler     string            `json:\"handler\" validate:\"nonzero\"`\n\tShim        bool              `json:\"shim\"`\n\tEnvironment map[string]string `json:\"environment\"`\n\tHooks       hooks.Hooks       `json:\"hooks\"`\n}\n```\nConfig for a Lambda function.\n\n```go\ntype Deployer interface {\n\tDeploy(*Function) error\n}\n```\nDeployer reacts to the Open hook.\n\n```go\ntype Function struct {\n\tConfig\n\tName            string\n\tFunctionName    string\n\tPath            string\n\tService         lambdaiface.LambdaAPI\n\tLog             log.Interface\n\tIgnoredPatterns []string\n\tPlugins         []string\n}\n```\nFunction represents a Lambda function, with configuration loaded from the \"function.json\" file on disk.\n\n```go\nfunc (f *Function) Build() (io.Reader, error)\n```\nBuild returns the zipped contents of the function.\n\n```go\nfunc (f *Function) BuildBytes() ([]byte, error)\n```\nBuildBytes returns the generated zip as bytes.\n\n```go\nfunc (f *Function) Clean() error\n```\nClean invokes the CleanHook, useful for removing build artifacts and so on.\n\n```go\nfunc (f *Function) Create(zip []byte) error\n```\nCreate the function with the given \\`zip\\`.\n\n```go\nfunc (f *Function) Delete() error\n```\nDelete the function including all its versions\n\n```go\nfunc (f *Function) Deploy() error\n```\nDeploy 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.\n\n```go\nfunc (f *Function) DeployCode(zip []byte, config *lambda.GetFunctionOutput) error\n```\nDeployCode deploys function code when changed.\n\n```go\nfunc (f *Function) DeployConfigAndCode(zip []byte) error\n```\nDeployConfigAndCode updates config and updates function code.\n\n```go\nfunc (f *Function) GetConfig() (*lambda.GetFunctionOutput, error)\n```\nGetConfig returns the function configuration.\n\n```go\nfunc (f *Function) GetConfigCurrent() (*lambda.GetFunctionOutput, error)\n```\nGetConfigCurrent returns the function configuration for the current version.\n\n```go\nfunc (f *Function) GetConfigQualifier(s string) (*lambda.GetFunctionOutput, error)\n```\nGetConfigQualifier returns the function configuration for the given qualifier.\n\n```go\nfunc (f *Function) GroupName() string\n```\nGroupName returns the CloudWatchLogs group name.\n\n```go\nfunc (f *Function) Invoke(event, context interface{}) (reply, logs io.Reader, err error)\n```\nInvoke the remote Lambda function, returning the response and logs, if any.\n\n```go\nfunc (f *Function) Open() error\n```\nOpen the function.json file and prime the config.\n\n```go\nfunc (f *Function) Rollback() error\n```\nRollback the function to the previous.\n\n```go\nfunc (f *Function) RollbackVersion(version string) error\n```\nRollbackVersion the function to the specified version.\n\n```go\nfunc (f *Function) Setenv(name, value string)\n```\nSetenv sets environment variable \\`name\\` to \\`value\\`.\n\n```go\nfunc (f *Function) Update(zip []byte) error\n```\nUpdate the function with the given \\`zip\\`.\n\n```go\ntype InvocationType string\n```\nInvocationType determines how an invocation request is made.\n\n```go\ntype InvokeError struct {\n\tMessage string   `json:\"errorMessage\"`\n\tType    string   `json:\"errorType\"`\n\tStack   []string `json:\"stackTrace\"`\n\tHandled bool\n}\n```\nInvokeError records an error from an invocation.\n\n```go\nfunc (e *InvokeError) Error() string\n```\nError message.\n\n```go\ntype Opener interface {\n\tOpen(*Function) error\n}\n```\nOpener reacts to the Open hook.\n\n```go\ntype Plugin interface{}\n```\nA Plugin is a chunk of isolated(ish) logic which reacts to various hooks within the system in order to implement specific features such as runtime inference or environment variable support.\n\n","path":"github.com/nmcclain/apex/function","name":"function","synopsis":"Package function implements function-level operations.","isRedistributable":true}
