1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! [`HardwareInventory`] impl for [`StaticBackendDispatcher`].
//!
//! Forwards to HSM's `/apis/smd/hsm/v2/Inventory/Hardware` endpoints.
//! Both CSM and Ochami implement this trait natively.
use super::*;
impl HardwareInventory for StaticBackendDispatcher {
/// `GET /Inventory/Hardware/Query/{xname}` projected to a
/// `NodeSummary` (CPU model count, memory, accelerator count, …).
/// The thin per-node view used by listings.
async fn get_inventory_hardware(
&self,
auth_token: &str,
xname: &str,
) -> Result<NodeSummary, Error> {
dispatch!(self, get_inventory_hardware, auth_token, xname)
}
/// `GET /Inventory/Hardware/Query/{xname}` with the full HSM query
/// parameter set — `type`, `children`, `parents`, `partition`,
/// `format`. Returns the raw [`HWInventory`] tree.
async fn get_inventory_hardware_query(
&self,
auth_token: &str,
xname: &str,
r#type: Option<&str>,
children: Option<bool>,
parents: Option<bool>,
partition: Option<&str>,
format: Option<&str>,
) -> Result<HWInventory, Error> {
dispatch!(
self,
get_inventory_hardware_query,
auth_token,
xname,
r#type,
children,
parents,
partition,
format
)
}
/// `POST /Inventory/Hardware` — push a hardware-by-location list
/// into HSM (used by discovery / restore flows). The returned
/// `HsmActionResponse` reports how many records were inserted or
/// updated.
async fn post_inventory_hardware(
&self,
auth_token: &str,
hardware: HWInventoryByLocationList,
) -> Result<HsmActionResponse, Error> {
dispatch!(self, post_inventory_hardware, auth_token, hardware)
}
}