Documentation
¶
Index ¶
- Constants
- Variables
- func CLI(ctx context.Context, parse CLIParseFunc) (int, error)
- func DefaultJsonnetNativeFuncs() []*jsonnet.NativeFunction
- func ToJSONString(v any) 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 RequireStrictLoader
- 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.5.0"
Functions ¶
func DefaultJsonnetNativeFuncs ¶ added in v1.1.0
func DefaultJsonnetNativeFuncs() []*jsonnet.NativeFunction
func ToJSONString ¶ added in v1.0.0
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" json:"deploy,omitempty"`
Init *InitOption `cmd:"init" help:"init function.json" json:"init,omitempty"`
List *ListOption `cmd:"list" help:"list functions" json:"list,omitempty"`
Rollback *RollbackOption `cmd:"rollback" help:"rollback function" json:"rollback,omitempty"`
Invoke *InvokeOption `cmd:"invoke" help:"invoke function" json:"invoke,omitempty"`
Archive *ArchiveOption `cmd:"archive" help:"archive function" json:"archive,omitempty"`
Logs *LogsOption `cmd:"logs" help:"show logs of function" json:"logs,omitempty"`
Diff *DiffOption `cmd:"diff" help:"show diff of function" json:"diff,omitempty"`
Render *RenderOption `cmd:"render" help:"render function.json" json:"render,omitempty"`
Status *StatusOption `cmd:"status" help:"show status of function" json:"status,omitempty"`
Delete *DeleteOption `cmd:"delete" help:"delete function" json:"delete,omitempty"`
Versions *VersionsOption `cmd:"versions" help:"show versions of function" json:"versions,omitempty"`
Version struct{} `cmd:"version" help:"show version" json:"-"`
// LegacyExtStr and LegacyExtCode accept the pre-v1.3.1 option file key
// names (extstr/extcode). They are excluded from CLI parsing (kong:"-")
// and only exist so the strict loader accepts these deprecated keys;
// applyLegacyExtVars folds them into ExtStr/ExtCode.
// TODO: Remove in v2.
LegacyExtStr map[string]string `kong:"-" json:"extstr,omitempty"`
LegacyExtCode map[string]string `kong:"-" json:"extcode,omitempty"`
}
CLIOptions is both the kong parse target for the command line and the schema of the option file (--option). Global flags are placed at the top level (flat, via the embedded Option), while subcommand-specific flags are nested under the subcommand name. The json tag of each command field must match its cmd name so the option file resolver can scope lookups by subcommand.
func (CLIOptions) RequireStrict ¶ added in v1.5.0
func (CLIOptions) RequireStrict()
RequireStrict marks CLIOptions as a strict definition loader: when loaded from a file, unknown keys are rejected instead of warned and ignored. An option file is equivalent to specifying flags, so an unknown key is treated the same as an unknown flag.
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" json:"force,omitempty"`
DryRunOption
}
DeleteOption represents options for Delete()
type DeployOption ¶
type DeployOption struct {
Src string `help:"function zip archive or src dir" default:"." json:"src,omitempty"`
Publish bool `help:"publish function" default:"true" negatable:"" json:"publish,omitempty"`
AliasName string `name:"alias" help:"alias name for publish" default:"current" json:"alias,omitempty"`
AliasToLatest bool `help:"set alias to unpublished $LATEST version" default:"false" json:"alias_to_latest,omitempty"`
SkipArchive bool `` /* 141-byte string literal not displayed */
KeepVersions int `` /* 145-byte string literal not displayed */
Ignore string `help:"ignore fields by jq queries in function.json" default:"" json:"ignore,omitempty"`
FunctionURL string `help:"path to function-url definition" default:"" env:"LAMBROLL_FUNCTION_URL" json:"function_url,omitempty"`
SkipConfiguration bool `` /* 134-byte string literal not displayed */
SkipFunction bool `help:"skip to deploy a function. deploy function-url only" default:"false" json:"skip_function,omitempty"`
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:"." json:"src,omitempty"`
CodeSha256 bool `name:"code" help:"diff of code sha256" default:"false" json:"code,omitempty"`
Qualifier *string `help:"the qualifier to compare" json:"qualifier,omitempty"`
FunctionURL string `help:"path to function-url definition" default:"" env:"LAMBROLL_FUNCTION_URL" json:"function_url,omitempty"`
Ignore string `help:"ignore diff by jq query" default:"" json:"ignore,omitempty"`
ExitCode bool `help:"exit with code 2 if there are differences" default:"false" json:"exit_code,omitempty"`
SkipFunction bool `help:"skip function diff. shows function-url only" default:"false" json:"skip_function,omitempty"`
External string `help:"external command to display diff" default:"" env:"LAMBROLL_DIFF_COMMAND" json:"external,omitempty"`
Mask []string `help:"mask values in diff output by jq selector or environment variable name (repeatable)" json:"mask,omitempty"`
ZipOption
// contains filtered or unexported fields
}
DiffOption represents options for Diff()
type DryRunOption ¶ added in v1.4.0
type DryRunOption struct {
DryRun bool `default:"false" help:"dry run" json:"dry_run,omitempty"`
}
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:"" json:"function_name,omitempty"`
DownloadZip bool `name:"download" help:"Download function.zip" default:"false" json:"download,omitempty"`
Unzip bool `help:"Unzip function.zip and delete it" default:"false" json:"unzip,omitempty"`
Src string `help:"Source directory for unzipping function.zip" default:"." json:"src,omitempty"`
Jsonnet bool `help:"render function.json as jsonnet" default:"false" json:"jsonnet,omitempty"`
Qualifier *string `help:"function version or alias" json:"qualifier,omitempty"`
FunctionURL bool `help:"create function url definition file" default:"false" json:"function_url,omitempty"`
ForceOverwrite bool `help:"Overwrite existing files without prompting" default:"false" json:"force_overwrite,omitempty"`
}
InitOption represents options for Init()
type InvokeOption ¶ added in v0.1.0
type InvokeOption struct {
Async bool `default:"false" help:"invocation type async" json:"async,omitempty"`
LogTail bool `default:"false" help:"output tail of log to STDERR" json:"log_tail,omitempty"`
Qualifier *string `help:"version or alias to invoke" json:"qualifier,omitempty"`
Payload *string `help:"payload to invoke. if not specified, read from STDIN" json:"payload,omitempty"`
TenantID *string `help:"tenant ID for multi-tenant invocation" json:"tenant_id,omitempty"`
}
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" json:"since,omitempty"`
Follow *bool `help:"follow new logs" default:"false" json:"follow,omitempty"`
Format *string `help:"The format to display the logs" default:"detailed" enum:"detailed,short,json" json:"format,omitempty"`
FilterPattern *string `help:"The filter pattern to use" json:"filter_pattern,omitempty"`
}
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"`
}
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 RenderOption struct {
Jsonnet bool `default:"false" help:"render function.json as jsonnet" json:"jsonnet,omitempty"`
FunctionURL string `help:"render function-url definition file" default:"" env:"LAMBROLL_FUNCTION_URL" json:"function_url,omitempty"`
Mask []string `help:"mask values in rendered output by jq selector or environment variable name (repeatable)" json:"mask,omitempty"`
}
type RequireStrictLoader ¶ added in v1.5.0
type RequireStrictLoader interface {
RequireStrict()
}
RequireStrictLoader is implemented by definition types that must reject unknown keys when loaded from a file, instead of warning and ignoring them. Types that do not implement it keep the lenient behavior (warn and continue), which is useful for files that mirror evolving AWS API structures.
type RollbackOption ¶ added in v0.1.0
type RollbackOption struct {
Alias string `default:"current" help:"alias to rollback" json:"alias,omitempty"`
Version string `default:"" help:"version to rollback (default: previous version auto detected)" json:"version,omitempty"`
DeleteVersion bool `default:"false" help:"delete rolled back version" json:"delete_version,omitempty"`
DryRunOption
}
RollbackOption represents option for Rollback()
type StatusOption ¶ added in v1.0.0
type StatusOption struct {
Qualifier *string `help:"compare with" json:"qualifier,omitempty"`
Output string `help:"output format" default:"table" enum:"table,json" json:"output,omitempty"`
}
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)" json:"output,omitempty"`
Delete bool `default:"false" help:"delete older versions" json:"delete,omitempty"`
KeepVersions int `` /* 130-byte string literal not displayed */
}
VersionsOption represents options for Versions()