command

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2025 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package command provides the logic for parsing command-line arguments and run the available monitoring commands

Index

Constants

View Source
const (
	StateOk int = iota
	StateWarning
	StateCritical
	StateUndefined
)

(Nagios compatible) return codes constants.

View Source
const (
	DefaultWarningTokenExpiration  = "168h"
	DefaultCriticalTokenExpiration = "72h"
)

Thresholds in hours for warning and critical status.

Variables

This section is empty.

Functions

func Run

func Run(args []string) int

Run initializes a CLI instance and its command state engine.

Types

type BaseCommand

type BaseCommand struct {
	Address       string
	OutputFormat  string
	Token         string
	TokenAccessor string
	UI            cli.Ui

	UnknownAsCritical bool
	SealedAsWarning   bool
	// contains filtered or unexported fields
}

BaseCommand is a Command that holds the common command options

func (*BaseCommand) Client

func (c *BaseCommand) Client() (*api.Client, error)

Client returs a new HTTP API Vault client for the given configuration or the recommended default one, if no custom configuration were provided.

If the environment variable `VAULT_TOKEN` is present, the token will be automatically added to the client.

func (*BaseCommand) OutputHandle added in v0.6.2

func (c *BaseCommand) OutputHandle() (*Outputter, error)

OutputHandle returns the output helper function that is responsible of the command output formatting and return codes selection.

type GetCommand

type GetCommand struct {
	*BaseCommand
	Field string
	Path  string
}

GetCommand is a CLI Command that holds the attributes of the command `readsecret`.

func (*GetCommand) Help

func (c *GetCommand) Help() string

Help returns a long-form help text of the `get` command.

func (*GetCommand) Run

func (c *GetCommand) Run(args []string) int

Run executes the `get` command with the given CLI instance and command-line arguments.

func (*GetCommand) Synopsis

func (c *GetCommand) Synopsis() string

Synopsis returns a short synopsis of the `get` command.

type HAStatusCommand added in v0.7.0

type HAStatusCommand struct {
	*BaseCommand
}

HAStatusCommand is a CLI Command that holds the attributes of the command `hastatus`.

func (*HAStatusCommand) Help added in v0.7.0

func (c *HAStatusCommand) Help() string

Help returns a long-form help text of the `status` command.

func (*HAStatusCommand) Run added in v0.7.0

func (c *HAStatusCommand) Run(args []string) int

Run executes the `hastatus` command with the given CLI instance and command-line arguments.

func (*HAStatusCommand) Synopsis added in v0.7.0

func (c *HAStatusCommand) Synopsis() string

Synopsis returns a short synopsis of the `hastatus` command.

type Outputter added in v0.6.2

type Outputter struct {
	Output    func(format string, a ...interface{})
	Warning   func(format string, a ...interface{})
	Critical  func(format string, a ...interface{})
	Undefined func(format string, a ...interface{})
}

Outputter holds the output functions that are monitoring tool dependent.

type PoliciesCommand

type PoliciesCommand struct {
	*BaseCommand
	Policies []string
}

PoliciesCommand is a CLI Command that holds the attributes of the command `policies`.

func (*PoliciesCommand) Help

func (c *PoliciesCommand) Help() string

Help returns a long-form help text of the `policies` command.

func (*PoliciesCommand) Run

func (c *PoliciesCommand) Run(args []string) int

Run executes the `policies` command with the given CLI instance and command-line arguments.

func (*PoliciesCommand) Synopsis

func (c *PoliciesCommand) Synopsis() string

Synopsis returns a short synopsis of the `policies` command.

type StatusCommand

type StatusCommand struct {
	*BaseCommand
}

StatusCommand is a CLI Command that holds the attributes of the command `status`.

func (*StatusCommand) Help

func (c *StatusCommand) Help() string

Help returns a long-form help text of the `status` command.

func (*StatusCommand) Run

func (c *StatusCommand) Run(args []string) int

Run executes the `status` command with the given CLI instance and command-line arguments.

func (*StatusCommand) Synopsis

func (c *StatusCommand) Synopsis() string

Synopsis returns a short synopsis of the `status` command.

type TokenLookupCommand added in v0.8.0

type TokenLookupCommand struct {
	*BaseCommand
	WarningThreshold  string
	CriticalThreshold string
}

TokenLookupCommand is a CLI Command that holds the attributes of the command `token-lookup`.

func (*TokenLookupCommand) GetThresholds added in v0.8.0

func (c *TokenLookupCommand) GetThresholds() (time.Duration, time.Duration, error)

GetThresholds parses the warning and critical thresholds and return their corresponding Duration values

func (*TokenLookupCommand) Help added in v0.8.0

func (c *TokenLookupCommand) Help() string

Help returns a long-form help text of the `token-lookup` command.

func (*TokenLookupCommand) Run added in v0.8.0

func (c *TokenLookupCommand) Run(args []string) int

Run executes the `token-lookup` command with the given CLI instance and command-line arguments.

func (*TokenLookupCommand) Synopsis added in v0.8.0

func (c *TokenLookupCommand) Synopsis() string

Synopsis returns a short synopsis of the `token-lookup` command.

Jump to

Keyboard shortcuts

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