Documentation
¶
Index ¶
- type HostHandler
- func (h *HostHandler) ApplyPort(c *web.Context, req domain.ApplyPortReq) error
- func (h *HostHandler) CloseTerminal(c *web.Context, req domain.CloseTerminalReq) error
- func (h *HostHandler) ConnectVMTerminal(c *web.Context, req domain.TerminalReq) error
- func (h *HostHandler) CreateVM(c *web.Context, req domain.CreateVMReq) error
- func (h *HostHandler) DeleteHost(c *web.Context, req domain.IDReq[string]) error
- func (h *HostHandler) DeleteVM(c *web.Context, req domain.DeleteVirtualMachineReq) error
- func (h *HostHandler) GetInstallCommand(c *web.Context) error
- func (h *HostHandler) HostList(c *web.Context) error
- func (h *HostHandler) Install(c *web.Context, req domain.InstallReq) error
- func (h *HostHandler) JoinTerminal(c *web.Context, req domain.JoinTerminalReq) error
- func (h *HostHandler) ListPort(c *web.Context, req domain.ListPortsReq) error
- func (h *HostHandler) RecyclePort(c *web.Context, req domain.RecyclePortReq) error
- func (h *HostHandler) ShareTerminal(c *web.Context, req domain.ShareTerminalReq) error
- func (h *HostHandler) TerminalList(c *web.Context, req domain.IDReq[string]) error
- func (h *HostHandler) UpdateHost(c *web.Context, req domain.UpdateHostReq) error
- func (h *HostHandler) UpdateVM(c *web.Context, req domain.UpdateVMReq) error
- func (h *HostHandler) VMInfo(c *web.Context, req domain.IDReq[string]) error
- type InternalHostHandler
- func (h *InternalHostHandler) BatchGetVmIDsByEnvIDs(c *web.Context, req taskflow.BatchGetVmIDsByEnvIDsReq) error
- func (h *InternalHostHandler) CheckToken(c *web.Context, req taskflow.CheckTokenReq) error
- func (h *InternalHostHandler) GetCodingConfig(c *web.Context, req taskflow.GetCodingConfigReq) error
- func (h *InternalHostHandler) GetTaskLogStore(c *web.Context, req taskflow.GetTaskLogStoreReq) error
- func (h *InternalHostHandler) GetTaskStreamIPs(c *web.Context, req taskflow.GetTaskStreamIPsReq) error
- func (h *InternalHostHandler) GitCredential(c *web.Context, req taskflow.GitCredentialRequest) error
- func (h *InternalHostHandler) ListLLM(c *web.Context, req taskflow.ListLLMReq) error
- func (h *InternalHostHandler) ReportHostInfo(c *web.Context, host taskflow.Host) error
- func (h *InternalHostHandler) ReportVirtualMachine(c *web.Context, vm taskflow.VirtualMachine) error
- func (h *InternalHostHandler) VMActivity(c *web.Context, req VMActivityReq) error
- func (h *InternalHostHandler) VMList(c *web.Context) error
- func (h *InternalHostHandler) VmConditions(c *web.Context, req taskflow.VirtualMachineCondition) error
- func (h *InternalHostHandler) VmReady(c *web.Context, req taskflow.VirtualMachine) error
- type VMActivityReq
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostHandler ¶
type HostHandler struct {
// contains filtered or unexported fields
}
func NewHostHandler ¶
func NewHostHandler(i *do.Injector) (*HostHandler, error)
func (*HostHandler) ApplyPort ¶
func (h *HostHandler) ApplyPort(c *web.Context, req domain.ApplyPortReq) error
ApplyPort 为开发环境申请一个端口
@Summary 申请端口
@Description 为开发环境申请一个端口
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param host_id path string true "宿主机ID"
@Param id path string true "虚拟机ID"
@Param request body domain.ApplyPortReq true "申请端口请求"
@Success 200 {object} web.Resp{data=domain.VMPort} "成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/{host_id}/vms/{id}/ports [post]
func (*HostHandler) CloseTerminal ¶
func (h *HostHandler) CloseTerminal(c *web.Context, req domain.CloseTerminalReq) error
CloseTerminal 关闭虚拟机终端session
@Summary 关闭虚拟机终端session
@Description 关闭虚拟机终端session
@Tags 【用户】终端连接管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param id path string true "虚拟机ID"
@Param terminal_id path string true "终端 id"
@Success 200 {object} web.Resp{data=[]domain.Terminal} "成功"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/vms/{id}/terminals/{terminal_id} [delete]
func (*HostHandler) ConnectVMTerminal ¶
func (h *HostHandler) ConnectVMTerminal(c *web.Context, req domain.TerminalReq) error
ConnectVMTerminal 通过 WebSocket 连接到虚拟机终端
@Summary 连接虚拟机终端
@Description 通过 WebSocket 连接到指定虚拟机的终端,支持双向通信
@Tags 【用户】终端连接管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param id path string true "虚拟机ID"
@Param terminal_id query string false "终端ID"
@Param col query int false "终端列数" default(80)
@Param row query int false "终端行数" default(24)
@Success 101 {string} string "WebSocket 连接成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/vms/{id}/terminals/connect [get]
func (*HostHandler) CreateVM ¶
func (h *HostHandler) CreateVM(c *web.Context, req domain.CreateVMReq) error
CreateVM 创建虚拟机
@Summary 创建虚拟机
@Description 创建虚拟机
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param request body domain.CreateVMReq true "创建虚拟机请求"
@Success 200 {object} web.Resp{data=domain.VirtualMachine} "成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/vms [post]
func (*HostHandler) DeleteHost ¶
DeleteHost 删除宿主机
@Summary 删除宿主机
@Description 删除宿主机
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param id path string true "宿主机ID"
@Success 200 {object} web.Resp "成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/{id} [delete]
func (*HostHandler) DeleteVM ¶
func (h *HostHandler) DeleteVM(c *web.Context, req domain.DeleteVirtualMachineReq) error
DeleteVM 删除虚拟机
@Summary 删除虚拟机
@Description 删除虚拟机
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param host_id path string true "宿主机ID"
@Param id path string true "虚拟机ID"
@Success 200 {object} web.Resp "成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Failure 404 {object} web.Resp "虚拟机不存在"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/{host_id}/vms/{id} [delete]
func (*HostHandler) GetInstallCommand ¶
func (h *HostHandler) GetInstallCommand(c *web.Context) error
GetInstallCommand 获取绑定宿主机命令
@Summary 获取绑定宿主机命令
@Description 获取绑定宿主机命令
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Success 200 {object} web.Resp{data=domain.InstallCommand} "成功"
@Router /api/v1/users/hosts/install-command [get]
func (*HostHandler) HostList ¶
func (h *HostHandler) HostList(c *web.Context) error
HostList 获取主机列表
@Summary 获取主机列表
@Description 获取主机列表
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Success 200 {object} web.Resp{data=domain.HostListResp} "成功"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts [get]
func (*HostHandler) Install ¶
func (h *HostHandler) Install(c *web.Context, req domain.InstallReq) error
func (*HostHandler) JoinTerminal ¶
func (h *HostHandler) JoinTerminal(c *web.Context, req domain.JoinTerminalReq) error
JoinTerminal 通过 WebSocket 加入终端
@Summary 通过 WebSocket 加入终端
@Description 通过 WebSocket 加入终端
@Tags 【用户】终端连接管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param request query domain.JoinTerminalReq true "参数"
@Success 200 {object} web.Resp{data=domain.ShareTerminalResp} "成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Router /api/v1/users/hosts/vms/terminals/join [get]
func (*HostHandler) ListPort ¶
func (h *HostHandler) ListPort(c *web.Context, req domain.ListPortsReq) error
ListPort 列出开发环境的监听端口
@Summary 列出开发环境的监听端口
@Description 列出开发环境的监听端口
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param host_id path string true "宿主机ID"
@Param id path string true "虚拟机ID"
@Param request body domain.ApplyPortReq true "申请端口请求"
@Success 200 {object} web.Resp{data=[]domain.VMPort} "成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/{host_id}/vms/{id}/ports [get]
func (*HostHandler) RecyclePort ¶
func (h *HostHandler) RecyclePort(c *web.Context, req domain.RecyclePortReq) error
RecyclePort 为开发环境回收一个端口
@Summary 回收端口
@Description 为开发环境回收一个端口
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param host_id path string true "宿主机ID"
@Param id path string true "虚拟机ID"
@Param request body domain.RecyclePortReq true "回收端口请求"
@Success 200 {object} web.Resp "成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/{host_id}/vms/{id}/ports/{port} [delete]
func (*HostHandler) ShareTerminal ¶
func (h *HostHandler) ShareTerminal(c *web.Context, req domain.ShareTerminalReq) error
ShareTerminal 分享终端
@Summary 分享终端
@Description 分享终端
@Tags 【用户】终端连接管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param request body domain.ShareTerminalReq true "分享终端请求"
@Success 200 {object} web.Resp{data=domain.ShareTerminalResp} "成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Router /api/v1/users/hosts/vms/{id}/terminals/share [post]
func (*HostHandler) TerminalList ¶
TerminalList 获取虚拟机终端session列表
@Summary 获取虚拟机终端session列表
@Description 获取虚拟机终端session列表
@Tags 【用户】终端连接管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param id path string true "虚拟机ID"
@Success 200 {object} web.Resp{data=[]domain.Terminal} "成功"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/vms/{id}/terminals [get]
func (*HostHandler) UpdateHost ¶
func (h *HostHandler) UpdateHost(c *web.Context, req domain.UpdateHostReq) error
UpdateHost 更新宿主机
@Summary 更新宿主机
@Description 更新宿主机
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param id path string true "宿主机ID"
@Param request body domain.UpdateHostReq true "更新宿主机请求"
@Success 200 {object} web.Resp "成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/{id} [put]
func (*HostHandler) UpdateVM ¶
func (h *HostHandler) UpdateVM(c *web.Context, req domain.UpdateVMReq) error
UpdateVM 修改虚拟机
@Summary 修改虚拟机
@Description 修改虚拟机
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param req body domain.UpdateVMReq true "修改虚拟机请求"
@Success 200 {object} web.Resp{data=domain.VirtualMachine} "成功"
@Failure 400 {object} web.Resp "请求参数错误"
@Failure 401 {object} web.Resp "未授权"
@Failure 404 {object} web.Resp "虚拟机不存在"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/vms [put]
func (*HostHandler) VMInfo ¶
VMInfo 获取虚拟机详情
@Summary 获取虚拟机详情
@Description 获取虚拟机详情
@Tags 【用户】主机管理
@Accept json
@Produce json
@Security MonkeyCodeAIAuth
@Param id path string true "虚拟机ID"
@Success 200 {object} web.Resp{data=domain.VirtualMachine} "成功"
@Failure 401 {object} web.Resp "未授权"
@Failure 500 {object} web.Resp "服务器错误"
@Router /api/v1/users/hosts/vms/{id} [get]
type InternalHostHandler ¶
type InternalHostHandler struct {
// contains filtered or unexported fields
}
InternalHostHandler 处理 taskflow 回调的 host/VM 相关接口
func NewInternalHostHandler ¶
func NewInternalHostHandler(i *do.Injector) (*InternalHostHandler, error)
func (*InternalHostHandler) BatchGetVmIDsByEnvIDs ¶
func (h *InternalHostHandler) BatchGetVmIDsByEnvIDs(c *web.Context, req taskflow.BatchGetVmIDsByEnvIDsReq) error
BatchGetVmIDsByEnvIDs 批量查询 environmentID -> vmID 映射
func (*InternalHostHandler) CheckToken ¶
func (h *InternalHostHandler) CheckToken(c *web.Context, req taskflow.CheckTokenReq) error
CheckToken 认证 token
func (*InternalHostHandler) GetCodingConfig ¶
func (h *InternalHostHandler) GetCodingConfig(c *web.Context, req taskflow.GetCodingConfigReq) error
GetCodingConfig 获取编码配置
func (*InternalHostHandler) GetTaskLogStore ¶
func (h *InternalHostHandler) GetTaskLogStore(c *web.Context, req taskflow.GetTaskLogStoreReq) error
func (*InternalHostHandler) GetTaskStreamIPs ¶
func (h *InternalHostHandler) GetTaskStreamIPs(c *web.Context, req taskflow.GetTaskStreamIPsReq) error
GetTaskStreamIPs 获取任务 WebSocket 连接的客户端 IP
func (*InternalHostHandler) GitCredential ¶
func (h *InternalHostHandler) GitCredential(c *web.Context, req taskflow.GitCredentialRequest) error
GitCredential 获取 git 凭证
func (*InternalHostHandler) ListLLM ¶
func (h *InternalHostHandler) ListLLM(c *web.Context, req taskflow.ListLLMReq) error
ListLLM 列出虚拟机关联的 LLM
func (*InternalHostHandler) ReportHostInfo ¶
ReportHostInfo 上报宿主机信息
func (*InternalHostHandler) ReportVirtualMachine ¶
func (h *InternalHostHandler) ReportVirtualMachine(c *web.Context, vm taskflow.VirtualMachine) error
ReportVirtualMachine 上报虚拟机信息
func (*InternalHostHandler) VMActivity ¶
func (h *InternalHostHandler) VMActivity(c *web.Context, req VMActivityReq) error
func (*InternalHostHandler) VMList ¶
func (h *InternalHostHandler) VMList(c *web.Context) error
VMList 根据 ID 获取虚拟机信息
func (*InternalHostHandler) VmConditions ¶
func (h *InternalHostHandler) VmConditions(c *web.Context, req taskflow.VirtualMachineCondition) error
VmConditions VM 条件更新回调
func (*InternalHostHandler) VmReady ¶
func (h *InternalHostHandler) VmReady(c *web.Context, req taskflow.VirtualMachine) error
VmReady VM 就绪回调