Documentation ¶
Index ¶
- func Copy(ctx context.Context, copyWriter CopyWriter, dst string, request ExecRequest) error
- func NewExecError(err error, exitCode int) error
- func Run(ctx context.Context, request ExecRequest) (stdout string, stderr string, err error)
- func Stream(ctx context.Context, request ExecRequest) (stdout io.Reader, stderr io.Reader, errC chan error)
- type Command
- type CopyWriter
- type Copyable
- type ExecError
- type ExecRequest
- type ExecResponse
- type ExecStreams
- func (e *ExecStreams) Close() error
- func (e *ExecStreams) Stderr() io.Reader
- func (e *ExecStreams) StderrWriter() io.WriteCloser
- func (e *ExecStreams) Stdin() io.Reader
- func (e *ExecStreams) StdinWriter() io.WriteCloser
- func (e *ExecStreams) Stdout() io.Reader
- func (e *ExecStreams) StdoutWriter() io.WriteCloser
- type Transport
- type TransportType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
func Copy(ctx context.Context, copyWriter CopyWriter, dst string, request ExecRequest) error
Copy executes a copy request.
func NewExecError ¶
NewExecError creates a new ExecError with the provided exitCode and wrapped error.
Types ¶
type CopyWriter ¶
type CopyWriter func(errorC chan error)
CopyWriter a function that can write the stdin for a copy request.
func TarCopyWriter ¶
func TarCopyWriter(src Copyable, dst string, stdin io.WriteCloser) CopyWriter
TarCopyWriter creates a new CopyWriter that uses tar to copy a file.
type Copyable ¶
type Copyable interface { io.ReadSeekCloser Size() int64 }
Copyable is an interface for a copyable file.
type ExecError ¶
type ExecError struct {
// contains filtered or unexported fields
}
ExecError An exec error is a wrapper error that all transport implementations should return if the exec failed with an exit code.
type ExecRequest ¶
type ExecRequest interface { // Exec executes a remote command Exec(ctx context.Context) *ExecResponse // Streams retrieves the IO streams for the ExecRequest Streams() *ExecStreams }
ExecRequest can be used to execute a remote command.
type ExecResponse ¶
ExecResponse a Response that a transport exec request should return.
func NewExecResponse ¶
func NewExecResponse() *ExecResponse
func (*ExecResponse) WaitForResults ¶
func (e *ExecResponse) WaitForResults() (stdout, stderr string, err error)
WaitForResults waits for the execution to finish and returns the stdout, stderr and the execution error if there is any.
type ExecStreams ¶
type ExecStreams struct {
// contains filtered or unexported fields
}
ExecStreams The IO streams associated with an ExecRequest.
func NewExecStreams ¶
func NewExecStreams(stdin bool) *ExecStreams
func (*ExecStreams) Close ¶
func (e *ExecStreams) Close() error
Close closes all the streams and returns the aggregate error if any error occurred while closing any of the streams.
func (*ExecStreams) Stderr ¶
func (e *ExecStreams) Stderr() io.Reader
func (*ExecStreams) StderrWriter ¶
func (e *ExecStreams) StderrWriter() io.WriteCloser
func (*ExecStreams) Stdin ¶
func (e *ExecStreams) Stdin() io.Reader
func (*ExecStreams) StdinWriter ¶
func (e *ExecStreams) StdinWriter() io.WriteCloser
func (*ExecStreams) Stdout ¶
func (e *ExecStreams) Stdout() io.Reader
func (*ExecStreams) StdoutWriter ¶
func (e *ExecStreams) StdoutWriter() io.WriteCloser
type Transport ¶
type Transport interface { Copy(ctx context.Context, body Copyable, dest string) error Run(ctx context.Context, cmd Command) (stdout, stderr string, err error) Stream(ctx context.Context, cmd Command) (stdout, stderr io.Reader, errC chan error) Type() TransportType io.Closer }
Transport is a generic transport interface.
type TransportType ¶
type TransportType string
TransportType is the string representation of the transport type.