Documentation
¶
Index ¶
- type AuthError
- type CmdError
- type ConnError
- type Executor
- type MockExecutor
- func (m *MockExecutor) Close() error
- func (m *MockExecutor) Run(ctx context.Context, instance config.ServerInstance, command string) (string, error)
- func (m *MockExecutor) RunWithSudo(ctx context.Context, instance config.ServerInstance, command string) (string, error)
- func (m *MockExecutor) RunWithSudoAndStdin(ctx context.Context, instance config.ServerInstance, command string, ...) (string, error)
- type SSHClient
- func (c *SSHClient) Close() error
- func (c *SSHClient) Run(ctx context.Context, instance config.ServerInstance, command string) (string, error)
- func (c *SSHClient) RunWithSudo(ctx context.Context, instance config.ServerInstance, command string) (string, error)
- func (c *SSHClient) RunWithSudoAndStdin(ctx context.Context, instance config.ServerInstance, command string, ...) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor interface {
Run(ctx context.Context, instance config.ServerInstance, command string) (string, error)
RunWithSudo(ctx context.Context, instance config.ServerInstance, command string) (string, error)
RunWithSudoAndStdin(ctx context.Context, instance config.ServerInstance, command string, stdinContent string) (string, error)
Close() error
}
Executor defines the interface for running commands on remote servers.
type MockExecutor ¶
type MockExecutor struct {
RunFunc func(ctx context.Context, instance config.ServerInstance, command string) (string, error)
RunWithSudoFunc func(ctx context.Context, instance config.ServerInstance, command string) (string, error)
RunWithSudoAndStdinFunc func(ctx context.Context, instance config.ServerInstance, command string, stdinContent string) (string, error)
Closed bool
}
MockExecutor implements Executor for testing.
func (*MockExecutor) Close ¶
func (m *MockExecutor) Close() error
func (*MockExecutor) Run ¶
func (m *MockExecutor) Run(ctx context.Context, instance config.ServerInstance, command string) (string, error)
func (*MockExecutor) RunWithSudo ¶
func (m *MockExecutor) RunWithSudo(ctx context.Context, instance config.ServerInstance, command string) (string, error)
func (*MockExecutor) RunWithSudoAndStdin ¶
func (m *MockExecutor) RunWithSudoAndStdin(ctx context.Context, instance config.ServerInstance, command string, stdinContent string) (string, error)
type SSHClient ¶
type SSHClient struct {
// contains filtered or unexported fields
}
SSHClient implements Executor using native Go SSH.
func NewSSHClient ¶
NewSSHClient creates a new SSH client with key loading from SSH agent and PPK_NAMES.
func (*SSHClient) RunWithSudo ¶
Click to show internal directories.
Click to hide internal directories.