Documentation ¶
Index ¶
- Variables
- type Errors
- type Listener
- type MultiCommandSession
- type ReplayCommand
- type ReplayCommands
- func (c *ReplayCommands) Disable(source interface{}) (err error)
- func (c *ReplayCommands) Enable(source interface{}) (err error)
- func (c *ReplayCommands) Load() error
- func (c *ReplayCommands) Next(stdin string) string
- func (c *ReplayCommands) Register(stdin, stdout string)
- func (c *ReplayCommands) Shell() string
- func (c *ReplayCommands) Store() error
- func (c *ReplayCommands) System() string
- type Service
- type SessionConfig
- type TerminatedError
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
var ErrTerminated = &TerminatedError{}
ErrTerminated - command session terminated
Functions ¶
This section is empty.
Types ¶
type Listener ¶
Listener represent command listener (it will send stdout fragments as thier being available on stdout)
type MultiCommandSession ¶
type MultiCommandSession interface { Run(command string, listener Listener, timeoutMs int, terminators ...string) (string, error) ShellPrompt() string System() string Reconnect() error Close() }
MultiCommandSession represents a multi command session
func NewReplayMultiCommandSession ¶
func NewReplayMultiCommandSession(shellPrompt, system string, commands *ReplayCommands) MultiCommandSession
type ReplayCommand ¶
ReplayCommand represent a replay command
type ReplayCommands ¶
type ReplayCommands struct { Commands map[string]*ReplayCommand Keys []string BaseDir string }
replayCommands represnets command grouped by stdin
func NewReplayCommands ¶
func NewReplayCommands(basedir string) (*ReplayCommands, error)
NewReplayCommands create a new replay commands or error if provided basedir does not exists and can not be created
func (*ReplayCommands) Disable ¶
func (c *ReplayCommands) Disable(source interface{}) (err error)
func (*ReplayCommands) Enable ¶
func (c *ReplayCommands) Enable(source interface{}) (err error)
func (*ReplayCommands) Load ¶
func (c *ReplayCommands) Load() error
Load loads replay command from base directory
func (*ReplayCommands) Next ¶
func (c *ReplayCommands) Next(stdin string) string
return stdout pointed by index and increases index or empty string if exhausted
func (*ReplayCommands) Register ¶
func (c *ReplayCommands) Register(stdin, stdout string)
Register register stdin and corresponding stdout conversation
func (*ReplayCommands) Store ¶
func (c *ReplayCommands) Store() error
Store stores replay command in the base directory
type Service ¶
type Service interface { //Service returns a service wrapper Client() *ssh.Client //OpenMultiCommandSession opens multi command session OpenMultiCommandSession(config *SessionConfig) (MultiCommandSession, error) //Run runs supplied command Run(command string) error //Upload uploads provided content to specified destination //Deprecated: please consider using https://github.com/viant/afs/tree/master/scp Upload(destination string, mode os.FileMode, content []byte) error //Download downloads content from specified source. //Deprecated: please consider using https://github.com/viant/afs/tree/master/scp Download(source string) ([]byte, error) //OpenTunnel opens a tunnel between local to remote for network traffic. OpenTunnel(localAddress, remoteAddress string) error NewSession() (*ssh.Session, error) Close() error }
Service represents ssh service
func NewReplayService ¶
func NewReplayService(shellPrompt, system string, commands *ReplayCommands, storage map[string][]byte) Service
type SessionConfig ¶
type SessionConfig struct { EnvVariables map[string]string Shell string Term string Rows int Columns int }
SessionConfig represents a new session config
type TerminatedError ¶
type TerminatedError struct {
Err error
}
func (*TerminatedError) Error ¶
func (t *TerminatedError) Error() string