Documentation
¶
Overview ¶
Package lamvms provides a deployment tool for AWS Lambda MicroVMs.
Index ¶
- Constants
- Variables
- func CLI(ctx context.Context, parse CLIParseFunc) (int, error)
- type App
- func (app *App) Curl(ctx context.Context, opt *CurlOption) error
- 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) Logs(ctx context.Context, opt *LogsOption) error
- func (app *App) Resume(ctx context.Context, opt *ResumeOption) error
- func (app *App) Rollback(ctx context.Context, opt *RollbackOption) error
- func (app *App) Run(ctx context.Context, opt *RunOption) error
- func (app *App) Shell(ctx context.Context, opt *ShellOption) error
- func (app *App) Suspend(ctx context.Context, opt *SuspendOption) error
- func (app *App) Terminate(ctx context.Context, opt *TerminateOption) error
- func (app *App) Wait(ctx context.Context, opt *WaitOption) error
- type CLIOptions
- type CLIParseFunc
- type CallerIdentityData
- type CurlOption
- type DeleteOption
- type DeployOption
- type DiffOption
- type InitOption
- type LambdaMicroVMsClient
- type Loader
- type LogsOption
- type MicrovmImage
- type Option
- type ResumeOption
- type RollbackOption
- type RunConfig
- type RunOption
- type ShellOption
- type SuspendOption
- type TerminateOption
- type WaitOption
Constants ¶
const IgnoreFilename = ".microvmignore"
IgnoreFilename is the name of the file listing exclusion patterns for zip archive creation.
Variables ¶
var DefaultMicrovmFiles = []string{
"microvm.jsonnet",
"microvm.json",
}
DefaultMicrovmFiles is the list of default file names to search for.
var ErrDiff = errors.New("diff found")
ErrDiff indicates that differences were found between local and remote configurations.
var Version = "v0.0.1"
Version is the lamvms version string, rewritten by tagpr on release.
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents lamvms application.
func (*App) Curl ¶
func (app *App) Curl(ctx context.Context, opt *CurlOption) error
Curl sends a request to a running MicroVM via curl.
func (*App) Delete ¶
func (app *App) Delete(ctx context.Context, opt *DeleteOption) error
Delete deletes a MicroVM image.
func (*App) Deploy ¶
func (app *App) Deploy(ctx context.Context, opt *DeployOption) error
Deploy deploys a MicroVM image.
func (*App) Diff ¶
func (app *App) Diff(ctx context.Context, opt *DiffOption) error
Diff shows the diff between local and deployed MicroVM image configuration.
func (*App) Logs ¶
func (app *App) Logs(ctx context.Context, opt *LogsOption) error
Logs tails CloudWatch logs for the MicroVM image.
func (*App) Resume ¶
func (app *App) Resume(ctx context.Context, opt *ResumeOption) error
Resume resumes a suspended MicroVM.
func (*App) Rollback ¶
func (app *App) Rollback(ctx context.Context, opt *RollbackOption) error
Rollback deactivates the latest active version.
func (*App) Shell ¶
func (app *App) Shell(ctx context.Context, opt *ShellOption) error
Shell opens an interactive shell session to a running MicroVM.
func (*App) Suspend ¶
func (app *App) Suspend(ctx context.Context, opt *SuspendOption) error
Suspend suspends a running MicroVM.
type CLIOptions ¶
type CLIOptions struct {
Option
Init *InitOption `cmd:"init" help:"Initialize a microvm definition from an existing image." json:"init,omitempty"`
Deploy *DeployOption `cmd:"deploy" help:"Deploy a MicroVM image." json:"deploy,omitempty"`
Diff *DiffOption `cmd:"diff" help:"Show diff between local and deployed configuration." json:"diff,omitempty"`
Wait *WaitOption `cmd:"wait" help:"Wait for a MicroVM image to be ready." json:"wait,omitempty"`
Rollback *RollbackOption `cmd:"rollback" help:"Rollback to the previous active version." json:"rollback,omitempty"`
Run *RunOption `cmd:"run" help:"Run a new MicroVM." json:"run,omitempty"`
Suspend *SuspendOption `cmd:"suspend" help:"Suspend a running MicroVM." json:"suspend,omitempty"`
Resume *ResumeOption `cmd:"resume" help:"Resume a suspended MicroVM." json:"resume,omitempty"`
Terminate *TerminateOption `cmd:"terminate" help:"Terminate a MicroVM." json:"terminate,omitempty"`
Shell *ShellOption `cmd:"shell" help:"Open a shell session to a running MicroVM." json:"shell,omitempty"`
Curl *CurlOption `cmd:"curl" help:"Send a request to a running MicroVM via curl." json:"curl,omitempty"`
Delete *DeleteOption `cmd:"delete" help:"Delete a MicroVM image." json:"delete,omitempty"`
Logs *LogsOption `cmd:"logs" help:"Show CloudWatch logs of a MicroVM image." json:"logs,omitempty"`
Skills *skillscmd.Commands `cmd:"skills" help:"Manage agent skills." json:"-"`
Version struct{} `cmd:"version" help:"Show version." json:"-"`
}
CLIOptions combines global options with subcommand definitions.
type CLIParseFunc ¶
type CLIParseFunc func([]string) (string, *CLIOptions, func(), error)
CLIParseFunc is the signature of the CLI parser function.
type CallerIdentityData ¶
CallerIdentityData is the data exposed to templates.
type CurlOption ¶
type CurlOption struct {
MicrovmID string `help:"MicroVM ID. If omitted, select interactively." json:"microvm_id,omitempty"`
Port int `help:"Target port." default:"0" json:"port,omitempty"`
TokenExpiration time.Duration `help:"Auth token expiration duration." default:"5m" name:"token-expiration" json:"token_expiration,omitempty"`
Path string `arg:"" help:"Request path."`
Args []string `arg:"" optional:"" passthrough:"" help:"Arguments passed to curl."`
}
CurlOption represents options for the curl subcommand.
type DeleteOption ¶
type DeleteOption struct {
DryRun bool `help:"Dry run." default:"false" json:"dry_run,omitempty"`
}
DeleteOption represents options for the delete subcommand.
type DeployOption ¶
type DeployOption struct {
Src string `help:"Source directory to archive and upload. Defaults to the directory of the microvm definition file." json:"src,omitempty"`
SkipArchive bool `help:"Skip creating and uploading zip archive." default:"false" json:"skip_archive,omitempty"`
Wait bool `help:"Wait for the image build to complete." default:"true" negatable:"" json:"wait,omitempty"`
KeepVersions int `help:"Number of latest versions to keep. Older versions will be deleted." default:"0" json:"keep_versions,omitempty"`
DryRun bool `help:"Dry run." default:"false" json:"dry_run,omitempty"`
}
DeployOption represents options for the deploy subcommand.
type DiffOption ¶
type DiffOption struct {
ExitCode bool `help:"Exit with code 2 if there are differences." default:"false" json:"exit_code,omitempty"`
}
DiffOption represents options for the diff subcommand.
type InitOption ¶
type InitOption struct {
ImageName string `help:"Name of the existing MicroVM image." required:"true" name:"image-name" json:"image_name,omitempty"`
Output string `help:"Output file path." default:"microvm.json" json:"output,omitempty"`
Jsonnet bool `help:"Output as .jsonnet format." default:"false" json:"jsonnet,omitempty"`
ForceOverwrite bool `help:"Overwrite existing files without prompting." default:"false" json:"force_overwrite,omitempty"`
}
InitOption represents options for the init subcommand.
type LambdaMicroVMsClient ¶
type LambdaMicroVMsClient interface {
CreateMicrovmImage(ctx context.Context, params *lambdamicrovms.CreateMicrovmImageInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.CreateMicrovmImageOutput, error)
UpdateMicrovmImage(ctx context.Context, params *lambdamicrovms.UpdateMicrovmImageInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.UpdateMicrovmImageOutput, error)
GetMicrovmImage(ctx context.Context, params *lambdamicrovms.GetMicrovmImageInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.GetMicrovmImageOutput, error)
GetMicrovmImageVersion(ctx context.Context, params *lambdamicrovms.GetMicrovmImageVersionInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.GetMicrovmImageVersionOutput, error)
UpdateMicrovmImageVersion(ctx context.Context, params *lambdamicrovms.UpdateMicrovmImageVersionInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.UpdateMicrovmImageVersionOutput, error)
DeleteMicrovmImageVersion(ctx context.Context, params *lambdamicrovms.DeleteMicrovmImageVersionInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.DeleteMicrovmImageVersionOutput, error)
ListMicrovmImages(ctx context.Context, params *lambdamicrovms.ListMicrovmImagesInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.ListMicrovmImagesOutput, error)
ListMicrovmImageVersions(ctx context.Context, params *lambdamicrovms.ListMicrovmImageVersionsInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.ListMicrovmImageVersionsOutput, error)
ListMicrovmImageBuilds(ctx context.Context, params *lambdamicrovms.ListMicrovmImageBuildsInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.ListMicrovmImageBuildsOutput, error)
RunMicrovm(ctx context.Context, params *lambdamicrovms.RunMicrovmInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.RunMicrovmOutput, error)
GetMicrovm(ctx context.Context, params *lambdamicrovms.GetMicrovmInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.GetMicrovmOutput, error)
SuspendMicrovm(ctx context.Context, params *lambdamicrovms.SuspendMicrovmInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.SuspendMicrovmOutput, error)
ResumeMicrovm(ctx context.Context, params *lambdamicrovms.ResumeMicrovmInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.ResumeMicrovmOutput, error)
TerminateMicrovm(ctx context.Context, params *lambdamicrovms.TerminateMicrovmInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.TerminateMicrovmOutput, error)
ListMicrovms(ctx context.Context, params *lambdamicrovms.ListMicrovmsInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.ListMicrovmsOutput, error)
DeleteMicrovmImage(ctx context.Context, params *lambdamicrovms.DeleteMicrovmImageInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.DeleteMicrovmImageOutput, error)
ListTags(ctx context.Context, params *lambdamicrovms.ListTagsInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.ListTagsOutput, error)
TagResource(ctx context.Context, params *lambdamicrovms.TagResourceInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.TagResourceOutput, error)
UntagResource(ctx context.Context, params *lambdamicrovms.UntagResourceInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.UntagResourceOutput, error)
CreateMicrovmAuthToken(ctx context.Context, params *lambdamicrovms.CreateMicrovmAuthTokenInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.CreateMicrovmAuthTokenOutput, error)
CreateMicrovmShellAuthToken(ctx context.Context, params *lambdamicrovms.CreateMicrovmShellAuthTokenInput, optFns ...func(*lambdamicrovms.Options)) (*lambdamicrovms.CreateMicrovmShellAuthTokenOutput, error)
}
LambdaMicroVMsClient is the interface for AWS Lambda MicroVMs API operations.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads and evaluates microvm definition files.
type LogsOption ¶
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"`
}
LogsOption represents options for the logs subcommand.
type MicrovmImage ¶
type MicrovmImage lambdamicrovms.CreateMicrovmImageInput
MicrovmImage represents configuration based on CreateMicrovmImageInput.
func (MicrovmImage) MarshalJSON ¶
func (m MicrovmImage) MarshalJSON() ([]byte, error)
MarshalJSON implements custom marshaling for MicrovmImage.
func (*MicrovmImage) UnmarshalJSON ¶
func (m *MicrovmImage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom unmarshaling for MicrovmImage.
type Option ¶
type Option struct {
Microvm string `help:"Path to microvm definition file." name:"microvm" env:"LAMVMS_MICROVM" json:"microvm,omitempty"`
LogLevel string `` /* 128-byte string literal not displayed */
LogFormat string `help:"Log format (text, json)." default:"text" enum:",text,json" env:"LAMVMS_LOGFORMAT" json:"log_format"`
Color bool `help:"Enable colored output." default:"true" env:"LAMVMS_COLOR" negatable:"" json:"color,omitempty"`
FilterCommand string `help:"Filter command for interactive selection (e.g. peco, fzf)." env:"LAMVMS_FILTER_COMMAND" json:"filter_command,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"`
Endpoint *string `help:"AWS API endpoint." env:"AWS_ENDPOINT_URL" json:"endpoint,omitempty"`
Envfile []string `help:"Environment files." env:"LAMVMS_ENVFILE" json:"envfile,omitempty"`
ExtStr map[string]string `help:"Jsonnet external variables." short:"V" json:"ext_str,omitempty"`
ExtCode map[string]string `help:"Jsonnet external code." name:"ext-code" json:"ext_code,omitempty"`
}
Option holds global flags shared across all subcommands.
type ResumeOption ¶
type ResumeOption struct {
MicrovmID string `arg:"" optional:"" help:"MicroVM ID to resume. If omitted, select interactively."`
CreateAuthToken bool `help:"Create an auth token after resume." default:"false" json:"create_auth_token,omitempty"`
TokenExpiration time.Duration `help:"Auth token expiration duration." default:"30m" name:"token-expiration" json:"token_expiration,omitempty"`
Output string `help:"Output format." default:"text" enum:"text,json" json:"output,omitempty"`
}
ResumeOption represents options for the resume subcommand.
type RollbackOption ¶
type RollbackOption struct {
DryRun bool `help:"Dry run." default:"false" json:"dry_run,omitempty"`
}
RollbackOption represents options for the rollback subcommand.
type RunConfig ¶
type RunConfig lambdamicrovms.RunMicrovmInput
RunConfig represents configuration based on RunMicrovmInput.
func (RunConfig) MarshalJSON ¶
MarshalJSON implements custom marshaling for RunConfig.
func (*RunConfig) UnmarshalJSON ¶
UnmarshalJSON implements custom unmarshaling for RunConfig.
type RunOption ¶
type RunOption struct {
RunDef string `help:"Path to run definition file (run.jsonnet or run.json)." name:"run-def" json:"run_def,omitempty"`
ImageVersion string `help:"Image version to run." name:"image-version" json:"image_version,omitempty"`
ExecutionRoleArn string `help:"IAM role ARN for runtime permissions." name:"execution-role-arn" json:"execution_role_arn,omitempty"`
MaximumDurationInSeconds int32 `help:"Maximum duration in seconds (1-28800)." name:"max-duration" json:"maximum_duration_in_seconds,omitempty"`
RunHookPayload string `help:"Payload for /run lifecycle hook (max 16KB)." name:"run-hook-payload" json:"run_hook_payload,omitempty"`
Wait bool `help:"Wait for the MicroVM to be running." default:"true" negatable:"" json:"wait,omitempty"`
CreateAuthToken bool `help:"Create an auth token after run." default:"false" json:"create_auth_token,omitempty"`
TokenExpiration time.Duration `help:"Auth token expiration duration." default:"30m" name:"token-expiration" json:"token_expiration,omitempty"`
Output string `help:"Output format." default:"text" enum:"text,json" json:"output,omitempty"`
}
RunOption represents options for the run subcommand.
type ShellOption ¶
type ShellOption struct {
MicrovmID string `arg:"" optional:"" help:"MicroVM ID to connect. If omitted, select interactively."`
TokenExpiration time.Duration `help:"Shell auth token expiration duration." default:"60m" name:"token-expiration" json:"token_expiration,omitempty"`
}
ShellOption represents options for the shell subcommand.
type SuspendOption ¶
type SuspendOption struct {
MicrovmID string `arg:"" optional:"" help:"MicroVM ID to suspend. If omitted, select interactively."`
}
SuspendOption represents options for the suspend subcommand.
type TerminateOption ¶
type TerminateOption struct {
MicrovmID string `arg:"" optional:"" help:"MicroVM ID to terminate. If omitted, select interactively."`
}
TerminateOption represents options for the terminate subcommand.
type WaitOption ¶
type WaitOption struct {
Version string `help:"Image version to wait for. Defaults to the latest version." json:"version,omitempty"`
KeepVersions int `help:"Number of latest versions to keep. Older versions will be deleted." default:"0" json:"keep_versions,omitempty"`
}
WaitOption represents options for the wait subcommand.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
codegen
command
codegen generates Go types with custom (Un)MarshalJSON for AWS SDK structs that contain union-typed fields.
|
codegen generates Go types with custom (Un)MarshalJSON for AWS SDK structs that contain union-typed fields. |
|
lamvms
command
|
|
|
Package skillscmd provides Kong-compatible command structs for skillsmith integration.
|
Package skillscmd provides Kong-compatible command structs for skillsmith integration. |