Documentation ¶
Index ¶
- type Connection
- func (c Connection) Run(cmd string) (stdout, stderr []byte, exitCode int, err error)
- func (c Connection) Stream(cmd string, stdoutWriter io.Writer) (stderr []byte, exitCode int, err error)
- func (c Connection) StreamStdin(cmd string, stdinReader io.Reader) (stdout, stderr []byte, exitCode int, err error)
- func (c Connection) Username() string
- type Logger
- type RemoteRunner
- type RemoteRunnerFactory
- type SSHConnection
- type SSHOptsGenerator
- type SSHSession
- type SSHSessionBuilder
- type SshRemoteRunner
- func (r SshRemoteRunner) ArchiveAndDownload(directory string, writer io.Writer) error
- func (r SshRemoteRunner) ChecksumDirectory(path string) (map[string]string, error)
- func (r SshRemoteRunner) ConnectedUsername() string
- func (r SshRemoteRunner) CreateDirectory(directory string) error
- func (r SshRemoteRunner) DirectoryExists(dir string) (bool, error)
- func (r SshRemoteRunner) ExtractAndUpload(reader io.Reader, directory string) error
- func (r SshRemoteRunner) FindFiles(pattern string) ([]string, error)
- func (r SshRemoteRunner) IsWindows() (bool, error)
- func (r SshRemoteRunner) RemoveDirectory(dir string) error
- func (r SshRemoteRunner) RunScript(path, label string) error
- func (r SshRemoteRunner) RunScriptWithEnv(path string, env map[string]string, label string, stdout io.Writer) error
- func (r SshRemoteRunner) SizeInBytes(path string) (int, error)
- func (r SshRemoteRunner) SizeOf(path string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (Connection) Run ¶
func (c Connection) Run(cmd string) (stdout, stderr []byte, exitCode int, err error)
func (Connection) StreamStdin ¶
func (Connection) Username ¶
func (c Connection) Username() string
type RemoteRunner ¶
type RemoteRunner interface { ConnectedUsername() string DirectoryExists(dir string) (bool, error) RemoveDirectory(dir string) error ArchiveAndDownload(directory string, writer io.Writer) error CreateDirectory(directory string) error ExtractAndUpload(reader io.Reader, directory string) error SizeOf(path string) (string, error) SizeInBytes(path string) (int, error) ChecksumDirectory(path string) (map[string]string, error) RunScript(path, label string) error RunScriptWithEnv(path string, env map[string]string, label string, stdout io.Writer) error FindFiles(pattern string) ([]string, error) IsWindows() (bool, error) }
func NewSshRemoteRunner ¶
func NewSshRemoteRunner(host, user, privateKey string, publicKeyCallback ssh.HostKeyCallback, publicKeyAlgorithm []string, logger Logger) (RemoteRunner, error)
type RemoteRunnerFactory ¶
type RemoteRunnerFactory func(host, user, privateKey string, publicKeyCallback ssh.HostKeyCallback, publicKeyAlgorithm []string, logger Logger) (RemoteRunner, error)
type SSHConnection ¶
type SSHConnection interface { Stream(cmd string, writer io.Writer) ([]byte, int, error) StreamStdin(cmd string, reader io.Reader) ([]byte, []byte, int, error) Run(cmd string) ([]byte, []byte, int, error) Username() string }
func NewConnection ¶
func NewConnection(hostName, userName, privateKey string, publicKeyCallback ssh.HostKeyCallback, publicKeyAlgorithm []string, logger Logger) (SSHConnection, error)
func NewConnectionWithServerAliveInterval ¶
func NewConnectionWithServerAliveInterval(hostName, userName, privateKey string, publicKeyCallback ssh.HostKeyCallback, publicKeyAlgorithm []string, serverAliveInterval time.Duration, logger Logger) (SSHConnection, error)
type SSHOptsGenerator ¶
type SSHSession ¶ added in v1.9.1
type SSHSessionBuilder ¶ added in v1.9.1
type SshRemoteRunner ¶
type SshRemoteRunner struct {
// contains filtered or unexported fields
}
func (SshRemoteRunner) ArchiveAndDownload ¶
func (r SshRemoteRunner) ArchiveAndDownload(directory string, writer io.Writer) error
func (SshRemoteRunner) ChecksumDirectory ¶
func (r SshRemoteRunner) ChecksumDirectory(path string) (map[string]string, error)
func (SshRemoteRunner) ConnectedUsername ¶
func (r SshRemoteRunner) ConnectedUsername() string
func (SshRemoteRunner) CreateDirectory ¶
func (r SshRemoteRunner) CreateDirectory(directory string) error
func (SshRemoteRunner) DirectoryExists ¶
func (r SshRemoteRunner) DirectoryExists(dir string) (bool, error)
func (SshRemoteRunner) ExtractAndUpload ¶
func (r SshRemoteRunner) ExtractAndUpload(reader io.Reader, directory string) error
func (SshRemoteRunner) FindFiles ¶
func (r SshRemoteRunner) FindFiles(pattern string) ([]string, error)
func (SshRemoteRunner) IsWindows ¶
func (r SshRemoteRunner) IsWindows() (bool, error)
func (SshRemoteRunner) RemoveDirectory ¶
func (r SshRemoteRunner) RemoveDirectory(dir string) error
func (SshRemoteRunner) RunScript ¶
func (r SshRemoteRunner) RunScript(path, label string) error
func (SshRemoteRunner) RunScriptWithEnv ¶
func (r SshRemoteRunner) RunScriptWithEnv(path string, env map[string]string, label string, stdout io.Writer) error
RunScriptWithEnv runs the script at 'path' on our remote environment. The script is run with the environment variables specified in 'env'. All logging is annotated with 'label'.
Instead of returning the contents of stdout as a string, we stream it to the Writer 'stdout' during the call. This means that if a given script outputs very large amounts of data to stdout, we don't cache it all in memory and run the risk of crashing the CLI.
func (SshRemoteRunner) SizeInBytes ¶ added in v1.7.2
func (r SshRemoteRunner) SizeInBytes(path string) (int, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.