manta_server/backend_dispatcher/
redfish_endpoint.rs

1//! [`RedfishEndpointTrait`] impl for [`StaticBackendDispatcher`].
2//!
3//! Forwards to HSM's
4//! `/apis/smd/hsm/v2/Inventory/RedfishEndpoints` API. Both CSM and
5//! Ochami implement this trait natively.
6
7use super::*;
8
9impl RedfishEndpointTrait for StaticBackendDispatcher {
10  /// `GET /RedfishEndpoints` — every registered BMC endpoint.
11  async fn get_all_redfish_endpoints(
12    &self,
13    auth_token: &str,
14  ) -> Result<RedfishEndpointArray, Error> {
15    dispatch!(self, get_all_redfish_endpoints, auth_token)
16  }
17
18  /// `GET /RedfishEndpoints` with the full HSM filter set
19  /// (`id`, `fqdn`, `type`, `uuid`, `macaddr`, `ip_address`,
20  /// `last_status`).
21  async fn get_redfish_endpoints(
22    &self,
23    auth_token: &str,
24    id: Option<&str>,
25    fqdn: Option<&str>,
26    r#type: Option<&str>,
27    uuid: Option<&str>,
28    macaddr: Option<&str>,
29    ip_address: Option<&str>,
30    last_status: Option<&str>,
31  ) -> Result<RedfishEndpointArray, Error> {
32    dispatch!(
33      self,
34      get_redfish_endpoints,
35      auth_token,
36      id,
37      fqdn,
38      r#type,
39      uuid,
40      macaddr,
41      ip_address,
42      last_status
43    )
44  }
45
46  /// `POST /RedfishEndpoints` — bulk-register endpoints.
47  async fn add_redfish_endpoint(
48    &self,
49    auth_token: &str,
50    redfish_endpoint: &RedfishEndpointArray,
51  ) -> Result<(), Error> {
52    dispatch!(self, add_redfish_endpoint, auth_token, redfish_endpoint)
53  }
54
55  /// `PUT /RedfishEndpoints/{id}` — replace a single endpoint's
56  /// record.
57  async fn update_redfish_endpoint(
58    &self,
59    auth_token: &str,
60    redfish_endpoint: &RedfishEndpoint,
61  ) -> Result<(), Error> {
62    dispatch!(self, update_redfish_endpoint, auth_token, redfish_endpoint)
63  }
64
65  /// `DELETE /RedfishEndpoints/{id}`. Returns HSM's raw JSON
66  /// action summary.
67  async fn delete_redfish_endpoint(
68    &self,
69    auth_token: &str,
70    id: &str,
71  ) -> Result<Value, Error> {
72    dispatch!(self, delete_redfish_endpoint, auth_token, id)
73  }
74}