Documentation ¶
Index ¶
- Constants
- Variables
- func ActionConfirm(actionRaw, msg string) (*bool, error)
- func AddKindFlag(cmd *cobra.Command, prefix string, all bool) *string
- func AddTrackFlags(cmd *cobra.Command)
- func AdminReqDescription(desc string) string
- func ConflictingFlags(cmd *cobra.Command, first, second string) error
- func DeprecatedDescription(desc string) string
- func GetInsecurePassword(insecure string) ([]byte, error)
- func GetTrackSettings(cmd *cobra.Command) (int, time.Duration)
- func InsecureOrSecurePassword(insecure, message string, verify bool) ([]byte, error)
- func MustUseAFlag(cmd *cobra.Command, first, second string) error
- func PasswordVerify(password []byte) error
- func Track(params TrackParams) error
- type TrackParams
- type TrackParamsConfig
Constants ¶
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" )
const DefaultECERegion = "ece-region"
DefaultECERegion is the region for ECE
const DeprecatedText = "DEPRECATED (Will be removed in the next major version):"
DeprecatedText is an additional helper text for commands
const PlatformAdminRequired = "(Available for ECE only)"
PlatformAdminRequired is an additional helper text for commands
Variables ¶
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, " ")) )
var DefaultTestFrequency = plan.TrackFrequencyConfig{ PollFrequency: time.Millisecond, MaxRetries: 1, }
DefaultTestFrequency provides sane defaults for testing Plan change tracking.
var DefaultTrackFrequencyConfig = plan.TrackFrequencyConfig{ PollFrequency: time.Second * 5, MaxRetries: 3, }
DefaultTrackFrequencyConfig provides sane defaults for Plan change tracking.
Functions ¶
func ActionConfirm ¶
ActionConfirm asks you to confirm before performing an action
func AddKindFlag ¶
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 ¶
AddTrackFlags adds flags which control the tracking frequency to the passed command reference.
func AdminReqDescription ¶
AdminReqDescription adds a text about required admin permissions to a string
func ConflictingFlags ¶
ConflictingFlags checks if both flags have been specified, and if so returns an error.
func DeprecatedDescription ¶
DeprecatedDescription adds a text about deprecation to a string
func GetInsecurePassword ¶
GetInsecurePassword retrieves an insecure password from a CLI command
func GetTrackSettings ¶
GetTrackSettings obtains the currently set tracking settings, the first return value being the MaxPollRetries and the second one the poll frequency.
func InsecureOrSecurePassword ¶
InsecureOrSecurePassword checks if an insecure password has been set and gets a password in a secure or insecure way.
func MustUseAFlag ¶
MustUseAFlag checks if one or another flags are used, and if not returns an error.
func PasswordVerify ¶
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 { planutil.TrackChangeParams // 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 NewTrackParams ¶
func NewTrackParams(params TrackParamsConfig) TrackParams
NewTrackParams creates a TrackParams structure from the config.
func (TrackParams) Validate ¶
func (params TrackParams) Validate() error
Validate ensures the parameters are usable by the consuming function.