command

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInterface

type ClientInterface interface {
	NewSession() (SSHSession, error)
}

type DefaultRemoteExecutor

type DefaultRemoteExecutor struct {
	Client ClientInterface
}

func (*DefaultRemoteExecutor) Execute

func (executor *DefaultRemoteExecutor) Execute(dest io.Writer, command string) (err error)

Copy the output from a command to the specified io.Writer

type Executer

type Executer interface {
	Execute(destination io.Writer, command string) error
}

func NewLocalExecuter

func NewLocalExecuter() Executer

func NewRemoteExecutor

func NewRemoteExecutor(sshCfg SshConfig) (executor Executer, err error)

This method creates executor based on ssh, it has concrete ssh reference

type SSHSession

type SSHSession interface {
	Start(cmd string) error
	Wait() error
	StdoutPipe() (io.Reader, error)
	Close() error
}

type SshClientWrapper

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

Wrapper of ssh client to match client interface signature, since client.NewSession() does not use an interface

func NewClientWrapper

func NewClientWrapper(client *ssh.Client) *SshClientWrapper

func (*SshClientWrapper) NewSession

func (c *SshClientWrapper) NewSession() (SSHSession, error)

type SshConfig

type SshConfig struct {
	Username string
	Password string
	Host     string
	Port     int
}

Config for the SSH connection

Jump to

Keyboard shortcuts

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