client

package
v0.0.0-...-7bd5736 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MulanPSL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeartbeatInterval = 30 * time.Second
	HeartbeatKey      = "heartbeat:"
)
View Source
const TokenCookie = "PluginToken"

Variables

This section is empty.

Functions

func ReverseProxyHandler

func ReverseProxyHandler(c *gin.Context)

Types

type CallbackHandler

type CallbackHandler struct {
	RunCommandCallback RunCommandCallback
	TaskLen            int
}

type Client

type Client struct {
	PluginInfo *PluginInfo
	// contains filtered or unexported fields
}

func DefaultClient

func DefaultClient(desc *PluginInfo) *Client

func GetClient

func GetClient() *Client

func (*Client) ApplyConfig

func (c *Client) ApplyConfig(batch *common.Batch, path, content string) error

func (*Client) BatchList

func (c *Client) BatchList() ([]*common.BatchList, error)

func (*Client) BatchUUIDList

func (c *Client) BatchUUIDList(batchId string) ([]string, error)

func (*Client) FileUpload

func (client *Client) FileUpload(filePath string, filename string) error

func (*Client) GetPluginInfo

func (c *Client) GetPluginInfo(name string) (*PluginInfo, error)

func (*Client) HasPermission

func (c *Client) HasPermission(resource, operate string) (bool, error)

func (*Client) IsBind

func (client *Client) IsBind() bool

client是否bind PilotGo server

func (*Client) ListenEvent

func (c *Client) ListenEvent(eventTypes []int, callbacks []EventCallback) error

注册event事件监听

func (*Client) MachineInfoByUUID

func (c *Client) MachineInfoByUUID(machine_uuid string) (*common.MachineNode, error)

func (*Client) MachineList

func (c *Client) MachineList() ([]*common.MachineNode, error)

func (*Client) OnGetTags

func (client *Client) OnGetTags(callback GetTagsCallback)

func (*Client) ProcessCommandResult

func (c *Client) ProcessCommandResult(command_result *common.AsyncCmdResult)

func (*Client) ProcessEvent

func (c *Client) ProcessEvent(event *common.EventMessage)

func (*Client) PublishEvent

func (c *Client) PublishEvent(msg common.EventMessage) error

发布event事件

func (*Client) RegisterExtention

func (c *Client) RegisterExtention(exts []common.Extention)

func (*Client) RegisterHandlers

func (client *Client) RegisterHandlers(router *gin.Engine)

RegisterHandlers 注册一些插件标准的API接口,清单如下: GET /plugin_manage/info

func (*Client) RegisterPermission

func (c *Client) RegisterPermission(pers []common.Permission) error

func (*Client) RunCommand

func (c *Client) RunCommand(batch *common.Batch, cmd string) ([]*common.CmdResult, error)

func (*Client) RunCommandAsync

func (c *Client) RunCommandAsync(batch *common.Batch, cmd string, callback RunCommandCallback) error

func (*Client) RunScript

func (c *Client) RunScript(batch *common.Batch, script string, params []string) ([]*common.CmdResult, error)

func (*Client) Server

func (client *Client) Server() string

func (*Client) ServiceStatus

func (c *Client) ServiceStatus(batch *common.Batch, servicename string) ([]*common.ServiceResult, error)

func (*Client) StartService

func (c *Client) StartService(batch *common.Batch, serviceName string) ([]*common.ServiceResult, error)

func (*Client) StopService

func (c *Client) StopService(batch *common.Batch, serviceName string) ([]*common.ServiceResult, error)

func (*Client) UnListenEvent

func (c *Client) UnListenEvent(eventTypes []int) error

取消注册event事件监听

func (*Client) Wait4Bind

func (c *Client) Wait4Bind()

type EventCallback

type EventCallback func(e *common.EventMessage)

type GetTagsCallback

type GetTagsCallback func([]string) []common.Tag

type PluginFullInfo

type PluginFullInfo struct {
	PluginInfo
	Extentions  []common.Extention
	Permissions []common.Permission
}

用于插件与PilotGo server通讯

type PluginInfo

type PluginInfo struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Description string `json:"description"`
	Author      string `json:"author"`
	Email       string `json:"email"`
	Url         string `json:"url"`
	PluginType  string `json:"plugin_type"`
	ReverseDest string `json:"reverse_dest"`
}

用于初始化Client

type PluginStatus

type PluginStatus struct {
	Connected   bool
	LastConnect time.Time
}

插件连接状态

type RunCommandCallback

type RunCommandCallback func([]*common.CmdResult)

type ScriptStruct

type ScriptStruct struct {
	Batch  *common.Batch `json:"batch"`
	Script string        `json:"script"`
	Params []string      `json:"params"`
}

Jump to

Keyboard shortcuts

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