hanzo_client/models/target_view.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 TargetView {
16 /// Capacity is a human summary of what the machine has (\"8 vCPU / 32G\", \"1× GB10\"), up to 256 characters. Prose for a card — Spec is the same thing in a form a scheduler can read, and nothing derives one from the other.
17 #[serde(rename = "capacity", skip_serializing_if = "Option::is_none")]
18 pub capacity: Option<String>,
19 /// CreatedAt is when the machine was first registered, RFC 3339 in UTC. A re-link refreshes the row and leaves this alone, so it dates the machine and not the connection.
20 #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
21 pub created_at: Option<String>,
22 /// Host is the hostname sessions on this machine report, and it is a JOIN KEY, not a label: a session naming this host counts against the load below even when it names no target id, and a re-link of the same (org, host, owner) refreshes this row instead of creating a second. Empty means the machine is addressable only by ID.
23 #[serde(rename = "host", skip_serializing_if = "Option::is_none")]
24 pub host: Option<String>,
25 /// ID is the machine's handle, minted as \"tgt_\" + 32 hex characters. It is what a session records to say it ran here, and what every later patch, claim or delete addresses.
26 #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
27 pub id: Option<String>,
28 /// Kind is what sort of destination this is, from a closed five: laptop | cloud | gpu | cluster | machine. A register that named none is a `machine`.
29 #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
30 pub kind: Option<String>,
31 /// Label is the name a person gave the machine (\"workshop\"), up to 128 characters. Required at register, free text, and the only field here meant for reading rather than matching.
32 #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
33 pub label: Option<String>,
34 /// Metrics is what the machine was DOING at its last heartbeat — loadavg, memory, accelerator utilization. Absent when it has never beaten. It is a SNAPSHOT: the series over time lives in the fleet samples, not here.
35 #[serde(rename = "metrics", skip_serializing_if = "Option::is_none")]
36 pub metrics: Option<Box<models::Metrics>>,
37 /// MetricsAt is when that heartbeat was recorded, RFC 3339 in UTC, and the SERVER stamps it — a client cannot backdate or forge the staleness clock. Absent means never beaten, which is exactly the case where Status is taken at its word.
38 #[serde(rename = "metricsAt", skip_serializing_if = "Option::is_none")]
39 pub metrics_at: Option<String>,
40 /// Running is how many of those are in `running` right now — the number a dispatcher weighs against Capacity. paused sessions are in Sessions and not here.
41 #[serde(rename = "running", skip_serializing_if = "Option::is_none")]
42 pub running: Option<i32>,
43 /// Sessions is how many of the org's sessions are mapped to this machine, by target id OR by matching Host. All of them, whatever their status.
44 #[serde(rename = "sessions", skip_serializing_if = "Option::is_none")]
45 pub sessions: Option<i32>,
46 /// Spec is what the machine IS — os, arch, cores, RAM, accelerators — the static half, changed only when something reports it again. Absent when nothing has ever been reported, and a scheduler reads absence as \"cannot satisfy a floor\" rather than as \"no limits\".
47 #[serde(rename = "spec", skip_serializing_if = "Option::is_none")]
48 pub spec: Option<Box<models::Spec>>,
49 /// Status is the EFFECTIVE liveness — online | offline | draining — not the stored one. offline and draining are operator INTENT and are reported as they stand; `online` is checked against the heartbeat, and a machine that has beaten before but not in the last 90 seconds reports offline whatever its row says. A target that has NEVER beaten keeps its stored status, because a hand-registered destination has no fact to check.
50 #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
51 pub status: Option<String>,
52 /// UpdatedAt is the last write to the row, same format — which for a beating machine is its last heartbeat, since a heartbeat IS a write.
53 #[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")]
54 pub updated_at: Option<String>,
55}
56
57impl TargetView {
58 pub fn new() -> TargetView {
59 TargetView {
60 capacity: None,
61 created_at: None,
62 host: None,
63 id: None,
64 kind: None,
65 label: None,
66 metrics: None,
67 metrics_at: None,
68 running: None,
69 sessions: None,
70 spec: None,
71 status: None,
72 updated_at: None,
73 }
74 }
75}
76