Documentation ¶
Index ¶
- Constants
- Variables
- func AddContextValueSupplier(name string, supplier ContextValueSupplier)
- func Load(source Source) error
- func RegisterAction(name string, action LocalAction)
- func RegisterColumnFormatter(name string, formatter print.Formatter)
- func RegisterColumnFunction(name string, f print.ColumnFunction)
- func RegisterCommandType(name string, creator CommandMaker)
- func RegisterParameterizedColumnFunction(name string, m ColumnFunctionMaker)
- type ColumnFormatterType
- type ColumnFunctionMaker
- type ColumnFunctionType
- type Command
- type CommandMaker
- type CommandModel
- type CommandType
- type ContextValueSupplier
- type ContextValues
- type FileSystemSource
- type GitSource
- type GroupCommand
- type LocalAction
- type LocalActionType
- type Model
- type OptionsCommand
- func (w *OptionsCommand) GetAPIClient() *api.Client
- func (w *OptionsCommand) GetCobraCommand() *cobra.Command
- func (w *OptionsCommand) GetUnauthenticatedAPIClient() *api.Client
- func (w *OptionsCommand) Initialize(c *cobra.Command, cm *CommandModel) Command
- func (w *OptionsCommand) PrintResult(n *jnode.Node)
- func (w *OptionsCommand) SetContextValues(ctx map[string]string)
- type ParameterDefs
- type ParameterDisposition
- type ParameterModel
- type ResultModel
- type Source
Constants ¶
View Source
const ( // Put the parameter value in the context ContextDisposition = ParameterDisposition("context") // Read a file and post its content as the body JSONFileBodyDisposition = ParameterDisposition("json_file_body") // Do nothing with the flag NOOPDisposition = ParameterDisposition("noop") )
View Source
const ( GetMethod = "GET" PostMethod = "POST" PatchMethod = "PATCH" DeleteMethod = "DELETE" )
View Source
const ( XCPCI = "xcp_ci" CIENVBODY = "ci_env_body" )
Variables ¶
View Source
var Models []*Model
Functions ¶
func AddContextValueSupplier ¶
func AddContextValueSupplier(name string, supplier ContextValueSupplier)
func RegisterAction ¶
func RegisterAction(name string, action LocalAction)
func RegisterColumnFormatter ¶ added in v0.4.4
func RegisterColumnFunction ¶ added in v0.4.17
func RegisterColumnFunction(name string, f print.ColumnFunction)
func RegisterCommandType ¶ added in v0.4.4
func RegisterCommandType(name string, creator CommandMaker)
func RegisterParameterizedColumnFunction ¶ added in v0.4.17
func RegisterParameterizedColumnFunction(name string, m ColumnFunctionMaker)
Types ¶
type ColumnFormatterType ¶ added in v0.4.4
type ColumnFormatterType string
func (ColumnFormatterType) GetFormatter ¶ added in v0.4.4
func (t ColumnFormatterType) GetFormatter() print.Formatter
type ColumnFunctionMaker ¶ added in v0.4.17
type ColumnFunctionMaker func(name string, args []string) (print.ColumnFunction, error)
type ColumnFunctionType ¶ added in v0.4.17
type ColumnFunctionType string
func (ColumnFunctionType) GetColumnFunction ¶ added in v0.4.17
func (t ColumnFunctionType) GetColumnFunction() (print.ColumnFunction, error)
type CommandMaker ¶ added in v0.4.4
type CommandMaker func(c *cobra.Command, cm *CommandModel) Command
type CommandModel ¶
type CommandModel struct { Type string `hcl:"type,label"` Name string `hcl:"name,label"` Use *string `hcl:"use"` Short *string `hcl:"short"` Example *string `hcl:"example"` Aliases *[]string `hcl:"aliases"` Path *string `hcl:"path"` Method *string `hcl:"method"` Options *[]string `hcl:"options"` Parameters []*ParameterModel `hcl:"parameter,block"` ParameterNames *[]string `hcl:"parameters"` ClusterIDOptional *bool `hcl:"cluster_id_optional"` Unauthenticated *bool `hcl:"unauthenticated"` DefaultTimeout *int `hcl:"default_timeout"` Result *ResultModel `hcl:"result,block"` Commands []*CommandModel `hcl:"command,block"` ParameterDefs *ParameterDefs `hcl:"parameter_defs,block"` // contains filtered or unexported fields }
func (*CommandModel) GetCommand ¶
func (cm *CommandModel) GetCommand() Command
func (*CommandModel) GetCommandType ¶
func (cm *CommandModel) GetCommandType() CommandType
type CommandType ¶
type CommandType string
func (CommandType) IsGroup ¶
func (t CommandType) IsGroup() bool
type ContextValueSupplier ¶
type ContextValues ¶
type ContextValues struct {
// contains filtered or unexported fields
}
func NewContextValues ¶ added in v0.4.4
func NewContextValues() *ContextValues
type FileSystemSource ¶ added in v0.4.4
func (*FileSystemSource) GetFileSystem ¶ added in v0.4.4
func (s *FileSystemSource) GetFileSystem() fs.FS
func (*FileSystemSource) GetPath ¶ added in v0.4.4
func (s *FileSystemSource) GetPath(name string) string
func (*FileSystemSource) GetVersion ¶ added in v0.4.4
func (s *FileSystemSource) GetVersion(name string, content []byte) string
func (*FileSystemSource) IsEmbedded ¶ added in v0.4.8
func (s *FileSystemSource) IsEmbedded() bool
func (*FileSystemSource) String ¶ added in v0.4.4
func (s *FileSystemSource) String() string
type GitSource ¶
type GitSource struct { FileSystemSource WasFetched bool // contains filtered or unexported fields }
type GroupCommand ¶ added in v0.4.4
func (*GroupCommand) GetAPIClient ¶ added in v0.4.4
func (g *GroupCommand) GetAPIClient() *api.Client
func (*GroupCommand) GetCobraCommand ¶ added in v0.4.4
func (g *GroupCommand) GetCobraCommand() *cobra.Command
func (*GroupCommand) GetUnauthenticatedAPIClient ¶ added in v0.4.4
func (g *GroupCommand) GetUnauthenticatedAPIClient() *api.Client
func (*GroupCommand) PrintResult ¶ added in v0.4.4
func (g *GroupCommand) PrintResult(n *jnode.Node)
func (*GroupCommand) SetContextValues ¶ added in v0.4.4
func (g *GroupCommand) SetContextValues(m map[string]string)
type LocalAction ¶
type LocalActionType ¶ added in v0.4.4
type LocalActionType string
func (LocalActionType) Run ¶ added in v0.4.4
func (a LocalActionType) Run(command Command, n *jnode.Node) (*jnode.Node, error)
type OptionsCommand ¶ added in v0.4.4
type OptionsCommand struct { options.Interface ClientOpts *options.ClientOpts PrintOpts *options.PrintOpts CobraCommand *cobra.Command }
OptionsCommand is a command based on the options framework
func (*OptionsCommand) GetAPIClient ¶ added in v0.4.4
func (w *OptionsCommand) GetAPIClient() *api.Client
func (*OptionsCommand) GetCobraCommand ¶ added in v0.4.4
func (w *OptionsCommand) GetCobraCommand() *cobra.Command
func (*OptionsCommand) GetUnauthenticatedAPIClient ¶ added in v0.4.4
func (w *OptionsCommand) GetUnauthenticatedAPIClient() *api.Client
func (*OptionsCommand) Initialize ¶ added in v0.4.4
func (w *OptionsCommand) Initialize(c *cobra.Command, cm *CommandModel) Command
func (*OptionsCommand) PrintResult ¶ added in v0.4.4
func (w *OptionsCommand) PrintResult(n *jnode.Node)
func (*OptionsCommand) SetContextValues ¶ added in v0.4.39
func (w *OptionsCommand) SetContextValues(ctx map[string]string)
type ParameterDefs ¶ added in v0.4.17
type ParameterDefs struct {
Parameters []*ParameterModel `hcl:"parameter,block"`
}
type ParameterDisposition ¶
type ParameterDisposition string
What to do with a parameter. By default the parameter is put in the query string (for GET), or in the json body (everything else.)
type ParameterModel ¶
type ParameterModel struct { Name string `hcl:"name,label"` Shorthand *string `hcl:"shorthand"` Usage *string `hcl:"usage"` Required *bool `hcl:"required"` RepeatedFlag *bool `hcl:"repeated"` MapFlag *bool `hcl:"map"` BooleanFlag *bool `hcl:"boolean"` LiteralValue *string `hcl:"literal_value"` ContextValue *string `hcl:"context_value"` DefaultValue *string `hcl:"default_value"` Disposition *string `hcl:"disposition"` }
type ResultModel ¶
type ResultModel struct { Path *[]string `hcl:"path"` TruncationIndicatorPath *[]string `hcl:"truncation_indicator"` Columns *[]string `hcl:"columns"` WideColumns *[]string `hcl:"wide_columns"` Sort *[]string `hcl:"sort_by"` Formatters *map[string]string `hcl:"formatters"` ComputedColumns *map[string]string `hcl:"computed_columns"` LocalAction *string `hcl:"local_action"` LocalActions *[]string `hcl:"local_actions"` DiffColumn *string `hcl:"diff_column"` VersionColumn *string `hcl:"version_column"` DefaultOutputFormat *string `hcl:"default_output_format"` }
func (*ResultModel) GetColumnFunction ¶ added in v0.4.17
func (r *ResultModel) GetColumnFunction(column string) print.ColumnFunction
func (*ResultModel) GetFormatter ¶ added in v0.4.4
func (r *ResultModel) GetFormatter(column string) print.Formatter
func (*ResultModel) GetLocalActions ¶ added in v0.4.33
func (r *ResultModel) GetLocalActions() (result []LocalActionType)
Click to show internal directories.
Click to hide internal directories.