Documentation
¶
Index ¶
- Constants
- Variables
- func CLI(ctx context.Context, parse CLIParseFunc) (int, error)
- func DefaultJsonnetNativeFuncs() []*jsonnet.NativeFunction
- func ToJSONString(v interface{}) string
- type App
- func (app *App) AWSAccountID(ctx context.Context) string
- func (app *App) Archive(ctx context.Context, opt *ArchiveOption) error
- func (app *App) ConfigLoader() *config.Loader
- func (app *App) Delete(ctx context.Context, opt *DeleteOption) error
- func (app *App) Deploy(ctx context.Context, opt *DeployOption) error
- func (app *App) Diff(ctx context.Context, opt *DiffOption) error
- func (app *App) Init(ctx context.Context, opt *InitOption) error
- func (app *App) Invoke(ctx context.Context, opt *InvokeOption) error
- func (app *App) JsonnetVM() *jsonnet.VM
- func (app *App) List(ctx context.Context, opt *ListOption) error
- func (app *App) Logs(ctx context.Context, opt *LogsOption) error
- func (app *App) Render(ctx context.Context, opt *RenderOption) error
- func (app *App) Rollback(ctx context.Context, opt *RollbackOption) error
- func (app *App) Status(ctx context.Context, opt *StatusOption) error
- func (app *App) Versions(ctx context.Context, opt *VersionsOption) error
- type ArchiveOption
- type CLIOptions
- type CLIParseFunc
- type CallerIdentity
- type DeleteOption
- type DeployOption
- type DiffOption
- type DryRunOption
- type ExitCode
- type ExitError
- type Function
- type FunctionURL
- type FunctionURLConfig
- type FunctionURLPermission
- type FunctionURLPermissions
- type InitOption
- type InvokeOption
- type LayerArnResolver
- type ListOption
- type LogsOption
- type Option
- type PolicyOutput
- type PolicyStatement
- type RenderOption
- type RollbackOption
- type StatusOption
- type StatusOutput
- type Tags
- type VersionsOption
- type ZipOption
Constants ¶
const ( ExitCodeOK = ExitCode(0) ExitCodeGeneralError = ExitCode(1) ExitCodeDiffFound = ExitCode(2) )
Variables ¶
var ( SidPattern = regexp.MustCompile("^lambroll-[0-9a-f]+$") SidFormat = "lambroll-%x" )
var ( // DefaultLogLevel is default log level DefaultLogLevel = "info" // IgnoreFilename defines file name includes ignore patterns at creating zip archive. IgnoreFilename = ".lambdaignore" // DefaultFunctionFilename defines file name for function definition. DefaultFunctionFilenames = []string{ "function.json", "function.jsonnet", } // DefaultFunctionURLFilenames defines file name for function URL definition. DefaultFunctionURLFilenames = []string{ "function_url.json", "function_url.jsonnet", } // FunctionZipFilename defines file name for zip archive downloaded at init. FunctionZipFilename = "function.zip" // DefaultExcludes is a preset excludes file list DefaultExcludes = []string{ IgnoreFilename, DefaultFunctionFilenames[0], DefaultFunctionFilenames[1], DefaultFunctionURLFilenames[0], DefaultFunctionURLFilenames[1], FunctionZipFilename, ".git/*", ".terraform/*", "terraform.tfstate", } // CurrentAliasName is alias name for current deployed function CurrentAliasName = "current" )
var ErrDiff = &ExitError{Code: ExitCodeDiffFound, Err: nil}
var Setenv = os.Setenv
var Version = "v1.4.1"
Functions ¶
func DefaultJsonnetNativeFuncs ¶ added in v1.1.0
func DefaultJsonnetNativeFuncs() []*jsonnet.NativeFunction
func ToJSONString ¶ added in v1.0.0
func ToJSONString(v interface{}) string
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents lambroll application
func (*App) AWSAccountID ¶
AWSAccountID returns AWS account ID in current session
func (*App) Archive ¶ added in v0.2.0
func (app *App) Archive(ctx context.Context, opt *ArchiveOption) error
Archive archives zip
func (*App) ConfigLoader ¶ added in v1.2.0
func (*App) Delete ¶ added in v0.1.0
func (app *App) Delete(ctx context.Context, opt *DeleteOption) error
Delete deletes function
func (*App) Deploy ¶
func (app *App) Deploy(ctx context.Context, opt *DeployOption) error
Deploy deploys a new lambda function code
func (*App) Diff ¶ added in v0.8.0
func (app *App) Diff(ctx context.Context, opt *DiffOption) error
Diff prints diff of function.json compared with latest function
func (*App) Init ¶
func (app *App) Init(ctx context.Context, opt *InitOption) error
Init initializes function.json
func (*App) Invoke ¶ added in v0.1.0
func (app *App) Invoke(ctx context.Context, opt *InvokeOption) error
Invoke invokes function
func (*App) List ¶
func (app *App) List(ctx context.Context, opt *ListOption) error
List lists lambda functions
func (*App) Render ¶ added in v1.0.0
func (app *App) Render(ctx context.Context, opt *RenderOption) error
Invoke invokes function
func (*App) Rollback ¶ added in v0.1.0
func (app *App) Rollback(ctx context.Context, opt *RollbackOption) error
Rollback rollbacks function
type ArchiveOption ¶ added in v1.0.0
type CLIOptions ¶ added in v1.0.0
type CLIOptions struct {
Option
Deploy *DeployOption `cmd:"deploy" help:"deploy or create function"`
Init *InitOption `cmd:"init" help:"init function.json"`
List *ListOption `cmd:"list" help:"list functions"`
Rollback *RollbackOption `cmd:"rollback" help:"rollback function"`
Invoke *InvokeOption `cmd:"invoke" help:"invoke function"`
Archive *ArchiveOption `cmd:"archive" help:"archive function"`
Logs *LogsOption `cmd:"logs" help:"show logs of function"`
Diff *DiffOption `cmd:"diff" help:"show diff of function"`
Render *RenderOption `cmd:"render" help:"render function.json"`
Status *StatusOption `cmd:"status" help:"show status of function"`
Delete *DeleteOption `cmd:"delete" help:"delete function"`
Versions *VersionsOption `cmd:"versions" help:"show versions of function"`
Version struct{} `cmd:"version" help:"show version"`
}
type CLIParseFunc ¶ added in v1.0.0
type CLIParseFunc func([]string) (string, *CLIOptions, func(), error)
type CallerIdentity ¶ added in v1.1.0
type CallerIdentity struct {
Resolver func(ctx context.Context) (*sts.GetCallerIdentityOutput, error)
// contains filtered or unexported fields
}
func (*CallerIdentity) Account ¶ added in v1.1.0
func (c *CallerIdentity) Account(ctx context.Context) string
func (*CallerIdentity) FuncMap ¶ added in v1.1.0
func (c *CallerIdentity) FuncMap(ctx context.Context) template.FuncMap
func (*CallerIdentity) JsonnetNativeFuncs ¶ added in v1.1.0
func (c *CallerIdentity) JsonnetNativeFuncs(ctx context.Context) []*jsonnet.NativeFunction
type DeleteOption ¶ added in v0.1.0
type DeleteOption struct {
Force bool `help:"delete without confirmation" default:"false"`
DryRunOption
}
DeleteOption represents options for Delete()
type DeployOption ¶
type DeployOption struct {
Src string `help:"function zip archive or src dir" default:"."`
Publish bool `help:"publish function" default:"true"`
AliasName string `name:"alias" help:"alias name for publish" default:"current"`
AliasToLatest bool `help:"set alias to unpublished $LATEST version" default:"false"`
SkipArchive bool `help:"skip to create zip archive. requires Code.S3Bucket and Code.S3Key in function definition" default:"false"`
KeepVersions int `help:"Number of latest versions to keep. Older versions will be deleted. (Optional value: default 0)." default:"0"`
Ignore string `help:"ignore fields by jq queries in function.json" default:""`
FunctionURL string `help:"path to function-url definition" default:"" env:"LAMBROLL_FUNCTION_URL"`
SkipConfiguration bool `help:"skip updating function configuration, deploy function code and aliases only" default:"false"`
SkipFunction bool `help:"skip to deploy a function. deploy function-url only" default:"false"`
DryRunOption
ZipOption
}
DeployOption represents an option for Deploy()
func (*DeployOption) String ¶ added in v0.2.0
func (opt *DeployOption) String() string
type DiffOption ¶ added in v0.8.0
type DiffOption struct {
Src string `help:"function zip archive or src dir" default:"."`
CodeSha256 bool `name:"code" help:"diff of code sha256" default:"false"`
Qualifier *string `help:"the qualifier to compare"`
FunctionURL string `help:"path to function-url definition" default:"" env:"LAMBROLL_FUNCTION_URL"`
Ignore string `help:"ignore diff by jq query" default:""`
ExitCode bool `help:"exit with code 2 if there are differences" default:"false"`
SkipFunction bool `help:"skip function diff. shows function-url only" default:"false"`
ZipOption
}
DiffOption represents options for Diff()
type DryRunOption ¶ added in v1.4.0
type DryRunOption struct {
DryRun bool `default:"false" help:"dry run"`
}
type Function ¶ added in v0.1.0
type Function lambda.CreateFunctionInput
Function represents configuration of Lambda function type Function = lambda.CreateFunctionInput
type FunctionURL ¶ added in v1.0.0
type FunctionURL struct {
Config *FunctionURLConfig `json:"Config"`
Permissions FunctionURLPermissions `json:"Permissions"`
}
func (*FunctionURL) RemovePermissionInput ¶ added in v1.0.4
func (fc *FunctionURL) RemovePermissionInput(sid string) *lambda.RemovePermissionInput
func (*FunctionURL) Validate ¶ added in v1.0.0
func (f *FunctionURL) Validate(functionName string) error
type FunctionURLConfig ¶ added in v1.0.0
type FunctionURLConfig = lambda.CreateFunctionUrlConfigInput
type FunctionURLPermission ¶ added in v1.0.0
type FunctionURLPermission struct {
Principal *string `json:"Principal,omitempty"`
PrincipalOrgID *string `json:"PrincipalOrgID,omitempty"`
SourceArn *string `json:"SourceArn,omitempty"`
SourceAccount *string `json:"SourceAccount,omitempty"`
// contains filtered or unexported fields
}
func (*FunctionURLPermission) AddPermissionInputs ¶ added in v1.4.0
func (p *FunctionURLPermission) AddPermissionInputs(fc *FunctionURL) []*lambda.AddPermissionInput
func (*FunctionURLPermission) Equals ¶ added in v1.4.0
func (p *FunctionURLPermission) Equals(o *FunctionURLPermission) bool
func (*FunctionURLPermission) String ¶ added in v1.4.0
func (p *FunctionURLPermission) String() string
type FunctionURLPermissions ¶ added in v1.0.0
type FunctionURLPermissions []*FunctionURLPermission
type InitOption ¶
type InitOption struct {
FunctionName *string `help:"Function name for init" required:"true" default:""`
DownloadZip bool `name:"download" help:"Download function.zip" default:"false"`
Unzip bool `help:"Unzip function.zip and delete it" default:"false"`
Src string `help:"Source directory for unzipping function.zip" default:"."`
Jsonnet bool `help:"render function.json as jsonnet" default:"false"`
Qualifier *string `help:"function version or alias"`
FunctionURL bool `help:"create function url definition file" default:"false"`
ForceOverwrite bool `help:"Overwrite existing files without prompting" default:"false"`
}
InitOption represents options for Init()
type InvokeOption ¶ added in v0.1.0
type InvokeOption struct {
Async bool `default:"false" help:"invocation type async"`
LogTail bool `default:"false" help:"output tail of log to STDERR"`
Qualifier *string `help:"version or alias to invoke"`
Payload *string `help:"payload to invoke. if not specified, read from STDIN"`
}
InvokeOption represents option for Invoke()
type LayerArnResolver ¶ added in v1.2.0
type LayerArnResolver struct {
// contains filtered or unexported fields
}
func (*LayerArnResolver) FuncMap ¶ added in v1.2.0
func (r *LayerArnResolver) FuncMap(ctx context.Context) template.FuncMap
func (*LayerArnResolver) JsonnetNativeFuncs ¶ added in v1.2.0
func (r *LayerArnResolver) JsonnetNativeFuncs(ctx context.Context) []*jsonnet.NativeFunction
type LogsOption ¶ added in v0.4.0
type LogsOption struct {
Since *string `help:"From what time to begin displaying logs" default:"10m"`
Follow *bool `help:"follow new logs" default:"false"`
Format *string `help:"The format to display the logs" default:"detailed" enum:"detailed,short,json"`
FilterPattern *string `help:"The filter pattern to use"`
}
type Option ¶ added in v0.5.0
type Option struct {
OptionFilePath string `help:"option file path" env:"LAMBROLL_OPTION" name:"option" json:"-"`
Function string `help:"Function file path" env:"LAMBROLL_FUNCTION" json:"function,omitempty"`
LogLevel string `` /* 142-byte string literal not displayed */
LogFormat string `help:"log format (text, json)" default:"text" enum:",text,json" env:"LAMBROLL_LOGFORMAT" json:"log_format"`
Color bool `help:"enable colored output" default:"true" env:"LAMBROLL_COLOR" negatable:"" json:"color,omitempty"`
Region *string `help:"AWS region" env:"AWS_REGION" json:"region,omitempty"`
Profile *string `help:"AWS credential profile name" env:"AWS_PROFILE" json:"profile,omitempty"`
TFState *string `name:"tfstate" help:"URL to terraform.tfstate" env:"LAMBROLL_TFSTATE" json:"tfstate,omitempty"`
PrefixedTFState map[string]string `` /* 181-byte string literal not displayed */
Endpoint *string `help:"AWS API Lambda Endpoint" env:"AWS_LAMBDA_ENDPOINT" json:"endpoint,omitempty"`
Envfile []string `help:"environment files" env:"LAMBROLL_ENVFILE" json:"envfile,omitempty"`
ExtStr map[string]string `help:"external string values for Jsonnet" env:"LAMBROLL_EXTSTR" json:"ext_str,omitempty"`
ExtCode map[string]string `help:"external code values for Jsonnet" env:"LAMBROLL_EXTCODE" json:"ext_code,omitempty"`
}
func (*Option) UnmarshalJSON ¶ added in v1.3.1
UnmarshalJSON implements custom JSON unmarshaling to support both old and new field names TODO: Remove backward compatibility for extstr/extcode fields in v2
type PolicyOutput ¶ added in v1.0.0
type PolicyOutput struct {
Id string `json:"Id"`
Version string `json:"Version"`
Statement []PolicyStatement `json:"Statement"`
}
type PolicyStatement ¶ added in v1.0.0
type PolicyStatement struct {
Sid string `json:"Sid"`
Effect string `json:"Effect"`
Principal any `json:"Principal"`
Action string `json:"Action"`
Resource any `json:"Resource"`
Condition any `json:"Condition"`
}
func (*PolicyStatement) PrincipalOrgID ¶ added in v1.0.0
func (ps *PolicyStatement) PrincipalOrgID() *string
func (*PolicyStatement) PrincipalString ¶ added in v1.0.4
func (ps *PolicyStatement) PrincipalString() *string
func (*PolicyStatement) SourceAccount ¶ added in v1.4.0
func (ps *PolicyStatement) SourceAccount() *string
func (*PolicyStatement) SourceArn ¶ added in v1.0.4
func (ps *PolicyStatement) SourceArn() *string
type RenderOption ¶ added in v1.0.0
type RollbackOption ¶ added in v0.1.0
type RollbackOption struct {
Alias string `default:"current" help:"alias to rollback"`
Version string `default:"" help:"version to rollback (default: previous version auto detected)"`
DeleteVersion bool `default:"false" help:"delete rolled back version"`
DryRunOption
}
RollbackOption represents option for Rollback()
type StatusOption ¶ added in v1.0.0
type StatusOption struct {
Qualifier *string `help:"compare with"`
Output string `help:"output format" default:"table" enum:"table,json"`
}
StatusOption represents options for Status()
type StatusOutput ¶ added in v1.0.0
type StatusOutput struct {
FunctionName string `json:"FunctionName"`
FunctionArn string `json:"FunctionArn"`
Version string `json:"Version"`
Runtime string `json:"Runtime,omitempty"`
PackageType string `json:"PackageType"`
State string `json:"State"`
LastUpdateState string `json:"LastUpdateState"`
FunctionURL string `json:"FunctionURL,omitempty"`
}
func (*StatusOutput) String ¶ added in v1.0.0
func (o *StatusOutput) String() string
type VersionsOption ¶ added in v0.12.0
type VersionsOption struct {
Output string `default:"table" enum:"table,json,tsv" help:"output format (table,json,tsv)"`
Delete bool `default:"false" help:"delete older versions"`
KeepVersions int `default:"0" help:"Number of latest versions to keep. Older versions will be deleted with --delete."`
}
VersionsOption represents options for Versions()