proxmox_api/generated/cluster/mapping/
usb.rs

1pub mod id;
2pub struct UsbClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> UsbClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}{}", parent_path, "/usb"),
14        }
15    }
16}
17impl<T> UsbClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "List USB Hardware Mappings"]
22    pub fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
23        let path = self.path.to_string();
24        self.client.get(&path, &params)
25    }
26}
27impl<T> UsbClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "Create a new hardware mapping."]
32    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33        let path = self.path.to_string();
34        self.client.post(&path, &params)
35    }
36}
37impl GetOutputItems {
38    pub fn new(description: String, id: String, map: Vec<String>) -> Self {
39        Self {
40            description,
41            id,
42            map,
43            additional_properties: Default::default(),
44        }
45    }
46}
47#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
48pub struct GetOutputItems {
49    #[doc = "A description of the logical mapping."]
50    pub description: String,
51    #[doc = "The logical ID of the mapping."]
52    pub id: String,
53    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
54    #[doc = "The entries of the mapping."]
55    pub map: Vec<String>,
56    #[serde(
57        flatten,
58        default,
59        skip_serializing_if = "::std::collections::HashMap::is_empty"
60    )]
61    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
62}
63#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
64pub struct GetParams {
65    #[serde(rename = "check-node")]
66    #[serde(skip_serializing_if = "Option::is_none", default)]
67    #[doc = "If given, checks the configurations on the given node for correctness, and adds relevant errors to the devices."]
68    pub check_node: Option<String>,
69    #[serde(
70        flatten,
71        default,
72        skip_serializing_if = "::std::collections::HashMap::is_empty"
73    )]
74    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
75}
76impl PostParams {
77    pub fn new(id: String, map: Vec<String>) -> Self {
78        Self {
79            id,
80            map,
81            description: Default::default(),
82            additional_properties: Default::default(),
83        }
84    }
85}
86#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
87pub struct PostParams {
88    #[serde(skip_serializing_if = "Option::is_none", default)]
89    #[doc = "Description of the logical USB device."]
90    pub description: Option<String>,
91    #[doc = "The ID of the logical USB mapping."]
92    pub id: String,
93    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
94    #[doc = "A list of maps for the cluster nodes."]
95    pub map: Vec<String>,
96    #[serde(
97        flatten,
98        default,
99        skip_serializing_if = "::std::collections::HashMap::is_empty"
100    )]
101    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
102}
103impl<T> UsbClient<T>
104where
105    T: crate::client::Client,
106{
107    pub fn id(&self, id: &str) -> id::IdClient<T> {
108        id::IdClient::<T>::new(self.client.clone(), &self.path, id)
109    }
110}