backend_dispatcher/interfaces/hsm/
component.rs

1use serde_json::Value;
2
3use crate::{
4    error::Error,
5    types::{Component, ComponentArrayPostArray, NodeMetadataArray},
6};
7
8pub trait ComponentTrait {
9    fn get_all_nodes(
10        &self,
11        auth_token: &str,
12        nid_only: Option<&str>,
13    ) -> impl std::future::Future<Output = Result<NodeMetadataArray, Error>> + Send;
14
15    fn get(
16        &self,
17        auth_token: &str,
18        id: Option<&str>,
19        r#type: Option<&str>,
20        state: Option<&str>,
21        flag: Option<&str>,
22        role: Option<&str>,
23        subrole: Option<&str>,
24        enabled: Option<&str>,
25        software_status: Option<&str>,
26        subtype: Option<&str>,
27        arch: Option<&str>,
28        class: Option<&str>,
29        nid: Option<&str>,
30        nid_start: Option<&str>,
31        nid_end: Option<&str>,
32        partition: Option<&str>,
33        group: Option<&str>,
34        state_only: Option<&str>,
35        flag_only: Option<&str>,
36        role_only: Option<&str>,
37        nid_only: Option<&str>,
38    ) -> impl std::future::Future<Output = Result<NodeMetadataArray, Error>> + Send;
39
40    fn get_node_metadata_available(
41        &self,
42        auth_token: &str,
43    ) -> impl std::future::Future<Output = Result<Vec<Component>, Error>> + Send;
44
45    // HSM/COMPONENT
46    fn post_nodes(
47        &self,
48        auth_token: &str,
49        component: ComponentArrayPostArray,
50    ) -> impl std::future::Future<Output = Result<(), Error>> + Send;
51
52    // HSM/COMPONENT
53    fn delete_node(
54        &self,
55        auth_token: &str,
56        id: &str,
57    ) -> impl std::future::Future<Output = Result<Value, Error>> + Send;
58}