Documentation ¶
Index ¶
- Variables
- func DisablePTY()
- type BaseExecutor
- type BashExecutor
- type Canceler
- type CommandFeeder
- type ContentType
- type ExecRequest
- type ExecResponse
- type Executor
- func NewBashExecutor(content []byte, contentType *ContentType) (Executor, error)
- func NewMySQLExecutor(content []byte, contentType *ContentType) (Executor, error)
- func NewPSQLExecutor(content []byte, contentType *ContentType) (Executor, error)
- func NewRemoteShellExecutor(content []byte, contentType *ContentType) (Executor, error)
- func NewWinBashExecutor(content []byte, contentType *ContentType) (Executor, error)
- type IgnoreCloseWriter
- type MySQLExecutor
- type PSQLExecutor
- type Register
- type RemoteShellExecutor
- type RequestHdr
- type ResponseHdr
- type WinBashExecutor
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Bash = &ContentType{"text", "bash", map[string]string{}} Shell = &ContentType{"text", "shell", map[string]string{}} )
View Source
var ( ErrUnsupportedContentType = errors.New("unsupported content-type") ErrExecInProgress = errors.New("an execution is already in progress") )
View Source
var MySQL = &ContentType{"text", "mysql", map[string]string{}}
View Source
var PSQL = &ContentType{"text", "psql", map[string]string{}}
Functions ¶
func DisablePTY ¶
func DisablePTY()
Types ¶
type BaseExecutor ¶
type BaseExecutor struct {
// contains filtered or unexported fields
}
func (*BaseExecutor) Cleanup ¶
func (be *BaseExecutor) Cleanup()
func (*BaseExecutor) ContentType ¶
func (be *BaseExecutor) ContentType() *ContentType
func (*BaseExecutor) Execute ¶
func (be *BaseExecutor) Execute(ctx context.Context, req *ExecRequest) *ExecResponse
func (*BaseExecutor) Name ¶
func (be *BaseExecutor) Name() string
type BashExecutor ¶
type BashExecutor struct { BaseExecutor // contains filtered or unexported fields }
type CommandFeeder ¶
type CommandFeeder struct {
// contains filtered or unexported fields
}
func NewCommandFeeder ¶
func NewCommandFeeder(inputWriter io.WriteCloser) *CommandFeeder
func (*CommandFeeder) Close ¶
func (cf *CommandFeeder) Close() error
func (*CommandFeeder) Put ¶
func (cf *CommandFeeder) Put(content []byte)
type ContentType ¶
func NewContentType ¶
func NewContentType(language string, params map[string]string) *ContentType
func Parse ¶
func Parse(val string) (*ContentType, error)
func (*ContentType) Clone ¶
func (ct *ContentType) Clone() *ContentType
func (*ContentType) MarshalJSON ¶
func (ct *ContentType) MarshalJSON() ([]byte, error)
func (*ContentType) ParentOf ¶
func (ct *ContentType) ParentOf(other *ContentType, requiredKeys []string) bool
ParentOf returns true when the other content-type matches but may have more specific parameters (i.e. this content-type is a "parent" of the other).
func (*ContentType) String ¶
func (ct *ContentType) String() string
func (*ContentType) UnmarshalJSON ¶
func (ct *ContentType) UnmarshalJSON(data []byte) error
type ExecRequest ¶
type ExecRequest struct { Hdr *RequestHdr // Content refers to the payload provided by the requester Content []byte // ContentType refers to the MIME type of the content ContentType *ContentType // In represents the additional input provided by the requester, // a side-effect. This is in-addition to the regular input provided // by the Content byte array. // Example: In a shell command execution (i.e ContentType=text/bash). // Content can be process command line, while In could represents the stdin. In *os.File // the executor publishes all side effects (Stdout, Stderr, debugging events etc.) Stdout io.WriteCloser Stderr io.WriteCloser }
func DefaultRequest ¶
func DefaultRequest() *ExecRequest
type ExecResponse ¶
type ExecResponse struct { Hdr *ResponseHdr // Exit status of the command ExitStatus int // Err is set to non-nil on error/cancellation Err error }
type Executor ¶
type Executor interface { Name() string // ContentType returns the content type supported by the Executor ContentType() *ContentType // Execute requests the Executor to execute the provided request Execute(context.Context, *ExecRequest) *ExecResponse // Cleanup is the Internal function invoked when the Register is torn down Cleanup() }
func NewBashExecutor ¶
func NewBashExecutor(content []byte, contentType *ContentType) (Executor, error)
func NewMySQLExecutor ¶
func NewMySQLExecutor(content []byte, contentType *ContentType) (Executor, error)
func NewPSQLExecutor ¶
func NewPSQLExecutor(content []byte, contentType *ContentType) (Executor, error)
func NewRemoteShellExecutor ¶
func NewRemoteShellExecutor(content []byte, contentType *ContentType) (Executor, error)
func NewWinBashExecutor ¶
func NewWinBashExecutor(content []byte, contentType *ContentType) (Executor, error)
type IgnoreCloseWriter ¶
func (*IgnoreCloseWriter) Close ¶
func (icw *IgnoreCloseWriter) Close() error
type MySQLExecutor ¶
type MySQLExecutor struct {
BaseExecutor
}
type PSQLExecutor ¶
type PSQLExecutor struct {
BaseExecutor
}
type Register ¶
func NewRegister ¶
func (*Register) Execute ¶
func (r *Register) Execute(ctx context.Context, req *ExecRequest) *ExecResponse
type RemoteShellExecutor ¶
type RemoteShellExecutor struct {
BaseExecutor
}
type RequestHdr ¶
type ResponseHdr ¶
type ResponseHdr struct { // RequestID refers to request's unique ID RequestID string }
type WinBashExecutor ¶
type WinBashExecutor struct {
BaseExecutor
}
Click to show internal directories.
Click to hide internal directories.