pve/nodes/node/qemu/vmid/
feature.rs

1#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
2pub struct GetParameters {
3    #[doc = "Feature to check."]
4    pub feature: String,
5    #[doc = "The name of the snapshot."]
6    #[serde(skip_serializing_if = "Option::is_none", default)]
7    pub snapname: Option<String>,
8}
9
10#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
11pub struct GetResponseItem {
12    #[serde(
13        rename = "hasFeature",
14        deserialize_with = "crate::common::deserialize_bool_lax",
15        serialize_with = "crate::common::serialize_bool_as_u64"
16    )]
17    pub has_feature: bool,
18    pub nodes: Vec<String>,
19}
20
21#[derive(Debug, Clone)]
22pub struct FeatureClient<T> {
23    client: T,
24    path: String,
25}
26
27impl<T> FeatureClient<T>
28where
29    T: Clone,
30{
31    pub fn new(client: T, parent_path: &str) -> Self {
32        Self {
33            client,
34            path: format!("{}/{}", parent_path, "feature"),
35        }
36    }
37}
38impl<T> FeatureClient<T>
39where
40    T: crate::client::HttpClient,
41{
42    #[doc = "Check if feature for virtual machine is available."]
43    pub fn get(&self, parameters: GetParameters) -> Result<GetResponseItem, T::Error> {
44        self.client.get(&self.path, &parameters)
45    }
46}
47#[derive(Debug, Clone)]
48pub struct AsyncFeatureClient<T> {
49    client: T,
50    path: String,
51}
52
53impl<T> AsyncFeatureClient<T>
54where
55    T: Clone,
56{
57    pub fn new(client: T, parent_path: &str) -> Self {
58        Self {
59            client,
60            path: format!("{}/{}", parent_path, "feature"),
61        }
62    }
63}
64impl<T> AsyncFeatureClient<T>
65where
66    T: crate::client::AsyncHttpClient,
67{
68    #[doc = "Check if feature for virtual machine is available."]
69    pub async fn get(&self, parameters: GetParameters) -> Result<GetResponseItem, T::Error> {
70        self.client.get(&self.path, &parameters).await
71    }
72}