types

package
v0.0.0-...-2e1a402 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS        = 200
	ERROR          = 500
	INVALID_PARAMS = 400
	UNKNOWN_ERROR  = 999

	SLAVE_INVALID               = 5001
	SLAVE_INSUFFICIENT_RESOURCE = 5002

	CONTAINER_IS_BUSY = 6001
)

Variables

View Source
var MsgFlags = map[int]string{
	SUCCESS:        "ok",
	ERROR:          "内部错误",
	INVALID_PARAMS: "请求参数错误",
	UNKNOWN_ERROR:  "未知错误",

	SLAVE_INVALID:               "设备机无效",
	SLAVE_INSUFFICIENT_RESOURCE: "设备机资源不足",

	CONTAINER_IS_BUSY: "该容器正在进行其他操作",
}

Functions

func GetMsg

func GetMsg(code int) string

GetMsg get error information based on Code

func GetSlaveStatsString

func GetSlaveStatsString(stats StatsSlave) string

Types

type APICallBackRequestBase

type APICallBackRequestBase struct {
	OperationID int64  `form:"operation_id" valid:"Required"`
	CallbackURL string `form:"callback_url" valid:"Required"`
}

APICallBackRequestBase 需要回调的 API 请求的 Request base

type APICallBackResponseBase

type APICallBackResponseBase struct {
	OperationID int64  `json:"operation_id"`
	Code        int    `json:"code"`
	Msg         string `json:"msg"`
}

APICallBackResponseBase 需要回调的 API 请求的 Response base

type APIContainerCreateRequest

type APIContainerCreateRequest struct {
	APICallBackRequestBase
	SlaveID        string `form:"slave_id" valid:"Required"`
	UECContainerID string `form:"uec_container_id" valid:"Required"`

	ImageName string `form:"image_name" valid:"Required"`

	ExposedTCPPorts []string `form:"exposed_tcp_ports"`
	ExposedUDPPorts []string `form:"exposed_udp_ports"`

	Mounts []string `form:"mounts"`

	CoreCnt int `form:"core_cnt" valid:"Required"`
	// max memory usage, in bytes
	MemorySize int64 `form:"memory_size" valid:"Required"`
	// max storage usage size, in bytes
	StorageSize int64 `form:"storage_size" valid:"Required"`
}

type APIContainerCreateResponse

type APIContainerCreateResponse struct {
	APICallBackResponseBase `json:"api_response_base"`

	ExposedTCPPorts        []string `json:"exposed_tcp_ports"`
	ExposedTCPMappingPorts []string `json:"exposed_tcp_mapping_ports"`
	ExposedUDPPorts        []string `json:"exposed_udp_ports"`
	ExposedUDPMappingPorts []string `json:"exposed_udp_mapping_ports"`
}

type APIContainerRemoveRequest

type APIContainerRemoveRequest struct {
	APICallBackRequestBase
	SlaveID        string `form:"slave_id" valid:"Required"`
	UECContainerID string `form:"uec_container_id" valid:"Required"`
}

type APIContainerRemoveResponse

type APIContainerRemoveResponse struct {
	APICallBackResponseBase `json:"api_response_base"`
}

type APIContainerStartRequest

type APIContainerStartRequest struct {
	APICallBackRequestBase
	SlaveID        string `form:"slave_id" valid:"Required"`
	UECContainerID string `form:"uec_container_id" valid:"Required"`
}

type APIContainerStartResponse

type APIContainerStartResponse struct {
	APICallBackResponseBase `json:"api_response_base"`
}

type APIContainerStopRequest

type APIContainerStopRequest struct {
	APICallBackRequestBase
	SlaveID        string `form:"slave_id" valid:"Required"`
	UECContainerID string `form:"uec_container_id" valid:"Required"`
}

type APIContainerStopResponse

type APIContainerStopResponse struct {
	APICallBackResponseBase `json:"api_response_base"`
}

type APISlaveAddToken

type APISlaveAddToken struct {
	Token string `json:"token"`
}

type APISlaveDeleteRequest

type APISlaveDeleteRequest struct {
	APICallBackRequestBase
	SlaveUUID string `json:"slave_uuid"`
}

type APISlaveDeleteResponse

type APISlaveDeleteResponse struct {
	APICallBackResponseBase
	SlaveUUID string `json:"slave_uuid"`
}

type APISlaveImageListRequest

type APISlaveImageListRequest struct {
	SlaveUUID string `json:"slave_uuid"`
}

type APISlaveImageListResponse

type APISlaveImageListResponse struct {
	Images []ImageListItem `json:"images"`
}

type APISlaveProfileListRequest

type APISlaveProfileListRequest struct {
	SlavesUUID []string `json:"slaves"`
}

type APISlaveProfileListResponse

type APISlaveProfileListResponse struct {
	Slaves []SlaveProfile `json:"slaves"`
}

type APISlaveStatusItem

type APISlaveStatusItem struct {
	UUID             string `json:"uuid"`
	Stats            string `json:"stats"`
	CoreAvailable    int    `json:"core_available"`
	MemAvailable     uint64 `json:"mem_available"`
	StorageAvailable uint64 `json:"storage_available"`
}

type APISlaveStatusRequest

type APISlaveStatusRequest struct {
	SlaveUUID []string `json:"uuids"`
}

type APISlaveStatusResponse

type APISlaveStatusResponse struct {
	Status []APISlaveStatusItem `json:"status"`
}

type APISlaveUUIDListResponse

type APISlaveUUIDListResponse struct {
	SlavesUUID []string `json:"slaves"`
}

type CreatMasterBody

type CreatMasterBody struct {
	Recovery string

	SlaveControlListenerPort string

	APIPort string

	RedisHost     string
	RedisPort     string
	RedisPassword string
	RedisDB       string

	Reload bool
}

type CreatSlaveBody

type CreatSlaveBody struct {
	MasterIP        string
	MasterPort      string
	MasterSecretKey string

	HostPortBias int

	Reload bool
}

type ImageListItem

type ImageListItem struct {
	Name        string `json:"name"`
	Size        int64  `json:"size"`
	CreatedTime string `json:"created_time"`
}

type SlaveProfile

type SlaveProfile struct {
	SlaveUUId string `json:"slave_uuid"`

	Platform        string `json:"platform"`
	PlatformFamily  string `json:"platform_family"`
	PlatformVersion string `json:"platform_version"`

	MemoryTotalSize uint64 `json:"memory_total_size"`

	CpuModelName    string `json:"cpu_model_name"`
	LogicalCoreCnt  int    `json:"logical_core_cnt"`
	PhysicalCoreCnt int    `json:"physical_core_cnt"`
}

type StatsSlave

type StatsSlave int
const (
	StatsWaitingEstablishControlConnection StatsSlave = iota
	StatsWaitingEstablishDataConnection
	StatsNormal
	StatsStopped
	StatsOffline
)

Jump to

Keyboard shortcuts

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