Documentation
¶
Overview ¶
Package macros loads and validates honeyfile.yaml macro sets.
Index ¶
Constants ¶
const APIVersionV1Alpha1 = "honey.shareed2k.io/v1alpha1"
APIVersionV1Alpha1 is the only supported apiVersion value for MacroSet documents.
Variables ¶
This section is empty.
Functions ¶
func ResolvePath ¶
ResolvePath returns the absolute path of the honeyfile, checking --file, HONEY_MACROS_FILE, and default filenames.
Types ¶
type Macro ¶
type Macro struct {
Kind string `yaml:"kind" validate:"required,oneof=exec recipe logs tunnel app egress"`
MacroSelector `yaml:",inline"`
MacroExec `yaml:",inline"`
MacroRecipe `yaml:",inline"`
MacroLogs `yaml:",inline"`
MacroApp `yaml:",inline"`
MacroEgress `yaml:",inline"`
}
Macro describes a single named automation entry in a MacroSet. Kind selects which embedded field group applies. The groups are embedded inline, so the honeyfile.yaml wire format stays flat and callers read promoted fields (m.Command, m.EgressHost, …) unchanged — the decomposition names the per-kind field clusters without touching the schema or the readers.
type MacroEgress ¶ added in v0.3.7
type MacroEgress struct {
EgressHost string `yaml:"host"`
EgressHosts []string `yaml:"hosts"`
EgressPort int `yaml:"port"`
EgressBind string `yaml:"bind"`
EgressTun bool `yaml:"tun"`
EgressAutoProxy bool `yaml:"auto_proxy"`
EgressBypass []string `yaml:"bypass"`
}
MacroEgress holds the fields for kind: egress.
type MacroExec ¶ added in v0.3.7
type MacroExec struct {
Command string `yaml:"command"`
Commands []string `yaml:"commands"`
Parallel int `yaml:"parallel" validate:"omitempty,gte=1"`
Retry int `yaml:"retry" validate:"omitempty,gte=1"`
Timeout string `yaml:"timeout" validate:"omitempty,goduration"`
Shell string `yaml:"shell" validate:"omitempty,oneof=auto sh bash raw powershell"`
RunAs string `yaml:"runAs"`
Output string `yaml:"output" validate:"omitempty,oneof=text json"`
Quiet *bool `yaml:"quiet"`
}
MacroExec holds the fields for kind: exec.
type MacroLogs ¶ added in v0.3.7
type MacroLogs struct {
Source string `yaml:"source"`
Unit string `yaml:"unit"`
File string `yaml:"file"`
Cmd string `yaml:"cmd"`
Follow *bool `yaml:"follow"`
Tail *int64 `yaml:"tail" validate:"omitempty,gte=1"`
Since string `yaml:"since" validate:"omitempty,goduration"`
Timestamps *bool `yaml:"timestamps"`
Grep string `yaml:"grep"`
Labels []string `yaml:"labels"`
TUI *bool `yaml:"tui"`
OutputFile string `yaml:"outputFile"`
MaxConcurrency *int `yaml:"maxConcurrency" validate:"omitempty,gte=1"`
}
MacroLogs holds the fields for kind: logs.
type MacroRecipe ¶ added in v0.3.7
type MacroRecipe struct {
RecipePath string `yaml:"recipePath"`
Execute *bool `yaml:"execute"`
Env []string `yaml:"env"`
}
MacroRecipe holds the fields for kind: recipe.
type MacroSelector ¶ added in v0.3.7
type MacroSelector struct {
Target string `yaml:"target"`
Provider string `yaml:"provider"`
Backends string `yaml:"backends"`
Name string `yaml:"name"`
NameRegex string `yaml:"nameRegex"`
}
MacroSelector picks which hosts a macro runs against. Shared by every kind.
type MacroSet ¶
type MacroSet struct {
APIVersion string `yaml:"apiVersion" validate:"required,eq=honey.shareed2k.io/v1alpha1"`
Kind string `yaml:"kind" validate:"required,eq=MacroSet"`
Metadata Metadata `yaml:"metadata" validate:"required"`
Spec MacroSpecs `yaml:"spec" validate:"required"`
}
MacroSet is the top-level structure of a honeyfile.yaml.
type MacroSpecs ¶
type MacroSpecs struct {
Macros map[string]Macro `yaml:"macros" validate:"required,min=1,dive,keys,required,endkeys,required"`
}
MacroSpecs contains the named macro definitions within a MacroSet.