Documentation
¶
Index ¶
- type ArtifactHandler
- type AuditHandler
- type DockerHandler
- type FileHandler
- type HealthHandler
- type Hub
- type KeyHandler
- type OrgHandler
- func (oh *OrgHandler) AddMember(c *gin.Context)
- func (oh *OrgHandler) Create(c *gin.Context)
- func (oh *OrgHandler) Delete(c *gin.Context)
- func (oh *OrgHandler) Get(c *gin.Context)
- func (oh *OrgHandler) List(c *gin.Context)
- func (oh *OrgHandler) ListMembers(c *gin.Context)
- func (oh *OrgHandler) ListSessions(c *gin.Context)
- func (oh *OrgHandler) RemoveMember(c *gin.Context)
- type PolicyHandler
- type RunHandler
- type SessionHandler
- type SnapshotHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtifactHandler ¶
type ArtifactHandler struct {
// contains filtered or unexported fields
}
ArtifactHandler serves cross-session shared artifact endpoints.
func NewArtifactHandler ¶
func NewArtifactHandler(h *Hub) *ArtifactHandler
func (*ArtifactHandler) Delete ¶
func (ah *ArtifactHandler) Delete(c *gin.Context)
DELETE /api/v1/artifacts/:id
func (*ArtifactHandler) Download ¶
func (ah *ArtifactHandler) Download(c *gin.Context)
GET /api/v1/artifacts/:id/download Streams the artifact file. Non-master callers may only download artifacts they created.
func (*ArtifactHandler) List ¶
func (ah *ArtifactHandler) List(c *gin.Context)
GET /api/v1/artifacts Lists shared artifacts. Non-master callers see only their own artifacts.
func (*ArtifactHandler) Promote ¶
func (ah *ArtifactHandler) Promote(c *gin.Context)
POST /api/v1/sessions/:id/artifacts Promotes a file from the session workspace to the shared artifact registry. Body: {"path":"/workspace/output.csv","name":"output.csv"} (name is optional)
type AuditHandler ¶
type AuditHandler struct {
// contains filtered or unexported fields
}
func NewAuditHandler ¶
func NewAuditHandler(h *Hub) *AuditHandler
type DockerHandler ¶
type DockerHandler struct {
// contains filtered or unexported fields
}
DockerHandler serves Docker image and container-management endpoints. All routes are restricted to the master API key except the per-session stats/logs endpoints which use the standard session-access check.
func NewDockerHandler ¶
func NewDockerHandler(h *Hub) *DockerHandler
func (*DockerHandler) ListImages ¶
func (dh *DockerHandler) ListImages(c *gin.Context)
GET /api/v1/docker/images Returns the list of Docker images locally available on the host.
func (*DockerHandler) PullImage ¶
func (dh *DockerHandler) PullImage(c *gin.Context)
POST /api/v1/docker/images/pull Body: {"image":"python:3.12-slim"} Pulls a Docker image from the registry and blocks until complete.
func (*DockerHandler) SessionLogs ¶
func (dh *DockerHandler) SessionLogs(c *gin.Context)
GET /api/v1/sessions/:id/logs?tail=100 Streams the last N lines of stdout+stderr from the session's container.
func (*DockerHandler) SessionStats ¶
func (dh *DockerHandler) SessionStats(c *gin.Context)
GET /api/v1/sessions/:id/stats Returns a one-shot CPU/memory/network snapshot for the session's container.
type FileHandler ¶
type FileHandler struct {
// contains filtered or unexported fields
}
func NewFileHandler ¶
func NewFileHandler(h *Hub) *FileHandler
func (*FileHandler) Delete ¶
func (fh *FileHandler) Delete(c *gin.Context)
DELETE /api/v1/sessions/:id/files/*path
func (*FileHandler) Download ¶
func (fh *FileHandler) Download(c *gin.Context)
GET /api/v1/sessions/:id/files/*path
func (*FileHandler) List ¶
func (fh *FileHandler) List(c *gin.Context)
GET /api/v1/sessions/:id/files
func (*FileHandler) Upload ¶
func (fh *FileHandler) Upload(c *gin.Context)
POST /api/v1/sessions/:id/files
func (*FileHandler) WorkspaceZip ¶
func (fh *FileHandler) WorkspaceZip(c *gin.Context)
GET /api/v1/sessions/:id/workspace.zip Streams the entire workspace as a ZIP archive. Symlink escape protection is applied: symlinks whose real target lies outside the workspace are skipped.
type HealthHandler ¶
type HealthHandler struct {
// contains filtered or unexported fields
}
func NewHealthHandler ¶
func NewHealthHandler(h *Hub) *HealthHandler
func (*HealthHandler) Health ¶
func (hh *HealthHandler) Health(c *gin.Context)
GET /health Returns a structured health object covering each major dependency. Responds 200 when all required checks pass, 503 when the DB is unreachable. Docker failures are reported but do not change the status code (the API can still serve non-run requests without a live Docker daemon).
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub holds shared dependencies that all handlers need.
func (*Hub) PolicyFile ¶
PolicyFile returns the configured OPA policy file path (empty = AllowAll).
type KeyHandler ¶
type KeyHandler struct {
// contains filtered or unexported fields
}
func NewKeyHandler ¶
func NewKeyHandler(h *Hub) *KeyHandler
type OrgHandler ¶
type OrgHandler struct {
// contains filtered or unexported fields
}
OrgHandler serves /api/v1/orgs and /api/v1/orgs/:id/members.
func NewOrgHandler ¶
func NewOrgHandler(h *Hub) *OrgHandler
func (*OrgHandler) AddMember ¶
func (oh *OrgHandler) AddMember(c *gin.Context)
POST /api/v1/orgs/:id/members (master key or org admin)
func (*OrgHandler) Create ¶
func (oh *OrgHandler) Create(c *gin.Context)
POST /api/v1/orgs (master key only)
func (*OrgHandler) Delete ¶
func (oh *OrgHandler) Delete(c *gin.Context)
DELETE /api/v1/orgs/:id (master key only)
func (*OrgHandler) Get ¶
func (oh *OrgHandler) Get(c *gin.Context)
GET /api/v1/orgs/:id (master key or any org member)
func (*OrgHandler) List ¶
func (oh *OrgHandler) List(c *gin.Context)
GET /api/v1/orgs (master key only)
func (*OrgHandler) ListMembers ¶
func (oh *OrgHandler) ListMembers(c *gin.Context)
GET /api/v1/orgs/:id/members (master key or any org member)
func (*OrgHandler) ListSessions ¶
func (oh *OrgHandler) ListSessions(c *gin.Context)
GET /api/v1/orgs/:id/sessions (org member — respects role visibility)
func (*OrgHandler) RemoveMember ¶
func (oh *OrgHandler) RemoveMember(c *gin.Context)
DELETE /api/v1/orgs/:id/members/:principal (master key or org admin)
type PolicyHandler ¶
type PolicyHandler struct {
// contains filtered or unexported fields
}
func NewPolicyHandler ¶
func NewPolicyHandler(h *Hub) *PolicyHandler
func (*PolicyHandler) Eval ¶
func (ph *PolicyHandler) Eval(c *gin.Context)
POST /api/v1/policy/eval — dry-run: evaluate a command or file access against the currently loaded policy without actually executing anything.
type RunHandler ¶
type RunHandler struct {
// contains filtered or unexported fields
}
func NewRunHandler ¶
func NewRunHandler(h *Hub) *RunHandler
func (*RunHandler) Async ¶
func (rh *RunHandler) Async(c *gin.Context)
POST /api/v1/sessions/:id/run/async Non-blocking variant: creates the run record immediately (status=pending), returns 202 with the run_id, and executes the command in a background worker. Optional "callback_url" field in the request body receives an HTTP POST with the completed Run when finished.
func (*RunHandler) Execute ¶
func (rh *RunHandler) Execute(c *gin.Context)
POST /api/v1/sessions/:id/run
func (*RunHandler) ListBySession ¶
func (rh *RunHandler) ListBySession(c *gin.Context)
GET /api/v1/sessions/:id/runs
func (*RunHandler) Stream ¶
func (rh *RunHandler) Stream(c *gin.Context)
POST /api/v1/sessions/:id/run/stream Same request body as Execute, but responds with text/event-stream (SSE). Events:
data: {"type":"stdout","data":"..."}\n\n
data: {"type":"stderr","data":"..."}\n\n
data: {"type":"done","run_id":"...","exit_code":0,"status":"completed","duration_ms":123}\n\n
type SessionHandler ¶
type SessionHandler struct {
// contains filtered or unexported fields
}
func NewSessionHandler ¶
func NewSessionHandler(h *Hub) *SessionHandler
func (*SessionHandler) Create ¶
func (sh *SessionHandler) Create(c *gin.Context)
POST /api/v1/sessions
func (*SessionHandler) Delete ¶
func (sh *SessionHandler) Delete(c *gin.Context)
DELETE /api/v1/sessions/:id
func (*SessionHandler) List ¶
func (sh *SessionHandler) List(c *gin.Context)
GET /api/v1/sessions Returns the caller's own sessions plus sessions in any org they belong to. Master key sees all sessions. Supports optional ?label=key:value filter.
func (*SessionHandler) UpdateLabels ¶
func (sh *SessionHandler) UpdateLabels(c *gin.Context)
PATCH /api/v1/sessions/:id/labels Replaces the session's entire label set. Pass {} to clear all labels.
type SnapshotHandler ¶
type SnapshotHandler struct {
// contains filtered or unexported fields
}
SnapshotHandler serves snapshot endpoints under /sessions/:id/snapshots and the /snapshots/:id singleton routes.
func NewSnapshotHandler ¶
func NewSnapshotHandler(h *Hub) *SnapshotHandler
func (*SnapshotHandler) Create ¶
func (sh *SnapshotHandler) Create(c *gin.Context)
POST /api/v1/sessions/:id/snapshots Body: {"name":"my-snapshot"} Creates a gzip-compressed tar archive of the session workspace and records it in the database. The archive path is never exposed to callers.
func (*SnapshotHandler) Delete ¶
func (sh *SnapshotHandler) Delete(c *gin.Context)
DELETE /api/v1/snapshots/:id
func (*SnapshotHandler) Download ¶
func (sh *SnapshotHandler) Download(c *gin.Context)
GET /api/v1/snapshots/:id/download Streams the snapshot archive as application/gzip.
func (*SnapshotHandler) List ¶
func (sh *SnapshotHandler) List(c *gin.Context)
GET /api/v1/sessions/:id/snapshots