macros

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package macros loads and validates honeyfile.yaml macro sets.

Index

Constants

View Source
const APIVersionV1Alpha1 = "honey.shareed2k.io/v1alpha1"

APIVersionV1Alpha1 is the only supported apiVersion value for MacroSet documents.

Variables

This section is empty.

Functions

func ResolvePath

func ResolvePath(explicit string) (string, error)

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"`

	Target    string `yaml:"target"`
	Provider  string `yaml:"provider"`
	Backends  string `yaml:"backends"`
	Name      string `yaml:"name"`
	NameRegex string `yaml:"nameRegex"`

	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"`

	RecipePath string   `yaml:"recipePath"`
	Execute    *bool    `yaml:"execute"`
	Env        []string `yaml:"env"`

	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"`

	App         string `yaml:"app"`
	OpenBrowser *bool  `yaml:"openBrowser"`

	// Egress kind
	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"`
}

Macro describes a single named automation entry in a MacroSet.

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.

func Load

func Load(path string) (*MacroSet, error)

Load parses and validates the MacroSet at path.

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.

type Metadata

type Metadata struct {
	Name string `yaml:"name" validate:"required"`
}

Metadata holds identifying information for a MacroSet.

Jump to

Keyboard shortcuts

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