Skip to main content

proxmox_api/generated/nodes/node/hardware/
pci.rs

1pub mod pci_id_or_mapping;
2#[derive(Debug, Clone)]
3pub struct PciClient<T> {
4    client: T,
5    path: String,
6}
7impl<T> PciClient<T>
8where
9    T: crate::client::Client,
10{
11    pub fn new(client: T, parent_path: &str) -> Self {
12        Self {
13            client,
14            path: format!("{}{}", parent_path, "/pci"),
15        }
16    }
17}
18impl<T> PciClient<T>
19where
20    T: crate::client::Client,
21{
22    #[doc = "List local PCI devices."]
23    #[doc = ""]
24    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\", \"Sys.Modify\"], any)"]
25    pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
26        let path = self.path.to_string();
27        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &params).await?;
28        Ok(optional_vec.unwrap_or_default())
29    }
30}
31impl GetOutputItems {
32    pub fn new(class: String, device: String, id: String, iommugroup: i64, vendor: String) -> Self {
33        Self {
34            class,
35            device,
36            id,
37            iommugroup,
38            vendor,
39            device_name: ::std::default::Default::default(),
40            mdev: ::std::default::Default::default(),
41            subsystem_device: ::std::default::Default::default(),
42            subsystem_device_name: ::std::default::Default::default(),
43            subsystem_vendor: ::std::default::Default::default(),
44            subsystem_vendor_name: ::std::default::Default::default(),
45            vendor_name: ::std::default::Default::default(),
46            additional_properties: ::std::default::Default::default(),
47        }
48    }
49}
50#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
51pub struct GetOutputItems {
52    #[doc = "The PCI Class of the device."]
53    #[doc = ""]
54    pub class: String,
55    #[doc = "The Device ID."]
56    #[doc = ""]
57    pub device: String,
58    #[serde(skip_serializing_if = "Option::is_none", default)]
59    pub device_name: Option<String>,
60    #[doc = "The PCI ID."]
61    #[doc = ""]
62    pub id: String,
63    #[serde(
64        serialize_with = "crate::types::serialize_int",
65        deserialize_with = "crate::types::deserialize_int"
66    )]
67    #[doc = "The IOMMU group in which the device is in. If no IOMMU group is detected, it is set to -1."]
68    #[doc = ""]
69    pub iommugroup: i64,
70    #[serde(
71        serialize_with = "crate::types::serialize_bool_optional",
72        deserialize_with = "crate::types::deserialize_bool_optional"
73    )]
74    #[serde(skip_serializing_if = "Option::is_none", default)]
75    #[doc = "If set, marks that the device is capable of creating mediated devices."]
76    #[doc = ""]
77    pub mdev: Option<bool>,
78    #[serde(skip_serializing_if = "Option::is_none", default)]
79    #[doc = "The Subsystem Device ID."]
80    #[doc = ""]
81    pub subsystem_device: Option<String>,
82    #[serde(skip_serializing_if = "Option::is_none", default)]
83    pub subsystem_device_name: Option<String>,
84    #[serde(skip_serializing_if = "Option::is_none", default)]
85    #[doc = "The Subsystem Vendor ID."]
86    #[doc = ""]
87    pub subsystem_vendor: Option<String>,
88    #[serde(skip_serializing_if = "Option::is_none", default)]
89    pub subsystem_vendor_name: Option<String>,
90    #[doc = "The Vendor ID."]
91    #[doc = ""]
92    pub vendor: String,
93    #[serde(skip_serializing_if = "Option::is_none", default)]
94    pub vendor_name: 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}
102#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
103pub struct GetParams {
104    #[serde(rename = "pci-class-blacklist")]
105    #[serde(skip_serializing_if = "Option::is_none", default)]
106    #[doc = "A list of blacklisted PCI classes, which will not be returned. Following are filtered by default: Memory Controller (05), Bridge (06) and Processor (0b)."]
107    #[doc = ""]
108    pub pci_class_blacklist: Option<String>,
109    #[serde(
110        serialize_with = "crate::types::serialize_bool_optional",
111        deserialize_with = "crate::types::deserialize_bool_optional"
112    )]
113    #[serde(skip_serializing_if = "Option::is_none", default)]
114    #[doc = "If disabled, does only print the PCI IDs. Otherwise, additional information like vendor and device will be returned."]
115    #[doc = ""]
116    pub verbose: Option<bool>,
117    #[serde(
118        flatten,
119        default,
120        skip_serializing_if = "::std::collections::HashMap::is_empty"
121    )]
122    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
123}
124impl<T> PciClient<T>
125where
126    T: crate::client::Client,
127{
128    pub fn pci_id_or_mapping(
129        &self,
130        pci_id_or_mapping: &str,
131    ) -> pci_id_or_mapping::PciIdOrMappingClient<T> {
132        pci_id_or_mapping::PciIdOrMappingClient::<T>::new(
133            self.client.clone(),
134            &self.path,
135            pci_id_or_mapping,
136        )
137    }
138}