Skip to main content

proxmox_api/generated/nodes/node/qemu/
vmid.rs

1pub mod agent;
2pub mod clone;
3pub mod cloudinit;
4pub mod config;
5pub mod dbus_vmstate;
6pub mod feature;
7pub mod firewall;
8pub mod migrate;
9pub mod monitor;
10pub mod move_disk;
11pub mod mtunnel;
12pub mod mtunnelwebsocket;
13pub mod pending;
14pub mod remote_migrate;
15pub mod resize;
16pub mod rrd;
17pub mod rrddata;
18pub mod sendkey;
19pub mod snapshot;
20pub mod spiceproxy;
21pub mod status;
22pub mod template;
23pub mod termproxy;
24pub mod unlink;
25pub mod vncproxy;
26pub mod vncwebsocket;
27#[derive(Debug, Clone)]
28pub struct VmidClient<T> {
29    client: T,
30    path: String,
31}
32impl<T> VmidClient<T>
33where
34    T: crate::client::Client,
35{
36    pub fn new(client: T, parent_path: &str, vmid: crate::types::VmId) -> Self {
37        Self {
38            client,
39            path: format!("{}/{}", parent_path, vmid),
40        }
41    }
42}
43impl<T> VmidClient<T>
44where
45    T: crate::client::Client,
46{
47    #[doc = "Destroy the VM and  all used/owned volumes. Removes any VM specific permissions and firewall rules"]
48    #[doc = ""]
49    #[doc = "Permission check: perm(\"/vms/{vmid}\", [\"VM.Allocate\"])"]
50    pub async fn delete(&self, params: DeleteParams) -> Result<String, T::Error> {
51        let path = self.path.to_string();
52        self.client.delete(&path, &params).await
53    }
54}
55impl<T> VmidClient<T>
56where
57    T: crate::client::Client,
58{
59    #[doc = "Directory index"]
60    #[doc = ""]
61    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
62        let path = self.path.to_string();
63        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
64        Ok(optional_vec.unwrap_or_default())
65    }
66}
67#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
68pub struct DeleteParams {
69    #[serde(rename = "destroy-unreferenced-disks")]
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, destroy additionally all disks not referenced in the config but with a matching VMID from all enabled storages."]
76    #[doc = ""]
77    pub destroy_unreferenced_disks: Option<bool>,
78    #[serde(
79        serialize_with = "crate::types::serialize_bool_optional",
80        deserialize_with = "crate::types::deserialize_bool_optional"
81    )]
82    #[serde(skip_serializing_if = "Option::is_none", default)]
83    #[doc = "Remove VMID from configurations, like backup & replication jobs and HA."]
84    #[doc = ""]
85    pub purge: Option<bool>,
86    #[serde(
87        serialize_with = "crate::types::serialize_bool_optional",
88        deserialize_with = "crate::types::deserialize_bool_optional"
89    )]
90    #[serde(skip_serializing_if = "Option::is_none", default)]
91    #[doc = "Ignore locks - only root is allowed to use this option."]
92    #[doc = ""]
93    pub skiplock: Option<bool>,
94    #[serde(
95        flatten,
96        default,
97        skip_serializing_if = "::std::collections::HashMap::is_empty"
98    )]
99    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
100}
101impl GetOutputItems {
102    pub fn new(subdir: String) -> Self {
103        Self {
104            subdir,
105            additional_properties: ::std::default::Default::default(),
106        }
107    }
108}
109#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
110pub struct GetOutputItems {
111    pub subdir: String,
112    #[serde(
113        flatten,
114        default,
115        skip_serializing_if = "::std::collections::HashMap::is_empty"
116    )]
117    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
118}
119impl<T> VmidClient<T>
120where
121    T: crate::client::Client,
122{
123    pub fn firewall(&self) -> firewall::FirewallClient<T> {
124        firewall::FirewallClient::<T>::new(self.client.clone(), &self.path)
125    }
126}
127impl<T> VmidClient<T>
128where
129    T: crate::client::Client,
130{
131    pub fn agent(&self) -> agent::AgentClient<T> {
132        agent::AgentClient::<T>::new(self.client.clone(), &self.path)
133    }
134}
135impl<T> VmidClient<T>
136where
137    T: crate::client::Client,
138{
139    pub fn rrd(&self) -> rrd::RrdClient<T> {
140        rrd::RrdClient::<T>::new(self.client.clone(), &self.path)
141    }
142}
143impl<T> VmidClient<T>
144where
145    T: crate::client::Client,
146{
147    pub fn rrddata(&self) -> rrddata::RrddataClient<T> {
148        rrddata::RrddataClient::<T>::new(self.client.clone(), &self.path)
149    }
150}
151impl<T> VmidClient<T>
152where
153    T: crate::client::Client,
154{
155    pub fn config(&self) -> config::ConfigClient<T> {
156        config::ConfigClient::<T>::new(self.client.clone(), &self.path)
157    }
158}
159impl<T> VmidClient<T>
160where
161    T: crate::client::Client,
162{
163    pub fn pending(&self) -> pending::PendingClient<T> {
164        pending::PendingClient::<T>::new(self.client.clone(), &self.path)
165    }
166}
167impl<T> VmidClient<T>
168where
169    T: crate::client::Client,
170{
171    pub fn cloudinit(&self) -> cloudinit::CloudinitClient<T> {
172        cloudinit::CloudinitClient::<T>::new(self.client.clone(), &self.path)
173    }
174}
175impl<T> VmidClient<T>
176where
177    T: crate::client::Client,
178{
179    pub fn unlink(&self) -> unlink::UnlinkClient<T> {
180        unlink::UnlinkClient::<T>::new(self.client.clone(), &self.path)
181    }
182}
183impl<T> VmidClient<T>
184where
185    T: crate::client::Client,
186{
187    pub fn vncproxy(&self) -> vncproxy::VncproxyClient<T> {
188        vncproxy::VncproxyClient::<T>::new(self.client.clone(), &self.path)
189    }
190}
191impl<T> VmidClient<T>
192where
193    T: crate::client::Client,
194{
195    pub fn termproxy(&self) -> termproxy::TermproxyClient<T> {
196        termproxy::TermproxyClient::<T>::new(self.client.clone(), &self.path)
197    }
198}
199impl<T> VmidClient<T>
200where
201    T: crate::client::Client,
202{
203    pub fn vncwebsocket(&self) -> vncwebsocket::VncwebsocketClient<T> {
204        vncwebsocket::VncwebsocketClient::<T>::new(self.client.clone(), &self.path)
205    }
206}
207impl<T> VmidClient<T>
208where
209    T: crate::client::Client,
210{
211    pub fn spiceproxy(&self) -> spiceproxy::SpiceproxyClient<T> {
212        spiceproxy::SpiceproxyClient::<T>::new(self.client.clone(), &self.path)
213    }
214}
215impl<T> VmidClient<T>
216where
217    T: crate::client::Client,
218{
219    pub fn status(&self) -> status::StatusClient<T> {
220        status::StatusClient::<T>::new(self.client.clone(), &self.path)
221    }
222}
223impl<T> VmidClient<T>
224where
225    T: crate::client::Client,
226{
227    pub fn sendkey(&self) -> sendkey::SendkeyClient<T> {
228        sendkey::SendkeyClient::<T>::new(self.client.clone(), &self.path)
229    }
230}
231impl<T> VmidClient<T>
232where
233    T: crate::client::Client,
234{
235    pub fn feature(&self) -> feature::FeatureClient<T> {
236        feature::FeatureClient::<T>::new(self.client.clone(), &self.path)
237    }
238}
239impl<T> VmidClient<T>
240where
241    T: crate::client::Client,
242{
243    pub fn clone(&self) -> clone::CloneClient<T> {
244        clone::CloneClient::<T>::new(self.client.clone(), &self.path)
245    }
246}
247impl<T> VmidClient<T>
248where
249    T: crate::client::Client,
250{
251    pub fn move_disk(&self) -> move_disk::MoveDiskClient<T> {
252        move_disk::MoveDiskClient::<T>::new(self.client.clone(), &self.path)
253    }
254}
255impl<T> VmidClient<T>
256where
257    T: crate::client::Client,
258{
259    pub fn migrate(&self) -> migrate::MigrateClient<T> {
260        migrate::MigrateClient::<T>::new(self.client.clone(), &self.path)
261    }
262}
263impl<T> VmidClient<T>
264where
265    T: crate::client::Client,
266{
267    pub fn remote_migrate(&self) -> remote_migrate::RemoteMigrateClient<T> {
268        remote_migrate::RemoteMigrateClient::<T>::new(self.client.clone(), &self.path)
269    }
270}
271impl<T> VmidClient<T>
272where
273    T: crate::client::Client,
274{
275    pub fn monitor(&self) -> monitor::MonitorClient<T> {
276        monitor::MonitorClient::<T>::new(self.client.clone(), &self.path)
277    }
278}
279impl<T> VmidClient<T>
280where
281    T: crate::client::Client,
282{
283    pub fn resize(&self) -> resize::ResizeClient<T> {
284        resize::ResizeClient::<T>::new(self.client.clone(), &self.path)
285    }
286}
287impl<T> VmidClient<T>
288where
289    T: crate::client::Client,
290{
291    pub fn snapshot(&self) -> snapshot::SnapshotClient<T> {
292        snapshot::SnapshotClient::<T>::new(self.client.clone(), &self.path)
293    }
294}
295impl<T> VmidClient<T>
296where
297    T: crate::client::Client,
298{
299    pub fn template(&self) -> template::TemplateClient<T> {
300        template::TemplateClient::<T>::new(self.client.clone(), &self.path)
301    }
302}
303impl<T> VmidClient<T>
304where
305    T: crate::client::Client,
306{
307    pub fn mtunnel(&self) -> mtunnel::MtunnelClient<T> {
308        mtunnel::MtunnelClient::<T>::new(self.client.clone(), &self.path)
309    }
310}
311impl<T> VmidClient<T>
312where
313    T: crate::client::Client,
314{
315    pub fn mtunnelwebsocket(&self) -> mtunnelwebsocket::MtunnelwebsocketClient<T> {
316        mtunnelwebsocket::MtunnelwebsocketClient::<T>::new(self.client.clone(), &self.path)
317    }
318}
319impl<T> VmidClient<T>
320where
321    T: crate::client::Client,
322{
323    pub fn dbus_vmstate(&self) -> dbus_vmstate::DbusVmstateClient<T> {
324        dbus_vmstate::DbusVmstateClient::<T>::new(self.client.clone(), &self.path)
325    }
326}