API Reference
Resources
State
- Implements: ISimulatorResource
Key/value in-memory state for the simulator.
Use the preflight method token(key)
to obtain a token that can be used to reference the value
of the state at runtime.
During deployment (i.e. cloud.OnDeploy
or cloud.Service
startup), you must call the inflight
method set(key, value)
to set the runtime value. The value will be available at runtime through
the inflight method get(key)
(or resolved as a token).
See tests for examples.
Initializers
bring sim;
new sim.State();
Name | Type | Description |
---|
Methods
Preflight Methods
Name | Description |
---|---|
token | Returns a token that can be used to retrieve the value of the state after the simulation has run. |
toSimulator | Convert this resource to a resource schema for the simulator. |
Inflight Methods
Name | Description |
---|---|
get | Gets the runtime state of this object. |
set | Sets the state of runtime a runtime object. |
tryGet | Checks if runtime state exists for this object and returns it's value. |
token
token(key: str): str
Returns a token that can be used to retrieve the value of the state after the simulation has run.
key
Required
- Type: str
The object key retrieved through the inflight state.get()
.
toSimulator
toSimulator(): BaseResourceSchema
Convert this resource to a resource schema for the simulator.
get
get(key: str): Json
Gets the runtime state of this object.
Throws if there is no value for the given key.
key
Required
- Type: str
The object's key.
set
set(key: str, value: Json): void
Sets the state of runtime a runtime object.
key
Required
- Type: str
The object's key.
value
Required
- Type: Json
The object's value.
tryGet
tryGet(key: str): Json
Checks if runtime state exists for this object and returns it's value.
If no value exists,
returns nil
.
key
Required
- Type: str
The object's key.
Properties
Name | Type | Description |
---|---|---|
node | constructs.Node | The tree node. |
node
Required
node: Node;
- Type: constructs.Node
The tree node.
Protocols
ISimulatorResource
Extends: IResource
Implemented By: State, ISimulatorResource
Interfaces shared by all polycon implementations (preflight classes) targeting the simulator.
Methods
Name | Description |
---|---|
toSimulator | Convert this resource to a resource schema for the simulator. |
toSimulator
toSimulator(): BaseResourceSchema
Convert this resource to a resource schema for the simulator.
Properties
Name | Type | Description |
---|---|---|
node | constructs.Node | The tree node. |
node
Required
node: Node;
- Type: constructs.Node
The tree node.