Skip to main content

proxmox_api/generated/nodes/node/capabilities/qemu/
cpu.rs

1#[derive(Debug, Clone)]
2pub struct CpuClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> CpuClient<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, "/cpu"),
14        }
15    }
16}
17impl<T> CpuClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "List all custom and default CPU models."]
22    #[doc = ""]
23    #[doc = "Only returns custom models when the current user has Sys.Audit on /nodes."]
24    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
25        let path = self.path.to_string();
26        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
27        Ok(optional_vec.unwrap_or_default())
28    }
29}
30impl GetOutputItems {
31    pub fn new(custom: bool, name: String, vendor: String) -> Self {
32        Self {
33            custom,
34            name,
35            vendor,
36            additional_properties: ::std::default::Default::default(),
37        }
38    }
39}
40#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
41pub struct GetOutputItems {
42    #[serde(
43        serialize_with = "crate::types::serialize_bool",
44        deserialize_with = "crate::types::deserialize_bool"
45    )]
46    #[doc = "True if this is a custom CPU model."]
47    #[doc = ""]
48    pub custom: bool,
49    #[doc = "Name of the CPU model. Identifies it for subsequent API calls. Prefixed with 'custom-' for custom models."]
50    #[doc = ""]
51    pub name: String,
52    #[doc = "CPU vendor visible to the guest when this model is selected. Vendor of 'reported-model' in case of custom models."]
53    #[doc = ""]
54    pub vendor: String,
55    #[serde(
56        flatten,
57        default,
58        skip_serializing_if = "::std::collections::HashMap::is_empty"
59    )]
60    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
61}