proxmox_api/generated/nodes/node/qemu/vmid/
snapshot.rs1pub 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 VM."]
32 pub fn post(&self, params: PostParams) -> Result<String, T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
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 vmstate: Default::default(),
45 additional_properties: Default::default(),
46 }
47 }
48}
49#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
50pub struct GetOutputItems {
51 #[doc = "Snapshot description."]
52 pub description: String,
53 #[doc = "Snapshot identifier. Value 'current' identifies the current VM."]
54 pub name: String,
55 #[serde(skip_serializing_if = "Option::is_none", default)]
56 #[doc = "Parent snapshot identifier."]
57 pub parent: Option<String>,
58 #[serde(
59 serialize_with = "crate::types::serialize_int_optional",
60 deserialize_with = "crate::types::deserialize_int_optional"
61 )]
62 #[serde(skip_serializing_if = "Option::is_none", default)]
63 #[doc = "Snapshot creation time"]
64 pub snaptime: Option<u64>,
65 #[serde(
66 serialize_with = "crate::types::serialize_bool_optional",
67 deserialize_with = "crate::types::deserialize_bool_optional"
68 )]
69 #[serde(skip_serializing_if = "Option::is_none", default)]
70 #[doc = "Snapshot includes RAM."]
71 pub vmstate: Option<bool>,
72 #[serde(
73 flatten,
74 default,
75 skip_serializing_if = "::std::collections::HashMap::is_empty"
76 )]
77 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
78}
79impl PostParams {
80 pub fn new(snapname: String) -> Self {
81 Self {
82 snapname,
83 description: Default::default(),
84 vmstate: Default::default(),
85 additional_properties: Default::default(),
86 }
87 }
88}
89#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
90pub struct PostParams {
91 #[serde(skip_serializing_if = "Option::is_none", default)]
92 #[doc = "A textual description or comment."]
93 pub description: Option<String>,
94 #[doc = "The name of the snapshot."]
95 pub snapname: String,
96 #[serde(
97 serialize_with = "crate::types::serialize_bool_optional",
98 deserialize_with = "crate::types::deserialize_bool_optional"
99 )]
100 #[serde(skip_serializing_if = "Option::is_none", default)]
101 #[doc = "Save the vmstate"]
102 pub vmstate: Option<bool>,
103 #[serde(
104 flatten,
105 default,
106 skip_serializing_if = "::std::collections::HashMap::is_empty"
107 )]
108 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
109}
110impl<T> SnapshotClient<T>
111where
112 T: crate::client::Client,
113{
114 pub fn snapname(&self, snapname: &str) -> snapname::SnapnameClient<T> {
115 snapname::SnapnameClient::<T>::new(self.client.clone(), &self.path, snapname)
116 }
117}