Documentation ¶
Index ¶
- Variables
- func ColorResults(responses []*tx.Response, regexes []*colorize.Colorize)
- func ValidateNodeFilter(NodeFilter *[]string, nodes map[string]nodes.Node) error
- func WatchFS(ctx *Context, cb func(string)) *fsnotify.Watcher
- func WsErrorf(ws chan<- interface{}, msg string, args ...interface{})
- func WsMakeChannel(conn *websocket.Conn) chan<- interface{}
- func WsWarnf(ws chan<- interface{}, msg string, args ...interface{})
- type Context
- type ContextJson
- type LinkJson
- type LogOutput
- type NodeJson
- type OutputAsJson
- type OutputAsLog
- type ResultOutput
- type Settings
- type Template
- type Templates
- type Topo
- type TopoJson
- type Vars
- type WebSocketOutput
- type WsConfig
- type WsMessage
- type WsMsgCode
- type WsTemplate
- type WsUiData
Constants ¶
This section is empty.
Variables ¶
View Source
var DebugCount int
Debug Level
Functions ¶
func ColorResults ¶ added in v0.0.3
Color the templates
func ValidateNodeFilter ¶
Ensure the NodeFilter contains valid nodes If empty, ensure it contains ALL the nodes
func WsErrorf ¶ added in v0.0.3
func WsErrorf(ws chan<- interface{}, msg string, args ...interface{})
func WsMakeChannel ¶ added in v0.0.21
Types ¶
type Context ¶
type Context struct { // the Kong Command() Command string DebugCount int Settings *Settings Async bool // Topology filename, used by config, serve TopoFilename string LabctlFilename string // used by config, serve TemplatePaths *orderedmap.OrderedMap[string, string] // used by config TemplateList []string // Used by config NodeFilter []string Topo Topo Template *template.Template // Output of any config command. Either to the terminal or websocket Output ResultOutput }
func (*Context) AsJson ¶ added in v0.0.21
func (ctx *Context) AsJson() *ContextJson
func (*Context) TemplatePathsSlice ¶ added in v0.0.3
Convert the TemplatePath stored in an orderedmap to a []string
type ContextJson ¶ added in v0.0.21
type LogOutput ¶ added in v0.0.3
type LogOutput struct{}
The standard output to the log. Implements ResultOutput
func (*LogOutput) LogResponses ¶ added in v0.0.3
func (l *LogOutput) LogResponses(obj []*tx.Response, _ *config.NodeConfig)
func (*LogOutput) PreferStdout ¶ added in v0.0.3
type NodeJson ¶
type NodeJson struct { types.ContainerDetails Vars map[string]interface{} `json:"vars,omitempty"` }
type OutputAsJson ¶ added in v0.0.3
type OutputAsJson interface{}
type OutputAsLog ¶ added in v0.0.3
type OutputAsLog interface{}
type ResultOutput ¶ added in v0.0.3
type Settings ¶
type Settings struct { Colors []*colorize.Colorize `yaml:"colorize"` Kindmap map[string]tx.KindDef `yaml:"kindmap"` }
func NewSettings ¶
func (*Settings) InitColors ¶
type Template ¶
type Templates ¶
func LoadTemplates ¶
Load the template from the ctx.TemplatePaths
type Topo ¶
func (*Topo) VarsAsJson ¶
type WebSocketOutput ¶ added in v0.0.3
type WebSocketOutput struct {
Ws chan<- interface{}
}
Implements ResultOutput
func (*WebSocketOutput) Error ¶ added in v0.0.3
func (ws *WebSocketOutput) Error(node string, msg string)
func (*WebSocketOutput) Info ¶ added in v0.0.3
func (ws *WebSocketOutput) Info(node string, msg string)
func (*WebSocketOutput) LogResponses ¶ added in v0.0.3
func (ws *WebSocketOutput) LogResponses(obj []*tx.Response, nc *config.NodeConfig)
func (*WebSocketOutput) PreferStdout ¶ added in v0.0.3
func (l *WebSocketOutput) PreferStdout() bool
type WsConfig ¶ added in v0.0.3
type WsConfig struct { Cmd string `json:"cmd,omitempty"` Results []*tx.Response `json:"results,omitempty"` Input *config.NodeConfig `json:"env"` }
type WsMessage ¶ added in v0.0.3
type WsMessage struct { Code WsMsgCode `json:"code"` Msg string `json:"msg,omitempty"` UiData *WsUiData `json:"uidata,omitempty"` Template *WsTemplate `json:"template,omitempty"` Config *WsConfig `json:"config,omitempty"` }
func WsUiUpdate ¶ added in v0.0.21
func (*WsMessage) UnmarshalJson ¶ added in v0.0.3
type WsTemplate ¶ added in v0.0.3
type WsTemplate struct { Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` Template string `json:"template,omitempty"` Vars map[string]interface{} `json:"vars,omitempty"` Result string `json:"result,omitempty"` ResultYaml map[string]interface{} `json:"resulty,omitempty"` }
Used by the frontend to request a template to be rendered
func (*WsTemplate) ClearInput ¶ added in v0.0.3
func (t *WsTemplate) ClearInput()
Clear the template command's input (typically before replying)
func (*WsTemplate) Render ¶ added in v0.0.3
func (t *WsTemplate) Render(ctx *Context) error
Render the template
type WsUiData ¶ added in v0.0.3
type WsUiData struct { Options map[string]interface{} `json:"options"` // A generic options dictionary for persistent UI options Layouts layouts `json:"layouts"` // layouts is a property of v-network-graph Templates map[string]string `json:"templates"` // Templates used by the UI etc Context *ContextJson `json:"context"` // Context with filename, template paths etc }
func NewWsUiData ¶ added in v0.0.3
func NewWsUiData() *WsUiData
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
The discovery package allows test processing of router CLI output It leverages TextFSMto parse the output and apply a golang template to the output
|
The discovery package allows test processing of router CLI output It leverages TextFSMto parse the output and apply a golang template to the output |
Click to show internal directories.
Click to hide internal directories.