Documentation
¶
Index ¶
- func CreateSettings() settings.Settings
- type Bastion
- type Client
- func (c *Client) AddCommandProvider(host string, f CommandProvider) *Client
- func (c *Client) AddScriptProvider(host string, f UploadScriptProvider) *Client
- func (c *Client) Check() connection.Check
- func (c *Client) Command(name string, arg ...string) connection.Command
- func (c *Client) File() connection.File
- func (c *Client) IsStopped() bool
- func (c *Client) KubeProxy() connection.KubeProxy
- func (c *Client) Loop(fn connection.SSHLoopHandler) error
- func (c *Client) OnlyPreparePrivateKeys() error
- func (c *Client) PrivateKeys() []session.AgentPrivateKey
- func (c *Client) RefreshPrivateKeys() error
- func (c *Client) ReverseTunnel(address string) connection.ReverseTunnel
- func (c *Client) Session() *session.Session
- func (c *Client) SetFileProvider(host string, f FileProvider) *Client
- func (c *Client) Start() error
- func (c *Client) Stop()
- func (c *Client) Tunnel(address string) connection.Tunnel
- func (c *Client) UploadScript(scriptPath string, args ...string) connection.Script
- func (c *Client) WithSettings(sett settings.Settings) *Client
- type Command
- func (t *Command) Cmd(ctx context.Context)
- func (t *Command) CombinedOutput(context.Context) ([]byte, error)
- func (t *Command) OnCommandStart(fn func())
- func (t *Command) Output(context.Context) ([]byte, []byte, error)
- func (t *Command) Run(ctx context.Context) error
- func (t *Command) Start() error
- func (t *Command) StderrBytes() []byte
- func (t *Command) StdoutBytes() []byte
- func (t *Command) Stop()
- func (t *Command) Sudo(ctx context.Context)
- func (t *Command) WithEnv(env map[string]string)
- func (t *Command) WithErr(err error) *Command
- func (t *Command) WithRun(f func()) *Command
- func (t *Command) WithSSHArgs(args ...string)
- func (t *Command) WithStdErr(s []byte) *Command
- func (t *Command) WithStderrHandler(h func(line string))
- func (t *Command) WithStdoutHandler(h func(line string))
- func (t *Command) WithTimeout(timeout time.Duration)
- type CommandProvider
- type DownloadFn
- type File
- func (f *File) Download(ctx context.Context, srcPath, dstPath string) error
- func (f *File) DownloadBytes(ctx context.Context, remotePath string) ([]byte, error)
- func (f *File) Upload(ctx context.Context, srcPath, dstPath string) error
- func (f *File) UploadBytes(ctx context.Context, data []byte, remotePath string) error
- type FileProvider
- type SSHProvider
- func (p *SSHProvider) AddCommandProvider(host string, f CommandProvider) *SSHProvider
- func (p *SSHProvider) AddScriptProvider(host string, f UploadScriptProvider) *SSHProvider
- func (p *SSHProvider) Cleanup(context.Context) error
- func (p *SSHProvider) Client(context.Context) (connection.SSHClient, error)
- func (p *SSHProvider) InitSession() *session.Session
- func (p *SSHProvider) NewAdditionalClient(context.Context) (connection.SSHClient, error)
- func (p *SSHProvider) NewStandaloneClient(ctx context.Context, sess *session.Session, ...) (connection.SSHClient, error)
- func (p *SSHProvider) SetFileProvider(host string, f FileProvider) *SSHProvider
- func (p *SSHProvider) SwitchClient(_ context.Context, sess *session.Session, ...) (connection.SSHClient, error)
- func (p *SSHProvider) SwitchToDefault(ctx context.Context) (connection.SSHClient, error)
- func (p *SSHProvider) Switches() []Switch
- func (p *SSHProvider) WithInitPrivateKeys(k []session.AgentPrivateKey) *SSHProvider
- func (p *SSHProvider) WithSwitchHandler(f SwitchHandler) *SSHProvider
- type Script
- func (t *Script) Execute(context.Context) ([]byte, error)
- func (t *Script) ExecuteBundle(ctx context.Context, parentDir, bundleDir string) ([]byte, error)
- func (t *Script) Sudo()
- func (t *Script) WithBundlerOpts(opts ...connection.BundlerOption)
- func (t *Script) WithCleanupAfterExec(doCleanup bool)
- func (t *Script) WithEnvs(envs map[string]string)
- func (t *Script) WithError(err error) *Script
- func (t *Script) WithExecuteUploadDir(dir string)
- func (t *Script) WithNoLogStepOutOnError(enabled bool)
- func (t *Script) WithRun(f func()) *Script
- func (t *Script) WithStdoutHandler(handler func(string))
- func (t *Script) WithTimeout(timeout time.Duration)
- type Switch
- type SwitchHandler
- type UploadFn
- type UploadScriptProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSettings ¶
Types ¶
type Client ¶
type Client struct {
Settings settings.Settings
SessionSettings *session.Session
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(session *session.Session, privKeys []session.AgentPrivateKey) *Client
func (*Client) AddCommandProvider ¶
func (c *Client) AddCommandProvider(host string, f CommandProvider) *Client
func (*Client) AddScriptProvider ¶
func (c *Client) AddScriptProvider(host string, f UploadScriptProvider) *Client
func (*Client) Check ¶
func (c *Client) Check() connection.Check
UploadScript is used to upload script and execute it on remote server
func (*Client) Command ¶
func (c *Client) Command(name string, arg ...string) connection.Command
Command is used to run commands on remote server
func (*Client) File ¶
func (c *Client) File() connection.File
File is used to upload and download files and directories
func (*Client) KubeProxy ¶
func (c *Client) KubeProxy() connection.KubeProxy
KubeProxy is used to start kubectl proxy and create a tunnel from local port to proxy port
func (*Client) Loop ¶
func (c *Client) Loop(fn connection.SSHLoopHandler) error
Loop Looping all available hosts
func (*Client) OnlyPreparePrivateKeys ¶
func (*Client) PrivateKeys ¶
func (c *Client) PrivateKeys() []session.AgentPrivateKey
func (*Client) RefreshPrivateKeys ¶
func (*Client) ReverseTunnel ¶
func (c *Client) ReverseTunnel(address string) connection.ReverseTunnel
ReverseTunnel is used to open remote (R) tunnel
func (*Client) SetFileProvider ¶
func (c *Client) SetFileProvider(host string, f FileProvider) *Client
func (*Client) Tunnel ¶
func (c *Client) Tunnel(address string) connection.Tunnel
Tunnel is used to open local (L) and remote (R) tunnels
func (*Client) UploadScript ¶
func (c *Client) UploadScript(scriptPath string, args ...string) connection.Script
UploadScript is used to upload script and execute it on remote server
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func NewCommand ¶
func (*Command) OnCommandStart ¶
func (t *Command) OnCommandStart(fn func())
func (*Command) StderrBytes ¶
func (*Command) StdoutBytes ¶
func (*Command) WithSSHArgs ¶
func (*Command) WithStdErr ¶
func (*Command) WithStderrHandler ¶
func (*Command) WithStdoutHandler ¶
func (*Command) WithTimeout ¶
type CommandProvider ¶
type DownloadFn ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func NewFile ¶
func NewFile(upload UploadFn, download DownloadFn) *File
func (*File) DownloadBytes ¶
type FileProvider ¶
type SSHProvider ¶
type SSHProvider struct {
// contains filtered or unexported fields
}
func NewSSHProvider ¶
func NewSSHProvider(initSession *session.Session, once bool) *SSHProvider
func (*SSHProvider) AddCommandProvider ¶
func (p *SSHProvider) AddCommandProvider(host string, f CommandProvider) *SSHProvider
func (*SSHProvider) AddScriptProvider ¶
func (p *SSHProvider) AddScriptProvider(host string, f UploadScriptProvider) *SSHProvider
func (*SSHProvider) Client ¶
func (p *SSHProvider) Client(context.Context) (connection.SSHClient, error)
func (*SSHProvider) InitSession ¶
func (p *SSHProvider) InitSession() *session.Session
func (*SSHProvider) NewAdditionalClient ¶
func (p *SSHProvider) NewAdditionalClient(context.Context) (connection.SSHClient, error)
func (*SSHProvider) NewStandaloneClient ¶
func (p *SSHProvider) NewStandaloneClient(ctx context.Context, sess *session.Session, privateKeys []session.AgentPrivateKey, opts ...connection.StandaloneClientOpt) (connection.SSHClient, error)
func (*SSHProvider) SetFileProvider ¶
func (p *SSHProvider) SetFileProvider(host string, f FileProvider) *SSHProvider
func (*SSHProvider) SwitchClient ¶
func (p *SSHProvider) SwitchClient(_ context.Context, sess *session.Session, privateKeys []session.AgentPrivateKey) (connection.SSHClient, error)
func (*SSHProvider) SwitchToDefault ¶
func (p *SSHProvider) SwitchToDefault(ctx context.Context) (connection.SSHClient, error)
func (*SSHProvider) Switches ¶
func (p *SSHProvider) Switches() []Switch
func (*SSHProvider) WithInitPrivateKeys ¶
func (p *SSHProvider) WithInitPrivateKeys(k []session.AgentPrivateKey) *SSHProvider
func (*SSHProvider) WithSwitchHandler ¶
func (p *SSHProvider) WithSwitchHandler(f SwitchHandler) *SSHProvider
type Script ¶
type Script struct {
// contains filtered or unexported fields
}
func (*Script) ExecuteBundle ¶
func (*Script) WithBundlerOpts ¶
func (t *Script) WithBundlerOpts(opts ...connection.BundlerOption)
func (*Script) WithCleanupAfterExec ¶
func (*Script) WithExecuteUploadDir ¶
func (*Script) WithNoLogStepOutOnError ¶
func (*Script) WithStdoutHandler ¶
func (*Script) WithTimeout ¶
type Switch ¶
type Switch struct {
Bastion Bastion
Session *session.Session
PrivateKeys []session.AgentPrivateKey
}
type SwitchHandler ¶
type SwitchHandler func(s Switch)
Click to show internal directories.
Click to hide internal directories.