Cubicle

Box

The Box class of @cubicle/sdk: its constructor, properties and methods.

A Box whose identity is known, as returned by create or ref(info). It addresses the Box by ID, so it keeps reaching the same Box even if its name is reused later.

Example

import { Cubicle } from "@cubicle/sdk"

const cubicle = new Cubicle()
const box = await cubicle.boxes.create({ name: "job-1" })
await box.exec(["uname", "-a"])
await box.stop()
await box.delete()

Extends

Constructors

Constructor

new Box(info, boxes): Box;

Internal

Parameters

ParameterType
infoBoxInfo
boxesBoxes

Returns

Box

Overrides

BoxRef.constructor

Properties

PropertyModifierTypeDescription
idreadonlystringThe Box's ID, a UUID.
namereadonlystringThe Box's name, unique in its organization.
orgreadonlyobjectThe organization that owns the Box.
org.idpublicstring-
org.namepublicstring-
refreadonlystringThe ID, ORG/NAME or bare NAME used in requests.

Methods

delete()

delete(options?): Promise<void>;

Deletes the Box and waits until its Node removed it. Same as Boxes.delete.

Parameters

ParameterType
options?LifecycleOptions

Returns

Promise<void>

Inherited from

BoxRef.delete


exec()

exec(argv, options?): Promise<ExecResult>;

Runs a command and waits for its result. Same as Boxes.exec.

Parameters

ParameterType
argvstring[]
options?ExecOptions

Returns

Promise<ExecResult>

Inherited from

BoxRef.exec


hibernate()

hibernate(options?): Promise<BoxInfo>;

Hibernates the Box and waits until it is hibernated. Same as Boxes.hibernate.

Parameters

ParameterType
options?LifecycleOptions

Returns

Promise<BoxInfo>

Inherited from

BoxRef.hibernate


info()

info(options?): Promise<BoxInfo>;

The Box's current record. Same as Boxes.get.

Parameters

ParameterType
options?SignalOptions

Returns

Promise<BoxInfo>

Inherited from

BoxRef.info


listOperations()

listOperations(options?): Promise<Operation[]>;

The Box's 50 most recent operations. Same as Boxes.listOperations.

Parameters

ParameterType
options?SignalOptions

Returns

Promise<Operation[]>

Inherited from

BoxRef.listOperations


listSnapshots()

listSnapshots(options?): Promise<Snapshot[]>;

The Box's snapshots, newest first. Same as Boxes.listSnapshots.

Parameters

ParameterType
options?SignalOptions

Returns

Promise<Snapshot[]>

Inherited from

BoxRef.listSnapshots


restore()

restore(snapshotId, options?): Promise<Operation>;

Restores the stopped Box's disk from a snapshot. Same as Boxes.restore.

Parameters

ParameterType
snapshotIdstring
options?OperationOptions

Returns

Promise<Operation>

Inherited from

BoxRef.restore


snapshot()

snapshot(name, options?): Promise<Snapshot>;

Snapshots the stopped Box's disk. Same as Boxes.snapshot.

Parameters

ParameterType
namestring
options?OperationOptions

Returns

Promise<Snapshot>

Inherited from

BoxRef.snapshot


start()

start(options?): Promise<BoxInfo>;

Starts or resumes the Box and waits until it is ready. Same as Boxes.start.

Parameters

ParameterType
options?LifecycleOptions

Returns

Promise<BoxInfo>

Inherited from

BoxRef.start


stop()

stop(options?): Promise<BoxInfo>;

Stops the Box and waits until it is stopped. Same as Boxes.stop.

Parameters

ParameterType
options?LifecycleOptions

Returns

Promise<BoxInfo>

Inherited from

BoxRef.stop


waitUntil()

waitUntil(target, options?): Promise<BoxInfo>;

Polls until the Box is ready, stopped or hibernated. Same as Boxes.waitUntil.

Parameters

ParameterType
targetWaitTarget
options?WaitOptions

Returns

Promise<BoxInfo>

Inherited from

BoxRef.waitUntil


waitUntilReady()

waitUntilReady(options?): Promise<BoxInfo>;

Polls until exec and SSH can be used. Same as Boxes.waitUntilReady.

Parameters

ParameterType
options?WaitOptions

Returns

Promise<BoxInfo>

Inherited from

BoxRef.waitUntilReady

On this page