commands

package
v3.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RootName defines default name used for the root command.
	RootName = "agentctl"
)

Functions

func AddBaseCommands

func AddBaseCommands(cmd *cobra.Command, cli cli.Cli)

AddBaseCommands adds all base commands to cmd.

func DisableFlagsInUseLine

func DisableFlagsInUseLine(cmd *cobra.Command)

DisableFlagsInUseLine sets the DisableFlagsInUseLine flag on all commands within the tree rooted at cmd.

func ExitCode

func ExitCode(err error) int

ExitCode returns proper exit code for err or 0 if err is nil.

func FlagErrorFunc

func FlagErrorFunc(cmd *cobra.Command, err error) error

FlagErrorFunc returns status error when err is not nil. It includes usage string and error message.

func NewAgentCli

func NewAgentCli(opts ...cli.AgentCliOption) *cli.AgentCli

NewAgentCli creates new AgentCli with opts and configures log output to error stream.

func NewConfigCommand added in v3.2.0

func NewConfigCommand(cli agentcli.Cli) *cobra.Command

func NewDumpCommand

func NewDumpCommand(cli agentcli.Cli) *cobra.Command

func NewGenerateCommand

func NewGenerateCommand(cli agentcli.Cli) *cobra.Command

func NewImportCommand

func NewImportCommand(cli agentcli.Cli) *cobra.Command

func NewKvdbCommand

func NewKvdbCommand(cli agentcli.Cli) *cobra.Command

func NewLogCommand

func NewLogCommand(cli agentcli.Cli) *cobra.Command

func NewMetricsCommand

func NewMetricsCommand(cli agentcli.Cli) *cobra.Command

func NewModelCommand

func NewModelCommand(cli agentcli.Cli) *cobra.Command

func NewReportCommand added in v3.3.0

func NewReportCommand(cli agentcli.Cli) *cobra.Command

func NewRootCommand

func NewRootCommand(agentCli *cli.AgentCli) (*cobra.Command, error)

NewRootCommand is helper for default initialization process for root command. Returs cobra command which is ready to be executed.

func NewServiceCallCommand

func NewServiceCallCommand(cli agentcli.Cli) *cobra.Command

func NewServiceCommand

func NewServiceCommand(cli agentcli.Cli) *cobra.Command

func NewServiceListCommand

func NewServiceListCommand(cli agentcli.Cli) *cobra.Command

func NewStatusCommand

func NewStatusCommand(cli agentcli.Cli) *cobra.Command

func NewValuesCommand

func NewValuesCommand(cli agentcli.Cli) *cobra.Command

func NewVppCommand

func NewVppCommand(cli agentcli.Cli) *cobra.Command

func RunImport

func RunImport(cli agentcli.Cli, opts ImportOptions) error

func RunLogList

func RunLogList(cli agentcli.Cli, opts LogListOptions) error

func RunLogSet

func RunLogSet(cli agentcli.Cli, opts LogSetOptions) error

func SetupRootCommand

func SetupRootCommand(rootCmd *cobra.Command) (*cli.ClientOptions, *pflag.FlagSet, *cobra.Command)

SetupRootCommand setups cobra command and returns CLI client options, flags and help command.

func ShowHelp

func ShowHelp(out io.Writer) func(*cobra.Command, []string) error

ShowHelp shows the command help.

func VisitAll

func VisitAll(root *cobra.Command, fn func(*cobra.Command))

VisitAll will traverse all commands from the root. This is different from the VisitAll of cobra.Command where only parents are checked.

Types

type ConfigDeleteOptions added in v3.2.0

type ConfigDeleteOptions struct {
	Format   string
	WaitDone bool
	Verbose  bool
}

type ConfigGetOptions added in v3.2.0

type ConfigGetOptions struct {
	Format string
	Labels []string
}

type ConfigHistoryOptions added in v3.2.0

type ConfigHistoryOptions struct {
	Format  string
	Details bool
	TxnRef  string
}

type ConfigResyncOptions added in v3.2.0

type ConfigResyncOptions struct {
	Format  string
	Verbose bool
	Retry   bool
}

type ConfigRetrieveOptions added in v3.2.0

type ConfigRetrieveOptions struct {
	Format string
}

type ConfigUpdateOptions added in v3.2.0

type ConfigUpdateOptions struct {
	Format  string
	Replace bool
	// WaitDone bool
	// Verbose  bool
	Timeout time.Duration
	Labels  []string
}

type ConfigWatchOptions added in v3.3.0

type ConfigWatchOptions struct {
	Format  string
	Filters []string
}

type DumpOptions

type DumpOptions struct {
	Models []string
	View   string
	Origin string
	Format string
}

func (*DumpOptions) Validate added in v3.2.0

func (opts *DumpOptions) Validate() error

type Errors

type Errors []error

Errors is a list of errors. Useful in a loop if you don't want to return the error right away and you want to display after the loop, all the errors that happened during the loop.

func (Errors) Error

func (errList Errors) Error() string

type GenerateOptions

type GenerateOptions struct {
	Model   string
	Format  string
	OneLine bool
}

type ImportOptions

type ImportOptions struct {
	InputFile string
	TxOps     uint
	Timeout   time.Duration
	ViaGrpc   bool
}

type LogListOptions

type LogListOptions struct {
	Name string
}

type LogSetOptions

type LogSetOptions struct {
	Logger string
	Level  string
}

type MetricsGetOptions

type MetricsGetOptions struct {
	Metrics []string
}

type MetricsListOptions

type MetricsListOptions struct {
	Refs []string
}

type ModelInspectOptions

type ModelInspectOptions struct {
	Names  []string
	Format string
}

type ModelListOptions

type ModelListOptions struct {
	Class  string
	Refs   []string
	Format string
}

type ReportOptions added in v3.3.0

type ReportOptions struct {
	OutputDirectory string
	IgnoreErrors    bool
}

type Root

type Root struct {
	// contains filtered or unexported fields
}

Root encapsulates a top-level cobra command (either agentctl or custom one).

func NewRoot

func NewRoot(agentCli *cli.AgentCli) *Root

NewRoot returns new Root using RootName for name.

func NewRootNamed

func NewRootNamed(name string, agentCli *cli.AgentCli) *Root

NewRootNamed returns new Root named with name.

func (*Root) HandleGlobalFlags

func (root *Root) HandleGlobalFlags() (*cobra.Command, []string, error)

HandleGlobalFlags takes care of parsing global flags defined on the command, it returns the underlying cobra command and the args it will be called with (or an error).

On success the caller is responsible for calling Initialize() before calling `Execute` on the returned command.

func (*Root) Initialize

func (root *Root) Initialize(ops ...cli.InitializeOpt) error

Initialize finalises global option parsing and initializes the agentctl client.

func (*Root) PrepareCommand

func (root *Root) PrepareCommand() (*cobra.Command, error)

PrepareCommand handles global flags and Initialize should be called before executing returned cobra command.

type ServiceCallOptions

type ServiceCallOptions struct {
	Service string
	Method  string
}

type ServiceListOptions

type ServiceListOptions struct {
	Methods bool
}

type StatusError

type StatusError struct {
	Status     string
	StatusCode int
}

StatusError reports an unsuccessful exit by a command.

func (StatusError) Error

func (e StatusError) Error() string

func (StatusError) String

func (e StatusError) String() string

type StatusOptions

type StatusOptions struct {
	Format string
}

type ValuesOptions

type ValuesOptions struct {
	Models []string
	Format string
}

Jump to

Keyboard shortcuts

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