proxmox_api/generated/cluster/mapping/
pci.rs

1pub mod id;
2pub struct PciClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> PciClient<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, "/pci"),
14        }
15    }
16}
17impl<T> PciClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "List PCI Hardware Mapping"]
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> PciClient<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 ChecksGetOutputItemsChecksItems {
38    pub fn new(message: String, severity: Severity) -> Self {
39        Self {
40            message,
41            severity,
42            additional_properties: Default::default(),
43        }
44    }
45}
46#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
47pub struct ChecksGetOutputItemsChecksItems {
48    #[doc = "The message of the error"]
49    pub message: String,
50    #[doc = "The severity of the error"]
51    pub severity: Severity,
52    #[serde(
53        flatten,
54        default,
55        skip_serializing_if = "::std::collections::HashMap::is_empty"
56    )]
57    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
58}
59impl GetOutputItems {
60    pub fn new(description: String, id: String, map: Vec<String>) -> Self {
61        Self {
62            description,
63            id,
64            map,
65            checks: Default::default(),
66            additional_properties: Default::default(),
67        }
68    }
69}
70#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
71pub struct GetOutputItems {
72    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
73    #[doc = "A list of checks, only present if 'check_node' is set."]
74    pub checks: Vec<ChecksGetOutputItemsChecksItems>,
75    #[doc = "A description of the logical mapping."]
76    pub description: String,
77    #[doc = "The logical ID of the mapping."]
78    pub id: String,
79    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
80    #[doc = "The entries of the mapping."]
81    pub map: Vec<String>,
82    #[serde(
83        flatten,
84        default,
85        skip_serializing_if = "::std::collections::HashMap::is_empty"
86    )]
87    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
88}
89#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
90pub struct GetParams {
91    #[serde(rename = "check-node")]
92    #[serde(skip_serializing_if = "Option::is_none", default)]
93    #[doc = "If given, checks the configurations on the given node for correctness, and adds relevant diagnostics for the devices to the response."]
94    pub check_node: Option<String>,
95    #[serde(
96        flatten,
97        default,
98        skip_serializing_if = "::std::collections::HashMap::is_empty"
99    )]
100    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
101}
102impl PostParams {
103    pub fn new(id: String, map: Vec<String>) -> Self {
104        Self {
105            id,
106            map,
107            description: Default::default(),
108            mdev: Default::default(),
109            additional_properties: Default::default(),
110        }
111    }
112}
113#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
114pub struct PostParams {
115    #[serde(skip_serializing_if = "Option::is_none", default)]
116    #[doc = "Description of the logical PCI device."]
117    pub description: Option<String>,
118    #[doc = "The ID of the logical PCI mapping."]
119    pub id: String,
120    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
121    #[doc = "A list of maps for the cluster nodes."]
122    pub map: Vec<String>,
123    #[serde(
124        serialize_with = "crate::types::serialize_bool_optional",
125        deserialize_with = "crate::types::deserialize_bool_optional"
126    )]
127    #[serde(skip_serializing_if = "Option::is_none", default)]
128    pub mdev: Option<bool>,
129    #[serde(
130        flatten,
131        default,
132        skip_serializing_if = "::std::collections::HashMap::is_empty"
133    )]
134    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
135}
136#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
137pub enum Severity {
138    #[serde(rename = "error")]
139    Error,
140    #[serde(rename = "warning")]
141    Warning,
142}
143impl<T> PciClient<T>
144where
145    T: crate::client::Client,
146{
147    pub fn id(&self, id: &str) -> id::IdClient<T> {
148        id::IdClient::<T>::new(self.client.clone(), &self.path, id)
149    }
150}