operator

package
v0.0.0-...-d1d09b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

The SSHOperator struct executes commands on a remote machine over an SSH session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(ctx context.Context, cmd string) Command

type CommandOperator

type CommandOperator interface {
	Execute(command string) (CommandRes, error)
	ExecuteStdout(command string, stream bool) (CommandRes, error)
}

CommandOperator executes a command on a machine to install k3sup

type CommandRes

type CommandRes struct {
	StdOut   []byte
	StdErr   []byte
	ExitCode int
}

CommandRes contains the STDIO output from running a command

type SSHOperator

type SSHOperator struct {
	*vssh.VSSH
}

SSHOperator executes commands on a remote machine over an SSH session

func NewSSHOperator

func NewSSHOperator() *SSHOperator

func (*SSHOperator) AddClient

func (s *SSHOperator) AddClient(address string, config *ssh.ClientConfig) (*SSHOperator, error)

func (*SSHOperator) Close

func (s *SSHOperator) Close() error

func (*SSHOperator) CopyFile

func (s *SSHOperator) CopyFile(ctx context.Context, source string, dest string) error

func (*SSHOperator) Execute

func (s *SSHOperator) Execute(command Command) (CommandRes, error)

func (*SSHOperator) ExecuteStdout

func (s *SSHOperator) ExecuteStdout(command Command, stream bool) (CommandRes, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL