common

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: 1 Imported by: 0

Documentation

Overview

提供公共数据结构定义

Index

Constants

View Source
const (
	// 主机安装软件包
	MsgPackageInstall = 0
	// 主机升级软件包
	MsgPackageUpdate = 1
	// 主机卸载软件包
	MsgPackageUninstall = 2
	// 主机ip变更
	MsgIPChange = 3

	// 平台新增主机
	MsgHostAdd = 10
	// 平台移除主机
	MsgHostRemove = 11

	// 插件添加
	MsgPluginAdd = 20
	// 插件卸载
	MsgPluginRemove = 21
)

event消息类型定义

View Source
const (
	// 单机/多机操作扩展,增加选择单机/多机时对机器的操作功能
	ExtentionMachine = "machine"
	// 批处理扩展,增加选择批次时对批次的操作
	ExtentionBatch = "batch"
	// 主页面扩展,增加侧边栏入口及主页面
	ExtentionPage = "page"
)
View Source
const (
	ServiceActiveStatusRunning  = "running"
	ServiceActiveStatusExited   = "exited"
	ServiceActiveStatusWaiting  = "waiting"
	ServiceActiveStatusInactive = "inactive"
	ServiceActiveStatusUnknown  = "unknown"

	ServiceLoadedStatusEnabled  = "enabled"
	ServiceLoadedStatusDisabled = "disabled"
	ServiceLoadedStatusStatic   = "static"
	ServiceLoadedStatusMask     = "mask"
	ServiceLoadedStatusUnknown  = "unknown"
)
View Source
const (
	ServiceUnit   = "service"
	SocketUnit    = "socket"
	TargetUnit    = "target"
	MountUnit     = "mount"
	AutomountUnit = "automount"
	PathUnit      = "path"
	TimeUnit      = "time"
)
View Source
const (
	// 插件正在运行
	StatusRunning = "running"
	// 插件已加载,但未运行
	StatusLoaded = "loaded"
	// 插件离线,无法访问
	StatusOffline = "offline"
)
View Source
const (
	TypeOk    = "ok"
	TypeWarn  = "warn"
	TypeError = "error"
)

Variables

This section is empty.

Functions

func ToMessage

func ToMessage(d string, s interface{}) error

将 MessageData json字符串转换成指定结构体的message消息数据

Types

type AsyncCmdResult

type AsyncCmdResult struct {
	TaskID string       `json:"task_id"`
	Result []*CmdResult `json:"result"`
}

type Batch

type Batch struct {
	BatchIds      []int    `json:"batch_ids"`
	DepartmentIDs []int    `json:"department_ids"`
	MachineUUIDs  []string `json:"machine_uuids"`
}

type BatchExtention

type BatchExtention struct {
	Type       string `json:"type"`
	Name       string `json:"name"`
	URL        string `json:"url"`
	Permission string `json:"permission"`
}

func (*BatchExtention) Clone

func (be *BatchExtention) Clone() Extention

type BatchList

type BatchList struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Manager     string `json:"manager"`
}

type CmdResult

type CmdResult struct {
	MachineUUID string `json:"machine_uuid"`
	MachineIP   string `json:"machine_ip"`
	RetCode     int    `json:"retcode"`
	Stdout      string `json:"stdout"`
	Stderr      string `json:"stderr"`
}

type CmdStruct

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

type CommonResult

type CommonResult struct {
	Code    int             `json:"code"`
	Message string          `json:"msg"`
	Data    json.RawMessage `json:"data"`
}

func (*CommonResult) ParseData

func (r *CommonResult) ParseData(d interface{}) error

type EventMessage

type EventMessage struct {
	MessageType int
	MessageData string
}

type Extention

type Extention interface {
	Clone() Extention
}

func ParseParameters

func ParseParameters(data []map[string]interface{}) []Extention

解析extentions参数

type File

type File struct {
	Path    string `json:"path"`
	Name    string `json:"name"`
	Content string `json:"content"`
}

type MDIPChange

type MDIPChange struct {
	HostUUID string
	NewIP    string
}

type MDPackageInstall

type MDPackageInstall struct {
	HostUUID string
	Name     string
	Version  string
	Time     string
}

type MDPackageUninstall

type MDPackageUninstall struct {
	HostUUID string
	Name     string
	Version  string
	Time     string
}

type MDPackageUpdate

type MDPackageUpdate struct {
	HostUUID string
	Name     string
	Version  string
	Time     string
}

type MachineExtention

type MachineExtention struct {
	Type       string `json:"type"`
	Name       string `json:"name"`
	URL        string `json:"url"`
	Permission string `json:"permission"`
}

func (*MachineExtention) Clone

func (me *MachineExtention) Clone() Extention

type MachineNode

type MachineNode struct {
	UUID        string `json:"uuid"`
	Department  string `json:"department"`
	IP          string `json:"ip"`
	CPUArch     string `json:"cpu_arch"`
	OS          string `json:"os"`
	RunStatus   string `json:"runstatus"`
	MaintStatus string `json:"maintatatus"`
}

type NodeResult

type NodeResult struct {
	UUID  string
	Error string
	Data  interface{}
}

type PageExtention

type PageExtention struct {
	Type       string `json:"type"`
	Name       string `json:"name"`
	URL        string `json:"url"`
	Permission string `json:"permission"`
}

func (*PageExtention) Clone

func (pe *PageExtention) Clone() Extention

type Permission

type Permission struct {
	Resource string `json:"resource"` //字符串中不允许包含"/"
	Operate  string `json:"operate"`
}

type Result

type Result struct {
	Code    int              `json:"code"`
	Mseeage string           `json:"msg"`
	Data    []*ServiceResult `json:"data"`
}

type ServiceInfo

type ServiceInfo struct {
	ServiceName            string
	UnitName               string
	UnitType               string
	ServicePath            string //配置文件放置的目录
	ServiceAfter           string //在什么服务启动后启动
	ServiceBefore          string //在什么服务启动前启动
	ServiceRequires        string //需要的daemon
	ServiceWants           string //与requires相反
	ServiceEnvironmentFile string //启动脚本的环境配置文件
	ServiceExectStart      string //实际执行daemon的指令或脚本程序
	ServiceActiveStatus    string
	ServiceLoadedStatus    string
	StartTime              string
}

type ServiceResult

type ServiceResult struct {
	MachineUUID   string
	MachineIP     string
	ServiceSample ServiceInfo
}

type ServiceStruct

type ServiceStruct struct {
	Batch       *Batch `json:"batch"`
	ServiceName string `json:"service"`
}

type Tag

type Tag struct {
	UUID       string `json:"machineuuid"`
	PluginName string `json:"plugin_name"`
	Type       string `json:"type"`
	Data       string `json:"data"`
}

Jump to

Keyboard shortcuts

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