manta_server/backend_dispatcher/
component_ethernet_interface.rs

1//! [`ComponentEthernetInterfaceTrait`] impl for
2//! [`StaticBackendDispatcher`].
3//!
4//! Forwards to HSM's
5//! `/apis/smd/hsm/v2/Inventory/EthernetInterfaces` endpoints. Both
6//! CSM and Ochami implement these natively.
7//!
8//! No HTTP handler currently calls these methods; this file exists so
9//! the dispatcher covers the full trait surface. Without it, a handler
10//! added later would silently hit the trait's "not implemented" default
11//! even when the backend actually does implement the method — the same
12//! class of bug that caused the `apply_sat_image_create_session` issue.
13
14use manta_backend_dispatcher::interfaces::hsm::component_ethernet_interface::ComponentEthernetInterfaceTrait;
15use manta_backend_dispatcher::types::hsm::inventory::ComponentEthernetInterface;
16use serde_json::Value;
17
18use super::*;
19
20impl ComponentEthernetInterfaceTrait for StaticBackendDispatcher {
21  /// `GET /Inventory/EthernetInterfaces` — every interface.
22  async fn get_all_component_ethernet_interfaces(
23    &self,
24    auth_token: &str,
25  ) -> Result<Vec<ComponentEthernetInterface>, Error> {
26    dispatch!(self, get_all_component_ethernet_interfaces, auth_token)
27  }
28
29  /// `GET /Inventory/EthernetInterfaces/{id}` — one interface.
30  async fn get_component_ethernet_interface(
31    &self,
32    auth_token: &str,
33    eth_interface_id: &str,
34  ) -> Result<ComponentEthernetInterface, Error> {
35    dispatch!(
36      self,
37      get_component_ethernet_interface,
38      auth_token,
39      eth_interface_id
40    )
41  }
42
43  /// `POST /Inventory/EthernetInterfaces` — create.
44  async fn add_component_ethernet_interface(
45    &self,
46    auth_token: &str,
47    component_ethernet_interface: &ComponentEthernetInterface,
48  ) -> Result<(), Error> {
49    dispatch!(
50      self,
51      add_component_ethernet_interface,
52      auth_token,
53      component_ethernet_interface
54    )
55  }
56
57  /// `PATCH /Inventory/EthernetInterfaces/{id}` — update
58  /// description and/or the (current_ip, new_ip) mapping. Returns
59  /// HSM's raw JSON response.
60  async fn update_component_ethernet_interface(
61    &self,
62    auth_token: &str,
63    eth_interface_id: &str,
64    description: Option<&str>,
65    ip_address_mapping: (&str, &str),
66  ) -> Result<Value, Error> {
67    dispatch!(
68      self,
69      update_component_ethernet_interface,
70      auth_token,
71      eth_interface_id,
72      description,
73      ip_address_mapping
74    )
75  }
76
77  /// `DELETE /Inventory/EthernetInterfaces` — wipe the collection.
78  /// Returns HSM's action-summary JSON.
79  async fn delete_all_component_ethernet_interfaces(
80    &self,
81    auth_token: &str,
82  ) -> Result<Value, Error> {
83    dispatch!(self, delete_all_component_ethernet_interfaces, auth_token)
84  }
85
86  /// `DELETE /Inventory/EthernetInterfaces/{id}`.
87  async fn delete_component_ethernet_interface(
88    &self,
89    auth_token: &str,
90    eth_interface_id: &str,
91  ) -> Result<Value, Error> {
92    dispatch!(
93      self,
94      delete_component_ethernet_interface,
95      auth_token,
96      eth_interface_id
97    )
98  }
99}