Documentation
¶
Index ¶
- Constants
- Variables
- func CreateTable(data *TableData, tableWriter io.Writer) terminal.Table
- func DerefValue(thing reflect.Value) reflect.Value
- func GetArrayElementType(value reflect.Value) reflect.Kind
- func GetLastQuerySegment(query string) string
- func GetStringValue(thing reflect.Value) string
- func HasExactlyOneArrayProperty(thing reflect.Value) bool
- func IsArrayType(kind reflect.Kind) bool
- func IsValidTableData(data *TableData) bool
- type CustomPrinterFunc
- type TableData
- type Utils
- func (u *Utils) CheckResponseForError(response *core.DetailedResponse, err error) (bool, interface{})
- func (u *Utils) ConfirmDelete(force bool) bool
- func (u *Utils) ConfirmRunningCommand()
- func (u *Utils) CreateErrorWithMessage(err error, msg string) error
- func (u *Utils) ExposeJMESQueryVar() *string
- func (u *Utils) ExposeOutputFormatVar() *string
- func (u *Utils) GetAuthenticator(serviceName string) (core.Authenticator, error)
- func (u *Utils) GetCommandName() string
- func (u *Utils) GetJMESQuery() string
- func (u *Utils) GetJsonStringAsBytes(json string) (stringAsBytes []byte)
- func (u *Utils) GetOutputFormat() string
- func (u *Utils) GetPluginConfig() plugin.PluginConfig
- func (u *Utils) GetRegionFromContext() string
- func (u *Utils) GetResult(response *core.DetailedResponse, err error) (interface{}, interface{}, error)
- func (u *Utils) GetServiceURL(GetServiceURLForRegion func(string) (string, error)) string
- func (u *Utils) HandleError(err error, message string)
- func (u *Utils) HandleErrorResponse(errorBody interface{})
- func (u *Utils) HandleErrorResponseImpl(errorBody interface{})
- func (u *Utils) InitializeLogger(quiet bool)
- func (u *Utils) MakeResultGeneric(result interface{}) interface{}
- func (u *Utils) NonZeroExit()
- func (u *Utils) Ok()
- func (u *Utils) OutputIsNotMachineReadable() bool
- func (u *Utils) PostProcessServiceConfiguration(service *core.BaseService, serviceName string) error
- func (u *Utils) PrintJSON(result interface{})
- func (u *Utils) PrintJSONImpl(result interface{})
- func (u *Utils) PrintOutput(result interface{}, tableWriter io.Writer)
- func (u *Utils) PrintOutputImpl(result interface{}, tableWriter io.Writer)
- func (u *Utils) ProcessBinaryResponse(response *core.DetailedResponse, err error, outputFilename string)
- func (u *Utils) ProcessEmptyResponse(response *core.DetailedResponse, err error)
- func (u *Utils) ProcessResponse(response *core.DetailedResponse, err error)
- func (u *Utils) Prompt(message string, options *terminal.PromptOptions) *terminal.Prompt
- func (u *Utils) ReadAsFile(userInput string) bool
- func (u *Utils) Say(message string)
- func (u *Utils) SetCommandName(args []string)
- func (u *Utils) SetContext(c plugin.PluginContext)
- func (u *Utils) SetJMESQuery(value string)
- func (u *Utils) SetOutputFormat(value string)
- func (u *Utils) SetServiceErrorMessages(msgs map[string]string)
- func (u *Utils) SetTableHeaderOrder(order []string)
- func (u *Utils) ValidateRequiredFlags(required []string, flags *pflag.FlagSet, serviceName string) error
- func (u *Utils) WriteFile(fileInterface interface{}, filename string) error
Constants ¶
const EmptyString = ""
Variables ¶
var TableHeaderOrder []string
Functions ¶
func DerefValue ¶
Return the dereferenced value if a pointer or interface, hand the value back if not.
func GetArrayElementType ¶
for an array value, get the "Kind" of its individual elements
func GetLastQuerySegment ¶
If there was a jmespath query against the data, this function will extract the final segment as it may need to be used as a column header. If no query was given, use a default of "values".
func GetStringValue ¶
Takes the final value that is to be written to the table and formats it as a string if possible.
func HasExactlyOneArrayProperty ¶
Returns true if the value is a map that has exactly one property that is an array.
func IsArrayType ¶
returns true if kind is Slice or Array returns false otherwise
func IsValidTableData ¶
validates the data to ensure a table can be printed returns false if the table doesn't have sufficient data
Types ¶
type CustomPrinterFunc ¶
type CustomPrinterFunc func(interface{}) bool
type TableData ¶
func FormatTableData ¶
type Utils ¶
type Utils struct { OutputFormat string JMESQuery string // contains filtered or unexported fields }
func (*Utils) CheckResponseForError ¶
func (u *Utils) CheckResponseForError(response *core.DetailedResponse, err error) (bool, interface{})
func (*Utils) ConfirmDelete ¶
func (*Utils) ConfirmRunningCommand ¶
func (u *Utils) ConfirmRunningCommand()
func (*Utils) CreateErrorWithMessage ¶
Creates a new error with a descriptive message placed before the original error message. This is only used for interactive mode.
func (*Utils) ExposeJMESQueryVar ¶
func (*Utils) ExposeOutputFormatVar ¶
func (*Utils) GetAuthenticator ¶
func (u *Utils) GetAuthenticator(serviceName string) (core.Authenticator, error)
func (*Utils) GetCommandName ¶
func (*Utils) GetJMESQuery ¶
func (*Utils) GetJsonStringAsBytes ¶
func (*Utils) GetOutputFormat ¶
func (*Utils) GetPluginConfig ¶
func (u *Utils) GetPluginConfig() plugin.PluginConfig
func (*Utils) GetRegionFromContext ¶
func (*Utils) GetResult ¶
func (u *Utils) GetResult(response *core.DetailedResponse, err error) (interface{}, interface{}, error)
func (*Utils) GetServiceURL ¶
func (*Utils) HandleError ¶
func (*Utils) HandleErrorResponse ¶
func (u *Utils) HandleErrorResponse(errorBody interface{})
func (*Utils) HandleErrorResponseImpl ¶
func (u *Utils) HandleErrorResponseImpl(errorBody interface{})
func (*Utils) InitializeLogger ¶
func (*Utils) MakeResultGeneric ¶
func (u *Utils) MakeResultGeneric(result interface{}) interface{}
func (*Utils) NonZeroExit ¶
func (u *Utils) NonZeroExit()
Exit the program with a non-zero exit code. This should only be called in an error situation.
func (*Utils) OutputIsNotMachineReadable ¶
func (*Utils) PostProcessServiceConfiguration ¶
func (u *Utils) PostProcessServiceConfiguration(service *core.BaseService, serviceName string) error
func (*Utils) PrintJSONImpl ¶
func (u *Utils) PrintJSONImpl(result interface{})
func (*Utils) PrintOutput ¶
func (*Utils) PrintOutputImpl ¶
func (*Utils) ProcessBinaryResponse ¶
func (u *Utils) ProcessBinaryResponse(response *core.DetailedResponse, err error, outputFilename string)
func (*Utils) ProcessEmptyResponse ¶
func (u *Utils) ProcessEmptyResponse(response *core.DetailedResponse, err error)
func (*Utils) ProcessResponse ¶
func (u *Utils) ProcessResponse(response *core.DetailedResponse, err error)
func (*Utils) ReadAsFile ¶
func (*Utils) SetCommandName ¶
store the name of the currently executed command to enable context-aware logic in the utilities
func (*Utils) SetContext ¶
func (u *Utils) SetContext(c plugin.PluginContext)