HubApiClient class
A thin REST client for the Hub HTTP API, used by the CLI's operational commands — and by the web dashboard — so both exercise exactly the same public API surface as any other client.
Constructors
- HubApiClient(Uri baseUrl, {String? token, String? principal, ApiTransport? transport})
-
Creates a client for
baseUrl.
Properties
- baseUrl → Uri
-
The API base URL (e.g.
https://hub.example.com:8443).final - hashCode → int
-
The hash code for this object.
no setterinherited
- principal → String?
-
Optional principal the token was granted to.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- token → String?
-
Optional bearer token.
final
Methods
-
alerts(
) → Future< List< Alert> > - What is wrong right now.
-
applyPreset(
String nodeId, {String? presetId, Preset? preset}) → Future< PresetApplyResult> - Applies a preset to a node and waits.
-
applyPresetAsync(
String nodeId, {String? presetId, Preset? preset}) → Future< Operation> - Dispatches the same work, returning a handle instead of an answer.
-
assignBlueprint(
String id, String blueprint) → Future< void> -
Says
idshould beblueprint. Runs nothing. -
audit(
) → Future< List< AuditEntry> > - The audit trail — who did what, as the Hub verified it.
-
blueprint(
String id) → Future< Blueprint> - One blueprint, as it was authored.
-
blueprints(
) → Future< List< Blueprint> > - Every blueprint saved on the Hub.
-
capabilities(
String id) → Future< NodeCapabilities> - What a node advertises it can do.
-
close(
) → void - Releases the underlying transport.
-
declarePreset(
String id, Preset preset) → Future< void> -
Says
idshould bepreset. Runs nothing. -
declareSteps(
String id, List< PresetStep> steps) → Future<void> -
Says
idshould be these steps. Runs nothing. -
delete(
String path) → Future -
DELETE
/api/v1[path]. -
deleteBlueprint(
String id) → Future< void> - Deletes a saved blueprint.
-
deletePreset(
String id) → Future< void> - Deletes a saved preset.
-
desiredState(
String id) → Future< DesiredState?> -
What
idis declared to be, ornullif nothing was ever declared. -
drift(
String id) → Future< Drift?> -
How far
idhas drifted, ornullif nothing was declared for it. -
events(
) → Future< List< OmnyEvent> > - Recent Hub events, newest first.
-
formulas(
) → Future< List< FormulaSpec> > - The formulas a node can be asked to run, and the actions each implements.
-
formulaStatus(
String id, {List< String> only = const []}) → Future<List< FormulaStatusReport> > - What state each of a node's formulas is in, asked of the node.
-
get(
String path) → Future -
GET
/api/v1[path], decoding the JSON body. -
getText(
String absolutePath) → Future< String> -
GET a raw text endpoint (e.g.
/metrics) outside the versioned API. -
grants(
) → Future< List< Grant> > - Every credential the Hub has issued. Hashes, never tokens.
-
healthz(
) → Future< bool> - Whether the Hub is up. Unauthenticated, and outside the versioned API.
-
issueGrant(
{required String principal, required Set< String> roles, String note = ''}) → Future<IssuedGrant> - Issues a credential. The token comes back once and cannot be read again — the Hub keeps only a hash of it.
-
logs(
String id, {int tail = 200}) → Future< List< LogLine> > - The tail of what a node has reported.
-
metrics(
String id, {String since = '1h', int limit = 200}) → Future< List< MetricPoint> > - A node's resource history, newest first.
-
node(
String id) → Future< NodeDescriptor> - One node's descriptor.
-
nodes(
{List< String> labels = const [], bool? online}) → Future<List< NodeDescriptor> > - Every registered node, optionally narrowed.
-
nodeStatus(
String id) → Future< NodeStatus?> -
A node's live status, or
nullif it has not reported one yet. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
operation(
String id) → Future< Operation> - One dispatched operation.
-
operations(
{String? nodeId, bool running = false}) → Future< List< Operation> > -
Work dispatched with
async: what is running, and how the last few went. -
post(
String path, [Object? body]) → Future -
POST
/api/v1[path]with an optional JSONbody. -
preset(
String id) → Future< Preset> - One saved preset.
-
presets(
) → Future< List< Preset> > - Every preset saved on the Hub.
-
put(
String path, [Object? body]) → Future -
PUT
/api/v1[path]with an optional JSONbody. -
reconcile(
String id, {bool dryRun = false, bool purgeAdopted = false}) → Future< ConvergeResult> -
Makes
idwhat it was declared to be, and waits. -
reconcileAsync(
String id, {bool dryRun = false, bool purgeAdopted = false}) → Future< Operation> - Dispatches the same work, returning a handle instead of an answer.
-
resolvedBlueprint(
String id) → Future< ResolvedBlueprint> - A blueprint flattened: includes expanded, variables substituted, resources in the order they would be settled, and a hash over all of it.
-
restartAgent(
String id) → Future< void> - Restarts the node agent — not the machine.
-
revokeGrant(
String id) → Future< void> - Revokes a credential.
-
runFormula(
String id, {required String formula, required FormulaAction action, String? version}) → Future< FormulaRunResult> - Runs a formula action and waits for the answer.
-
runFormulaAsync(
String id, {required String formula, required FormulaAction action, String? version}) → Future< Operation> - Dispatches a formula action, returning a handle instead of an answer.
-
saveBlueprint(
Blueprint blueprint) → Future< void> - Saves a blueprint on the Hub.
-
savePreset(
Preset preset) → Future< void> - Saves a preset on the Hub, so every operator applies the same one.
-
stopAgent(
String id) → Future< void> - Stops the node agent — not the machine.
-
toString(
) → String -
A string representation of this object.
inherited
-
unassign(
String id, {bool purgeAdopted = false}) → Future< BlueprintApplyResult> -
Takes the blueprint back off
id, removing what it put there. -
undeclare(
String id) → Future< void> -
Stops expecting anything of
id, and leaves the machine as it is. -
update(
String id, {String target = 'agent'}) → Future< void> - Updates the node: its OS packages, one named package, or the agent itself.
-
whoami(
) → Future< Identity> - Who the Hub resolves these credentials to.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited