handler

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandExecutor

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

CommandExecutor 命令执行器

func NewCommandExecutor

func NewCommandExecutor(logger *zap.Logger) *CommandExecutor

func (*CommandExecutor) Execute

func (h *CommandExecutor) Execute(ctx context.Context, task *CommandTask) (string, error)

type CommandTask

type CommandTask struct {
	Command     string             `json:"command"`
	Args        model.StringList   `json:"args"`
	WorkDir     string             `json:"work_dir"`
	Environment model.KeyValueList `json:"environment"`
	Timeout     int                `json:"timeout"`
}

type CronHandlers

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

func NewCronHandlers

func NewCronHandlers(
	logger *zap.Logger,
	cronDAO dao.CronJobDAO,
	treeLocalDAO treeDAO.TreeLocalDAO,
	onDutyDAO alert.AlertManagerOnDutyDAO,
	k8sDAO k8sDao.ClusterDAO,
	k8sClient client.K8sClient,
	clusterMgr manager.ClusterManager,
	promConfigCache cache.MonitorCache,
) *CronHandlers

func (*CronHandlers) ProcessTask

func (h *CronHandlers) ProcessTask(ctx context.Context, t *asynq.Task) error

type ExecutionResult

type ExecutionResult struct {
	Success  bool   `json:"success"`
	Output   string `json:"output"`
	ErrorMsg string `json:"error_msg"`
}

type HTTPExecutor

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

HTTPExecutor HTTP执行器

func NewHTTPExecutor

func NewHTTPExecutor(logger *zap.Logger) *HTTPExecutor

NewHTTPExecutor 创建HTTP执行器

func (*HTTPExecutor) Execute

func (h *HTTPExecutor) Execute(ctx context.Context, task *HTTPTask) (string, error)

Execute 执行HTTP请求,返回响应字符串

type HTTPTask

type HTTPTask struct {
	Method  string             `json:"method"`
	URL     string             `json:"url"`
	Headers model.KeyValueList `json:"headers"`
	Body    string             `json:"body"`
	Timeout int                `json:"timeout"`
}

HTTPTask HTTP任务配置

type ScriptExecutor

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

ScriptExecutor 脚本执行器

func NewScriptExecutor

func NewScriptExecutor(logger *zap.Logger) *ScriptExecutor

func (*ScriptExecutor) Execute

func (h *ScriptExecutor) Execute(ctx context.Context, task *ScriptTask) (string, error)

type ScriptTask

type ScriptTask struct {
	Type    string `json:"type"`
	Content string `json:"content"`
	Timeout int    `json:"timeout"`
}

Jump to

Keyboard shortcuts

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