sup

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name    string        `yaml:"name"`   // Command name.
	Desc    string        `yaml:"desc"`   // Command description.
	Run     *string       `yaml:"run"`    // Command(s) to be run remotelly.
	Script  *string       `yaml:"script"` // Load command(s) from script and run it remotelly.
	Upload  []*Upload     `yaml:"upload"` // See Upload struct.
	Stdin   bool          `yaml:"stdin"`  // Attach localhost STDOUT to remote commands' STDIN?
	Input   io.ReadCloser `yaml:"-"`
	Timeout int           `yaml:"timeout"`
}

Command represents command(s) to be run remotely.

type Commands

type Commands struct {
	Names []string
	// contains filtered or unexported fields
}

Commands is a list of user-defined commands

func (*Commands) Get

func (c *Commands) Get(name string) (Command, bool)

func (*Commands) Set

func (c *Commands) Set(name string, cmd Command)

func (*Commands) UnmarshalYAML

func (c *Commands) UnmarshalYAML(unmarshal func(interface{}) error) error

type EnvList

type EnvList []*EnvVar

EnvList is a list of environment variables that maps to a YAML map, but maintains order, enabling late variables to reference early variables.

func (*EnvList) AsExport

func (e *EnvList) AsExport() string

func (*EnvList) ResolveValues

func (e *EnvList) ResolveValues() error

func (*EnvList) Set

func (e *EnvList) Set(key, value string)

Set key to be equal value in this list.

func (EnvList) Slice

func (e EnvList) Slice() []string

func (*EnvList) UnmarshalYAML

func (e *EnvList) UnmarshalYAML(unmarshal func(interface{}) error) error

type EnvVar

type EnvVar struct {
	Key   string
	Value string
}

EnvVar represents an environment variable

func (EnvVar) AsExport

func (e EnvVar) AsExport() string

AsExport returns the environment variable as a bash export statement

func (EnvVar) String

func (e EnvVar) String() string

type ErrMustUpdate

type ErrMustUpdate struct {
	Msg string
}

func (ErrMustUpdate) Error

func (e ErrMustUpdate) Error() string

type ErrUnsupportedSupfileVersion

type ErrUnsupportedSupfileVersion struct {
	Msg string
}

func (ErrUnsupportedSupfileVersion) Error

type Network

type Network struct {
	Env       EnvList `yaml:"env"`
	Inventory string  `yaml:"inventory"`
	// Hosts     []string                      `yaml:"hosts"`
	Remotes []*structs.L2DeviceRemoteInfo `yaml:"remotes"`
	Bastion string                        `yaml:"bastion"` // Jump host for the environment

	// Should these live on Hosts too? We'd have to change []string to struct, even in Supfile.
	User         string // `yaml:"user"`
	IdentityFile string // `yaml:"identity_file"`
}

Network is group of hosts with extra custom env vars.

func (Network) ParseInventory

func (n Network) ParseInventory() ([]string, error)

ParseInventory runs the inventory command, if provided, and appends the command's output lines to the manually defined list of hosts.

type Networks

type Networks struct {
	Names []string
	// contains filtered or unexported fields
}

Networks is a list of user-defined networks

func (*Networks) Get

func (n *Networks) Get(name string) (Network, bool)

func (*Networks) UnmarshalYAML

func (n *Networks) UnmarshalYAML(unmarshal func(interface{}) error) error

type SupConfig

type SupConfig struct {
	// Network  Network  `yaml:"network"`
	Commands []*Command `yaml:"commands"`
	Targets  Targets    `yaml:"targets"`
	Env      *EnvList   `yaml:"env"`
	Version  string     `yaml:"version"`
}

func NewSupConfg

func NewSupConfg(data []byte) (*SupConfig, error)

func (*SupConfig) AddEnv

func (s *SupConfig) AddEnv(key, value string)

func (*SupConfig) RunCommand

func (s *SupConfig) RunCommand(name, cmd, desc string) (err error)

func (*SupConfig) ScriptCommand

func (s *SupConfig) ScriptCommand(name, script string) (err error)

func (*SupConfig) UploadCommand

func (s *SupConfig) UploadCommand(name string, urls []*Upload) (err error)

type Supfile

type Supfile struct {
	Networks Networks `yaml:"networks"`
	Commands Commands `yaml:"commands"`
	Targets  Targets  `yaml:"targets"`
	Env      *EnvList `yaml:"env"`
	Version  string   `yaml:"version"`
}

Supfile represents the Stack Up configuration YAML file.

func NewSupfile

func NewSupfile(data []byte) (*Supfile, error)

NewSupfile parses configuration file and returns Supfile or error.

type Targets

type Targets struct {
	Names []string
	// contains filtered or unexported fields
}

Targets is a list of user-defined targets

func (*Targets) Get

func (t *Targets) Get(name string) ([]string, bool)

func (*Targets) UnmarshalYAML

func (t *Targets) UnmarshalYAML(unmarshal func(interface{}) error) error

type Upload

type Upload struct {
	Name    string  `yaml:"name"`
	Src     *string `yaml:"src"`
	Dst     *string `yaml:"dst"`
	Exc     string  `yaml:"exclude"`
	Timeout int     `yaml:"timeout"`
}

Upload represents file copy operation from localhost Src path to Dst path of every host in a given Network.

Jump to

Keyboard shortcuts

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