cmd

package
v0.0.0-...-3f1c2bf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommonFlagRegistry = []Flag{
	{
		Name:          "profile",
		Shorthand:     "p",
		Usage:         "Profile configuration of AWS",
		Value:         aws.String(constants.EmptyString),
		DefValue:      constants.EmptyString,
		FlagAddMethod: "StringVar",
	},
}
View Source
var FlagRegistry = map[string][]Flag{
	"fullSet": {
		{
			Name:          "manifest",
			Shorthand:     "m",
			Usage:         "The manifest configuration file to use. (required)",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "manifest-s3-region",
			Usage:         "Region of bucket containing the manifest configuration file to use. (required if –manifest starts with s3://)",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "stack",
			Usage:         "stack that should be deployed.(required)",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "ami",
			Usage:         "Amazon AMI to use.",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "env",
			Usage:         "The environment that is being deployed into.",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "assume-role",
			Usage:         "The Role ARN to assume into.",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "timeout",
			Usage:         "Time to wait for deploy to finish before timing out (default 60m)",
			Value:         &zeroTimeout,
			DefValue:      timeout,
			FlagAddMethod: "DurationVar",
		},
		{
			Name:          "region",
			Usage:         "The region to deploy into, if undefined, then the deployment will run against all regions for the given environment.",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "slack-off",
			Usage:         "Turn off slack alarm",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
		{
			Name:          "log-level",
			Usage:         "Level of logging",
			Shorthand:     "v",
			Value:         aws.String(constants.EmptyString),
			DefValue:      "warning",
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "extra-tags",
			Usage:         "Extra tags to add to autoscaling group tags",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "ansible-extra-vars",
			Usage:         "Extra variables for ansible",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "override-instance-type",
			Usage:         "Instance Type to override",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "override-spot-types",
			Usage:         "Spot Instance Type to override",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "disable-metrics",
			Usage:         "Disable gathering metrics.",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
		{
			Name:          "release-notes",
			Usage:         "Release note for the current deployment",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "release-notes-base64",
			Usage:         "Base64 encoded string of release note for the current deployment",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "force-manifest-capacity",
			Usage:         "Force-apply the capacity of instances in the manifest file",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
		{
			Name:          "polling-interval",
			Usage:         "Time to interval for polling health check (default 60s)",
			Value:         &zeroPollingInterval,
			DefValue:      pollingInterval,
			FlagAddMethod: "DurationVar",
		},
		{
			Name:          "auto-apply",
			Usage:         "Apply command without confirmation from local terminal",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
	},
	"deploySet": {
		{
			Name:          "manifest",
			Shorthand:     "m",
			Usage:         "The manifest configuration file to use. (required)",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "manifest-s3-region",
			Usage:         "Region of bucket containing the manifest configuration file to use. (required if –manifest starts with s3://)",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "stack",
			Usage:         "stack that should be deployed.(required)",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "ami",
			Usage:         "Amazon AMI to use.",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "env",
			Usage:         "The environment that is being deployed into.",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "assume-role",
			Usage:         "The Role ARN to assume into.",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "timeout",
			Usage:         "Time to wait for deploy to finish before timing out (default 60m)",
			Value:         &zeroTimeout,
			DefValue:      timeout,
			FlagAddMethod: "DurationVar",
		},
		{
			Name:          "region",
			Usage:         "The region to deploy into, if undefined, then the deployment will run against all regions for the given environment.",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "slack-off",
			Usage:         "Turn off slack alarm",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
		{
			Name:          "log-level",
			Usage:         "Level of logging",
			Shorthand:     "v",
			Value:         aws.String(constants.EmptyString),
			DefValue:      "warning",
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "extra-tags",
			Usage:         "Extra tags to add to autoscaling group tags",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "ansible-extra-vars",
			Usage:         "Extra variables for ansible",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "override-instance-type",
			Usage:         "Instance Type to override",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "override-spot-types",
			Usage:         "Spot Instance Type to override",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "disable-metrics",
			Usage:         "Disable gathering metrics.",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
		{
			Name:          "release-notes",
			Usage:         "Release note for the current deployment",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "release-notes-base64",
			Usage:         "Base64 encoded string of release note for the current deployment",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "force-manifest-capacity",
			Usage:         "Force-apply the capacity of instances in the manifest file",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
		{
			Name:          "polling-interval",
			Usage:         "Time to interval for polling health check (default 60s)",
			Value:         &zeroPollingInterval,
			DefValue:      pollingInterval,
			FlagAddMethod: "DurationVar",
		},
		{
			Name:          "auto-apply",
			Usage:         "Apply command without confirmation from local terminal",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
		{
			Name:          "complete-canary",
			Usage:         "Complete the rest of canary deployment.(Only works with Canary replacement type)",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
	},
	"initSet": {
		{
			Name:          "log-level",
			Usage:         "Level of logging",
			Shorthand:     "v",
			Value:         aws.String(constants.EmptyString),
			DefValue:      "warning",
			FlagAddMethod: "StringVar",
		},
	},
	"addSet": {
		{
			Name:          "log-level",
			Usage:         "Level of logging",
			Shorthand:     "v",
			Value:         aws.String(constants.EmptyString),
			DefValue:      "warning",
			FlagAddMethod: "StringVar",
		},
	},
	"statusSet": {
		{
			Name:          "region",
			Usage:         "Region of autoscaling group",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
	},
	"updateSet": {
		{
			Name:          "region",
			Usage:         "Region of autoscaling group",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "auto-apply",
			Usage:         "Apply command without confirmation from local terminal",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
		{
			Name:          "min",
			Usage:         "Minimum instance capacity you want to update with",
			Value:         aws.Int(-1),
			DefValue:      -1,
			FlagAddMethod: "IntVar",
		},
		{
			Name:          "max",
			Usage:         "Maximum instance capacity you want to update with",
			Value:         aws.Int(-1),
			DefValue:      -1,
			FlagAddMethod: "IntVar",
		},
		{
			Name:          "desired",
			Usage:         "Desired instance capacity you want to update with",
			Value:         aws.Int(-1),
			DefValue:      -1,
			FlagAddMethod: "IntVar",
		},
		{
			Name:          "polling-interval",
			Usage:         "Time to interval for polling health check (default 60s)",
			Value:         &zeroPollingInterval,
			DefValue:      pollingInterval,
			FlagAddMethod: "DurationVar",
		},
		{
			Name:          "timeout",
			Usage:         "Time to wait for deploy to finish before timing out (default 60m)",
			Value:         &zeroTimeout,
			DefValue:      timeout,
			FlagAddMethod: "DurationVar",
		},
	},
	"refreshSet": {
		{
			Name:          "region",
			Usage:         "Region of autoscaling group",
			Value:         aws.String(constants.EmptyString),
			DefValue:      constants.EmptyString,
			FlagAddMethod: "StringVar",
		},
		{
			Name:          "auto-apply",
			Usage:         "Apply command without confirmation from local terminal",
			Value:         aws.Bool(false),
			DefValue:      false,
			FlagAddMethod: "BoolVar",
		},
		{
			Name:          "instance-warmup",
			Usage:         "How much time it takes a newly launched instance to be ready to use.",
			Value:         aws.Int(constants.DefaultInstanceWarmup),
			DefValue:      constants.DefaultInstanceWarmup,
			FlagAddMethod: "IntVar",
		},
		{
			Name:          "min-healthy-percentage",
			Usage:         "At least this percentage of the desired capacity of the Auto Scaling group must remain healthy during this operation to allow it to continue.",
			Value:         aws.Int(constants.DefaultMinHealthyPercentage),
			DefValue:      constants.DefaultMinHealthyPercentage,
			FlagAddMethod: "IntVar",
		},
		{
			Name:          "polling-interval",
			Usage:         "Time to interval for polling health check (default 60s)",
			Value:         &zeroPollingInterval,
			DefValue:      pollingInterval,
			FlagAddMethod: "DurationVar",
		},
		{
			Name:          "timeout",
			Usage:         "Time to wait for deploy to finish before timing out (default 60m)",
			Value:         &zeroTimeout,
			DefValue:      timeout,
			FlagAddMethod: "DurationVar",
		},
	},
}

Functions

func NewAddCommand

func NewAddCommand() *cobra.Command

Create new deploy command

func NewDeleteCommand

func NewDeleteCommand() *cobra.Command

Create new delete command

func NewDeployCommand

func NewDeployCommand() *cobra.Command

Create new deploy command

func NewInitCommand

func NewInitCommand() *cobra.Command

Create new deploy command

func NewRefreshCommand

func NewRefreshCommand() *cobra.Command

Create new refresh command

func NewRootCommand

func NewRootCommand(out, stderr io.Writer) *cobra.Command

NewRootCommand creates new root command

func NewServerCommand

func NewServerCommand() *cobra.Command

Create new deploy command

func NewStatusCommand

func NewStatusCommand() *cobra.Command

Create new deploy command

func NewUpdateCommand

func NewUpdateCommand() *cobra.Command

Create new update command

func NewVersionCommand

func NewVersionCommand() *cobra.Command

Create Command for get pod

func SetCommandFlags

func SetCommandFlags(cmd *cobra.Command)

Add command flags

Types

type Command

type Command interface {
	WithDescription(description string) Command
	WithLongDescription(description string) Command
	SetFlags() Command
	SetPreRunWithArgs(action func(context.Context, io.Writer, []string) error) Command
	RunWithNoArgs(action func(context.Context, io.Writer, string) error) *cobra.Command
	RunWithArgs(action func(context.Context, io.Writer, []string, string) error) *cobra.Command
}

func NewCmd

func NewCmd(use string) Command

NewCmd creates a new command builder.

type Flag

type Flag struct {
	Name               string
	Shorthand          string
	Usage              string
	Value              interface{}
	DefValue           interface{}
	DefValuePerCommand map[string]interface{}
	FlagAddMethod      string
	Hidden             bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL