client

package
v0.0.0-...-8019898 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MulanPSL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InfoHandler

func InfoHandler(c *gin.Context)

func ReverseProxyHandler

func ReverseProxyHandler(c *gin.Context)

Types

type Client

type Client struct {
	Server     string
	PluginInfo *PluginInfo
}

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) GetPluginInfo

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

func (*Client) ListenEvent

func (c *Client) ListenEvent(event Event, callback EventCallback) error

注册event事件监听

func (*Client) MachineList

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

func (*Client) RegisterHandlers

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

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

func (*Client) RunCommand

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

func (*Client) RunScript

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

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(listenerID string) error

取消注册event事件监听

type CmdResult

type CmdResult struct {
	MachineUUID string
	MachineIP   string
	RetCode     int
	Stdout      string
	Stderr      string
}

type CmdStruct

type CmdStruct struct {
	Batch   *common.Batch `json:"batch"`
	Command string        `json:"command"`
}

type Event

type Event struct {
	ID       int
	MetaData interface{}
}

type EventCallback

type EventCallback func(e *Event)

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"`
}
var BaseInfo *PluginInfo

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