agent

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EachFile

func EachFile(libdirs []string, cb func(name string, path string) (br bool))

EachFile calls cb with a path to every found agent DDL, stops looking when br is true

Types

type Action

type Action struct {
	Name        string                       `json:"action"`
	Input       json.RawMessage              `json:"input"`
	Output      map[string]*ActionOutputItem `json:"output"`
	Display     string                       `json:"display"`
	Description string                       `json:"description"`
	Aggregation []ActionAggregateItem        `json:"aggregate"`

	sync.Mutex
	// contains filtered or unexported fields
}

Action describes an individual action in an agent

func (*Action) AggregateResult added in v0.6.0

func (a *Action) AggregateResult(result map[string]interface{}) error

AggregateResult receives a result and aggregate all the data found in it, most errors are squashed since aggregation are called during processing of replies and we do not want to fail a reply just because aggregation failed, thus this is basically a best efforts kind of thing on purpose

func (*Action) AggregateResultJSON added in v0.6.0

func (a *Action) AggregateResultJSON(jres []byte) error

AggregateResultJSON receives a JSON reply and aggregate all the data found in it

func (*Action) AggregateSummaryFormattedStrings added in v0.6.0

func (a *Action) AggregateSummaryFormattedStrings() (map[string][]string, error)

AggregateSummaryFormattedStrings produce a formatted string for each output item that has a aggregate summary defined

func (*Action) AggregateSummaryJSON added in v0.6.0

func (a *Action) AggregateSummaryJSON() ([]byte, error)

AggregateSummaryJSON produce a JSON representation of aggregate results for every output item that has a aggregate summary defined

func (*Action) AggregateSummaryStrings added in v0.6.0

func (a *Action) AggregateSummaryStrings() (map[string]map[string]string, error)

AggregateSummaryStrings produce a map of results for every output item that has a aggregate summary defined

type ActionAggregateItem added in v0.6.0

type ActionAggregateItem struct {
	Function  string          `json:"function"`
	Arguments json.RawMessage `json:"args"`
}

ActionAggregateItem describes a aggregate function to summarize data

type ActionOutputItem

type ActionOutputItem struct {
	Description string      `json:"description"`
	DisplayAs   string      `json:"display_as"`
	Default     interface{} `json:"default"`
}

ActionOutputItem describes an individual output item

type DDL

type DDL struct {
	Schema   string           `json:"$schema"`
	Metadata *agents.Metadata `json:"metadata"`
	Actions  []*Action        `json:"actions"`
}

DDL represents the schema of a mcorpc agent and is at a basic level compatible with the mcollective agent ddl format

func Find

func Find(agent string, libdirs []string) (ddl *DDL, err error)

Find looks in the supplied libdirs for a DDL file for a specific agent

func New

func New(file string) (*DDL, error)

New creates a new DDL from a JSON file

func (*DDL) ActionInterface

func (d *DDL) ActionInterface(action string) (*Action, error)

ActionInterface looks up an Action by name

func (*DDL) ActionNames

func (d *DDL) ActionNames() []string

ActionNames is a list of known actions defined by a DDL

func (*DDL) HaveAction

func (d *DDL) HaveAction(action string) bool

HaveAction determines if an action is known

func (*DDL) Timeout

func (d *DDL) Timeout() time.Duration

Timeout is the timeout for this agent

Jump to

Keyboard shortcuts

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