Skip to main content

manta_shared/shared/
dto.rs

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