Documentation
¶
Overview ¶
Package commands provides base commands and helpers.
Index ¶
- Variables
- func ParseCustomLabels(labels string) (map[string]string, error)
- func ParseTemplate(text string) *template.Template
- func ReadFile(filepath string) (string, error)
- func RenderTemplate(t *template.Template, data interface{}) string
- func SetupClients(ctx context.Context, serverURL string)
- type Command
- type CommandWithContext
- type Error
- type ErrorResponse
- type Result
Constants ¶
This section is empty.
Variables ¶
var ( Annotation = new(annotationCommand) AnnotationC = kingpin.Command("annotate", "Add an annotation to Grafana charts") )
register command
var ( Config = new(configCommand) ConfigC = kingpin.Command("config", "Configure local pmm-agent") )
register command
var ( List = new(listCommand) ListC = kingpin.Command("list", "Show Services and Agents running on this Node") )
register command
var ( Status = new(statusCommand) StatusC = kingpin.Command("status", "Show information about local pmm-agent") )
register command
var ( Summary = new(summaryCommand) SummaryC = kingpin.Command("summary", "Fetch system data for diagnostics") )
register command
var Ctx = context.Background()
Ctx is a shared context for all requests.
var GlobalFlags = new(globalFlagsValues)
GlobalFlags contains pmm-admin core flags values.
var UsageTemplate = `` /* 1396-byte string literal not displayed */
Default kingping's usage template with tweaks: * FormatAllCommands is a copy of FormatCommands that ignores hidden flag; * subcommands are shown with FormatAllCommands.
Functions ¶
func ParseCustomLabels ¶
ParseCustomLabels parses --custom-labels flag value.
Note that quotes around value are parsed and removed by shell before this function is called. E.g. the value of [[--custom-labels='region=us-east1, mylabel=mylab-22']] will be received by this function as [[region=us-east1, mylabel=mylab-22]].
func ParseTemplate ¶
func RenderTemplate ¶
RenderTemplate renders given template with given data and returns result as string.
func SetupClients ¶
SetupClients configures local and PMM Server API clients.
Types ¶
type Command ¶
Command is a common interface for all commands.
Command should:
- use logrus.Trace/Debug functions for debug logging;
- return result on success;
- return error on failure.
Command should not:
- return both result and error;
- exit with logrus.Fatal, os.Exit, etc;
- use logrus.Print, logrus.Info and higher levels except:
- summary command (for progress output).
type CommandWithContext ¶
type CommandWithContext interface { // TODO rename to Run RunWithContext(ctx context.Context) (Result, error) }
TODO remove Command above, rename CommandWithContext to Command
type ErrorResponse ¶
Directories
¶
Path | Synopsis |
---|---|
Package inventory provides inventory commands.
|
Package inventory provides inventory commands. |
Package management provides management commands.
|
Package management provides management commands. |