Documentation ¶
Index ¶
- func Providers() []string
- func RegisterProvider(name string, constructor func(string) HostProvider, magic func() HostProvider)
- func Version() string
- func VersionTuple() (major, minor, patch int)
- type Cache
- type DataLoader
- type Executor
- type History
- type HistoryItem
- type Host
- func (h *Host) AddPublicKey(k ssh.PublicKey)
- func (h *Host) Amend(h2 *Host)
- func (h *Host) GetAttribute(key string) (interface{}, bool)
- func (h *Host) MarshalJSON() ([]byte, error)
- func (h *Host) Match(hostnameGlob string, attributes MatchAttributes) bool
- func (h *Host) PublicKeys() []ssh.PublicKey
- func (h Host) String() string
- func (h *Host) UnmarshalJSON(data []byte) error
- type HostAttributes
- type HostKeyProvider
- type HostListOptions
- type HostProvider
- type HostSet
- func (s *HostSet) AddHost(host *Host)
- func (s *HostSet) AddHosts(hosts *HostSet)
- func (s *HostSet) Get(i int) *Host
- func (s *HostSet) Len() int
- func (s *HostSet) MarshalJSON() ([]byte, error)
- func (s *HostSet) Remove(glob string, attrs MatchAttributes)
- func (s *HostSet) Sample(attributes []string, count int)
- func (s *HostSet) Search(hostnameGlob string, attributes MatchAttributes) *HostSet
- func (s *HostSet) SetSortFields(attributes []string)
- func (s *HostSet) Sort()
- func (s *HostSet) String() string
- func (s *HostSet) Uniq()
- func (s *HostSet) UnmarshalJSON(b []byte) error
- type LoadingMessage
- type MatchAttribute
- type MatchAttributes
- type MultiError
- type OutputLine
- type OutputMode
- type ProgressMessage
- type ProgressState
- type Registry
- func (r *Registry) AddMagicProvider(p HostProvider)
- func (r *Registry) AddProvider(p HostProvider)
- func (r *Registry) InvalidateCache()
- func (r *Registry) KeepCaches()
- func (r *Registry) LoadHostKeys(ctx context.Context, lm LoadingMessage) error
- func (r *Registry) LoadHosts(ctx context.Context, lm LoadingMessage) error
- func (r *Registry) LoadMagicProviders()
- func (r *Registry) LoadProviders(c *viper.Viper) error
- func (r *Registry) Search(hostnameGlob string, attributes MatchAttributes, sampled []string, count int) *HostSet
- func (r *Registry) Settings() (string, map[string]interface{})
- type Result
- type Runner
- func (r *Runner) End()
- func (r *Runner) GetTimeout() time.Duration
- func (r *Runner) Interrupt()
- func (r *Runner) OnSignal(s os.Signal, f func())
- func (r *Runner) Run(command string, pc chan ProgressMessage, oc chan OutputLine) (*HistoryItem, error)
- func (r *Runner) SetConnectTimeout(t time.Duration)
- func (r *Runner) SetHostTimeout(t time.Duration)
- func (r *Runner) SetParallel(p int)
- func (r *Runner) SetSplay(t time.Duration)
- func (r *Runner) SetTimeout(t time.Duration)
- func (r *Runner) Settings() (string, map[string]interface{})
- type SettingsFunc
- type SimpleUI
- func (ui *SimpleUI) BindLogrus()
- func (ui *SimpleUI) End()
- func (ui *SimpleUI) LoadingMessage(what string, done bool, err error)
- func (ui *SimpleUI) OutputChannel() chan OutputLine
- func (ui *SimpleUI) PrintHistoryItem(hi *HistoryItem)
- func (ui *SimpleUI) PrintHostList(opts HostListOptions)
- func (ui *SimpleUI) PrintSettings(funcs ...SettingsFunc)
- func (ui *SimpleUI) ProgressChannel(deadline time.Time) chan ProgressMessage
- func (ui *SimpleUI) SetOutputMode(o OutputMode)
- func (ui *SimpleUI) SetOutputTimestamp(e bool)
- func (ui *SimpleUI) SetPagerEnabled(e bool)
- func (ui *SimpleUI) Settings() (string, map[string]interface{})
- func (ui *SimpleUI) Sync()
- func (ui *SimpleUI) Write(msg []byte) (int, error)
- type TimeoutError
- type UI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterProvider ¶
func RegisterProvider(name string, constructor func(string) HostProvider, magic func() HostProvider)
func VersionTuple ¶ added in v0.11.0
func VersionTuple() (major, minor, patch int)
Types ¶
type Cache ¶
type Cache interface { Source() HostProvider Invalidate() Keep() SetCacheDir(string) }
type DataLoader ¶
type History ¶
type History []*HistoryItem
type HistoryItem ¶
type HistoryItem struct { Command string Results []*Result Summary struct { Ok int Fail int Err int } StartTime time.Time EndTime time.Time ElapsedTime float64 // contains filtered or unexported fields }
func (*HistoryItem) MarshalJSON ¶
func (h *HistoryItem) MarshalJSON() ([]byte, error)
type Host ¶
type Host struct { Name string Address string Attributes HostAttributes Connection io.Closer // contains filtered or unexported fields }
A host represents a remote host. It can be instantiated manually, but is usually fetched from one or more Providers, which can all contribute to the hosts attributes.
func NewHost ¶
func NewHost(name, address string, attributes HostAttributes) *Host
Hosts should be initialized with this function, which also initializes any internal data, without which SSH connections will not be possible.
func (*Host) AddPublicKey ¶
Adds a public key to a host. Used by the ssh know hosts provider, but can be used by any other code as well.
func (*Host) GetAttribute ¶
func (*Host) MarshalJSON ¶ added in v0.11.0
func (*Host) PublicKeys ¶
func (*Host) UnmarshalJSON ¶
type HostAttributes ¶
type HostAttributes map[string]interface{}
Hosts can have attributes of any types, but querying is limited to strings, booleans, numbers, nil and slices of these values.
type HostKeyProvider ¶ added in v0.11.0
type HostListOptions ¶
type HostProvider ¶
type HostProvider interface { Name() string Prefix() string ParseViper(v *viper.Viper) error Load(ctx context.Context, l LoadingMessage) (*HostSet, error) Equivalent(p HostProvider) bool }
func NewProvider ¶
func NewProvider(pname, name string) (HostProvider, error)
type HostSet ¶ added in v0.10.0
type HostSet struct {
// contains filtered or unexported fields
}
func MergeHostSets ¶ added in v0.10.0
func NewHostSet ¶ added in v0.10.0
func NewHostSet() *HostSet
func (*HostSet) MarshalJSON ¶ added in v0.10.0
func (*HostSet) Remove ¶ added in v0.10.0
func (s *HostSet) Remove(glob string, attrs MatchAttributes)
func (*HostSet) Search ¶ added in v0.10.0
func (s *HostSet) Search(hostnameGlob string, attributes MatchAttributes) *HostSet
func (*HostSet) SetSortFields ¶ added in v0.10.0
func (*HostSet) UnmarshalJSON ¶ added in v0.10.0
type LoadingMessage ¶
type MatchAttribute ¶
type MatchAttribute struct { Name string FuzzyTyping bool Negate bool Regex bool Value interface{} }
func (MatchAttribute) Match ¶
func (m MatchAttribute) Match(value interface{}) (matches bool)
func (MatchAttribute) String ¶
func (m MatchAttribute) String() string
type MatchAttributes ¶
type MatchAttributes []MatchAttribute
type MultiError ¶
type MultiError struct { Subject string // contains filtered or unexported fields }
func (*MultiError) Add ¶
func (m *MultiError) Add(e error)
func (*MultiError) Error ¶
func (m *MultiError) Error() string
func (*MultiError) HasErrors ¶
func (m *MultiError) HasErrors() bool
type OutputLine ¶
type OutputMode ¶
type OutputMode int
const ( OutputTail OutputMode = iota OutputPerhost OutputInline OutputAll )
type ProgressMessage ¶
type ProgressMessage struct { Host *Host State ProgressState Result *Result }
type ProgressState ¶
type ProgressState int
const ( Queued ProgressState = iota Waiting Running Finished )
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func (*Registry) AddMagicProvider ¶
func (r *Registry) AddMagicProvider(p HostProvider)
func (*Registry) AddProvider ¶
func (r *Registry) AddProvider(p HostProvider)
func (*Registry) InvalidateCache ¶
func (r *Registry) InvalidateCache()
func (*Registry) KeepCaches ¶ added in v0.10.0
func (r *Registry) KeepCaches()
func (*Registry) LoadHostKeys ¶ added in v0.11.0
func (r *Registry) LoadHostKeys(ctx context.Context, lm LoadingMessage) error
func (*Registry) LoadHosts ¶
func (r *Registry) LoadHosts(ctx context.Context, lm LoadingMessage) error
func (*Registry) LoadMagicProviders ¶
func (r *Registry) LoadMagicProviders()
type Result ¶
type Result struct { Host string ExitStatus int Stdout []byte Stderr []byte Err error StartTime time.Time EndTime time.Time ElapsedTime float64 // contains filtered or unexported fields }
func (Result) MarshalJSON ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) GetTimeout ¶ added in v0.10.0
func (*Runner) Run ¶
func (r *Runner) Run(command string, pc chan ProgressMessage, oc chan OutputLine) (*HistoryItem, error)
func (*Runner) SetConnectTimeout ¶
func (*Runner) SetHostTimeout ¶
func (*Runner) SetParallel ¶
func (*Runner) SetTimeout ¶
type SettingsFunc ¶
type SimpleUI ¶
type SimpleUI struct {
// contains filtered or unexported fields
}
func NewSimpleUI ¶
func (*SimpleUI) BindLogrus ¶
func (ui *SimpleUI) BindLogrus()
func (*SimpleUI) LoadingMessage ¶
func (*SimpleUI) OutputChannel ¶
func (ui *SimpleUI) OutputChannel() chan OutputLine
func (*SimpleUI) PrintHistoryItem ¶
func (ui *SimpleUI) PrintHistoryItem(hi *HistoryItem)
func (*SimpleUI) PrintHostList ¶
func (ui *SimpleUI) PrintHostList(opts HostListOptions)
func (*SimpleUI) PrintSettings ¶
func (ui *SimpleUI) PrintSettings(funcs ...SettingsFunc)
func (*SimpleUI) ProgressChannel ¶
func (ui *SimpleUI) ProgressChannel(deadline time.Time) chan ProgressMessage
func (*SimpleUI) SetOutputMode ¶
func (ui *SimpleUI) SetOutputMode(o OutputMode)
func (*SimpleUI) SetOutputTimestamp ¶
func (*SimpleUI) SetPagerEnabled ¶
type TimeoutError ¶
type TimeoutError struct {
Message string
}
func (TimeoutError) Error ¶
func (e TimeoutError) Error() string
type UI ¶
type UI interface { PrintHistoryItem(hi *HistoryItem) PrintHostList(opts HostListOptions) PrintSettings(...SettingsFunc) SetOutputMode(OutputMode) SetOutputTimestamp(bool) SetPagerEnabled(bool) Write([]byte) (int, error) Sync() End() LoadingMessage(what string, done bool, err error) OutputChannel() chan OutputLine ProgressChannel(deadline time.Time) chan ProgressMessage BindLogrus() Settings() (string, map[string]interface{}) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.