hanzo_client/models/fleet_unit.rs
1/*
2 * Hanzo Cloud API
3 *
4 * The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
5 *
6 * The version of the OpenAPI document: v1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct FleetUnit {
16 /// Host is the unit's hostname. Empty for a unit that is not one host: a cluster row has no hostname to report.
17 #[serde(rename = "host", skip_serializing_if = "Option::is_none")]
18 pub host: Option<String>,
19 /// Kind is what the unit IS: laptop, cloud, gpu, cluster, machine or worker.
20 #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
21 pub kind: Option<String>,
22 /// Label is the name to show a human — a target's label, a worker's hostname, a machine's display name. Empty when the source has none to give.
23 #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
24 pub label: Option<String>,
25 /// Metrics is the unit's latest utilization: its own live snapshot when it keeps one (a run-target's heartbeat wins), else the newest sample from the series for the SAME source. Absent means nothing is known about this unit's load — which is deliberately not the same as a reading of zero.
26 #[serde(rename = "metrics", skip_serializing_if = "Option::is_none")]
27 pub metrics: Option<Box<models::FleetMetrics>>,
28 /// Queued is how many renders are waiting on THIS GPU's own lane in the org's gpu-jobs queue. BYO units only — an agent run-target dispatches, it does not queue — and omitted when nothing is waiting.
29 #[serde(rename = "queued", skip_serializing_if = "Option::is_none")]
30 pub queued: Option<i32>,
31 /// Running is what the unit is executing right now: agent sessions in flight for a run-target, claimed renders for a BYO GPU.
32 #[serde(rename = "running", skip_serializing_if = "Option::is_none")]
33 pub running: Option<i32>,
34 /// Sessions is how many agent sessions are open on this unit. Always present, and 0 for a source that cannot host agent sessions at all — a fact about that plane, not a gap in the reading.
35 #[serde(rename = "sessions", skip_serializing_if = "Option::is_none")]
36 pub sessions: Option<i32>,
37 /// Source is the plane this row came from: \"agent\" (a linked run-target), \"byo\" (a worker or cluster the org dialed in) or \"visor\" (a machine Hanzo provisioned). It is half the row's identity, and it says which face owns the unit — /v1/agents/targets, /v1/visor/fleet/workers, /v1/visor/machines.
38 #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
39 pub source: Option<String>,
40 /// Spec is the unit's static capability. Absent when the source reported none — unknown capability, never a zeroed one.
41 #[serde(rename = "spec", skip_serializing_if = "Option::is_none")]
42 pub spec: Option<Box<models::FleetSpec>>,
43 /// Status is liveness in the SOURCE's own vocabulary, because each plane decides it differently: a run-target's is derived from its heartbeat, a BYO worker's is online/offline on the 90s window, a BYO cluster's is \"attached\", and a Visor machine's is the provider's word for its lifecycle state.
44 #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
45 pub status: Option<String>,
46 /// Unit is the SOURCE's own id for this unit — a run-target id, a BYO worker id, a Visor machine name — so a row links straight back to the face that owns it. It is unique within a source, not across them: two planes may mint the same id, which is why (source, unit) together is the identity.
47 #[serde(rename = "unit", skip_serializing_if = "Option::is_none")]
48 pub unit: Option<String>,
49}
50
51impl FleetUnit {
52 pub fn new() -> FleetUnit {
53 FleetUnit {
54 host: None,
55 kind: None,
56 label: None,
57 metrics: None,
58 queued: None,
59 running: None,
60 sessions: None,
61 source: None,
62 spec: None,
63 status: None,
64 unit: None,
65 }
66 }
67}
68