cmdutil

package
v1.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PlanRetriesFlagMessage is the message to be used by the --retries flag.
	PlanRetriesFlagMessage = "Number of times monitoring will be retried. Meaning it accepts an N number of API errors"
	// TrackFlagMessage is the message to be used by the --track flag.
	TrackFlagMessage = "Tracks the progress of the performed task"
)
View Source
const DefaultECERegion = "ece-region"

DefaultECERegion is the region for ECE

View Source
const PlatformAdminRequired = "(Available for ECE only)"

PlatformAdminRequired is an additional helper text for commands

Variables

View Source
var (
	// StatelessKinds declares the stateless deployment resource kinds
	StatelessKinds = []string{"apm", "appsearch", "kibana"}

	// StatefulKinds declares the stateful deployment resource kinds (Elasticsearch).
	StatefulKinds = []string{"elasticsearch"}

	// AllKinds is StatelessKinds appending StatefulKinds
	AllKinds = append(StatelessKinds, StatefulKinds...)

	// StatelessKindsCompFunc is the bash autocompletion function for stateless kinds.
	StatelessKindsCompFunc = fmt.Sprintf(compFuncTpl, "stateless", strings.Join(StatelessKinds, " "))

	// AllKindsCompFunc is the bash autocompletion function for all kinds.
	AllKindsCompFunc = fmt.Sprintf(compFuncTpl, "all", strings.Join(AllKinds, " "))
)

Functions

func ActionConfirm

func ActionConfirm(actionRaw, msg string) (*bool, error)

ActionConfirm asks you to confirm before performing an action

func AddKindFlag

func AddKindFlag(cmd *cobra.Command, prefix string, all bool) *string

AddKindFlag adds a kind string flag to the specified command, with the resource kinds autocompletion function. It is intended to be used for any commands which call the deployment/resource APIs.

func AddTrackFlags

func AddTrackFlags(cmd *cobra.Command)

AddTrackFlags adds flags which control the tracking frequency to the passed command reference.

func AdminReqDescription

func AdminReqDescription(desc string) string

AdminReqDescription adds a text about required admin permissions to a string

func ConflictingFlags

func ConflictingFlags(cmd *cobra.Command, first, second string) error

ConflictingFlags checks if both flags have been specified, and if so returns an error.

func GetInsecurePassword

func GetInsecurePassword(insecure string) ([]byte, error)

GetInsecurePassword retrieves an insecure password from a CLI command

func GetInstances

func GetInstances(cmd *cobra.Command, params util.ClusterParams, flagName string) ([]string, error)

GetInstances tries to obtain a slice with the elasticsearch cluster instance names either from the current cluster topology or from the specified --instance flag in the cobra.Command.

func GetTrackSettings

func GetTrackSettings(cmd *cobra.Command) (int, time.Duration)

GetTrackSettings obtains the currently set tracking settings, the first return value being the MaxPollRetries and the second one the poll frequency.

func InsecureOrSecurePassword

func InsecureOrSecurePassword(insecure, message string, verify bool) ([]byte, error)

InsecureOrSecurePassword checks if an insecure password has been set and gets a password in a secure or insecure way.

func MustUseAFlag

func MustUseAFlag(cmd *cobra.Command, first, second string) error

MustUseAFlag checks if one or another flags are used, and if not returns an error.

func PasswordVerify

func PasswordVerify(password []byte) error

PasswordVerify retrieves a password from terminal input and verifies a match

func Track

func Track(params TrackParams) error

Track will either print and track the parameter specified Response. If the formatter is not specified an error will be returned.

Types

type TrackParams

type TrackParams struct {
	depresource.TrackResourcesParams

	// Formatter used to print the structure.
	Formatter formatter.Formatter

	// When set to true, it tracks the progress of the resource change with the
	// specified TrackResourcesParams.
	Track bool

	// Template is the template name which the formatter will use.
	Template string

	// Response will be printed using the formatter and template name.
	Response interface{}
}

TrackParams is consumed by Track.

func (TrackParams) Validate

func (params TrackParams) Validate() error

Validate ensures the parameters are usable by the consuming function.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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