Documentation ¶
Index ¶
- Constants
- Variables
- func CLI(ctx context.Context, parse CLIParseFunc) (int, error)
- func CompareTags(oldTags, newTags []types.Tag) (added, updated, deleted []types.Tag)
- func DefaultJsonnetNativeFuncs() []*jsonnet.NativeFunction
- func ExportEnvFile(file string) error
- func Log(f string, v ...interface{})
- func MarshalJSONForAPI(v interface{}, queries ...string) ([]byte, error)
- func MustMarshalJSONStringForAPI(v interface{}) string
- func NormalizePlatform(p *types.RuntimePlatform, isFargate bool) (arch, os string)
- func UnmarshalJSONForStruct(src []byte, v interface{}, path string) error
- type App
- func (d *App) AppSpec(ctx context.Context, opt AppSpecOption) error
- func (d *App) Config() *Config
- func (d *App) Delete(ctx context.Context, opt DeleteOption) error
- func (d *App) Deploy(ctx context.Context, opt DeployOption) error
- func (d *App) DeployByCodeDeploy(ctx context.Context, taskDefinitionArn string, count *int32, sv *Service, ...) error
- func (d *App) DeployFunc(sv *Service) (deployFunc, error)
- func (d *App) Deregister(ctx context.Context, opt DeregisterOption) error
- func (d *App) DescribeService(ctx context.Context) (*Service, error)
- func (d *App) DescribeServiceStatus(ctx context.Context, events int) (*Service, error)
- func (d *App) DescribeServicesInput() *ecs.DescribeServicesInput
- func (d *App) DescribeTaskDefinition(ctx context.Context, tdArn string) (*TaskDefinitionInput, error)
- func (d *App) DescribeTaskStatus(ctx context.Context, task *types.Task, ...) error
- func (d *App) DescribeTasksInput(task *types.Task) *ecs.DescribeTasksInput
- func (d *App) Diff(ctx context.Context, opt DiffOption) error
- func (d *App) Exec(ctx context.Context, opt ExecOption) error
- func (d *App) FilterCommand() string
- func (d *App) FindRollbackTarget(ctx context.Context, taskDefinitionArn string) (string, error)
- func (d *App) GetLogEvents(ctx context.Context, logGroup string, logStream string, startedAt time.Time, ...) (*string, error)
- func (d *App) GetLogEventsInput(logGroup string, logStream string, startAt int64, nextToken *string) *cloudwatchlogs.GetLogEventsInput
- func (d *App) GetLogInfo(task *types.Task, c *types.ContainerDefinition) (string, string)
- func (d *App) Init(ctx context.Context, opt InitOption) error
- func (d *App) LoadServiceDefinition(path string) (*Service, error)
- func (d *App) LoadTaskDefinition(path string) (*TaskDefinitionInput, error)
- func (d *App) Log(f string, v ...interface{})
- func (d *App) LogJSON(v interface{})
- func (d *App) Name() string
- func (d *App) NewEcsta(ctx context.Context) (*ecsta.Ecsta, error)
- func (d *App) OutputJSONForAPI(w io.Writer, v interface{}) error
- func (d *App) Register(ctx context.Context, opt RegisterOption) error
- func (d *App) RegisterTaskDefinition(ctx context.Context, td *TaskDefinitionInput) (*TaskDefinition, error)
- func (d *App) Render(ctx context.Context, opt RenderOption) error
- func (d *App) Revisions(ctx context.Context, opt RevisionsOption) error
- func (d *App) Rollback(ctx context.Context, opt RollbackOption) error
- func (d *App) RollbackByCodeDeploy(ctx context.Context, sv *Service, targetArn string, opt RollbackOption) (string, error)
- func (d *App) RollbackFunc(sv *Service) (rollbackFunc, error)
- func (d *App) RollbackServiceTasks(ctx context.Context, sv *Service, targetArn string, opt RollbackOption) (string, error)
- func (d *App) Run(ctx context.Context, opt RunOption) error
- func (d *App) RunTask(ctx context.Context, tdArn string, ov *types.TaskOverride, opt *RunOption) (*types.Task, error)
- func (d *App) Start(ctx context.Context) (context.Context, context.CancelFunc)
- func (d *App) Status(ctx context.Context, opt StatusOption) error
- func (d *App) Tasks(ctx context.Context, opt TasksOption) error
- func (d *App) Timeout() time.Duration
- func (d *App) UpdateServiceAttributes(ctx context.Context, sv *Service, taskDefinitionArn string, opt DeployOption) error
- func (d *App) UpdateServiceTags(ctx context.Context, sv *Service, added, updated, deleted []types.Tag, ...) error
- func (d *App) UpdateServiceTasks(ctx context.Context, taskDefinitionArn string, count *int32, sv *Service, ...) error
- func (d *App) Verify(ctx context.Context, opt VerifyOption) error
- func (d *App) Wait(ctx context.Context, opt WaitOption) error
- func (d *App) WaitForCodeDeploy(ctx context.Context, sv *Service) error
- func (d *App) WaitFunc(sv *Service, confirm confirmFunc) (waitFunc, error)
- func (d *App) WaitRunTask(ctx context.Context, task *types.Task, ...) error
- func (d *App) WaitServiceStable(ctx context.Context, sv *Service) error
- func (d *App) WaitTaskSetStable(ctx context.Context, sv *Service) error
- type AppOption
- type AppSpecOption
- type CLIOptions
- type CLIParseFunc
- type Config
- type ConfigCodeDeploy
- type ConfigIgnore
- type ConfigPlugin
- type DeleteOption
- type DeployOption
- type DeregisterOption
- type DiffOption
- type Duration
- type ErrConflictOptions
- type ErrNotFound
- type ErrSkipVerify
- type ExecOption
- type InitOption
- type RefreshOption
- type RegisterOption
- type RenderOption
- type RevisionsOption
- type RollbackOption
- type RunOption
- type ScaleOption
- type Service
- type ServiceForDiff
- type StatusOption
- type TaskDefinition
- type TaskDefinitionInput
- type TasksOption
- type VerifyOption
- type WaitOption
Constants ¶
View Source
const ( DefaultClusterName = "default" DefaultTimeout = 10 * time.Minute )
View Source
const (
CodeDeployConsoleURLFmt = "https://%s.console.aws.amazon.com/codesuite/codedeploy/deployments/%s?region=%s"
)
View Source
const DefaultConfigFilePath = "ecspresso.yml"
View Source
const DefaultDesiredCount = -1
Variables ¶
View Source
var CreateFileMode = os.FileMode(0644)
View Source
var EventTimeFormat = "2006/01/02 15:04:05"
View Source
var Version string
Functions ¶
func CompareTags ¶ added in v2.2.0
func DefaultJsonnetNativeFuncs ¶ added in v2.4.0
func DefaultJsonnetNativeFuncs() []*jsonnet.NativeFunction
func ExportEnvFile ¶
ExportEnvFile exports envfile to environment variables.
func MarshalJSONForAPI ¶
func MustMarshalJSONStringForAPI ¶
func MustMarshalJSONStringForAPI(v interface{}) string
func NormalizePlatform ¶
func NormalizePlatform(p *types.RuntimePlatform, isFargate bool) (arch, os string)
func UnmarshalJSONForStruct ¶ added in v2.2.3
Types ¶
type App ¶
func (*App) DeployByCodeDeploy ¶
func (*App) DeployFunc ¶ added in v2.0.4
func (*App) Deregister ¶
func (d *App) Deregister(ctx context.Context, opt DeregisterOption) error
func (*App) DescribeServiceStatus ¶
func (*App) DescribeServicesInput ¶
func (d *App) DescribeServicesInput() *ecs.DescribeServicesInput
func (*App) DescribeTaskDefinition ¶
func (*App) DescribeTaskStatus ¶
func (*App) DescribeTasksInput ¶
func (d *App) DescribeTasksInput(task *types.Task) *ecs.DescribeTasksInput
func (*App) FilterCommand ¶
func (*App) FindRollbackTarget ¶
func (*App) GetLogEvents ¶
func (*App) GetLogEventsInput ¶
func (d *App) GetLogEventsInput(logGroup string, logStream string, startAt int64, nextToken *string) *cloudwatchlogs.GetLogEventsInput
func (*App) GetLogInfo ¶
func (*App) LoadServiceDefinition ¶
func (*App) LoadTaskDefinition ¶
func (d *App) LoadTaskDefinition(path string) (*TaskDefinitionInput, error)
func (*App) OutputJSONForAPI ¶ added in v2.0.5
func (*App) RegisterTaskDefinition ¶
func (d *App) RegisterTaskDefinition(ctx context.Context, td *TaskDefinitionInput) (*TaskDefinition, error)
func (*App) Revisions ¶ added in v2.4.0
func (d *App) Revisions(ctx context.Context, opt RevisionsOption) error
func (*App) RollbackByCodeDeploy ¶
func (*App) RollbackFunc ¶ added in v2.0.4
func (*App) RollbackServiceTasks ¶ added in v2.0.4
func (*App) UpdateServiceAttributes ¶
func (*App) UpdateServiceTags ¶ added in v2.2.0
func (*App) UpdateServiceTasks ¶
func (*App) Verify ¶
func (d *App) Verify(ctx context.Context, opt VerifyOption) error
Verify verifies service / task definitions related resources are valid.
func (*App) WaitForCodeDeploy ¶
func (*App) WaitRunTask ¶
func (*App) WaitServiceStable ¶
type AppOption ¶ added in v2.3.0
type AppOption func(*appOptions)
func WithConfig ¶ added in v2.3.0
func WithConfigLoader ¶ added in v2.3.0
func WithLogger ¶ added in v2.3.0
type AppSpecOption ¶
type CLIOptions ¶
type CLIOptions struct { Envfile []string `help:"environment files" env:"ECSPRESSO_ENVFILE"` Debug bool `help:"enable debug log" env:"ECSPRESSO_DEBUG"` ExtStr map[string]string `help:"external string values for Jsonnet" env:"ECSPRESSO_EXT_STR"` ExtCode map[string]string `help:"external code values for Jsonnet" env:"ECSPRESSO_EXT_CODE"` ConfigFilePath string `name:"config" help:"config file" default:"ecspresso.yml" env:"ECSPRESSO_CONFIG"` AssumeRoleARN string `help:"the ARN of the role to assume" default:"" env:"ECSPRESSO_ASSUME_ROLE_ARN"` Timeout *time.Duration `help:"timeout. Override in a configuration file." env:"ECSPRESSO_TIMEOUT"` FilterCommand string `help:"filter command" env:"ECSPRESSO_FILTER_COMMAND"` Color bool `help:"enable colorized output" env:"ECSPRESSO_COLOR" default:"true" negatable:""` Appspec *AppSpecOption `cmd:"" help:"output AppSpec YAML for CodeDeploy to STDOUT"` Delete *DeleteOption `cmd:"" help:"delete service"` Deploy *DeployOption `cmd:"" help:"deploy service"` Deregister *DeregisterOption `cmd:"" help:"deregister task definition"` Diff *DiffOption `cmd:"" help:"show diff between task definition, service definition with current running service and task definition"` Exec *ExecOption `cmd:"" help:"execute command on task"` Init *InitOption `cmd:"" help:"create configuration files from existing ECS service"` Refresh *RefreshOption `cmd:"" help:"refresh service. equivalent to deploy --skip-task-definition --force-new-deployment --no-update-service"` Register *RegisterOption `cmd:"" help:"register task definition"` Render *RenderOption `cmd:"" help:"render config, service definition or task definition file to STDOUT"` Revisions *RevisionsOption `cmd:"" help:"show revisions of task definitions"` Rollback *RollbackOption `cmd:"" help:"rollback service"` Run *RunOption `cmd:"" help:"run task"` Scale *ScaleOption `cmd:"" help:"scale service. equivalent to deploy --skip-task-definition --no-update-service"` Status *StatusOption `cmd:"" help:"show status of service"` Tasks *TasksOption `cmd:"" help:"list tasks that are in a service or having the same family"` Verify *VerifyOption `cmd:"" help:"verify resources in configurations"` Wait *WaitOption `cmd:"" help:"wait until service stable"` Version struct{} `cmd:"" help:"show version"` }
func ParseCLIv2 ¶
func ParseCLIv2(args []string) (string, *CLIOptions, func(), error)
func (*CLIOptions) ForSubCommand ¶
func (opts *CLIOptions) ForSubCommand(sub string) interface{}
type CLIParseFunc ¶
type CLIParseFunc func([]string) (string, *CLIOptions, func(), error)
type Config ¶
type Config struct { RequiredVersion string `yaml:"required_version,omitempty" json:"required_version,omitempty"` Region string `yaml:"region" json:"region"` Cluster string `yaml:"cluster" json:"cluster"` Service string `yaml:"service" json:"service"` ServiceDefinitionPath string `yaml:"service_definition" json:"service_definition"` TaskDefinitionPath string `yaml:"task_definition" json:"task_definition"` Plugins []ConfigPlugin `yaml:"plugins,omitempty" json:"plugins,omitempty"` AppSpec *appspec.AppSpec `yaml:"appspec,omitempty" json:"appspec,omitempty"` FilterCommand string `yaml:"filter_command,omitempty" json:"filter_command,omitempty"` Timeout *Duration `yaml:"timeout,omitempty" json:"timeout,omitempty"` CodeDeploy *ConfigCodeDeploy `yaml:"codedeploy,omitempty" json:"codedeploy,omitempty"` Ignore *ConfigIgnore `yaml:"ignore,omitempty" json:"ignore,omitempty"` // contains filtered or unexported fields }
Config represents a configuration.
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig creates a default configuration.
func (*Config) AssumeRole ¶ added in v2.1.0
func (*Config) OverrideByCLIOptions ¶ added in v2.3.0
func (c *Config) OverrideByCLIOptions(opt *CLIOptions)
func (*Config) ValidateVersion ¶
ValidateVersion validates a version satisfies required_version.
type ConfigCodeDeploy ¶
type ConfigIgnore ¶ added in v2.4.0
type ConfigIgnore struct {
Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"`
}
func (*ConfigIgnore) Apply ¶ added in v2.4.0
func (i *ConfigIgnore) Apply(v hasTags) error
type ConfigPlugin ¶
type ConfigPlugin struct { Name string `yaml:"name" json:"name,omitempty"` Config map[string]any `yaml:"config" json:"config,omitempty"` FuncPrefix string `yaml:"func_prefix,omitempty" json:"func_prefix,omitempty"` }
func (ConfigPlugin) AppendFuncMap ¶
func (p ConfigPlugin) AppendFuncMap(c *Config, funcMap template.FuncMap) error
func (ConfigPlugin) AppendJsonnetNativeFuncs ¶ added in v2.4.0
func (p ConfigPlugin) AppendJsonnetNativeFuncs(c *Config, funcs []*jsonnet.NativeFunction) error
type DeleteOption ¶
type DeleteOption struct { DryRun bool `help:"dry-run" default:"false"` Force bool `help:"delete without confirmation" default:"false"` Terminate bool `help:"delete with terminate tasks" default:"false"` }
func (DeleteOption) DryRunString ¶
func (opt DeleteOption) DryRunString() string
type DeployOption ¶
type DeployOption struct { DryRun bool `help:"dry run" default:"false"` DesiredCount *int32 `name:"tasks" help:"desired count of tasks" default:"-1"` SkipTaskDefinition bool `help:"skip register a new task definition" default:"false"` Revision int64 `help:"revision of the task definition to run when --skip-task-definition" default:"0"` ForceNewDeployment bool `help:"force a new deployment of the service" default:"false"` Wait bool `help:"wait for service stable" default:"true" negatable:""` SuspendAutoScaling *bool `help:"suspend application auto-scaling attached with the ECS service"` ResumeAutoScaling *bool `help:"resume application auto-scaling attached with the ECS service"` AutoScalingMin *int32 `help:"set minimum capacity of application auto-scaling attached with the ECS service"` AutoScalingMax *int32 `help:"set maximum capacity of application auto-scaling attached with the ECS service"` RollbackEvents string `` /* 152-byte string literal not displayed */ UpdateService bool `help:"update service attributes by service definition" default:"true" negatable:""` LatestTaskDefinition bool `help:"deploy with the latest task definition without registering a new task definition" default:"false"` }
func (DeployOption) DryRunString ¶
func (opt DeployOption) DryRunString() string
func (DeployOption) ModifyAutoScalingParams ¶ added in v2.2.0
func (opt DeployOption) ModifyAutoScalingParams() *modifyAutoScalingParams
type DeregisterOption ¶
type DeregisterOption struct { DryRun bool `help:"dry run" default:"false"` Keeps *int `help:"number of task definitions to keep except in-use"` Revision string `help:"revision number or 'latest'" default:""` Force bool `help:"force deregister without confirmation" default:"false"` Delete bool `help:"delete task definition on deregistered" default:"false"` }
func (DeregisterOption) DryRunString ¶
func (opt DeregisterOption) DryRunString() string
type DiffOption ¶
type Duration ¶
func (*Duration) MarshalJSON ¶
func (*Duration) MarshalYAML ¶
func (*Duration) UnmarshalJSON ¶
func (*Duration) UnmarshalYAML ¶
type ErrConflictOptions ¶ added in v2.0.4
type ErrConflictOptions string
func (ErrConflictOptions) Error ¶ added in v2.0.4
func (e ErrConflictOptions) Error() string
type ErrNotFound ¶
type ErrNotFound string
func (ErrNotFound) Error ¶
func (e ErrNotFound) Error() string
type ErrSkipVerify ¶
type ErrSkipVerify string
func (ErrSkipVerify) Error ¶
func (e ErrSkipVerify) Error() string
type ExecOption ¶
type ExecOption struct { ID string `help:"task ID" default:""` Command string `help:"command to execute" default:"sh"` Container string `help:"container name" default:""` PortForward bool `help:"enable port forward" default:"false"` LocalPort int `help:"local port number" default:"0"` Port int `help:"remote port number (required for --port-forward)" default:"0"` Host string `help:"remote host (required for --port-forward)" default:""` L string `name:"L" short:"L" help:"short expression of local-port:host:port" default:""` }
type InitOption ¶
type InitOption struct { Region string `help:"AWS region" env:"AWS_REGION" default:""` Cluster string `help:"ECS cluster name" default:"default"` Service string `help:"ECS service name" required:"" xor:"FROM"` TaskDefinition string `help:"ECS task definition name:revision" required:"" xor:"FROM"` TaskDefinitionPath string `help:"path to output task definition file" default:"ecs-task-def.json"` ServiceDefinitionPath string `help:"path to output service definition file" default:"ecs-service-def.json"` Sort bool `help:"sort elements in task definition" default:"false" negatable:""` ForceOverwrite bool `help:"overwrite existing files" default:"false"` Jsonnet bool `help:"output files as jsonnet format" default:"false"` }
type RefreshOption ¶
type RefreshOption struct { DryRun bool `help:"dry run" default:"false"` Wait bool `help:"wait for service stable" default:"true" negatable:""` }
func (*RefreshOption) DeployOption ¶
func (o *RefreshOption) DeployOption() DeployOption
type RegisterOption ¶
type RegisterOption struct { DryRun bool `help:"dry run" default:"false"` Output bool `help:"output the registered task definition as JSON" default:"false"` }
func (RegisterOption) DryRunString ¶
func (opt RegisterOption) DryRunString() string
type RenderOption ¶
type RevisionsOption ¶
type RollbackOption ¶
type RollbackOption struct { DryRun bool `help:"dry run" default:"false"` DeregisterTaskDefinition bool `help:"deregister the rolled-back task definition. not works with --no-wait" default:"true" negatable:""` Wait bool `help:"wait for the service stable" default:"true" negatable:""` RollbackEvents string `` /* 152-byte string literal not displayed */ }
func (RollbackOption) DryRunString ¶
func (opt RollbackOption) DryRunString() string
type RunOption ¶
type RunOption struct { DryRun bool `help:"dry run" default:"false"` TaskDefinition string `name:"task-def" help:"task definition file for run task" default:""` Wait bool `help:"wait for task to complete" default:"true" negatable:""` TaskOverrideStr string `name:"overrides" help:"task override JSON string" default:""` TaskOverrideFile string `name:"overrides-file" help:"task override JSON file path" default:""` SkipTaskDefinition bool `help:"skip register a new task definition" default:"false"` Count int32 `help:"number of tasks to run (max 10)" default:"1"` WatchContainer string `help:"container name for watching exit code" default:""` LatestTaskDefinition bool `help:"use the latest task definition without registering a new task definition" default:"false"` PropagateTags string `help:"propagate the tags for the task (SERVICE or TASK_DEFINITION)" default:""` Tags string `help:"tags for the task: format is KeyFoo=ValueFoo,KeyBar=ValueBar" default:""` WaitUntil string `help:"wait until invoked tasks status reached to (running or stopped)" default:"stopped" enum:"running,stopped"` Revision *int64 `help:"revision of the task definition to run when --skip-task-definition" default:"0"` ClientToken *string `help:"unique token that identifies a request, useful for idempotency"` EBSDeleteOnTermination *bool `help:"whether to delete the EBS volume when the task is stopped" default:"true" negatable:""` }
func (RunOption) DryRunString ¶
type ScaleOption ¶
type ScaleOption struct { DryRun bool `help:"dry run" default:"false"` DesiredCount *int32 `name:"tasks" help:"desired count of tasks" default:"-1"` Wait bool `help:"wait for service stable" default:"true" negatable:""` SuspendAutoScaling *bool `help:"suspend application auto-scaling attached with the ECS service"` ResumeAutoScaling *bool `help:"resume application auto-scaling attached with the ECS service"` AutoScalingMin *int32 `help:"set minimum capacity of application auto-scaling attached with the ECS service"` AutoScalingMax *int32 `help:"set maximum capacity of application auto-scaling attached with the ECS service"` }
func (*ScaleOption) DeployOption ¶
func (o *ScaleOption) DeployOption() DeployOption
type Service ¶
type Service struct { types.Service ServiceConnectConfiguration *types.ServiceConnectConfiguration VolumeConfigurations []types.ServiceVolumeConfiguration VpcLatticeConfigurations []types.VpcLatticeConfiguration DesiredCount *int32 }
func (*Service) PrimaryDeployment ¶ added in v2.4.0
func (sv *Service) PrimaryDeployment() (types.Deployment, bool)
type ServiceForDiff ¶ added in v2.2.0
type ServiceForDiff struct { *ecs.UpdateServiceInput Tags []types.Tag }
func ServiceDefinitionForDiff ¶ added in v2.2.0
func ServiceDefinitionForDiff(sv *Service) *ServiceForDiff
type StatusOption ¶
type StatusOption struct {
Events int `help:"show events num" default:"10"`
}
type TaskDefinition ¶
type TaskDefinition types.TaskDefinition
func (*TaskDefinition) Name ¶ added in v2.4.0
func (td *TaskDefinition) Name() string
type TaskDefinitionInput ¶
type TaskDefinitionInput ecs.RegisterTaskDefinitionInput
func (*TaskDefinitionInput) GetTags ¶ added in v2.4.0
func (tdi *TaskDefinitionInput) GetTags() []types.Tag
func (*TaskDefinitionInput) SetTags ¶ added in v2.4.0
func (tdi *TaskDefinitionInput) SetTags(tags []types.Tag)
type TasksOption ¶
type TasksOption struct { ID string `help:"task ID" default:""` Output string `help:"output format" enum:"table,json,tsv" default:"table"` Find bool `help:"find a task from tasks list and dump it as JSON" default:"false"` Stop bool `help:"stop the task" default:"false"` Force bool `help:"stop the task without confirmation" default:"false"` Trace bool `help:"trace the task" default:"false"` }
type VerifyOption ¶
type VerifyOption struct { GetSecrets bool `help:"get secrets from ParameterStore or SecretsManager" default:"true" negatable:""` PutLogs bool `help:"put logs to CloudWatchLogs" default:"true" negatable:""` Cache bool `help:"use cache" default:"true" negatable:""` }
VerifyOption represents options for Verify()
type WaitOption ¶
type WaitOption struct { }
Source Files ¶
- appspec.go
- autoscaling.go
- cli.go
- cliv2.go
- config.go
- create.go
- delete.go
- deploy.go
- deregister.go
- diff.go
- duration.go
- ecspresso.go
- envfile.go
- errors.go
- exec.go
- format.go
- init.go
- json.go
- jsonnet.go
- logger.go
- plugin.go
- refresh.go
- register.go
- render.go
- revisions.go
- rollback.go
- run.go
- scale.go
- status.go
- tasks.go
- util.go
- verify.go
- wait.go
Click to show internal directories.
Click to hide internal directories.