manta_shared/types/dto.rs
1//! Wire response types shared by both binaries.
2//!
3//! The CLI (in `manta_cli::http_client::*` and `manta_cli::output::*`)
4//! deserializes responses from the manta-server using these types;
5//! the server serializes them back over HTTP via the service layer.
6//!
7//! `NodeDetails` is mirrored locally (rather than re-exporting from
8//! `csm-rs`) so `manta-shared` — and therefore `manta-cli` — does not
9//! transitively depend on `csm-rs`. No in-process conversion is
10//! needed: the type boundary is HTTP, and the JSON wire shape is
11//! byte-identical between `csm_rs::node::types::NodeDetails` and the
12//! mirror below (same field names, no `#[serde(rename)]`), so the CLI
13//! just deserializes the response directly into this struct.
14//!
15//! The remaining re-exports come from the lightweight
16//! `manta-backend-dispatcher` crate (types + traits only, no csm-rs
17//! / ochami-rs deps). Mirroring those too is a separate, optional
18//! follow-up.
19
20pub use manta_backend_dispatcher::types::{
21 Group, NodeSummary,
22 bos::session_template::BosSessionTemplate,
23 bss::BootParameters,
24 cfs::{
25 cfs_configuration_response::CfsConfigurationResponse,
26 session::CfsSessionGetResponse,
27 },
28 ims::Image,
29};
30
31use serde::{Deserialize, Serialize};
32use utoipa::ToSchema;
33
34/// Per-node details returned by `GET /api/v1/nodes`.
35///
36/// Mirror of `csm_rs::node::types::NodeDetails` with identical fields
37/// and identical JSON wire format. No conversion impl is needed in
38/// the server crate — the response is serialised straight from the
39/// csm-rs type and the CLI deserialises it into this mirror.
40///
41/// All fields are wire-stringified (CSM serializes them that way);
42/// callers parse them as needed for display or comparison.
43#[derive(Debug, Serialize, Deserialize, ToSchema)]
44pub struct NodeDetails {
45 /// Physical location ID, e.g. `x3000c0s1b0n0`.
46 pub xname: String,
47 /// Numeric node ID as a string, e.g. `"nid001313"`.
48 pub nid: String,
49 /// Comma-separated HSM group names this node belongs to.
50 pub hsm: String,
51 /// Current power state reported by PCS (`"On"`, `"Off"`, `"Ready"`,
52 /// etc.).
53 pub power_status: String,
54 /// CFS desired-configuration name targeting this node.
55 pub desired_configuration: String,
56 /// CFS configuration status (`"configured"`, `"pending"`,
57 /// `"failed"`, etc.).
58 pub configuration_status: String,
59 /// `"true"` or `"false"` — whether the node is enabled in the
60 /// hardware state manager.
61 pub enabled: String,
62 /// Stringified count of recent CFS failures.
63 pub error_count: String,
64 /// IMS image ID currently set as the boot image.
65 pub boot_image_id: String,
66 /// CFS configuration linked to the boot image.
67 pub boot_configuration: String,
68 /// Kernel command-line parameters as last reported by BSS.
69 pub kernel_params: String,
70}