Skip to main content

hanzo_client/models/
target_req.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 TargetReq {
16    /// Capacity is a human summary of the machine's size, up to 256 characters. Prose only; a scheduler reads Spec.
17    #[serde(rename = "capacity", skip_serializing_if = "Option::is_none")]
18    pub capacity: Option<String>,
19    /// Host is the hostname sessions on this machine will report. It is what makes a re-link IDEMPOTENT: the same (org, host, owner) refreshes the existing row and answers 200, while a request with no host always creates a new target and answers 201. It never adopts a row owned by somebody else.
20    #[serde(rename = "host", skip_serializing_if = "Option::is_none")]
21    pub host: Option<String>,
22    /// Kind is laptop | cloud | gpu | cluster | machine. Empty registers a `machine`; anything outside the five is a 400.
23    #[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
24    pub kind: Option<String>,
25    /// Label is the name to show for this machine, up to 128 characters. REQUIRED — it is the only field here a person reads.
26    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
27    pub label: Option<String>,
28    /// Metrics is a live sample, and sending one IS A HEARTBEAT: it refreshes the row and starts the 90-second liveness window, and it is appended to the fleet series as one point. Its own `at` is ignored — the server stamps the time, so a client can never age or backdate its own machine. Omit it to register a machine without claiming it is alive.
29    #[serde(rename = "metrics", skip_serializing_if = "Option::is_none")]
30    pub metrics: Option<Box<models::Metrics>>,
31    /// Spec is the machine's static capability — os, arch, cores, RAM, accelerators. Every field is bounded on write and at most 32 accelerators are accepted, so what comes back may be clamped. Omit it for a destination nothing probes.
32    #[serde(rename = "spec", skip_serializing_if = "Option::is_none")]
33    pub spec: Option<Box<models::Spec>>,
34    /// Status is online | offline | draining. Empty registers `online`. It states INTENT — a heartbeat is what decides whether an online machine is actually reachable, so declaring online does not make it so.
35    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
36    pub status: Option<String>,
37}
38
39impl TargetReq {
40    pub fn new() -> TargetReq {
41        TargetReq {
42            capacity: None,
43            host: None,
44            kind: None,
45            label: None,
46            metrics: None,
47            spec: None,
48            status: None,
49        }
50    }
51}
52