actions

package
v2.15.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package actions provides Actions implementations and runner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action interface {
	// ID returns an Action ID.
	ID() string
	// Type returns an Action type.
	Type() string
	// Run runs an Action and returns output and error.
	Run(ctx context.Context) ([]byte, error)
	// contains filtered or unexported methods
}

Action describes an abstract thing that can be run by a client and return some output.

func NewMongoDBExplainAction

func NewMongoDBExplainAction(id string, params *agentpb.StartActionRequest_MongoDBExplainParams, tempDir string) Action

NewMongoDBExplainAction creates a MongoDB EXPLAIN query Action.

func NewMongoDBQueryAdmincommandAction

func NewMongoDBQueryAdmincommandAction(params MongoDBQueryAdmincommandActionParams) Action

NewMongoDBQueryAdmincommandAction creates a MongoDB adminCommand query Action.

func NewMySQLExplainAction

func NewMySQLExplainAction(id string, params *agentpb.StartActionRequest_MySQLExplainParams) Action

NewMySQLExplainAction creates MySQL Explain Action. This is an Action that can run `EXPLAIN` command on MySQL service with given DSN.

func NewMySQLQuerySelectAction

func NewMySQLQuerySelectAction(id string, params *agentpb.StartActionRequest_MySQLQuerySelectParams) Action

NewMySQLQuerySelectAction creates MySQL SELECT query Action.

func NewMySQLQueryShowAction

func NewMySQLQueryShowAction(id string, params *agentpb.StartActionRequest_MySQLQueryShowParams) Action

NewMySQLQueryShowAction creates MySQL SHOW query Action.

func NewMySQLShowCreateTableAction

func NewMySQLShowCreateTableAction(id string, params *agentpb.StartActionRequest_MySQLShowCreateTableParams) Action

NewMySQLShowCreateTableAction creates MySQL SHOW CREATE TABLE Action. This is an Action that can run `SHOW CREATE TABLE` command on MySQL service with given DSN.

func NewMySQLShowIndexAction

func NewMySQLShowIndexAction(id string, params *agentpb.StartActionRequest_MySQLShowIndexParams) Action

NewMySQLShowIndexAction creates MySQL SHOW INDEX Action. This is an Action that can run `SHOW INDEX` command on MySQL service with given DSN.

func NewMySQLShowTableStatusAction

func NewMySQLShowTableStatusAction(id string, params *agentpb.StartActionRequest_MySQLShowTableStatusParams) Action

NewMySQLShowTableStatusAction creates MySQL SHOW TABLE STATUS Action. This is an Action that can run `SHOW TABLE STATUS` command on MySQL service with given DSN.

func NewPTMySQLSummaryAction

func NewPTMySQLSummaryAction(id string, cmd string, params *agentpb.StartActionRequest_PTMySQLSummaryParams) Action

NewPTMySQLSummaryAction creates a new process Action.

PTMySQL Summary Action, it's an abstract Action that can run an external commands. This commands can be a shell script, script written on interpreted language, or binary file.

func NewPostgreSQLQuerySelectAction

func NewPostgreSQLQuerySelectAction(id string, params *agentpb.StartActionRequest_PostgreSQLQuerySelectParams) Action

NewPostgreSQLQuerySelectAction creates PostgreSQL SELECT query Action.

func NewPostgreSQLQueryShowAction

func NewPostgreSQLQueryShowAction(id string, params *agentpb.StartActionRequest_PostgreSQLQueryShowParams) Action

NewPostgreSQLQueryShowAction creates PostgreSQL SHOW query Action.

func NewPostgreSQLShowCreateTableAction

func NewPostgreSQLShowCreateTableAction(id string, params *agentpb.StartActionRequest_PostgreSQLShowCreateTableParams) Action

NewPostgreSQLShowCreateTableAction creates PostgreSQL SHOW CREATE TABLE Action. This is an Action that can run `\d+ table` command analog on PostgreSQL service with given DSN.

func NewPostgreSQLShowIndexAction

func NewPostgreSQLShowIndexAction(id string, params *agentpb.StartActionRequest_PostgreSQLShowIndexParams) Action

NewPostgreSQLShowIndexAction creates PostgreSQL SHOW INDEX Action. This is an Action that can run `SHOW INDEX` command on PostgreSQL service with given DSN.

func NewProcessAction

func NewProcessAction(id string, cmd string, arg []string) Action

NewProcessAction creates a new process Action.

Process Action, it's an abstract Action that can run an external commands. This commands can be a shell script, script written on interpreted language, or binary file.

type ActionResult

type ActionResult struct {
	ID     string
	Output []byte
	Error  string
}

ActionResult represents an Action result.

type ConcurrentRunner

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

ConcurrentRunner represents concurrent Action runner. Action runner is component that can run an Actions.

func NewConcurrentRunner

func NewConcurrentRunner(ctx context.Context) *ConcurrentRunner

NewConcurrentRunner returns new runner. With this component you can run actions concurrently and read action results when they will be finished.

ConcurrentRunner is stopped when context passed to NewConcurrentRunner is canceled. Results are reported via Results() channel which must be read until it is closed.

func (*ConcurrentRunner) Results

func (r *ConcurrentRunner) Results() <-chan ActionResult

Results returns channel with Actions results.

func (*ConcurrentRunner) Start

func (r *ConcurrentRunner) Start(a Action, timeout time.Duration)

Start starts an Action in a separate goroutine.

func (*ConcurrentRunner) Stop

func (r *ConcurrentRunner) Stop(id string)

Stop stops running Action.

type MongoDBQueryAdmincommandActionParams

type MongoDBQueryAdmincommandActionParams struct {
	ID      string
	DSN     string
	Files   *agentpb.TextFiles
	Command string
	Arg     interface{}
	TempDir string
}

MongoDBQueryAdmincommandActionParams represent Mongo DB Query Admin Command Action params.

Jump to

Keyboard shortcuts

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