Skip to main content

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

1pub mod clone;
2pub mod config;
3pub mod feature;
4pub mod firewall;
5pub mod interfaces;
6pub mod migrate;
7pub mod move_volume;
8pub mod mtunnel;
9pub mod mtunnelwebsocket;
10pub mod pending;
11pub mod remote_migrate;
12pub mod resize;
13pub mod rrd;
14pub mod rrddata;
15pub mod snapshot;
16pub mod spiceproxy;
17pub mod status;
18pub mod template;
19pub mod termproxy;
20pub mod vncproxy;
21pub mod vncwebsocket;
22#[derive(Debug, Clone)]
23pub struct VmidClient<T> {
24    client: T,
25    path: String,
26}
27impl<T> VmidClient<T>
28where
29    T: crate::client::Client,
30{
31    pub fn new(client: T, parent_path: &str, vmid: crate::types::VmId) -> Self {
32        Self {
33            client,
34            path: format!("{}/{}", parent_path, vmid),
35        }
36    }
37}
38impl<T> VmidClient<T>
39where
40    T: crate::client::Client,
41{
42    #[doc = "Destroy the container (also delete all uses files)."]
43    #[doc = ""]
44    #[doc = "Permission check: perm(\"/vms/{vmid}\", [\"VM.Allocate\"])"]
45    pub async fn delete(&self, params: DeleteParams) -> Result<String, T::Error> {
46        let path = self.path.to_string();
47        self.client.delete(&path, &params).await
48    }
49}
50impl<T> VmidClient<T>
51where
52    T: crate::client::Client,
53{
54    #[doc = "Directory index"]
55    #[doc = ""]
56    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
57        let path = self.path.to_string();
58        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
59        Ok(optional_vec.unwrap_or_default())
60    }
61}
62#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
63pub struct DeleteParams {
64    #[serde(rename = "destroy-unreferenced-disks")]
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 = "If set, destroy additionally all disks with the VMID from all enabled storages which are not referenced in the config."]
71    #[doc = ""]
72    pub destroy_unreferenced_disks: Option<bool>,
73    #[serde(
74        serialize_with = "crate::types::serialize_bool_optional",
75        deserialize_with = "crate::types::deserialize_bool_optional"
76    )]
77    #[serde(skip_serializing_if = "Option::is_none", default)]
78    #[doc = "Force destroy, even if running."]
79    #[doc = ""]
80    pub force: Option<bool>,
81    #[serde(
82        serialize_with = "crate::types::serialize_bool_optional",
83        deserialize_with = "crate::types::deserialize_bool_optional"
84    )]
85    #[serde(skip_serializing_if = "Option::is_none", default)]
86    #[doc = "Remove container from all related configurations. For example, backup jobs, replication jobs or HA. Related ACLs and Firewall entries will *always* be removed."]
87    #[doc = ""]
88    pub purge: Option<bool>,
89    #[serde(
90        flatten,
91        default,
92        skip_serializing_if = "::std::collections::HashMap::is_empty"
93    )]
94    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
95}
96impl GetOutputItems {
97    pub fn new(subdir: String) -> Self {
98        Self {
99            subdir,
100            additional_properties: ::std::default::Default::default(),
101        }
102    }
103}
104#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
105pub struct GetOutputItems {
106    pub subdir: String,
107    #[serde(
108        flatten,
109        default,
110        skip_serializing_if = "::std::collections::HashMap::is_empty"
111    )]
112    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
113}
114impl<T> VmidClient<T>
115where
116    T: crate::client::Client,
117{
118    pub fn config(&self) -> config::ConfigClient<T> {
119        config::ConfigClient::<T>::new(self.client.clone(), &self.path)
120    }
121}
122impl<T> VmidClient<T>
123where
124    T: crate::client::Client,
125{
126    pub fn status(&self) -> status::StatusClient<T> {
127        status::StatusClient::<T>::new(self.client.clone(), &self.path)
128    }
129}
130impl<T> VmidClient<T>
131where
132    T: crate::client::Client,
133{
134    pub fn snapshot(&self) -> snapshot::SnapshotClient<T> {
135        snapshot::SnapshotClient::<T>::new(self.client.clone(), &self.path)
136    }
137}
138impl<T> VmidClient<T>
139where
140    T: crate::client::Client,
141{
142    pub fn firewall(&self) -> firewall::FirewallClient<T> {
143        firewall::FirewallClient::<T>::new(self.client.clone(), &self.path)
144    }
145}
146impl<T> VmidClient<T>
147where
148    T: crate::client::Client,
149{
150    pub fn rrd(&self) -> rrd::RrdClient<T> {
151        rrd::RrdClient::<T>::new(self.client.clone(), &self.path)
152    }
153}
154impl<T> VmidClient<T>
155where
156    T: crate::client::Client,
157{
158    pub fn rrddata(&self) -> rrddata::RrddataClient<T> {
159        rrddata::RrddataClient::<T>::new(self.client.clone(), &self.path)
160    }
161}
162impl<T> VmidClient<T>
163where
164    T: crate::client::Client,
165{
166    pub fn vncproxy(&self) -> vncproxy::VncproxyClient<T> {
167        vncproxy::VncproxyClient::<T>::new(self.client.clone(), &self.path)
168    }
169}
170impl<T> VmidClient<T>
171where
172    T: crate::client::Client,
173{
174    pub fn termproxy(&self) -> termproxy::TermproxyClient<T> {
175        termproxy::TermproxyClient::<T>::new(self.client.clone(), &self.path)
176    }
177}
178impl<T> VmidClient<T>
179where
180    T: crate::client::Client,
181{
182    pub fn vncwebsocket(&self) -> vncwebsocket::VncwebsocketClient<T> {
183        vncwebsocket::VncwebsocketClient::<T>::new(self.client.clone(), &self.path)
184    }
185}
186impl<T> VmidClient<T>
187where
188    T: crate::client::Client,
189{
190    pub fn spiceproxy(&self) -> spiceproxy::SpiceproxyClient<T> {
191        spiceproxy::SpiceproxyClient::<T>::new(self.client.clone(), &self.path)
192    }
193}
194impl<T> VmidClient<T>
195where
196    T: crate::client::Client,
197{
198    pub fn remote_migrate(&self) -> remote_migrate::RemoteMigrateClient<T> {
199        remote_migrate::RemoteMigrateClient::<T>::new(self.client.clone(), &self.path)
200    }
201}
202impl<T> VmidClient<T>
203where
204    T: crate::client::Client,
205{
206    pub fn migrate(&self) -> migrate::MigrateClient<T> {
207        migrate::MigrateClient::<T>::new(self.client.clone(), &self.path)
208    }
209}
210impl<T> VmidClient<T>
211where
212    T: crate::client::Client,
213{
214    pub fn feature(&self) -> feature::FeatureClient<T> {
215        feature::FeatureClient::<T>::new(self.client.clone(), &self.path)
216    }
217}
218impl<T> VmidClient<T>
219where
220    T: crate::client::Client,
221{
222    pub fn template(&self) -> template::TemplateClient<T> {
223        template::TemplateClient::<T>::new(self.client.clone(), &self.path)
224    }
225}
226impl<T> VmidClient<T>
227where
228    T: crate::client::Client,
229{
230    pub fn clone(&self) -> clone::CloneClient<T> {
231        clone::CloneClient::<T>::new(self.client.clone(), &self.path)
232    }
233}
234impl<T> VmidClient<T>
235where
236    T: crate::client::Client,
237{
238    pub fn resize(&self) -> resize::ResizeClient<T> {
239        resize::ResizeClient::<T>::new(self.client.clone(), &self.path)
240    }
241}
242impl<T> VmidClient<T>
243where
244    T: crate::client::Client,
245{
246    pub fn move_volume(&self) -> move_volume::MoveVolumeClient<T> {
247        move_volume::MoveVolumeClient::<T>::new(self.client.clone(), &self.path)
248    }
249}
250impl<T> VmidClient<T>
251where
252    T: crate::client::Client,
253{
254    pub fn pending(&self) -> pending::PendingClient<T> {
255        pending::PendingClient::<T>::new(self.client.clone(), &self.path)
256    }
257}
258impl<T> VmidClient<T>
259where
260    T: crate::client::Client,
261{
262    pub fn interfaces(&self) -> interfaces::InterfacesClient<T> {
263        interfaces::InterfacesClient::<T>::new(self.client.clone(), &self.path)
264    }
265}
266impl<T> VmidClient<T>
267where
268    T: crate::client::Client,
269{
270    pub fn mtunnel(&self) -> mtunnel::MtunnelClient<T> {
271        mtunnel::MtunnelClient::<T>::new(self.client.clone(), &self.path)
272    }
273}
274impl<T> VmidClient<T>
275where
276    T: crate::client::Client,
277{
278    pub fn mtunnelwebsocket(&self) -> mtunnelwebsocket::MtunnelwebsocketClient<T> {
279        mtunnelwebsocket::MtunnelwebsocketClient::<T>::new(self.client.clone(), &self.path)
280    }
281}