manta-server 2.0.0-beta.62

Manta HTTP server — single API that proxies to CSM / Ochami backends.
//! [`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)
  }
}