api

package
v0.0.0-...-89c7248 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWebSocketHandler

func NewWebSocketHandler(
	group *gin.RouterGroup,
	projectService *services.ProjectService,
	containerService *services.ContainerService,
	systemService *services.SystemService,
	authMiddleware *middleware.AuthMiddleware,
	cfg *config.Config,
)

Types

type GPUStats

type GPUStats struct {
	Name        string  `json:"name"`
	Index       int     `json:"index"`
	MemoryUsed  float64 `json:"memoryUsed"`
	MemoryTotal float64 `json:"memoryTotal"`
}

GPUStats represents statistics for a single GPU

type ROCmGPUInfo

type ROCmGPUInfo struct {
	VRAMUsed  string `json:"VRAM Total Used Memory (B)"`
	VRAMTotal string `json:"VRAM Total Memory (B)"`
}

ROCmGPUInfo represents GPU info from rocm-smi

type ROCmSMIOutput

type ROCmSMIOutput map[string]ROCmGPUInfo

ROCmSMIOutput represents the JSON structure from rocm-smi

type SystemStats

type SystemStats struct {
	CPUUsage     float64    `json:"cpuUsage"`
	MemoryUsage  uint64     `json:"memoryUsage"`
	MemoryTotal  uint64     `json:"memoryTotal"`
	DiskUsage    uint64     `json:"diskUsage,omitempty"`
	DiskTotal    uint64     `json:"diskTotal,omitempty"`
	CPUCount     int        `json:"cpuCount"`
	Architecture string     `json:"architecture"`
	Platform     string     `json:"platform"`
	Hostname     string     `json:"hostname,omitempty"`
	GPUCount     int        `json:"gpuCount"`
	GPUs         []GPUStats `json:"gpus,omitempty"`
}

SystemStats represents system resource statistics for WebSocket streaming.

type WebSocketHandler

type WebSocketHandler struct {
	// contains filtered or unexported fields
}

WebSocketHandler consolidates all WebSocket and streaming endpoints. REST endpoints are handled by Huma handlers.

func (*WebSocketHandler) ContainerExec

func (h *WebSocketHandler) ContainerExec(c *gin.Context)

ContainerExec provides interactive terminal access to a container.

@Summary		Execute command in container via WebSocket
@Description	Interactive terminal access to a container over WebSocket
@Tags			WebSocket
@Param			id			path	string	true	"Environment ID"
@Param			containerId	path	string	true	"Container ID"
@Param			shell		query	string	false	"Shell to execute"	default(/bin/sh)
@Router			/api/environments/{id}/ws/containers/{containerId}/terminal [get]

func (*WebSocketHandler) ContainerLogs

func (h *WebSocketHandler) ContainerLogs(c *gin.Context)

ContainerLogs streams container logs over WebSocket.

@Summary		Get container logs via WebSocket
@Description	Stream container logs over WebSocket connection
@Tags			WebSocket
@Param			id			path	string	true	"Environment ID"
@Param			containerId	path	string	true	"Container ID"
@Param			follow		query	bool	false	"Follow log output"						default(true)
@Param			tail		query	string	false	"Number of lines to show from the end"	default(100)
@Param			since		query	string	false	"Show logs since timestamp"
@Param			timestamps	query	bool	false	"Show timestamps"				default(false)
@Param			format		query	string	false	"Output format (text or json)"	default(text)
@Param			batched		query	bool	false	"Batch log messages"			default(false)
@Router			/api/environments/{id}/ws/containers/{containerId}/logs [get]

func (*WebSocketHandler) ContainerStats

func (h *WebSocketHandler) ContainerStats(c *gin.Context)

ContainerStats streams container stats over WebSocket.

@Summary		Get container stats via WebSocket
@Description	Stream container resource statistics over WebSocket connection
@Tags			WebSocket
@Param			id			path	string	true	"Environment ID"
@Param			containerId	path	string	true	"Container ID"
@Router			/api/environments/{id}/ws/containers/{containerId}/stats [get]

func (*WebSocketHandler) ProjectLogs

func (h *WebSocketHandler) ProjectLogs(c *gin.Context)

ProjectLogs streams project logs over WebSocket.

@Summary		Get project logs via WebSocket
@Description	Stream project logs over WebSocket connection
@Tags			WebSocket
@Param			id			path	string	true	"Environment ID"
@Param			projectId	path	string	true	"Project ID"
@Param			follow		query	bool	false	"Follow log output"						default(true)
@Param			tail		query	string	false	"Number of lines to show from the end"	default(100)
@Param			since		query	string	false	"Show logs since timestamp"
@Param			timestamps	query	bool	false	"Show timestamps"				default(false)
@Param			format		query	string	false	"Output format (text or json)"	default(text)
@Param			batched		query	bool	false	"Batch log messages"			default(false)
@Router			/api/environments/{id}/ws/projects/{projectId}/logs [get]

func (*WebSocketHandler) SystemStats

func (h *WebSocketHandler) SystemStats(c *gin.Context)

SystemStats streams system stats over WebSocket.

@Summary		Get system stats via WebSocket
@Description	Stream system resource statistics over WebSocket connection
@Tags			WebSocket
@Param			id	path	string	true	"Environment ID"
@Router			/api/environments/{id}/ws/system/stats [get]

Jump to

Keyboard shortcuts

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