plugins

package
v0.0.0-...-041d431 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAgent

func GetAgent(name string) interface{}

GetAgent will return an agent registered with the name.

func RegisterAgent

func RegisterAgent(name string, agent interface{})

RegisterAgent will register the agent with the agent store.

func RegisterNotifier

func RegisterNotifier(name string, notifier interface{})

RegisterNotifier will register the notifier with the notifier store.

func ValidateResultKeyRune

func ValidateResultKeyRune(r rune) bool

ValidateResultKeyRune returns true for a rune allowed in a AgentResult key.

Types

type Agent

type Agent interface {
	// Check should run the agents check.
	Check(result AgentResult) error
}

Agent should be implemented by all agents. An agent is the entity responsible for carrying out all checks.

type AgentDescription

type AgentDescription struct {
	Name      string                `json:"name"`
	Remote    bool                  `json:"remote"`
	Arguments []ArgumentDescription `json:"arguments"`
}

AgentDescription describes an agent.

func ListAgents

func ListAgents() []AgentDescription

ListAgents will return a list of all agents.

type AgentResult

type AgentResult map[string]interface{}

AgentResult describes the result from an agent.

func NewAgentResult

func NewAgentResult() AgentResult

NewAgentResult will instanmtiate a new AgentResult ready for passing to an agent.

func (AgentResult) AddValue

func (a AgentResult) AddValue(key string, value interface{})

AddValue will add a result value.

type ArgumentDescription

type ArgumentDescription struct {
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	Description string   `json:"description"`
	Default     string   `json:"default"`
	EnumValues  []string `json:"enum"`
}

ArgumentDescription contains everything needed for creating a GUI for configuring a plugin.

type Notifier

type Notifier interface {
	Notify(text string) error
}

Notifier must be implemented by plugins capable of delivering notifications.

func GetNotifier

func GetNotifier(name string) Notifier

GetNotifier will return a notifier registred with the name.

type NotifierDescription

type NotifierDescription struct {
	Name      string                `json:"name"`
	Arguments []ArgumentDescription `json:"arguments"`
}

NotifierDescription describes a notifier.

func ListNotifiers

func ListNotifiers() []NotifierDescription

ListNotifiers will return a list of all agents.

type RemoteAgent

type RemoteAgent interface {
	RemoteCheck(transport transports.Transport, result AgentResult) error
}

RemoteAgent should be implemented for all agents supporting a transport.

Directories

Path Synopsis
agents
ssh
notifiers

Jump to

Keyboard shortcuts

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