manta_shared/types/api/
node.rs

1//! HTTP request/response bodies and CLI-built parameter structs for
2//! the node endpoints (`/api/v1/nodes`).
3
4use serde::{Deserialize, Serialize};
5use utoipa::ToSchema;
6
7/// Request body for `POST /api/v1/nodes`.
8///
9/// Paired with [`super::responses::AddNodeResponse`] on success.
10///
11/// # Wire shape
12///
13/// ```json
14/// {
15///   "id": "x3000c0s1b0n0",
16///   "group": "alps",
17///   "enabled": true,
18///   "arch": "X86"
19/// }
20/// ```
21#[derive(Debug, Serialize, Deserialize, ToSchema)]
22pub struct AddNodeRequest {
23  /// Physical location ID (xname) of the node, e.g. `x3000c0s1b0n0`.
24  pub id: String,
25  /// Initial HSM group the node belongs to.
26  pub group: String,
27  /// Whether to register the node as enabled. Defaults to `false`
28  /// (disabled) per serde's default for `bool`; the CLI's
29  /// `manta add node` flips the polarity via `--disabled`.
30  #[serde(default)]
31  pub enabled: bool,
32  /// Optional architecture tag: `"X86"`, `"ARM"`, or `"Other"`.
33  pub arch: Option<String>,
34}
35
36/// Typed parameters for fetching node details.
37pub struct GetNodesParams {
38  /// Comma-separated xnames, NIDs, or hostlist expression
39  /// (e.g. `x3000c0s1b0n[0-3]`).
40  pub host_expression: String,
41  /// When true, also return nodes sharing a power supply with any
42  /// requested node.
43  pub include_siblings: bool,
44  /// Optional power-status filter (e.g. `ON`, `OFF`, `READY`).
45  pub status_filter: Option<String>,
46}