manta_server/backend_dispatcher/
hardware_inventory.rs

1//! Dispatches `HardwareInventory` methods to csm-rs or ochami-rs.
2
3use manta_backend_dispatcher::{
4  error::Error, interfaces::hsm::hardware_inventory::HardwareInventory,
5  types::HWInventoryByLocationList,
6};
7
8use StaticBackendDispatcher::*;
9
10use serde_json::Value;
11
12use crate::manta_backend_dispatcher::StaticBackendDispatcher;
13
14impl HardwareInventory for StaticBackendDispatcher {
15  async fn get_inventory_hardware(
16    &self,
17    auth_token: &str,
18    xname: &str,
19  ) -> Result<Value, Error> {
20    dispatch!(self, get_inventory_hardware, auth_token, xname)
21  }
22
23  async fn get_inventory_hardware_query(
24    &self,
25    auth_token: &str,
26    xname: &str,
27    r#type: Option<&str>,
28    children: Option<bool>,
29    parents: Option<bool>,
30    partition: Option<&str>,
31    format: Option<&str>,
32  ) -> Result<Value, Error> {
33    dispatch!(
34      self,
35      get_inventory_hardware_query,
36      auth_token,
37      xname,
38      r#type,
39      children,
40      parents,
41      partition,
42      format
43    )
44  }
45
46  async fn post_inventory_hardware(
47    &self,
48    auth_token: &str,
49    hardware: HWInventoryByLocationList,
50  ) -> Result<Value, Error> {
51    dispatch!(self, post_inventory_hardware, auth_token, hardware)
52  }
53}