service

package
v0.0.0-...-ee63aef Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownImplementation is returned when trying to create a service with an unknown implementation
	ErrUnknownImplementation = errors.New("unknown box service implementation")

	// ErrInvalidConfig is returned when the provided configuration is invalid
	ErrInvalidConfig = errors.New("invalid box service configuration")

	// ErrBoxNotFound is returned when a box with the specified ID does not exist
	ErrBoxNotFound = errors.New("box not found")

	// ErrBoxNotRunning is returned when trying to execute a command in a box that is not running
	ErrBoxNotRunning = errors.New("box is not running")
)

Functions

func Register

func Register(name string, factory Factory)

Register registers a box service implementation

Types

type BoxService

type BoxService interface {
	// Box lifecycle operations
	List(ctx context.Context, params *model.BoxListParams) (*model.BoxListResult, error)
	Get(ctx context.Context, id string) (*model.Box, error)
	CreateLinuxBox(ctx context.Context, params *model.LinuxAndroidBoxCreateParam) (*model.Box, error)
	CreateAndroidBox(ctx context.Context, params *model.AndroidBoxCreateParam) (*model.Box, error)
	Delete(ctx context.Context, id string, params *model.BoxDeleteParams) (*model.BoxDeleteResult, error)
	DeleteAll(ctx context.Context, params *model.BoxesDeleteParams) (*model.BoxesDeleteResult, error)
	Reclaim(ctx context.Context) (*model.BoxReclaimResult, error)

	// Box runtime operations
	Start(ctx context.Context, id string) (*model.BoxStartResult, error)
	Stop(ctx context.Context, id string) (*model.BoxStopResult, error)
	Exec(ctx context.Context, id string, params *model.BoxExecParams) (*model.BoxExecResult, error)
	ExecWS(ctx context.Context, id string, params *model.BoxExecWSParams, wsConn *websocket.Conn) (*model.BoxExecResult, error)
	RunCode(ctx context.Context, id string, params *model.BoxRunCodeParams) (*model.BoxRunCodeResult, error)

	// Box file operations
	GetArchive(ctx context.Context, id string, params *model.BoxArchiveGetParams) (*model.BoxArchiveResult, io.ReadCloser, error)
	HeadArchive(ctx context.Context, id string, params *model.BoxArchiveHeadParams) (*model.BoxArchiveHeadResult, error)
	ExtractArchive(ctx context.Context, id string, params *model.BoxArchiveExtractParams) error

	// Box filesystem operations
	ListFiles(ctx context.Context, id string, params *model.BoxFileListParams) (*model.BoxFileListResult, error)
	ReadFile(ctx context.Context, id string, params *model.BoxFileReadParams) (*model.BoxFileReadResult, error)
	WriteFile(ctx context.Context, id string, params *model.BoxFileWriteParams) (*model.BoxFileWriteResult, error)

	// GetExternalPort retrieves the host port mapping for a specific internal port of a box.
	GetExternalPort(ctx context.Context, id string, internalPort int) (int, error)

	// Box action operations, these are only supported for cloud version
	BoxActionClick(ctx context.Context, id string, params *model.BoxActionClickParams) (*model.BoxActionClickResult, error)
	BoxActionDrag(ctx context.Context, id string, params *model.BoxActionDragParams) (*model.BoxActionDragResult, error)
	BoxActionMove(ctx context.Context, id string, params *model.BoxActionMoveParams) (*model.BoxActionMoveResult, error)
	BoxActionPress(ctx context.Context, id string, params *model.BoxActionPressParams) (*model.BoxActionPressResult, error)
	BoxActionScreenshot(ctx context.Context, id string, params *model.BoxActionScreenshotParams) (*model.BoxActionScreenshotResult, error)
	BoxActionScroll(ctx context.Context, id string, params *model.BoxActionScrollParams) (*model.BoxActionScrollResult, error)
}

BoxService defines the interface for box operations

func New

func New(name string, tracker tracker.AccessTracker) (BoxService, error)

New creates a new box service based on the implementation name, passing the tracker

type Factory

type Factory func(tracker tracker.AccessTracker) (BoxService, error)

Factory creates a new box service instance, accepting an AccessTracker

Directories

Path Synopsis
impl
k8s

Jump to

Keyboard shortcuts

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