Documentation
¶
Overview ¶
Package taskflow 提供 taskflow 服务的客户端实现
Index ¶
- type ApplyWebClientIPReq
- type AskUserQuestionResponse
- type CheckTokenReq
- type Client
- func (c *Client) FileManager() FileManager
- func (c *Client) Host() Hoster
- func (c *Client) PortForwarder() PortForwarder
- func (c *Client) Stats(ctx context.Context) (*Stats, error)
- func (c *Client) TaskLive(ctx context.Context, taskID string, flush bool, fn func(*TaskChunk) error) error
- func (c *Client) TaskManager() TaskManager
- func (c *Client) VirtualMachiner() VirtualMachiner
- type Clienter
- type ClosePortForward
- type CloseTerminalReq
- type CodingAgent
- type CodingConfig
- type Condition
- type ConditionStatus
- type ConfigFile
- type CreatePortForward
- type CreateTaskReq
- type CreateVirtualMachineReq
- type DeleteVirtualMachineReq
- type File
- type FileKind
- type FileManager
- type FileOP
- type FileReq
- type GetCodingConfigReq
- type GetTaskStreamIPsReq
- type GetTaskStreamIPsResp
- type Git
- type GitCredentialRequest
- type GitCredentialResponse
- type HibernateVirtualMachineReq
- type Host
- type Hoster
- type IsOnlineReq
- type IsOnlineResp
- type LLM
- type LLMInfo
- type LLMProvider
- type LLMProviderReq
- type ListLLMReq
- type ListPortforwadReq
- type ListPortforwadResp
- type McpHttpHeader
- type McpServerConfig
- type Opt
- type PortForwardInfo
- type PortForwarder
- type RepoEntryMode
- type RepoFileChangeInfo
- type RepoFileChanges
- type RepoFileChangesReq
- type RepoFileDiff
- type RepoFileDiffReq
- type RepoFileInfo
- type RepoListFiles
- type RepoListFilesReq
- type RepoReadFile
- type RepoReadFileReq
- type ReportEntry
- type ReportSubscribeReq
- type Reporter
- type ReportsStream
- type Resp
- type RestartTaskReq
- type RestartTaskResp
- type ResumeVirtualMachineReq
- type Shell
- type Sheller
- type Stats
- type TTL
- type TTLKind
- type Task
- type TaskApproveReq
- type TaskChunk
- type TaskManager
- type TaskReq
- type Terminal
- type TerminalData
- type TerminalMode
- type TerminalReq
- type TerminalSize
- type Token
- type TokenKind
- type TokenTeam
- type TokenUser
- type UpdatePortForward
- type VirtualMachine
- type VirtualMachineCondition
- type VirtualMachineInfoReq
- type VirtualMachineStatus
- type VirtualMachiner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyWebClientIPReq ¶
type ApplyWebClientIPReq struct {
ClientIP string `json:"client_ip"`
}
ApplyWebClientIPReq 同步 Web 客户端 IP 请求
type AskUserQuestionResponse ¶
type AskUserQuestionResponse struct {
TaskId string `json:"task_id,omitempty"`
RequestId string `json:"request_id,omitempty"`
AnswersJson string `json:"answers_json,omitempty"`
Cancelled bool `json:"cancelled,omitempty"`
}
AskUserQuestionResponse 用户回答 AI 提问的响应
type CheckTokenReq ¶
type CheckTokenReq struct {
Token string `json:"token" validate:"required"`
MachineID string `json:"machine_id"`
}
CheckTokenReq 认证请求
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client taskflow 客户端
func (*Client) FileManager ¶
func (c *Client) FileManager() FileManager
func (*Client) PortForwarder ¶
func (c *Client) PortForwarder() PortForwarder
func (*Client) TaskLive ¶
func (c *Client) TaskLive(ctx context.Context, taskID string, flush bool, fn func(*TaskChunk) error) error
TaskLive 连接 taskflow 的 task-live WebSocket 并处理消息流
func (*Client) TaskManager ¶
func (c *Client) TaskManager() TaskManager
func (*Client) VirtualMachiner ¶
func (c *Client) VirtualMachiner() VirtualMachiner
type Clienter ¶
type Clienter interface {
VirtualMachiner() VirtualMachiner
Host() Hoster
FileManager() FileManager
TaskManager() TaskManager
PortForwarder() PortForwarder
Stats(ctx context.Context) (*Stats, error)
TaskLive(ctx context.Context, taskID string, flush bool, fn func(*TaskChunk) error) error
}
Clienter taskflow 客户端接口
type ClosePortForward ¶
type ClosePortForward struct {
ID string `json:"id" query:"id" validate:"required"`
ForwardID string `json:"forward_id"`
}
ClosePortForward 关闭端口转发请求
type CloseTerminalReq ¶
type CloseTerminalReq struct {
ID string `json:"id" query:"id"`
TerminalID string `json:"terminal_id" query:"terminal_id"`
}
CloseTerminalReq 关闭终端请求
type CodingAgent ¶
type CodingAgent int
CodingAgent 编码代理类型
const ( CodingAgentCodex CodingAgent = iota + 1 CodingAgentClaude CodingAgentMCAIReview CodingAgentOpenCode )
type Condition ¶
type Condition struct {
Type string `json:"type,omitempty"`
Status ConditionStatus `json:"status,omitempty"`
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
LastTransitionTime int64 `json:"last_transition_time,omitempty"`
Progress *int32 `json:"progress,omitempty"`
}
Condition 细粒度状态条件
type ConditionStatus ¶
type ConditionStatus int32
ConditionStatus 条件状态
const ( ConditionStatusUnknown ConditionStatus = 0 ConditionStatusInProgress ConditionStatus = 1 ConditionStatusTrue ConditionStatus = 2 ConditionStatusFalse ConditionStatus = 3 )
type ConfigFile ¶
ConfigFile 配置文件
type CreatePortForward ¶
type CreatePortForward struct {
ID string `json:"id" query:"id" validate:"required"`
UserID string `json:"user_id"`
LocalPort int32 `json:"local_port"`
WhitelistIPs []string `json:"whitelist_ips"`
}
CreatePortForward 创建端口转发请求
type CreateTaskReq ¶
type CreateTaskReq struct {
ID uuid.UUID `json:"id"`
VMID string `json:"vm_id"`
SystemPrompt string `json:"system_prompt,omitempty"`
Text string `json:"text,omitempty"`
LLM LLM `json:"llm,omitzero"`
CodingAgent CodingAgent `json:"coding_agent,omitempty"`
Configs []ConfigFile `json:"configs,omitzero"`
McpConfigs []McpServerConfig `json:"mcp_configs,omitzero"`
Env map[string]string `json:"env,omitempty"`
}
CreateTaskReq 创建任务请求
type CreateVirtualMachineReq ¶
type CreateVirtualMachineReq struct {
UserID string `json:"user_id" validate:"required"`
HostID string `json:"host_id" validate:"required"`
HostName string `json:"hostname"`
Git Git `json:"git"`
ZipUrl string `json:"zip_url"`
ImageURL string `json:"image_url"`
ProxyURL string `json:"proxy_url"`
TaskID uuid.UUID `json:"task_id"`
LLM LLMProviderReq `json:"llm"`
Cores string `json:"cores"`
Memory uint64 `json:"memory"`
InstallCodingAgents bool `json:"install_coding_agents"`
Envs []string `json:"envs,omitempty"`
}
CreateVirtualMachineReq 创建虚拟机请求
type DeleteVirtualMachineReq ¶
type DeleteVirtualMachineReq struct {
HostID string `json:"host_id" query:"host_id" validate:"required"`
UserID string `json:"user_id" query:"user_id" validate:"required"`
ID string `json:"id" query:"id" validate:"required"`
}
DeleteVirtualMachineReq 删除虚拟机请求
type File ¶
type File struct {
Name string `json:"name"`
User string `json:"user"`
Size uint64 `json:"size"`
Kind FileKind `json:"kind"`
SymlinkTarget string `json:"symlink_target,omitempty"`
SymlinkKind FileKind `json:"symlink_kind,omitempty"`
UnixMode uint32 `json:"unix_mode"`
CreatedAt int64 `json:"created_at"`
AccessedAt int64 `json:"accessed_at"`
UpdatedAt int64 `json:"updated_at"`
}
File 文件信息
type FileManager ¶
type FileManager interface {
Operate(ctx context.Context, req FileReq) ([]*File, error)
Download(ctx context.Context, req FileReq, fn func(uint64, []byte) error) error
Upload(ctx context.Context, req FileReq, data <-chan []byte) error
}
FileManager 文件管理接口
type FileReq ¶
type FileReq struct {
Operate FileOP `json:"operate" query:"operate"`
UserID string `json:"user_id" query:"user_id"`
ID string `json:"id" query:"id"`
Path string `json:"path,omitempty" query:"path"`
Source string `json:"source,omitempty" query:"source"`
Target string `json:"target,omitempty" query:"target"`
Content string `json:"content,omitempty" query:"content"`
}
FileReq 文件操作请求
type GetCodingConfigReq ¶
type GetCodingConfigReq struct {
VmID string `json:"vm_id"`
}
GetCodingConfigReq 获取编码配置请求
type GetTaskStreamIPsReq ¶
type GetTaskStreamIPsReq struct {
TaskID string `json:"task_id"`
}
GetTaskStreamIPsReq 获取任务 WebSocket 连接 IP 请求
type GetTaskStreamIPsResp ¶
type GetTaskStreamIPsResp struct {
IPs []string `json:"ips"`
}
GetTaskStreamIPsResp 获取任务 WebSocket 连接 IP 响应
type Git ¶
type Git struct {
URL string `json:"url"`
Token string `json:"token"`
ProxyURL string `json:"proxy_url"`
Branch string `json:"branch,omitempty"`
Username string `json:"username,omitempty"`
Email string `json:"email,omitempty"`
}
Git 仓库信息
type GitCredentialRequest ¶
type GitCredentialRequest struct {
TaskID string `json:"task_id"` // 任务 id
VMID string `json:"vm_id"` // 虚拟机 id
Protocol string `json:"protocol"` // git 协议 (e.g., "https")
Host string `json:"host"` // git server host (e.g., "gitlab.example.com")
Path string `json:"path"` // 仓库路径 (e.g., "owner/repo.git")
}
GitCredentialRequest git 凭证请求
type GitCredentialResponse ¶
type GitCredentialResponse struct {
Username *string `json:"username,omitempty"`
Password *string `json:"password,omitempty"`
Error *string `json:"error,omitempty"`
}
GitCredentialResponse git 凭证响应
type HibernateVirtualMachineReq ¶
type HibernateVirtualMachineReq struct {
HostID string `json:"host_id" query:"host_id" validate:"required"` // 宿主机 id
UserID string `json:"user_id" query:"user_id" validate:"required"` // 用户id
ID string `json:"id" query:"id" validate:"required"` // 虚拟机 id
EnvironmentID string `json:"environment_id" query:"environment_id"` // environment id
}
type Host ¶
type Host struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Hostname string `json:"hostname"`
Arch string `json:"arch"`
OS string `json:"os"`
Name string `json:"name"`
Cores int32 `json:"cores"`
Memory uint64 `json:"memory"`
Disk uint64 `json:"disk"`
PublicIP string `json:"public_ip"`
InternalIP string `json:"internal_ip"`
TTL TTL `json:"ttl"`
CreatedAt int64 `json:"created_at"`
Version string `json:"version"`
}
Host 宿主机信息
type Hoster ¶
type Hoster interface {
List(ctx context.Context, userID string) (map[string]*Host, error)
IsOnline(ctx context.Context, req *IsOnlineReq[string]) (*IsOnlineResp, error)
}
Hoster 宿主机管理接口
type IsOnlineResp ¶
IsOnlineResp 在线状态查询响应
type LLM ¶
type LLM struct {
ApiKey string `json:"api_key"`
BaseURL string `json:"base_url"`
Model string `json:"model"`
ApiType string `json:"api_type,omitempty"` // 接口类型 anthropic | openai
Temperature *float32 `json:"temperature,omitempty"`
}
LLM 模型配置
type LLMInfo ¶
type LLMInfo struct {
ApiKey string `json:"api_key"`
BaseURL string `json:"base_url"`
Model string `json:"model"`
Temperature *float32 `json:"temperature,omitempty"`
}
LLMInfo LLM 信息
type LLMProvider ¶
type LLMProvider string
LLMProvider 模型提供商
const (
LlmProviderOpenAI LLMProvider = "openai"
)
type LLMProviderReq ¶
type LLMProviderReq struct {
Provider LLMProvider `json:"provider"`
ApiKey string `json:"api_key"`
BaseURL string `json:"base_url"`
Model string `json:"model"`
Temperature *float32 `json:"temperature,omitempty"`
}
LLMProviderReq 模型提供商配置
type ListLLMReq ¶
type ListLLMReq struct {
VmID string `json:"vm_id" validate:"required"`
HostID string `json:"host_id" validate:"required"`
}
ListLLMReq 列出 LLM 请求
type ListPortforwadReq ¶
type ListPortforwadResp ¶
type ListPortforwadResp struct {
RequestId string `json:"request_id,omitempty"`
Ports []*PortForwardInfo `json:"ports"`
}
type McpHttpHeader ¶
type McpHttpHeader struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
}
McpHttpHeader MCP HTTP 头
type McpServerConfig ¶
type McpServerConfig struct {
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Url *string `json:"url,omitempty"`
Headers []*McpHttpHeader `json:"headers,omitempty"`
Command *string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
}
McpServerConfig MCP 服务器配置
type PortForwardInfo ¶
type PortForwardInfo struct {
Port int32 `json:"port"`
Status string `json:"status"`
Process string `json:"process"`
ForwardID *string `json:"forward_id"`
AccessURL *string `json:"access_url"`
CreatedAt int64 `json:"created_at"`
Success bool `json:"success"`
ErrorMessage string `json:"error_message,omitempty"`
WhitelistIPs []string `json:"whitelist_ips"`
}
PortForwardInfo 端口转发信息
type PortForwarder ¶
type PortForwarder interface {
List(ctx context.Context, req ListPortforwadReq) (*ListPortforwadResp, error)
Create(ctx context.Context, req CreatePortForward) (*PortForwardInfo, error)
Close(ctx context.Context, req ClosePortForward) error
Update(ctx context.Context, req UpdatePortForward) (*PortForwardInfo, error)
}
PortForwarder 端口转发管理接口
type RepoEntryMode ¶
type RepoEntryMode int32
RepoEntryMode 文件条目类型
const ( RepoEntryModeUnspecified RepoEntryMode = 0 RepoEntryModeFile RepoEntryMode = 1 RepoEntryModeExecutable RepoEntryMode = 2 RepoEntryModeSymlink RepoEntryMode = 3 RepoEntryModeTree RepoEntryMode = 4 RepoEntryModeSubmodule RepoEntryMode = 5 )
type RepoFileChangeInfo ¶
type RepoFileChangeInfo struct {
Path string `json:"path,omitempty"`
Status string `json:"status,omitempty"`
Additions *int32 `json:"additions,omitempty"`
Deletions *int32 `json:"deletions,omitempty"`
OldPath *string `json:"old_path,omitempty"`
}
RepoFileChangeInfo 单个文件变动信息
type RepoFileChanges ¶
type RepoFileChanges struct {
TaskId string `json:"task_id,omitempty"`
RequestId string `json:"request_id,omitempty"`
Changes []*RepoFileChangeInfo `json:"changes,omitempty"`
Branch *string `json:"branch,omitempty"`
CommitHash *string `json:"commit_hash,omitempty"`
Success bool `json:"success"`
Error *string `json:"error,omitempty"`
}
RepoFileChanges 文件变动列表响应
type RepoFileChangesReq ¶
type RepoFileChangesReq struct {
TaskId string `json:"task_id,omitempty"`
RequestId string `json:"request_id"`
}
RepoFileChangesReq 文件变动列表请求
type RepoFileDiff ¶
type RepoFileDiff struct {
TaskId string `json:"task_id,omitempty"`
RequestId string `json:"request_id"`
Path string `json:"path,omitempty"`
Diff string `json:"diff,omitempty"`
Success bool `json:"success"`
Error *string `json:"error,omitempty"`
}
RepoFileDiff 文件 diff 响应
type RepoFileDiffReq ¶
type RepoFileDiffReq struct {
TaskId string `json:"task_id,omitempty"`
RequestId string `json:"request_id"`
Path string `json:"path"`
Unified *bool `json:"unified"`
ContextLines *int32 `json:"context_lines"`
}
RepoFileDiffReq 文件 diff 请求
type RepoFileInfo ¶
type RepoFileInfo struct {
Name string `json:"name,omitempty"`
Path string `json:"path,omitempty"`
EntryMode RepoEntryMode `json:"entry_mode,omitempty"`
Size int64 `json:"size,omitempty"`
ModifiedAt int64 `json:"modified_at,omitempty"`
Mode *uint32 `json:"mode,omitempty"`
SymlinkTarget *string `json:"symlink_target,omitempty"`
}
RepoFileInfo 文件信息
type RepoListFiles ¶
type RepoListFiles struct {
TaskId string `json:"task_id,omitempty"`
RequestId string `json:"request_id"`
Path string `json:"path,omitempty"`
Files []*RepoFileInfo `json:"files,omitempty"`
Success bool `json:"success,omitempty"`
Error *string `json:"error,omitempty"`
}
RepoListFiles 列出文件响应
type RepoListFilesReq ¶
type RepoListFilesReq struct {
TaskId string `json:"task_id,omitempty"`
RequestId string `json:"request_id"`
Path string `json:"path"`
GlobPattern *string `json:"glob_pattern"`
IncludeHidden bool `json:"include_hidden"`
}
RepoListFilesReq 列出文件请求
type RepoReadFile ¶
type RepoReadFile struct {
TaskId string `json:"task_id,omitempty"`
RequestId string `json:"request_id"`
Path string `json:"path,omitempty"`
Content []byte `json:"content,omitempty"`
TotalSize int64 `json:"total_size,omitempty"`
Offset int64 `json:"offset,omitempty"`
Length int64 `json:"length,omitempty"`
IsTruncated bool `json:"is_truncated,omitempty"`
Success bool `json:"success"`
Error *string `json:"error,omitempty"`
}
RepoReadFile 读取文件响应
type RepoReadFileReq ¶
type RepoReadFileReq struct {
TaskId string `json:"task_id,omitempty"`
RequestId string `json:"request_id"`
Path string `json:"path"`
Offset *int64 `json:"offset"`
Length *int64 `json:"length"`
}
RepoReadFileReq 读取文件请求
type ReportEntry ¶
type ReportEntry struct {
ID string `json:"id"`
Source string `json:"source"`
Ts int64 `json:"ts"`
Data []byte `json:"data"`
}
ReportEntry 对应服务端 /internal/ws/reports 推送的 JSON 结构
type ReportSubscribeReq ¶
type ReportSubscribeReq struct {
ID string `json:"id" query:"id" validate:"required"`
History int64 `json:"history" query:"history"`
FromID string `json:"from_id" query:"from_id"`
}
ReportSubscribeReq 报告订阅请求
type Reporter ¶
type Reporter interface {
Stop()
BlockRead(fn func(ReportEntry)) error
}
Reporter 报告订阅接口
type ReportsStream ¶
type ReportsStream struct {
// contains filtered or unexported fields
}
ReportsStream 实现 Reporter
func (*ReportsStream) BlockRead ¶
func (r *ReportsStream) BlockRead(fn func(ReportEntry)) error
BlockRead 持续读取 WS 文本消息, 反序列化为 ReportEntry 并回调
type Resp ¶
type Resp[T any] struct { Code int `json:"code"` Message string `json:"message"` Data T `json:"data,omitempty"` }
Resp 通用 API 响应包装
type RestartTaskReq ¶
type RestartTaskReq struct {
ID uuid.UUID `json:"id"`
RequestId string `json:"request_id,omitempty"`
LoadSession bool `json:"load_session"`
}
RestartTaskReq 重启任务请求
type RestartTaskResp ¶
type RestartTaskResp struct {
ID uuid.UUID `json:"id"`
RequestId string `json:"request_id,omitempty"`
Success bool `json:"success"`
Message string `json:"message"`
SessionID string `json:"session_id"`
}
RestartTaskResp 重启任务响应
type ResumeVirtualMachineReq ¶
type ResumeVirtualMachineReq struct {
HostID string `json:"host_id" query:"host_id" validate:"required"` // 宿主机 id
UserID string `json:"user_id" query:"user_id" validate:"required"` // 用户id
ID string `json:"id" query:"id" validate:"required"` // 虚拟机 id
EnvironmentID string `json:"environment_id" query:"environment_id"` // environment id
}
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
Shell WebSocket 终端 shell 实现,支持自动重连和 keepalive
func (*Shell) BlockRead ¶
func (s *Shell) BlockRead(fn func(TerminalData)) error
BlockRead 阻塞读取终端数据,支持自动重连
type Sheller ¶
type Sheller interface {
Write(TerminalData) error
Stop()
BlockRead(fn func(TerminalData)) error
}
Sheller 终端 shell 接口
type Stats ¶
type Stats struct {
OnlineHostCount int `json:"online_host_count"`
OnlineTaskCount int `json:"online_task_count"`
OnlineVMCount int `json:"online_vm_count"`
OnlineTerminalCount int `json:"online_terminal_count"`
UsingTerminalUserCount int `json:"using_terminal_user_count"`
}
Stats 统计信息
type TaskApproveReq ¶
type TaskApproveReq struct {
ID uuid.UUID `json:"id"`
AutoApprove *bool `json:"auto_approve,omitempty"`
}
TaskApproveReq 任务自动批准请求
type TaskChunk ¶
type TaskChunk struct {
Data []byte `json:"data,omitempty"`
Event string `json:"event"`
Kind string `json:"kind"`
Timestamp int64 `json:"timestamp,omitempty"`
}
TaskChunk Loki 日志中的任务数据块
type TaskManager ¶
type TaskManager interface {
Create(ctx context.Context, req CreateTaskReq) error
Stop(ctx context.Context, req TaskReq) error
Restart(ctx context.Context, req RestartTaskReq) (*RestartTaskResp, error)
Cancel(ctx context.Context, req TaskReq) error
Continue(ctx context.Context, req TaskReq) error
AutoApprove(ctx context.Context, req TaskApproveReq) error
AskUserQuestion(ctx context.Context, req AskUserQuestionResponse) error
ListFiles(ctx context.Context, req RepoListFilesReq) (*RepoListFiles, error)
ReadFile(ctx context.Context, req RepoReadFileReq) (*RepoReadFile, error)
FileDiff(ctx context.Context, req RepoFileDiffReq) (*RepoFileDiff, error)
FileChanges(ctx context.Context, req RepoFileChangesReq) (*RepoFileChanges, error)
}
TaskManager 任务管理接口
type TaskReq ¶
type TaskReq struct {
VirtualMachine *VirtualMachine `json:"virtual_machine,omitempty"`
Task *Task `json:"task,omitempty"`
}
TaskReq 任务请求(通用)
type Terminal ¶
type Terminal struct {
ID string `json:"id"`
Title string `json:"title"`
ConnectedCount uint32 `json:"connected_count"`
CreatedAt int64 `json:"created_at"`
}
Terminal 终端信息
type TerminalData ¶
type TerminalData struct {
Data []byte `json:"data,omitempty"`
Connected bool `json:"connected"`
Resize *TerminalSize `json:"resize,omitempty"`
Error *string `json:"error,omitempty"`
}
TerminalData 终端数据
type TerminalMode ¶
type TerminalMode uint8
TerminalMode 终端模式
const ( TerminalModeReadWrite TerminalMode = iota TerminalModeReadOnly )
type TerminalReq ¶
type TerminalReq struct {
ID string `json:"id" query:"id"`
Mode TerminalMode `json:"mode" query:"mode"`
TerminalID string `json:"terminal_id" query:"terminal_id" validate:"required"`
Exec string `json:"exec" query:"exec"`
TerminalSize
}
TerminalReq 终端连接请求
type TerminalSize ¶
type TerminalSize struct {
Col uint32 `json:"col" query:"col"`
Row uint32 `json:"row" query:"row"`
}
TerminalSize 终端尺寸
type Token ¶
type Token struct {
Kind TokenKind `json:"kind"`
User *TokenUser `json:"user"`
ParentToken string `json:"parent_token"`
Token string `json:"token"`
TaskID uuid.UUID `json:"task_id"`
SessionID string `json:"session_id"`
RemoteIP string `json:"remote_ip"`
Version string `json:"version"`
}
Token 认证结果
type TokenUser ¶
type TokenUser struct {
ID string `json:"id"`
Name string `json:"name"`
AvatarURL string `json:"avatar_url"`
Email string `json:"email"`
Team *TokenTeam `json:"team"`
}
TokenUser token 中的用户信息
type UpdatePortForward ¶
type UpdatePortForward struct {
ID string `json:"id" query:"id" validate:"required"`
ForwardID string `json:"forward_id"`
WhitelistIPs []string `json:"whitelist_ips"`
}
UpdatePortForward 更新端口转发请求
type VirtualMachine ¶
type VirtualMachine struct {
ID string `json:"id"`
EnvironmentID string `json:"environment_id"`
HostID string `json:"host_id"`
Hostname string `json:"hostname"`
Arch string `json:"arch"`
OS string `json:"os"`
Name string `json:"name"`
Repository string `json:"repository"`
Status VirtualMachineStatus `json:"status"`
StatusMessage string `json:"status_message"`
Cores int32 `json:"cores"`
Memory uint64 `json:"memory"`
Disk uint64 `json:"disk"`
TTL TTL `json:"ttl"`
ExternalIP string `json:"external_ip"`
CreatedAt int64 `json:"created_at"`
Version string `json:"version"`
}
VirtualMachine 虚拟机信息
type VirtualMachineCondition ¶
type VirtualMachineCondition struct {
EnvID string `json:"env_id"`
Conditions []*Condition `json:"conditions,omitempty"`
}
VirtualMachineCondition 虚拟机条件集合
type VirtualMachineInfoReq ¶
type VirtualMachineInfoReq struct {
ID string `json:"id" query:"id"`
UserID string `json:"user_id" query:"user_id"`
}
VirtualMachineInfoReq 虚拟机信息查询请求
type VirtualMachineStatus ¶
type VirtualMachineStatus string
VirtualMachineStatus 虚拟机状态
const ( VirtualMachineStatusUnknown VirtualMachineStatus = "unknown" VirtualMachineStatusPending VirtualMachineStatus = "pending" VirtualMachineStatusOnline VirtualMachineStatus = "online" VirtualMachineStatusOffline VirtualMachineStatus = "offline" VirtualMachineStatusHibernated VirtualMachineStatus = "hibernated" )
type VirtualMachiner ¶
type VirtualMachiner interface {
Create(ctx context.Context, req *CreateVirtualMachineReq) (*VirtualMachine, error)
Delete(ctx context.Context, req *DeleteVirtualMachineReq) error
Hibernate(ctx context.Context, req *HibernateVirtualMachineReq) error
Resume(ctx context.Context, req *ResumeVirtualMachineReq) error
List(ctx context.Context, id string) ([]*VirtualMachine, error)
Info(ctx context.Context, req VirtualMachineInfoReq) (*VirtualMachine, error)
Terminal(ctx context.Context, req *TerminalReq) (Sheller, error)
Reports(ctx context.Context, req ReportSubscribeReq) (Reporter, error)
TerminalList(ctx context.Context, id string) ([]*Terminal, error)
CloseTerminal(ctx context.Context, req *CloseTerminalReq) error
IsOnline(ctx context.Context, req *IsOnlineReq[string]) (*IsOnlineResp, error)
}
VirtualMachiner 虚拟机管理接口