agent

package
v0.0.0-...-341d4b1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CMD_G_GENERIC = iota
	CMD_G_RESOURCE
	CMD_G_DEUBG
	CMD_G_INTEGRATION
	CMD_G_SIZE
)
View Source
const (
	PRI_PKG
)

Variables

This section is empty.

Functions

func ExactArgs

func ExactArgs(n int) cobra.PositionalArgs

ExactArgs returns an error if there are not exactly n args.

func GetHookGroups

func GetHookGroups(env *EnvSettings) ([]*cobra.Command, templates.CommandGroups)

func InStrings

func InStrings(a string, b []string) bool

func MaximumNArgs

func MaximumNArgs(n int) cobra.PositionalArgs

MaximumNArgs returns an error if there are more than N args.

func MinimumNArgs

func MinimumNArgs(n int) cobra.PositionalArgs

MinimumNArgs returns an error if there is not at least N args.

func Mkdir

func Mkdir(path string) error

func NewSettingsClient

func NewSettingsClient(env *EnvSettings) settings.Client

func NoArgs

func NoArgs(cmd *cobra.Command, args []string) error

NoArgs returns an error if any args are included.

func RegisterCmd

func RegisterCmd(in ...CmdOps) error

func RegisterHooks

func RegisterHooks(in []HookOps) error

func SetFlagFromEnv

func SetFlagFromEnv(name, envName string, fs *pflag.FlagSet)

func SplitArgs

func SplitArgs(args []string, argsLenAtDash int) ([]string, []string)

Types

type CmdOps

type CmdOps struct {
	CmdFactory func(*EnvSettings) *cobra.Command
	GroupNum   int
}

type EnvSettings

type EnvSettings struct {
	Agent *config.Config

	In     io.Reader
	Out    io.Writer
	Errout io.Writer

	Client  *rest.RESTClient
	Clients map[string]*rest.RESTClient // metrcs/cmd

	TopCmd *cobra.Command
	// contains filtered or unexported fields
}

envSettings describes all of the environment settings.

func NewSettings

func NewSettings(ctx context.Context) *EnvSettings

func (*EnvSettings) ApiCall

func (p *EnvSettings) ApiCall(method, uri string, param, body, output interface{}, opts ...cmdcli.RequestOption) error

func (*EnvSettings) ApiCallDone

func (p *EnvSettings) ApiCallDone(method, uri string, param, body, output interface{}, opts ...cmdcli.RequestOption) (err error)

func (*EnvSettings) ApiPaging

func (p *EnvSettings) ApiPaging(uri string, param, body, output interface{}, opts ...cmdcli.RequestOption) error

func (*EnvSettings) GetClient

func (p *EnvSettings) GetClient(name string) *rest.RESTClient

func (*EnvSettings) Init

func (p *EnvSettings) Init(cmd *cobra.Command) error

Init: init proc

func (EnvSettings) Output

func (p EnvSettings) Output() *EnvSettingsOutput

func (*EnvSettings) Parse

func (p *EnvSettings) Parse(fs *pflag.FlagSet, override map[string]string) error

func (*EnvSettings) Request

func (p *EnvSettings) Request(method, uri string, param, body, output interface{}, opts ...cmdcli.RequestOption) (*cmdcli.Request, error)

func (EnvSettings) String

func (p EnvSettings) String() string

func (*EnvSettings) Write

func (p *EnvSettings) Write(b []byte) (int, error)

type EnvSettingsOutput

type EnvSettingsOutput struct {
	Endpoint      string
	AuthTokenFile string
	DisablePage   bool
	PageSize      int
	Version       string
	Branch        string
	Revision      string
	BuildDate     string
}

type HookOps

type HookOps struct {
	CmdFactory func(*EnvSettings) *cobra.Command
	Owner      string
	GroupNum   int
	Priority   int
	Data       interface{}
}

type Preparer

type Preparer interface {
	Prepare() error
}

type Validator

type Validator interface {
	Validate() error
}

Directories

Path Synopsis
Package standalone provides utility functions for Agent CLI commands that set up a new in-process Agent runtime (ex: check, jmx commands), as opposed to CLI commands that query a running Agent's IPC API.
Package standalone provides utility functions for Agent CLI commands that set up a new in-process Agent runtime (ex: check, jmx commands), as opposed to CLI commands that query a running Agent's IPC API.

Jump to

Keyboard shortcuts

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