Cubicle

BoxRef

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

A Box addressed by reference. Creating one makes no request, so it may name a Box that does not exist; the first call reports that.

Get one from cubicle.boxes.ref("acme/job-1"). Its methods are those of Boxes, bound to this Box. It holds no copy of the Box's record: call info() for current values.

Extended by

Constructors

Constructor

new BoxRef(ref, boxes): BoxRef;

Internal

Parameters

ParameterType
refstring
boxesBoxes

Returns

BoxRef

Properties

PropertyModifierTypeDescription
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>


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>


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>


info()

info(options?): Promise<BoxInfo>;

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

Parameters

ParameterType
options?SignalOptions

Returns

Promise<BoxInfo>


listOperations()

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

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

Parameters

ParameterType
options?SignalOptions

Returns

Promise<Operation[]>


listSnapshots()

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

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

Parameters

ParameterType
options?SignalOptions

Returns

Promise<Snapshot[]>


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>


snapshot()

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

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

Parameters

ParameterType
namestring
options?OperationOptions

Returns

Promise<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>


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>


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>


waitUntilReady()

waitUntilReady(options?): Promise<BoxInfo>;

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

Parameters

ParameterType
options?WaitOptions

Returns

Promise<BoxInfo>

On this page