common

package
v0.0.0-...-0dfa492 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: MulanPSL-2.0 Imports: 2 Imported by: 5

Documentation

Overview

  • Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved.

  • PilotGo licensed under the Mulan Permissive Software License, Version 2.

  • See LICENSE file for more details.

  • Author: zhanghan2021 <zhanghan@kylinos.cn>

  • Date: Tue Jul 23 15:50:05 2024 +0800

  • Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved.

  • PilotGo licensed under the Mulan Permissive Software License, Version 2.

  • See LICENSE file for more details.

  • Author: Gzx1999 <guozhengxin@kylinos.cn>

  • Date: Tue Nov 7 15:01:17 2023 +0800

  • Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved.

  • PilotGo licensed under the Mulan Permissive Software License, Version 2.

  • See LICENSE file for more details.

  • Author: zhanghan2021 <zhanghan@kylinos.cn>

  • Date: Wed Sep 27 17:35:12 2023 +0800

  • Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved.

  • PilotGo licensed under the Mulan Permissive Software License, Version 2.

  • See LICENSE file for more details.

  • Author: wubijie <wubijie@kylinos.cn>

  • Date: Thu Jan 11 20:24:26 2024 +0800

  • Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved.

  • PilotGo licensed under the Mulan Permissive Software License, Version 2.

  • See LICENSE file for more details.

  • Author: Gzx1999 <guozhengxin@kylinos.cn>

  • Date: Wed Oct 11 16:18:11 2023 +0800

  • Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved.

  • PilotGo licensed under the Mulan Permissive Software License, Version 2.

  • See LICENSE file for more details.

  • Author: zhanghan2021 <zhanghan@kylinos.cn>

  • Date: Wed Sep 27 17:35:12 2023 +0800

  • Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved.

  • PilotGo licensed under the Mulan Permissive Software License, Version 2.

  • See LICENSE file for more details.

  • Author: zhanghan2021 <zhanghan@kylinos.cn>

  • Date: Wed Sep 27 17:35:12 2023 +0800

提供公共数据结构定义

  • Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved.
  • PilotGo licensed under the Mulan Permissive Software License, Version 2.
  • See LICENSE file for more details.
  • Author: wubijie <wubijie@kylinos.cn>
  • Date: Thu Nov 2 16:38:53 2023 +0800

Index

Constants

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

This section is empty.

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 EventCallback

type EventCallback func(e *EventMessage)

type EventMessage

type EventMessage struct {
	MessageType int    `json:"msgType"`
	MessageData string `json:"msgData"`
}

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 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 MessageData

type MessageData struct {
	MsgType     int         `json:"msg_type_id"`
	MessageType string      `json:"msg_type"`
	TimeStamp   time.Time   `json:"timestamp"`
	Data        interface{} `json:"data"`
}

func (*MessageData) ToMessageDataString

func (msgData *MessageData) ToMessageDataString() (string, error)

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