cube

package
v0.0.0-...-0bfe986 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0, BSD-2-Clause Imports: 39 Imported by: 0

Documentation

Overview

Package cube provides the interface for cube master

Index

Constants

View Source
const (
	SandboxAction                          = "/sandbox"
	SandboxPreviewAction                   = "/sandbox/preview"
	ImageAction                            = "/image"
	SandboxListAction                      = "/sandbox/list"
	SandboxInfoAction                      = "/sandbox/info"
	SandboxExecAction                      = "/sandbox/exec"
	SandboxUpdateAction                    = "/sandbox/update"
	SandboxTimeoutAction                   = "/sandbox/timeout"
	SandboxRefreshAction                   = "/sandbox/refresh"
	SandboxCommitAction                    = "/sandbox/commit"
	SandboxRollbackAction                  = "/sandbox/rollback"
	SnapshotAction                         = "/snapshot"
	SnapshotStorageAction                  = "/snapshot/storage"
	SnapshotCompatibleNodesByFactorsAction = "/snapshot/compatible-nodes-by-factors"
	OperationAction                        = "/operation"
	TemplateAction                         = "/template"
	TemplateCompatAction                   = "/template/compat"
	TemplateRedoAction                     = "/template/redo"
	TemplateBuildStatusAction              = "/template/build"
	TemplateFromImageAction                = "/template/from-image"
	TemplateArtifactDownloadAction         = "/template/artifact/download"
	RootfsArtifactAction                   = "/rootfs-artifact"
	CADownloadActionPrefix                 = "/ca/"
	ListInventoryAction                    = "/listinventory"
	SandboxLogsAction                      = "/sandbox/logs"
	VolumeAction                           = "/volume"
)

Variables

This section is empty.

Functions

func CubeURI

func CubeURI() string

func RegisterCubeRoutes

func RegisterCubeRoutes(g *gin.RouterGroup)

RegisterCubeRoutes registers all /cube routes onto the given gin.RouterGroup. The method/path registrations preserve parity with the previous observable behavior of the gorilla/mux wiring in server.go. One intentional delta from a literal mux mirror:

  • GET /cube/snapshot/storage is registered as an explicit static route (ahead of /cube/snapshot/:snapshot_id), so the storage listing is never shadowed by the param + method switch — safer than the mux approach of parsing the path inside a single handler.

(mux's POST /internal/fake_create is registered in the inner router, not here — see the inner package.)

Types

type CreateVolumeReq

type CreateVolumeReq struct {
	// Name is the human-readable label for the new volume. Required.
	Name string `json:"name"`
	// Driver is the plugin name to use (e.g. "cos"). Optional;
	// defaults to the first registered plugin when empty.
	Driver string `json:"driver,omitempty"`
}

CreateVolumeReq is the JSON body expected by POST /cube/volume.

type SandboxLogEntry

type SandboxLogEntry struct {
	Timestamp string `json:"timestamp"`
	Message   string `json:"message"`
	Level     string `json:"level"`
}

SandboxLogEntry is one log entry in the response.

type SandboxLogsReq

type SandboxLogsReq struct {
	types.Request
	SandboxID    string `json:"sandboxID"`
	InstanceType string `json:"instanceType,omitempty"`
	// Cursor is a Unix millisecond timestamp; only return entries after this time.
	Cursor int64 `json:"cursor,omitempty"`
	// Limit is the maximum number of entries to return (default 200, max 2000).
	Limit int `json:"limit,omitempty"`
}

SandboxLogsReq is the request body for POST /cube/sandbox/logs.

type SandboxLogsRes

type SandboxLogsRes struct {
	*types.Res
	Logs       []SandboxLogEntry `json:"logs"`
	NextCursor int64             `json:"nextCursor,omitempty"`
	HasMore    bool              `json:"hasMore"`
}

SandboxLogsRes is the response for POST /cube/sandbox/logs.

type ShimLogLine

type ShimLogLine struct {
	Module       string `json:"Module"`
	InstanceID   string `json:"InstanceId"`
	ContainerID  string `json:"ContainerId"`
	Timestamp    string `json:"Timestamp"`
	LogContent   string `json:"LogContent"`
	FunctionType string `json:"FunctionType"`
}

ShimLogLine is one parsed line from cube-shim-req.log.

type VolumeItem

type VolumeItem struct {
	VolumeID  string `json:"volumeID"`
	Name      string `json:"name"`
	Driver    string `json:"driver"`
	Token     string `json:"token,omitempty"`
	RefCount  int64  `json:"refCount"`
	CreatedAt int64  `json:"createdAt"`
}

VolumeItem is the serialised form of a volume returned to the caller.

Jump to

Keyboard shortcuts

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