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
Returns
Box
Overrides
Properties
Methods
delete()
delete(options?): Promise<void>;Deletes the Box and waits until its Node removed it. Same as Boxes.delete.
Parameters
| Parameter | Type |
|---|---|
options? | LifecycleOptions |
Returns
Promise<void>
Inherited from
exec()
exec(argv, options?): Promise<ExecResult>;Runs a command and waits for its result. Same as Boxes.exec.
Parameters
| Parameter | Type |
|---|---|
argv | string[] |
options? | ExecOptions |
Returns
Promise<ExecResult>
Inherited from
hibernate()
hibernate(options?): Promise<BoxInfo>;Hibernates the Box and waits until it is hibernated. Same as Boxes.hibernate.
Parameters
| Parameter | Type |
|---|---|
options? | LifecycleOptions |
Returns
Promise<BoxInfo>
Inherited from
info()
info(options?): Promise<BoxInfo>;The Box's current record. Same as Boxes.get.
Parameters
| Parameter | Type |
|---|---|
options? | SignalOptions |
Returns
Promise<BoxInfo>
Inherited from
listOperations()
listOperations(options?): Promise<Operation[]>;The Box's 50 most recent operations. Same as Boxes.listOperations.
Parameters
| Parameter | Type |
|---|---|
options? | SignalOptions |
Returns
Promise<Operation[]>
Inherited from
listSnapshots()
listSnapshots(options?): Promise<Snapshot[]>;The Box's snapshots, newest first. Same as Boxes.listSnapshots.
Parameters
| Parameter | Type |
|---|---|
options? | SignalOptions |
Returns
Promise<Snapshot[]>
Inherited from
restore()
restore(snapshotId, options?): Promise<Operation>;Restores the stopped Box's disk from a snapshot. Same as Boxes.restore.
Parameters
| Parameter | Type |
|---|---|
snapshotId | string |
options? | OperationOptions |
Returns
Promise<Operation>
Inherited from
snapshot()
snapshot(name, options?): Promise<Snapshot>;Snapshots the stopped Box's disk. Same as Boxes.snapshot.
Parameters
| Parameter | Type |
|---|---|
name | string |
options? | OperationOptions |
Returns
Promise<Snapshot>
Inherited from
start()
start(options?): Promise<BoxInfo>;Starts or resumes the Box and waits until it is ready. Same as Boxes.start.
Parameters
| Parameter | Type |
|---|---|
options? | LifecycleOptions |
Returns
Promise<BoxInfo>
Inherited from
stop()
stop(options?): Promise<BoxInfo>;Stops the Box and waits until it is stopped. Same as Boxes.stop.
Parameters
| Parameter | Type |
|---|---|
options? | LifecycleOptions |
Returns
Promise<BoxInfo>
Inherited from
waitUntil()
waitUntil(target, options?): Promise<BoxInfo>;Polls until the Box is ready, stopped or hibernated. Same as Boxes.waitUntil.
Parameters
| Parameter | Type |
|---|---|
target | WaitTarget |
options? | WaitOptions |
Returns
Promise<BoxInfo>
Inherited from
waitUntilReady()
waitUntilReady(options?): Promise<BoxInfo>;Polls until exec and SSH can be used. Same as Boxes.waitUntilReady.
Parameters
| Parameter | Type |
|---|---|
options? | WaitOptions |
Returns
Promise<BoxInfo>

