proxmox_api/generated/nodes/node/lxc/vmid/
snapshot.rs

1pub mod snapname;
2pub struct SnapshotClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> SnapshotClient<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, "/snapshot"),
14        }
15    }
16}
17impl<T> SnapshotClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "List all snapshots."]
22    pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
23        let path = self.path.to_string();
24        self.client.get(&path, &())
25    }
26}
27impl<T> SnapshotClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "Snapshot a container."]
32    pub fn post(&self, params: PostParams) -> Result<String, 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, name: String) -> Self {
39        Self {
40            description,
41            name,
42            parent: Default::default(),
43            snaptime: Default::default(),
44            additional_properties: Default::default(),
45        }
46    }
47}
48#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
49pub struct GetOutputItems {
50    #[doc = "Snapshot description."]
51    pub description: String,
52    #[doc = "Snapshot identifier. Value 'current' identifies the current VM."]
53    pub name: String,
54    #[serde(skip_serializing_if = "Option::is_none", default)]
55    #[doc = "Parent snapshot identifier."]
56    pub parent: Option<String>,
57    #[serde(
58        serialize_with = "crate::types::serialize_int_optional",
59        deserialize_with = "crate::types::deserialize_int_optional"
60    )]
61    #[serde(skip_serializing_if = "Option::is_none", default)]
62    #[doc = "Snapshot creation time"]
63    pub snaptime: Option<u64>,
64    #[serde(
65        flatten,
66        default,
67        skip_serializing_if = "::std::collections::HashMap::is_empty"
68    )]
69    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
70}
71impl PostParams {
72    pub fn new(snapname: String) -> Self {
73        Self {
74            snapname,
75            description: Default::default(),
76            additional_properties: Default::default(),
77        }
78    }
79}
80#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
81pub struct PostParams {
82    #[serde(skip_serializing_if = "Option::is_none", default)]
83    #[doc = "A textual description or comment."]
84    pub description: Option<String>,
85    #[doc = "The name of the snapshot."]
86    pub snapname: String,
87    #[serde(
88        flatten,
89        default,
90        skip_serializing_if = "::std::collections::HashMap::is_empty"
91    )]
92    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
93}
94impl<T> SnapshotClient<T>
95where
96    T: crate::client::Client,
97{
98    pub fn snapname(&self, snapname: &str) -> snapname::SnapnameClient<T> {
99        snapname::SnapnameClient::<T>::new(self.client.clone(), &self.path, snapname)
100    }
101}