1pub mod vmid;
2#[derive(Debug, Clone)]
3pub struct QemuClient<T> {
4 client: T,
5 path: String,
6}
7impl<T> QemuClient<T>
8where
9 T: crate::client::Client,
10{
11 pub fn new(client: T, parent_path: &str) -> Self {
12 Self {
13 client,
14 path: format!("{}{}", parent_path, "/qemu"),
15 }
16 }
17}
18impl<T> QemuClient<T>
19where
20 T: crate::client::Client,
21{
22 #[doc = "Virtual machine index (per node)."]
23 #[doc = ""]
24 #[doc = "Only list VMs where you have VM.Audit permissions on /vms/\\<vmid\\>."]
25 pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
26 let path = self.path.to_string();
27 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, ¶ms).await?;
28 Ok(optional_vec.unwrap_or_default())
29 }
30}
31impl<T> QemuClient<T>
32where
33 T: crate::client::Client,
34{
35 #[doc = "Create or restore a virtual machine."]
36 #[doc = ""]
37 #[doc = "You need 'VM.Allocate' permissions on /vms/{vmid} or on the VM pool /pool/{pool}. For restore (option 'archive'), it is enough if the user has 'VM.Backup' permission and the VM already exists. If you create disks you need 'Datastore.AllocateSpace' on any used storage.If you use a bridge/vlan, you need 'SDN.Use' on any used bridge/vlan."]
38 pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
39 let path = self.path.to_string();
40 self.client.post(&path, ¶ms).await
41 }
42}
43impl GetOutputItems {
44 pub fn new(status: Status, vmid: VmidInt) -> Self {
45 Self {
46 status,
47 vmid,
48 cpu: ::std::default::Default::default(),
49 cpus: ::std::default::Default::default(),
50 diskread: ::std::default::Default::default(),
51 diskwrite: ::std::default::Default::default(),
52 lock: ::std::default::Default::default(),
53 maxdisk: ::std::default::Default::default(),
54 maxmem: ::std::default::Default::default(),
55 mem: ::std::default::Default::default(),
56 memhost: ::std::default::Default::default(),
57 name: ::std::default::Default::default(),
58 netin: ::std::default::Default::default(),
59 netout: ::std::default::Default::default(),
60 pid: ::std::default::Default::default(),
61 pressurecpufull: ::std::default::Default::default(),
62 pressurecpusome: ::std::default::Default::default(),
63 pressureiofull: ::std::default::Default::default(),
64 pressureiosome: ::std::default::Default::default(),
65 pressurememoryfull: ::std::default::Default::default(),
66 pressurememorysome: ::std::default::Default::default(),
67 qmpstatus: ::std::default::Default::default(),
68 running_machine: ::std::default::Default::default(),
69 running_qemu: ::std::default::Default::default(),
70 serial: ::std::default::Default::default(),
71 tags: ::std::default::Default::default(),
72 template: ::std::default::Default::default(),
73 uptime: ::std::default::Default::default(),
74 additional_properties: ::std::default::Default::default(),
75 }
76 }
77}
78#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
79pub struct GetOutputItems {
80 #[serde(
81 serialize_with = "crate::types::serialize_number_optional",
82 deserialize_with = "crate::types::deserialize_number_optional"
83 )]
84 #[serde(skip_serializing_if = "Option::is_none", default)]
85 #[doc = "Current CPU usage."]
86 #[doc = ""]
87 pub cpu: Option<f64>,
88 #[serde(
89 serialize_with = "crate::types::serialize_number_optional",
90 deserialize_with = "crate::types::deserialize_number_optional"
91 )]
92 #[serde(skip_serializing_if = "Option::is_none", default)]
93 #[doc = "Maximum usable CPUs."]
94 #[doc = ""]
95 pub cpus: Option<f64>,
96 #[serde(
97 serialize_with = "crate::types::serialize_int_optional",
98 deserialize_with = "crate::types::deserialize_int_optional"
99 )]
100 #[serde(skip_serializing_if = "Option::is_none", default)]
101 #[doc = "The amount of bytes the guest read from it's block devices since the guest was started. (Note: This info is not available for all storage types.)"]
102 #[doc = ""]
103 pub diskread: Option<i64>,
104 #[serde(
105 serialize_with = "crate::types::serialize_int_optional",
106 deserialize_with = "crate::types::deserialize_int_optional"
107 )]
108 #[serde(skip_serializing_if = "Option::is_none", default)]
109 #[doc = "The amount of bytes the guest wrote from it's block devices since the guest was started. (Note: This info is not available for all storage types.)"]
110 #[doc = ""]
111 pub diskwrite: Option<i64>,
112 #[serde(skip_serializing_if = "Option::is_none", default)]
113 #[doc = "The current config lock, if any."]
114 #[doc = ""]
115 pub lock: Option<String>,
116 #[serde(
117 serialize_with = "crate::types::serialize_int_optional",
118 deserialize_with = "crate::types::deserialize_int_optional"
119 )]
120 #[serde(skip_serializing_if = "Option::is_none", default)]
121 #[doc = "Root disk size in bytes."]
122 #[doc = ""]
123 pub maxdisk: Option<i64>,
124 #[serde(
125 serialize_with = "crate::types::serialize_int_optional",
126 deserialize_with = "crate::types::deserialize_int_optional"
127 )]
128 #[serde(skip_serializing_if = "Option::is_none", default)]
129 #[doc = "Maximum memory in bytes."]
130 #[doc = ""]
131 pub maxmem: Option<i64>,
132 #[serde(
133 serialize_with = "crate::types::serialize_int_optional",
134 deserialize_with = "crate::types::deserialize_int_optional"
135 )]
136 #[serde(skip_serializing_if = "Option::is_none", default)]
137 #[doc = "Currently used memory in bytes."]
138 #[doc = ""]
139 pub mem: Option<i64>,
140 #[serde(
141 serialize_with = "crate::types::serialize_int_optional",
142 deserialize_with = "crate::types::deserialize_int_optional"
143 )]
144 #[serde(skip_serializing_if = "Option::is_none", default)]
145 #[doc = "Current memory usage on the host."]
146 #[doc = ""]
147 pub memhost: Option<i64>,
148 #[serde(skip_serializing_if = "Option::is_none", default)]
149 #[doc = "VM (host)name."]
150 #[doc = ""]
151 pub name: Option<String>,
152 #[serde(
153 serialize_with = "crate::types::serialize_int_optional",
154 deserialize_with = "crate::types::deserialize_int_optional"
155 )]
156 #[serde(skip_serializing_if = "Option::is_none", default)]
157 #[doc = "The amount of traffic in bytes that was sent to the guest over the network since it was started."]
158 #[doc = ""]
159 pub netin: Option<i64>,
160 #[serde(
161 serialize_with = "crate::types::serialize_int_optional",
162 deserialize_with = "crate::types::deserialize_int_optional"
163 )]
164 #[serde(skip_serializing_if = "Option::is_none", default)]
165 #[doc = "The amount of traffic in bytes that was sent from the guest over the network since it was started."]
166 #[doc = ""]
167 pub netout: Option<i64>,
168 #[serde(
169 serialize_with = "crate::types::serialize_int_optional",
170 deserialize_with = "crate::types::deserialize_int_optional"
171 )]
172 #[serde(skip_serializing_if = "Option::is_none", default)]
173 #[doc = "PID of the QEMU process, if the VM is running."]
174 #[doc = ""]
175 pub pid: Option<i64>,
176 #[serde(
177 serialize_with = "crate::types::serialize_number_optional",
178 deserialize_with = "crate::types::deserialize_number_optional"
179 )]
180 #[serde(skip_serializing_if = "Option::is_none", default)]
181 #[doc = "CPU Full pressure stall average over the last 10 seconds."]
182 #[doc = ""]
183 pub pressurecpufull: Option<f64>,
184 #[serde(
185 serialize_with = "crate::types::serialize_number_optional",
186 deserialize_with = "crate::types::deserialize_number_optional"
187 )]
188 #[serde(skip_serializing_if = "Option::is_none", default)]
189 #[doc = "CPU Some pressure stall average over the last 10 seconds."]
190 #[doc = ""]
191 pub pressurecpusome: Option<f64>,
192 #[serde(
193 serialize_with = "crate::types::serialize_number_optional",
194 deserialize_with = "crate::types::deserialize_number_optional"
195 )]
196 #[serde(skip_serializing_if = "Option::is_none", default)]
197 #[doc = "IO Full pressure stall average over the last 10 seconds."]
198 #[doc = ""]
199 pub pressureiofull: Option<f64>,
200 #[serde(
201 serialize_with = "crate::types::serialize_number_optional",
202 deserialize_with = "crate::types::deserialize_number_optional"
203 )]
204 #[serde(skip_serializing_if = "Option::is_none", default)]
205 #[doc = "IO Some pressure stall average over the last 10 seconds."]
206 #[doc = ""]
207 pub pressureiosome: Option<f64>,
208 #[serde(
209 serialize_with = "crate::types::serialize_number_optional",
210 deserialize_with = "crate::types::deserialize_number_optional"
211 )]
212 #[serde(skip_serializing_if = "Option::is_none", default)]
213 #[doc = "Memory Full pressure stall average over the last 10 seconds."]
214 #[doc = ""]
215 pub pressurememoryfull: Option<f64>,
216 #[serde(
217 serialize_with = "crate::types::serialize_number_optional",
218 deserialize_with = "crate::types::deserialize_number_optional"
219 )]
220 #[serde(skip_serializing_if = "Option::is_none", default)]
221 #[doc = "Memory Some pressure stall average over the last 10 seconds."]
222 #[doc = ""]
223 pub pressurememorysome: Option<f64>,
224 #[serde(skip_serializing_if = "Option::is_none", default)]
225 #[doc = "VM run state from the 'query-status' QMP monitor command."]
226 #[doc = ""]
227 pub qmpstatus: Option<String>,
228 #[serde(rename = "running-machine")]
229 #[serde(skip_serializing_if = "Option::is_none", default)]
230 #[doc = "The currently running machine type (if running)."]
231 #[doc = ""]
232 pub running_machine: Option<String>,
233 #[serde(rename = "running-qemu")]
234 #[serde(skip_serializing_if = "Option::is_none", default)]
235 #[doc = "The QEMU version the VM is currently using (if running)."]
236 #[doc = ""]
237 pub running_qemu: Option<String>,
238 #[serde(
239 serialize_with = "crate::types::serialize_bool_optional",
240 deserialize_with = "crate::types::deserialize_bool_optional"
241 )]
242 #[serde(skip_serializing_if = "Option::is_none", default)]
243 #[doc = "Guest has serial device configured."]
244 #[doc = ""]
245 pub serial: Option<bool>,
246 #[doc = "QEMU process status."]
247 #[doc = ""]
248 pub status: Status,
249 #[serde(skip_serializing_if = "Option::is_none", default)]
250 #[doc = "The current configured tags, if any"]
251 #[doc = ""]
252 pub tags: Option<String>,
253 #[serde(
254 serialize_with = "crate::types::serialize_bool_optional",
255 deserialize_with = "crate::types::deserialize_bool_optional"
256 )]
257 #[serde(skip_serializing_if = "Option::is_none", default)]
258 #[doc = "Determines if the guest is a template."]
259 #[doc = ""]
260 pub template: Option<bool>,
261 #[serde(
262 serialize_with = "crate::types::serialize_int_optional",
263 deserialize_with = "crate::types::deserialize_int_optional"
264 )]
265 #[serde(skip_serializing_if = "Option::is_none", default)]
266 #[doc = "Uptime in seconds."]
267 #[doc = ""]
268 pub uptime: Option<i64>,
269 #[doc = "The (unique) ID of the VM."]
270 #[doc = ""]
271 pub vmid: VmidInt,
272 #[serde(
273 flatten,
274 default,
275 skip_serializing_if = "::std::collections::HashMap::is_empty"
276 )]
277 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
278}
279#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
280pub struct GetParams {
281 #[serde(
282 serialize_with = "crate::types::serialize_bool_optional",
283 deserialize_with = "crate::types::deserialize_bool_optional"
284 )]
285 #[serde(skip_serializing_if = "Option::is_none", default)]
286 #[doc = "Determine the full status of active VMs."]
287 #[doc = ""]
288 pub full: Option<bool>,
289 #[serde(
290 flatten,
291 default,
292 skip_serializing_if = "::std::collections::HashMap::is_empty"
293 )]
294 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
295}
296impl PostParams {
297 pub fn new(vmid: VmidInt) -> Self {
298 Self {
299 vmid,
300 acpi: ::std::default::Default::default(),
301 affinity: ::std::default::Default::default(),
302 agent: ::std::default::Default::default(),
303 allow_ksm: ::std::default::Default::default(),
304 amd_sev: ::std::default::Default::default(),
305 arch: ::std::default::Default::default(),
306 archive: ::std::default::Default::default(),
307 args: ::std::default::Default::default(),
308 audio0: ::std::default::Default::default(),
309 autostart: ::std::default::Default::default(),
310 balloon: ::std::default::Default::default(),
311 bios: ::std::default::Default::default(),
312 boot: ::std::default::Default::default(),
313 bootdisk: ::std::default::Default::default(),
314 bwlimit: ::std::default::Default::default(),
315 cdrom: ::std::default::Default::default(),
316 cicustom: ::std::default::Default::default(),
317 cipassword: ::std::default::Default::default(),
318 citype: ::std::default::Default::default(),
319 ciupgrade: ::std::default::Default::default(),
320 ciuser: ::std::default::Default::default(),
321 cores: ::std::default::Default::default(),
322 cpu: ::std::default::Default::default(),
323 cpulimit: ::std::default::Default::default(),
324 cpuunits: ::std::default::Default::default(),
325 description: ::std::default::Default::default(),
326 efidisk0: ::std::default::Default::default(),
327 force: ::std::default::Default::default(),
328 freeze: ::std::default::Default::default(),
329 ha_managed: ::std::default::Default::default(),
330 hookscript: ::std::default::Default::default(),
331 hostpcis: ::std::default::Default::default(),
332 hotplug: ::std::default::Default::default(),
333 hugepages: ::std::default::Default::default(),
334 ides: ::std::default::Default::default(),
335 import_working_storage: ::std::default::Default::default(),
336 intel_tdx: ::std::default::Default::default(),
337 ipconfigs: ::std::default::Default::default(),
338 ivshmem: ::std::default::Default::default(),
339 keephugepages: ::std::default::Default::default(),
340 keyboard: ::std::default::Default::default(),
341 kvm: ::std::default::Default::default(),
342 live_restore: ::std::default::Default::default(),
343 localtime: ::std::default::Default::default(),
344 lock: ::std::default::Default::default(),
345 machine: ::std::default::Default::default(),
346 memory: ::std::default::Default::default(),
347 migrate_downtime: ::std::default::Default::default(),
348 migrate_speed: ::std::default::Default::default(),
349 name: ::std::default::Default::default(),
350 nameserver: ::std::default::Default::default(),
351 nets: ::std::default::Default::default(),
352 numa: ::std::default::Default::default(),
353 numas: ::std::default::Default::default(),
354 onboot: ::std::default::Default::default(),
355 ostype: ::std::default::Default::default(),
356 parallels: ::std::default::Default::default(),
357 pool: ::std::default::Default::default(),
358 protection: ::std::default::Default::default(),
359 reboot: ::std::default::Default::default(),
360 rng0: ::std::default::Default::default(),
361 satas: ::std::default::Default::default(),
362 scsis: ::std::default::Default::default(),
363 scsihw: ::std::default::Default::default(),
364 searchdomain: ::std::default::Default::default(),
365 serials: ::std::default::Default::default(),
366 shares: ::std::default::Default::default(),
367 smbios1: ::std::default::Default::default(),
368 smp: ::std::default::Default::default(),
369 sockets: ::std::default::Default::default(),
370 spice_enhancements: ::std::default::Default::default(),
371 sshkeys: ::std::default::Default::default(),
372 start: ::std::default::Default::default(),
373 startdate: ::std::default::Default::default(),
374 startup: ::std::default::Default::default(),
375 storage: ::std::default::Default::default(),
376 tablet: ::std::default::Default::default(),
377 tags: ::std::default::Default::default(),
378 tdf: ::std::default::Default::default(),
379 template: ::std::default::Default::default(),
380 tpmstate0: ::std::default::Default::default(),
381 unique: ::std::default::Default::default(),
382 unuseds: ::std::default::Default::default(),
383 usbs: ::std::default::Default::default(),
384 vcpus: ::std::default::Default::default(),
385 vga: ::std::default::Default::default(),
386 virtios: ::std::default::Default::default(),
387 virtiofss: ::std::default::Default::default(),
388 vmgenid: ::std::default::Default::default(),
389 vmstatestorage: ::std::default::Default::default(),
390 watchdog: ::std::default::Default::default(),
391 additional_properties: ::std::default::Default::default(),
392 }
393 }
394}
395#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
396pub struct PostParams {
397 #[serde(
398 serialize_with = "crate::types::serialize_bool_optional",
399 deserialize_with = "crate::types::deserialize_bool_optional"
400 )]
401 #[serde(skip_serializing_if = "Option::is_none", default)]
402 #[doc = "Enable/disable ACPI."]
403 #[doc = ""]
404 pub acpi: Option<bool>,
405 #[serde(skip_serializing_if = "Option::is_none", default)]
406 #[doc = "List of host cores used to execute guest processes, for example: 0,5,8-11"]
407 #[doc = ""]
408 pub affinity: Option<String>,
409 #[serde(skip_serializing_if = "Option::is_none", default)]
410 #[doc = "Enable/disable communication with the QEMU Guest Agent and its properties."]
411 #[doc = ""]
412 pub agent: Option<String>,
413 #[serde(rename = "allow-ksm")]
414 #[serde(
415 serialize_with = "crate::types::serialize_bool_optional",
416 deserialize_with = "crate::types::deserialize_bool_optional"
417 )]
418 #[serde(skip_serializing_if = "Option::is_none", default)]
419 #[doc = "Allow memory pages of this guest to be merged via KSM (Kernel Samepage Merging)."]
420 #[doc = ""]
421 pub allow_ksm: Option<bool>,
422 #[serde(rename = "amd-sev")]
423 #[serde(skip_serializing_if = "Option::is_none", default)]
424 #[doc = "Secure Encrypted Virtualization (SEV) features by AMD CPUs"]
425 #[doc = ""]
426 pub amd_sev: Option<String>,
427 #[serde(skip_serializing_if = "Option::is_none", default)]
428 #[doc = "Virtual processor architecture. Defaults to the host."]
429 #[doc = ""]
430 pub arch: Option<Arch>,
431 #[serde(skip_serializing_if = "Option::is_none", default)]
432 #[doc = "The backup archive. Either the file system path to a .tar or .vma file (use '-' to pipe data from stdin) or a proxmox storage backup volume identifier."]
433 #[doc = ""]
434 pub archive: Option<ArchiveStr>,
435 #[serde(skip_serializing_if = "Option::is_none", default)]
436 #[doc = "Arbitrary arguments passed to kvm."]
437 #[doc = ""]
438 #[doc = "Arbitrary arguments passed to kvm, for example:"]
439 #[doc = ""]
440 #[doc = "args: -no-reboot -smbios 'type=0,vendor=FOO'"]
441 #[doc = ""]
442 #[doc = "NOTE: this option is for experts only."]
443 #[doc = ""]
444 pub args: Option<String>,
445 #[serde(skip_serializing_if = "Option::is_none", default)]
446 #[doc = "Configure a audio device, useful in combination with QXL/Spice."]
447 #[doc = ""]
448 pub audio0: Option<String>,
449 #[serde(
450 serialize_with = "crate::types::serialize_bool_optional",
451 deserialize_with = "crate::types::deserialize_bool_optional"
452 )]
453 #[serde(skip_serializing_if = "Option::is_none", default)]
454 #[doc = "Automatic restart after crash (currently ignored)."]
455 #[doc = ""]
456 pub autostart: Option<bool>,
457 #[serde(
458 serialize_with = "crate::types::serialize_unsigned_int_optional",
459 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
460 )]
461 #[serde(skip_serializing_if = "Option::is_none", default)]
462 #[doc = "Amount of target RAM for the VM in MiB. Using zero disables the ballon driver."]
463 #[doc = ""]
464 pub balloon: Option<u64>,
465 #[serde(skip_serializing_if = "Option::is_none", default)]
466 #[doc = "Select BIOS implementation."]
467 #[doc = ""]
468 pub bios: Option<Bios>,
469 #[serde(skip_serializing_if = "Option::is_none", default)]
470 #[doc = "Specify guest boot order. Use the 'order=' sub-property as usage with no key or 'legacy=' is deprecated."]
471 #[doc = ""]
472 pub boot: Option<String>,
473 #[serde(skip_serializing_if = "Option::is_none", default)]
474 #[doc = "Enable booting from specified disk. Deprecated: Use 'boot: order=foo;bar' instead."]
475 #[doc = ""]
476 pub bootdisk: Option<BootdiskStr>,
477 #[serde(
478 serialize_with = "crate::types::serialize_unsigned_int_optional",
479 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
480 )]
481 #[serde(skip_serializing_if = "Option::is_none", default)]
482 #[doc = "Override I/O bandwidth limit (in KiB/s)."]
483 #[doc = ""]
484 pub bwlimit: Option<u64>,
485 #[serde(skip_serializing_if = "Option::is_none", default)]
486 #[doc = "This is an alias for option -ide2"]
487 #[doc = ""]
488 pub cdrom: Option<String>,
489 #[serde(skip_serializing_if = "Option::is_none", default)]
490 #[doc = "cloud-init: Specify custom files to replace the automatically generated ones at start."]
491 #[doc = ""]
492 pub cicustom: Option<String>,
493 #[serde(skip_serializing_if = "Option::is_none", default)]
494 #[doc = "cloud-init: Password to assign the user. Using this is generally not recommended. Use ssh keys instead. Also note that older cloud-init versions do not support hashed passwords."]
495 #[doc = ""]
496 pub cipassword: Option<String>,
497 #[serde(skip_serializing_if = "Option::is_none", default)]
498 #[doc = "Specifies the cloud-init configuration format. The default depends on the configured operating system type (`ostype`. We use the `nocloud` format for Linux, and `configdrive2` for windows."]
499 #[doc = ""]
500 pub citype: Option<Citype>,
501 #[serde(
502 serialize_with = "crate::types::serialize_bool_optional",
503 deserialize_with = "crate::types::deserialize_bool_optional"
504 )]
505 #[serde(skip_serializing_if = "Option::is_none", default)]
506 #[doc = "cloud-init: do an automatic package upgrade after the first boot."]
507 #[doc = ""]
508 pub ciupgrade: Option<bool>,
509 #[serde(skip_serializing_if = "Option::is_none", default)]
510 #[doc = "cloud-init: User name to change ssh keys and password for instead of the image's configured default user."]
511 #[doc = ""]
512 pub ciuser: Option<String>,
513 #[serde(
514 serialize_with = "crate::types::serialize_non_zero_pos_int_optional",
515 deserialize_with = "crate::types::deserialize_non_zero_pos_int_optional"
516 )]
517 #[serde(skip_serializing_if = "Option::is_none", default)]
518 #[doc = "The number of cores per socket."]
519 #[doc = ""]
520 pub cores: Option<std::num::NonZeroU64>,
521 #[serde(skip_serializing_if = "Option::is_none", default)]
522 #[doc = "Emulated CPU type."]
523 #[doc = ""]
524 pub cpu: Option<String>,
525 #[serde(skip_serializing_if = "Option::is_none", default)]
526 #[doc = "Limit of CPU usage."]
527 #[doc = ""]
528 #[doc = "Limit of CPU usage."]
529 #[doc = ""]
530 #[doc = "NOTE: If the computer has 2 CPUs, it has total of '2' CPU time. Value '0' indicates no CPU limit."]
531 #[doc = ""]
532 pub cpulimit: Option<CpulimitNum>,
533 #[serde(skip_serializing_if = "Option::is_none", default)]
534 #[doc = "CPU weight for a VM, will be clamped to \\\\[1, 10000\\\\] in cgroup v2."]
535 #[doc = ""]
536 #[doc = "CPU weight for a VM. Argument is used in the kernel fair scheduler. The larger the number is, the more CPU time this VM gets. Number is relative to weights of all the other running VMs."]
537 #[doc = ""]
538 pub cpuunits: Option<CpuunitsInt>,
539 #[serde(skip_serializing_if = "Option::is_none", default)]
540 #[doc = "Description for the VM. Shown in the web-interface VM's summary. This is saved as comment inside the configuration file."]
541 #[doc = ""]
542 pub description: Option<DescriptionStr>,
543 #[serde(skip_serializing_if = "Option::is_none", default)]
544 #[doc = "Configure a disk for storing EFI vars. Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Note that SIZE_IN_GiB is ignored here and that the default EFI vars are copied to the volume instead. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume."]
545 #[doc = ""]
546 pub efidisk0: Option<String>,
547 #[serde(
548 serialize_with = "crate::types::serialize_bool_optional",
549 deserialize_with = "crate::types::deserialize_bool_optional"
550 )]
551 #[serde(skip_serializing_if = "Option::is_none", default)]
552 #[doc = "Allow to overwrite existing VM."]
553 #[doc = ""]
554 pub force: Option<bool>,
555 #[serde(
556 serialize_with = "crate::types::serialize_bool_optional",
557 deserialize_with = "crate::types::deserialize_bool_optional"
558 )]
559 #[serde(skip_serializing_if = "Option::is_none", default)]
560 #[doc = "Freeze CPU at startup (use 'c' monitor command to start execution)."]
561 #[doc = ""]
562 pub freeze: Option<bool>,
563 #[serde(rename = "ha-managed")]
564 #[serde(
565 serialize_with = "crate::types::serialize_bool_optional",
566 deserialize_with = "crate::types::deserialize_bool_optional"
567 )]
568 #[serde(skip_serializing_if = "Option::is_none", default)]
569 #[doc = "Add the VM as a HA resource after it was created."]
570 #[doc = ""]
571 pub ha_managed: Option<bool>,
572 #[serde(skip_serializing_if = "Option::is_none", default)]
573 #[doc = "Script that will be executed during various steps in the vms lifetime."]
574 #[doc = ""]
575 pub hookscript: Option<String>,
576 #[serde(rename = "hostpci[n]")]
577 #[serde(
578 serialize_with = "crate::types::serialize_multi::<NumberedHostpcis, _>",
579 deserialize_with = "crate::types::deserialize_multi::<NumberedHostpcis, _>"
580 )]
581 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
582 #[serde(flatten)]
583 #[doc = "Map host PCI devices into guest."]
584 #[doc = ""]
585 #[doc = "Map host PCI devices into guest."]
586 #[doc = ""]
587 #[doc = "NOTE: This option allows direct access to host hardware. So it is no longer"]
588 #[doc = ""]
589 #[doc = "possible to migrate such machines - use with special care."]
590 #[doc = ""]
591 #[doc = "CAUTION: Experimental! User reported problems with this option."]
592 #[doc = ""]
593 pub hostpcis: ::std::collections::HashMap<u32, String>,
594 #[serde(skip_serializing_if = "Option::is_none", default)]
595 #[doc = "Selectively enable hotplug features. This is a comma separated list of hotplug features: 'network', 'disk', 'cpu', 'memory', 'usb' and 'cloudinit'. Use '0' to disable hotplug completely. Using '1' as value is an alias for the default `network,disk,usb`. USB hotplugging is possible for guests with machine version \\\\>= 7.1 and ostype l26 or windows \\\\> 7."]
596 #[doc = ""]
597 pub hotplug: Option<String>,
598 #[serde(skip_serializing_if = "Option::is_none", default)]
599 #[doc = "Enables hugepages memory."]
600 #[doc = ""]
601 #[doc = "Sets the size of hugepages in MiB. If the value is set to 'any' then 1 GiB hugepages will be used if possible, otherwise the size will fall back to 2 MiB."]
602 #[doc = ""]
603 pub hugepages: Option<Hugepages>,
604 #[serde(rename = "ide[n]")]
605 #[serde(
606 serialize_with = "crate::types::serialize_multi::<NumberedIdes, _>",
607 deserialize_with = "crate::types::deserialize_multi::<NumberedIdes, _>"
608 )]
609 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
610 #[serde(flatten)]
611 #[doc = "Use volume as IDE hard disk or CD-ROM (n is 0 to 3). Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume."]
612 #[doc = ""]
613 pub ides: ::std::collections::HashMap<u32, String>,
614 #[serde(rename = "import-working-storage")]
615 #[serde(skip_serializing_if = "Option::is_none", default)]
616 #[doc = "A file-based storage with 'images' content-type enabled, which is used as an intermediary extraction storage during import. Defaults to the source storage."]
617 #[doc = ""]
618 pub import_working_storage: Option<String>,
619 #[serde(rename = "intel-tdx")]
620 #[serde(skip_serializing_if = "Option::is_none", default)]
621 #[doc = "Trusted Domain Extension (TDX) features by Intel CPUs"]
622 #[doc = ""]
623 pub intel_tdx: Option<String>,
624 #[serde(rename = "ipconfig[n]")]
625 #[serde(
626 serialize_with = "crate::types::serialize_multi::<NumberedIpconfigs, _>",
627 deserialize_with = "crate::types::deserialize_multi::<NumberedIpconfigs, _>"
628 )]
629 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
630 #[serde(flatten)]
631 #[doc = "cloud-init: Specify IP addresses and gateways for the corresponding interface."]
632 #[doc = ""]
633 #[doc = "IP addresses use CIDR notation, gateways are optional but need an IP of the same type specified."]
634 #[doc = ""]
635 #[doc = "The special string 'dhcp' can be used for IP addresses to use DHCP, in which case no explicit"]
636 #[doc = ""]
637 #[doc = "gateway should be provided."]
638 #[doc = ""]
639 #[doc = "For IPv6 the special string 'auto' can be used to use stateless autoconfiguration. This requires"]
640 #[doc = ""]
641 #[doc = "cloud-init 19.4 or newer."]
642 #[doc = ""]
643 #[doc = "If cloud-init is enabled and neither an IPv4 nor an IPv6 address is specified, it defaults to using"]
644 #[doc = ""]
645 #[doc = "dhcp on IPv4."]
646 #[doc = ""]
647 pub ipconfigs: ::std::collections::HashMap<u32, String>,
648 #[serde(skip_serializing_if = "Option::is_none", default)]
649 #[doc = "Inter-VM shared memory. Useful for direct communication between VMs, or to the host."]
650 #[doc = ""]
651 pub ivshmem: Option<String>,
652 #[serde(
653 serialize_with = "crate::types::serialize_bool_optional",
654 deserialize_with = "crate::types::deserialize_bool_optional"
655 )]
656 #[serde(skip_serializing_if = "Option::is_none", default)]
657 #[doc = "Use together with hugepages. If enabled, hugepages will not not be deleted after VM shutdown and can be used for subsequent starts."]
658 #[doc = ""]
659 pub keephugepages: Option<bool>,
660 #[serde(skip_serializing_if = "Option::is_none", default)]
661 #[doc = "Keyboard layout for VNC server. This option is generally not required and is often better handled from within the guest OS."]
662 #[doc = ""]
663 pub keyboard: Option<Keyboard>,
664 #[serde(
665 serialize_with = "crate::types::serialize_bool_optional",
666 deserialize_with = "crate::types::deserialize_bool_optional"
667 )]
668 #[serde(skip_serializing_if = "Option::is_none", default)]
669 #[doc = "Enable/disable KVM hardware virtualization."]
670 #[doc = ""]
671 pub kvm: Option<bool>,
672 #[serde(rename = "live-restore")]
673 #[serde(
674 serialize_with = "crate::types::serialize_bool_optional",
675 deserialize_with = "crate::types::deserialize_bool_optional"
676 )]
677 #[serde(skip_serializing_if = "Option::is_none", default)]
678 #[doc = "Start the VM immediately while importing or restoring in the background."]
679 #[doc = ""]
680 pub live_restore: Option<bool>,
681 #[serde(
682 serialize_with = "crate::types::serialize_bool_optional",
683 deserialize_with = "crate::types::deserialize_bool_optional"
684 )]
685 #[serde(skip_serializing_if = "Option::is_none", default)]
686 #[doc = "Set the real time clock (RTC) to local time. This is enabled by default if the `ostype` indicates a Microsoft Windows OS."]
687 #[doc = ""]
688 pub localtime: Option<bool>,
689 #[serde(skip_serializing_if = "Option::is_none", default)]
690 #[doc = "Lock/unlock the VM."]
691 #[doc = ""]
692 pub lock: Option<Lock>,
693 #[serde(skip_serializing_if = "Option::is_none", default)]
694 #[doc = "Specify the QEMU machine."]
695 #[doc = ""]
696 pub machine: Option<String>,
697 #[serde(skip_serializing_if = "Option::is_none", default)]
698 #[doc = "Memory properties."]
699 #[doc = ""]
700 pub memory: Option<String>,
701 #[serde(skip_serializing_if = "Option::is_none", default)]
702 #[doc = "Set maximum tolerated downtime (in seconds) for migrations. Should the migration not be able to converge in the very end, because too much newly dirtied RAM needs to be transferred, the limit will be increased automatically step-by-step until migration can converge."]
703 #[doc = ""]
704 pub migrate_downtime: Option<MigrateDowntimeNum>,
705 #[serde(
706 serialize_with = "crate::types::serialize_unsigned_int_optional",
707 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
708 )]
709 #[serde(skip_serializing_if = "Option::is_none", default)]
710 #[doc = "Set maximum speed (in MB/s) for migrations. Value 0 is no limit."]
711 #[doc = ""]
712 pub migrate_speed: Option<u64>,
713 #[serde(skip_serializing_if = "Option::is_none", default)]
714 #[doc = "Set a name for the VM. Only used on the configuration web interface."]
715 #[doc = ""]
716 pub name: Option<String>,
717 #[serde(skip_serializing_if = "Option::is_none", default)]
718 #[doc = "cloud-init: Sets DNS server IP address for a container. Create will automatically use the setting from the host if neither searchdomain nor nameserver are set."]
719 #[doc = ""]
720 pub nameserver: Option<String>,
721 #[serde(rename = "net[n]")]
722 #[serde(
723 serialize_with = "crate::types::serialize_multi::<NumberedNets, _>",
724 deserialize_with = "crate::types::deserialize_multi::<NumberedNets, _>"
725 )]
726 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
727 #[serde(flatten)]
728 #[doc = "Specify network devices."]
729 #[doc = ""]
730 pub nets: ::std::collections::HashMap<u32, String>,
731 #[serde(
732 serialize_with = "crate::types::serialize_bool_optional",
733 deserialize_with = "crate::types::deserialize_bool_optional"
734 )]
735 #[serde(skip_serializing_if = "Option::is_none", default)]
736 #[doc = "Enable/disable NUMA."]
737 #[doc = ""]
738 pub numa: Option<bool>,
739 #[serde(rename = "numa[n]")]
740 #[serde(
741 serialize_with = "crate::types::serialize_multi::<NumberedNumas, _>",
742 deserialize_with = "crate::types::deserialize_multi::<NumberedNumas, _>"
743 )]
744 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
745 #[serde(flatten)]
746 #[doc = "NUMA topology."]
747 #[doc = ""]
748 pub numas: ::std::collections::HashMap<u32, String>,
749 #[serde(
750 serialize_with = "crate::types::serialize_bool_optional",
751 deserialize_with = "crate::types::deserialize_bool_optional"
752 )]
753 #[serde(skip_serializing_if = "Option::is_none", default)]
754 #[doc = "Specifies whether a VM will be started during system bootup."]
755 #[doc = ""]
756 pub onboot: Option<bool>,
757 #[serde(skip_serializing_if = "Option::is_none", default)]
758 #[doc = "Specify guest operating system."]
759 #[doc = ""]
760 #[doc = "Specify guest operating system. This is used to enable special"]
761 #[doc = ""]
762 #[doc = "optimization/features for specific operating systems:"]
763 #[doc = ""]
764 #[doc = "\\\\[horizontal\\\\]"]
765 #[doc = ""]
766 #[doc = "other;; unspecified OS"]
767 #[doc = ""]
768 #[doc = "wxp;; Microsoft Windows XP"]
769 #[doc = ""]
770 #[doc = "w2k;; Microsoft Windows 2000"]
771 #[doc = ""]
772 #[doc = "w2k3;; Microsoft Windows 2003"]
773 #[doc = ""]
774 #[doc = "w2k8;; Microsoft Windows 2008"]
775 #[doc = ""]
776 #[doc = "wvista;; Microsoft Windows Vista"]
777 #[doc = ""]
778 #[doc = "win7;; Microsoft Windows 7"]
779 #[doc = ""]
780 #[doc = "win8;; Microsoft Windows 8/2012/2012r2"]
781 #[doc = ""]
782 #[doc = "win10;; Microsoft Windows 10/2016/2019"]
783 #[doc = ""]
784 #[doc = "win11;; Microsoft Windows 11/2022/2025"]
785 #[doc = ""]
786 #[doc = "l24;; Linux 2.4 Kernel"]
787 #[doc = ""]
788 #[doc = "l26;; Linux 2.6 - 6.X Kernel"]
789 #[doc = ""]
790 #[doc = "solaris;; Solaris/OpenSolaris/OpenIndiania kernel"]
791 #[doc = ""]
792 pub ostype: Option<Ostype>,
793 #[serde(rename = "parallel[n]")]
794 #[serde(
795 serialize_with = "crate::types::serialize_multi::<NumberedParallels, _>",
796 deserialize_with = "crate::types::deserialize_multi::<NumberedParallels, _>"
797 )]
798 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
799 #[serde(flatten)]
800 #[doc = "Map host parallel devices (n is 0 to 2)."]
801 #[doc = ""]
802 #[doc = "Map host parallel devices (n is 0 to 2)."]
803 #[doc = ""]
804 #[doc = "NOTE: This option allows direct access to host hardware. So it is no longer possible to migrate such"]
805 #[doc = ""]
806 #[doc = "machines - use with special care."]
807 #[doc = ""]
808 #[doc = "CAUTION: Experimental! User reported problems with this option."]
809 #[doc = ""]
810 pub parallels: ::std::collections::HashMap<u32, ParallelNStr>,
811 #[serde(skip_serializing_if = "Option::is_none", default)]
812 #[doc = "Add the VM to the specified pool."]
813 #[doc = ""]
814 pub pool: Option<String>,
815 #[serde(
816 serialize_with = "crate::types::serialize_bool_optional",
817 deserialize_with = "crate::types::deserialize_bool_optional"
818 )]
819 #[serde(skip_serializing_if = "Option::is_none", default)]
820 #[doc = "Sets the protection flag of the VM. This will disable the remove VM and remove disk operations."]
821 #[doc = ""]
822 pub protection: Option<bool>,
823 #[serde(
824 serialize_with = "crate::types::serialize_bool_optional",
825 deserialize_with = "crate::types::deserialize_bool_optional"
826 )]
827 #[serde(skip_serializing_if = "Option::is_none", default)]
828 #[doc = "Allow reboot. If set to '0' the VM exit on reboot."]
829 #[doc = ""]
830 pub reboot: Option<bool>,
831 #[serde(skip_serializing_if = "Option::is_none", default)]
832 #[doc = "Configure a VirtIO-based Random Number Generator."]
833 #[doc = ""]
834 pub rng0: Option<String>,
835 #[serde(rename = "sata[n]")]
836 #[serde(
837 serialize_with = "crate::types::serialize_multi::<NumberedSatas, _>",
838 deserialize_with = "crate::types::deserialize_multi::<NumberedSatas, _>"
839 )]
840 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
841 #[serde(flatten)]
842 #[doc = "Use volume as SATA hard disk or CD-ROM (n is 0 to 5). Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume."]
843 #[doc = ""]
844 pub satas: ::std::collections::HashMap<u32, String>,
845 #[serde(rename = "scsi[n]")]
846 #[serde(
847 serialize_with = "crate::types::serialize_multi::<NumberedScsis, _>",
848 deserialize_with = "crate::types::deserialize_multi::<NumberedScsis, _>"
849 )]
850 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
851 #[serde(flatten)]
852 #[doc = "Use volume as SCSI hard disk or CD-ROM (n is 0 to 30). Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume."]
853 #[doc = ""]
854 pub scsis: ::std::collections::HashMap<u32, String>,
855 #[serde(skip_serializing_if = "Option::is_none", default)]
856 #[doc = "SCSI controller model"]
857 #[doc = ""]
858 pub scsihw: Option<Scsihw>,
859 #[serde(skip_serializing_if = "Option::is_none", default)]
860 #[doc = "cloud-init: Sets DNS search domains for a container. Create will automatically use the setting from the host if neither searchdomain nor nameserver are set."]
861 #[doc = ""]
862 pub searchdomain: Option<String>,
863 #[serde(rename = "serial[n]")]
864 #[serde(
865 serialize_with = "crate::types::serialize_multi::<NumberedSerials, _>",
866 deserialize_with = "crate::types::deserialize_multi::<NumberedSerials, _>"
867 )]
868 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
869 #[serde(flatten)]
870 #[doc = "Create a serial device inside the VM (n is 0 to 3)"]
871 #[doc = ""]
872 #[doc = "Create a serial device inside the VM (n is 0 to 3), and pass through a"]
873 #[doc = ""]
874 #[doc = "host serial device (i.e. /dev/ttyS0), or create a unix socket on the"]
875 #[doc = ""]
876 #[doc = "host side (use 'qm terminal' to open a terminal connection)."]
877 #[doc = ""]
878 #[doc = "NOTE: If you pass through a host serial device, it is no longer possible to migrate such machines -"]
879 #[doc = ""]
880 #[doc = "use with special care."]
881 #[doc = ""]
882 #[doc = "CAUTION: Experimental! User reported problems with this option."]
883 #[doc = ""]
884 pub serials: ::std::collections::HashMap<u32, SerialNStr>,
885 #[serde(skip_serializing_if = "Option::is_none", default)]
886 #[doc = "Amount of memory shares for auto-ballooning. The larger the number is, the more memory this VM gets. Number is relative to weights of all other running VMs. Using zero disables auto-ballooning. Auto-ballooning is done by pvestatd."]
887 #[doc = ""]
888 pub shares: Option<SharesInt>,
889 #[serde(skip_serializing_if = "Option::is_none", default)]
890 #[doc = "Specify SMBIOS type 1 fields."]
891 #[doc = ""]
892 pub smbios1: Option<Smbios1Str>,
893 #[serde(
894 serialize_with = "crate::types::serialize_non_zero_pos_int_optional",
895 deserialize_with = "crate::types::deserialize_non_zero_pos_int_optional"
896 )]
897 #[serde(skip_serializing_if = "Option::is_none", default)]
898 #[doc = "The number of CPUs. Please use option -sockets instead."]
899 #[doc = ""]
900 pub smp: Option<std::num::NonZeroU64>,
901 #[serde(
902 serialize_with = "crate::types::serialize_non_zero_pos_int_optional",
903 deserialize_with = "crate::types::deserialize_non_zero_pos_int_optional"
904 )]
905 #[serde(skip_serializing_if = "Option::is_none", default)]
906 #[doc = "The number of CPU sockets."]
907 #[doc = ""]
908 pub sockets: Option<std::num::NonZeroU64>,
909 #[serde(skip_serializing_if = "Option::is_none", default)]
910 #[doc = "Configure additional enhancements for SPICE."]
911 #[doc = ""]
912 pub spice_enhancements: Option<String>,
913 #[serde(skip_serializing_if = "Option::is_none", default)]
914 #[doc = "cloud-init: Setup public SSH keys (one key per line, OpenSSH format)."]
915 #[doc = ""]
916 pub sshkeys: Option<String>,
917 #[serde(
918 serialize_with = "crate::types::serialize_bool_optional",
919 deserialize_with = "crate::types::deserialize_bool_optional"
920 )]
921 #[serde(skip_serializing_if = "Option::is_none", default)]
922 #[doc = "Start VM after it was created successfully."]
923 #[doc = ""]
924 pub start: Option<bool>,
925 #[serde(skip_serializing_if = "Option::is_none", default)]
926 #[doc = "Set the initial date of the real time clock. Valid format for date are:'now' or '2006-06-17T16:01:21' or '2006-06-17'."]
927 #[doc = ""]
928 pub startdate: Option<StartdateStr>,
929 #[serde(skip_serializing_if = "Option::is_none", default)]
930 #[doc = "Startup and shutdown behavior. Order is a non-negative number defining the general startup order. Shutdown in done with reverse ordering. Additionally you can set the 'up' or 'down' delay in seconds, which specifies a delay to wait before the next VM is started or stopped."]
931 #[doc = ""]
932 pub startup: Option<String>,
933 #[serde(skip_serializing_if = "Option::is_none", default)]
934 #[doc = "Default storage."]
935 #[doc = ""]
936 pub storage: Option<String>,
937 #[serde(
938 serialize_with = "crate::types::serialize_bool_optional",
939 deserialize_with = "crate::types::deserialize_bool_optional"
940 )]
941 #[serde(skip_serializing_if = "Option::is_none", default)]
942 #[doc = "Enable/disable the USB tablet device."]
943 #[doc = ""]
944 #[doc = "Enable/disable the USB tablet device. This device is usually needed to allow absolute mouse positioning with VNC. Else the mouse runs out of sync with normal VNC clients. If you're running lots of console-only guests on one host, you may consider disabling this to save some context switches. This is turned off by default if you use spice (`qm set \\\\<vmid\\\\> --vga qxl`)."]
945 #[doc = ""]
946 pub tablet: Option<bool>,
947 #[serde(skip_serializing_if = "Option::is_none", default)]
948 #[doc = "Tags of the VM. This is only meta information."]
949 #[doc = ""]
950 pub tags: Option<String>,
951 #[serde(
952 serialize_with = "crate::types::serialize_bool_optional",
953 deserialize_with = "crate::types::deserialize_bool_optional"
954 )]
955 #[serde(skip_serializing_if = "Option::is_none", default)]
956 #[doc = "Enable/disable time drift fix."]
957 #[doc = ""]
958 pub tdf: Option<bool>,
959 #[serde(
960 serialize_with = "crate::types::serialize_bool_optional",
961 deserialize_with = "crate::types::deserialize_bool_optional"
962 )]
963 #[serde(skip_serializing_if = "Option::is_none", default)]
964 #[doc = "Enable/disable Template."]
965 #[doc = ""]
966 pub template: Option<bool>,
967 #[serde(skip_serializing_if = "Option::is_none", default)]
968 #[doc = "Configure a Disk for storing TPM state. The format is fixed to 'raw'. Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Note that SIZE_IN_GiB is ignored here and 4 MiB will be used instead. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume."]
969 #[doc = ""]
970 pub tpmstate0: Option<String>,
971 #[serde(
972 serialize_with = "crate::types::serialize_bool_optional",
973 deserialize_with = "crate::types::deserialize_bool_optional"
974 )]
975 #[serde(skip_serializing_if = "Option::is_none", default)]
976 #[doc = "Assign a unique random ethernet address."]
977 #[doc = ""]
978 pub unique: Option<bool>,
979 #[serde(rename = "unused[n]")]
980 #[serde(
981 serialize_with = "crate::types::serialize_multi::<NumberedUnuseds, _>",
982 deserialize_with = "crate::types::deserialize_multi::<NumberedUnuseds, _>"
983 )]
984 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
985 #[serde(flatten)]
986 #[doc = "Reference to unused volumes. This is used internally, and should not be modified manually."]
987 #[doc = ""]
988 pub unuseds: ::std::collections::HashMap<u32, String>,
989 #[serde(rename = "usb[n]")]
990 #[serde(
991 serialize_with = "crate::types::serialize_multi::<NumberedUsbs, _>",
992 deserialize_with = "crate::types::deserialize_multi::<NumberedUsbs, _>"
993 )]
994 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
995 #[serde(flatten)]
996 #[doc = "Configure an USB device (n is 0 to 4, for machine version \\\\>= 7.1 and ostype l26 or windows \\\\> 7, n can be up to 14)."]
997 #[doc = ""]
998 pub usbs: ::std::collections::HashMap<u32, String>,
999 #[serde(skip_serializing_if = "Option::is_none", default)]
1000 #[doc = "Number of hotplugged vcpus."]
1001 #[doc = ""]
1002 pub vcpus: Option<VcpusInt>,
1003 #[serde(skip_serializing_if = "Option::is_none", default)]
1004 #[doc = "Configure the VGA hardware."]
1005 #[doc = ""]
1006 #[doc = "Configure the VGA Hardware. If you want to use high resolution modes (\\\\>= 1280x1024x16) you may need to increase the vga memory option. Since QEMU 2.9 the default VGA display type is 'std' for all OS types besides some Windows versions (XP and older) which use 'cirrus'. The 'qxl' option enables the SPICE display server. For win* OS you can select how many independent displays you want, Linux guests can add displays them self."]
1007 #[doc = ""]
1008 #[doc = "You can also run without any graphic card, using a serial device as terminal."]
1009 #[doc = ""]
1010 pub vga: Option<String>,
1011 #[serde(rename = "virtio[n]")]
1012 #[serde(
1013 serialize_with = "crate::types::serialize_multi::<NumberedVirtios, _>",
1014 deserialize_with = "crate::types::deserialize_multi::<NumberedVirtios, _>"
1015 )]
1016 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
1017 #[serde(flatten)]
1018 #[doc = "Use volume as VIRTIO hard disk (n is 0 to 15). Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume. Use STORAGE_ID:0 and the 'import-from' parameter to import from an existing volume."]
1019 #[doc = ""]
1020 pub virtios: ::std::collections::HashMap<u32, String>,
1021 #[serde(rename = "virtiofs[n]")]
1022 #[serde(
1023 serialize_with = "crate::types::serialize_multi::<NumberedVirtiofss, _>",
1024 deserialize_with = "crate::types::deserialize_multi::<NumberedVirtiofss, _>"
1025 )]
1026 #[serde(skip_serializing_if = "::std::collections::HashMap::is_empty", default)]
1027 #[serde(flatten)]
1028 #[doc = "Configuration for sharing a directory between host and guest using Virtio-fs."]
1029 #[doc = ""]
1030 pub virtiofss: ::std::collections::HashMap<u32, String>,
1031 #[serde(skip_serializing_if = "Option::is_none", default)]
1032 #[doc = "Set VM Generation ID. Use '1' to autogenerate on create or update, pass '0' to disable explicitly."]
1033 #[doc = ""]
1034 #[doc = "The VM generation ID (vmgenid) device exposes a 128-bit integer value identifier to the guest OS. This allows to notify the guest operating system when the virtual machine is executed with a different configuration (e.g. snapshot execution or creation from a template). The guest operating system notices the change, and is then able to react as appropriate by marking its copies of distributed databases as dirty, re-initializing its random number generator, etc."]
1035 #[doc = ""]
1036 #[doc = "Note that auto-creation only works when done through API/CLI create or update methods, but not when manually editing the config file."]
1037 #[doc = ""]
1038 pub vmgenid: Option<VmgenidStr>,
1039 #[doc = "The (unique) ID of the VM."]
1040 #[doc = ""]
1041 pub vmid: VmidInt,
1042 #[serde(skip_serializing_if = "Option::is_none", default)]
1043 #[doc = "Default storage for VM state volumes/files."]
1044 #[doc = ""]
1045 pub vmstatestorage: Option<String>,
1046 #[serde(skip_serializing_if = "Option::is_none", default)]
1047 #[doc = "Create a virtual hardware watchdog device."]
1048 #[doc = ""]
1049 #[doc = "Create a virtual hardware watchdog device. Once enabled (by a guest action), the watchdog must be periodically polled by an agent inside the guest or else the watchdog will reset the guest (or execute the respective action specified)"]
1050 #[doc = ""]
1051 pub watchdog: Option<String>,
1052 #[serde(
1053 flatten,
1054 deserialize_with = "crate::types::multi::deserialize_additional_data::<'_, PostParams, _, _>"
1055 )]
1056 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
1057}
1058impl crate::types::multi::Test for PostParams {
1059 fn test_fn() -> fn(&str) -> bool {
1060 fn the_test(input: &str) -> bool {
1061 let array = [
1062 <NumberedHostpcis as crate::types::multi::NumberedItems>::key_matches
1063 as fn(&str) -> bool,
1064 <NumberedIdes as crate::types::multi::NumberedItems>::key_matches
1065 as fn(&str) -> bool,
1066 <NumberedIpconfigs as crate::types::multi::NumberedItems>::key_matches
1067 as fn(&str) -> bool,
1068 <NumberedNets as crate::types::multi::NumberedItems>::key_matches
1069 as fn(&str) -> bool,
1070 <NumberedNumas as crate::types::multi::NumberedItems>::key_matches
1071 as fn(&str) -> bool,
1072 <NumberedParallels as crate::types::multi::NumberedItems>::key_matches
1073 as fn(&str) -> bool,
1074 <NumberedSatas as crate::types::multi::NumberedItems>::key_matches
1075 as fn(&str) -> bool,
1076 <NumberedScsis as crate::types::multi::NumberedItems>::key_matches
1077 as fn(&str) -> bool,
1078 <NumberedSerials as crate::types::multi::NumberedItems>::key_matches
1079 as fn(&str) -> bool,
1080 <NumberedUnuseds as crate::types::multi::NumberedItems>::key_matches
1081 as fn(&str) -> bool,
1082 <NumberedUsbs as crate::types::multi::NumberedItems>::key_matches
1083 as fn(&str) -> bool,
1084 <NumberedVirtios as crate::types::multi::NumberedItems>::key_matches
1085 as fn(&str) -> bool,
1086 <NumberedVirtiofss as crate::types::multi::NumberedItems>::key_matches
1087 as fn(&str) -> bool,
1088 ];
1089 array.iter().any(|f| f(input))
1090 }
1091 the_test as _
1092 }
1093}
1094#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
1095#[doc = "Virtual processor architecture. Defaults to the host."]
1096#[doc = ""]
1097pub enum Arch {
1098 #[serde(rename = "aarch64")]
1099 Aarch64,
1100 #[serde(rename = "x86_64")]
1101 X8664,
1102}
1103impl TryFrom<&str> for Arch {
1104 type Error = String;
1105 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
1106 match value {
1107 "aarch64" => Ok(Self::Aarch64),
1108 "x86_64" => Ok(Self::X8664),
1109 v => Err(format!("Unknown variant {v}")),
1110 }
1111 }
1112}
1113#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
1114#[doc = "Select BIOS implementation."]
1115#[doc = ""]
1116pub enum Bios {
1117 #[serde(rename = "ovmf")]
1118 Ovmf,
1119 #[serde(rename = "seabios")]
1120 #[default]
1121 Seabios,
1122}
1123impl TryFrom<&str> for Bios {
1124 type Error = String;
1125 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
1126 match value {
1127 "ovmf" => Ok(Self::Ovmf),
1128 "seabios" => Ok(Self::Seabios),
1129 v => Err(format!("Unknown variant {v}")),
1130 }
1131 }
1132}
1133#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
1134#[doc = "Specifies the cloud-init configuration format. The default depends on the configured operating system type (`ostype`. We use the `nocloud` format for Linux, and `configdrive2` for windows."]
1135#[doc = ""]
1136pub enum Citype {
1137 #[serde(rename = "configdrive2")]
1138 Configdrive2,
1139 #[serde(rename = "nocloud")]
1140 Nocloud,
1141 #[serde(rename = "opennebula")]
1142 Opennebula,
1143}
1144impl TryFrom<&str> for Citype {
1145 type Error = String;
1146 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
1147 match value {
1148 "configdrive2" => Ok(Self::Configdrive2),
1149 "nocloud" => Ok(Self::Nocloud),
1150 "opennebula" => Ok(Self::Opennebula),
1151 v => Err(format!("Unknown variant {v}")),
1152 }
1153 }
1154}
1155#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
1156#[doc = "Enables hugepages memory."]
1157#[doc = ""]
1158#[doc = "Sets the size of hugepages in MiB. If the value is set to 'any' then 1 GiB hugepages will be used if possible, otherwise the size will fall back to 2 MiB."]
1159#[doc = ""]
1160pub enum Hugepages {
1161 #[serde(rename = "1024")]
1162 _1024,
1163 #[serde(rename = "2")]
1164 _2,
1165 #[serde(rename = "any")]
1166 Any,
1167}
1168impl TryFrom<&str> for Hugepages {
1169 type Error = String;
1170 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
1171 match value {
1172 "1024" => Ok(Self::_1024),
1173 "2" => Ok(Self::_2),
1174 "any" => Ok(Self::Any),
1175 v => Err(format!("Unknown variant {v}")),
1176 }
1177 }
1178}
1179#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
1180#[doc = "Keyboard layout for VNC server. This option is generally not required and is often better handled from within the guest OS."]
1181#[doc = ""]
1182pub enum Keyboard {
1183 #[serde(rename = "da")]
1184 Da,
1185 #[serde(rename = "de")]
1186 De,
1187 #[serde(rename = "de-ch")]
1188 DeCh,
1189 #[serde(rename = "en-gb")]
1190 EnGb,
1191 #[serde(rename = "en-us")]
1192 EnUs,
1193 #[serde(rename = "es")]
1194 Es,
1195 #[serde(rename = "fi")]
1196 Fi,
1197 #[serde(rename = "fr")]
1198 Fr,
1199 #[serde(rename = "fr-be")]
1200 FrBe,
1201 #[serde(rename = "fr-ca")]
1202 FrCa,
1203 #[serde(rename = "fr-ch")]
1204 FrCh,
1205 #[serde(rename = "hu")]
1206 Hu,
1207 #[serde(rename = "is")]
1208 Is,
1209 #[serde(rename = "it")]
1210 It,
1211 #[serde(rename = "ja")]
1212 Ja,
1213 #[serde(rename = "lt")]
1214 Lt,
1215 #[serde(rename = "mk")]
1216 Mk,
1217 #[serde(rename = "nl")]
1218 Nl,
1219 #[serde(rename = "no")]
1220 No,
1221 #[serde(rename = "pl")]
1222 Pl,
1223 #[serde(rename = "pt")]
1224 Pt,
1225 #[serde(rename = "pt-br")]
1226 PtBr,
1227 #[serde(rename = "sl")]
1228 Sl,
1229 #[serde(rename = "sv")]
1230 Sv,
1231 #[serde(rename = "tr")]
1232 Tr,
1233}
1234impl TryFrom<&str> for Keyboard {
1235 type Error = String;
1236 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
1237 match value {
1238 "da" => Ok(Self::Da),
1239 "de" => Ok(Self::De),
1240 "de-ch" => Ok(Self::DeCh),
1241 "en-gb" => Ok(Self::EnGb),
1242 "en-us" => Ok(Self::EnUs),
1243 "es" => Ok(Self::Es),
1244 "fi" => Ok(Self::Fi),
1245 "fr" => Ok(Self::Fr),
1246 "fr-be" => Ok(Self::FrBe),
1247 "fr-ca" => Ok(Self::FrCa),
1248 "fr-ch" => Ok(Self::FrCh),
1249 "hu" => Ok(Self::Hu),
1250 "is" => Ok(Self::Is),
1251 "it" => Ok(Self::It),
1252 "ja" => Ok(Self::Ja),
1253 "lt" => Ok(Self::Lt),
1254 "mk" => Ok(Self::Mk),
1255 "nl" => Ok(Self::Nl),
1256 "no" => Ok(Self::No),
1257 "pl" => Ok(Self::Pl),
1258 "pt" => Ok(Self::Pt),
1259 "pt-br" => Ok(Self::PtBr),
1260 "sl" => Ok(Self::Sl),
1261 "sv" => Ok(Self::Sv),
1262 "tr" => Ok(Self::Tr),
1263 v => Err(format!("Unknown variant {v}")),
1264 }
1265 }
1266}
1267#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
1268#[doc = "Lock/unlock the VM."]
1269#[doc = ""]
1270pub enum Lock {
1271 #[serde(rename = "backup")]
1272 Backup,
1273 #[serde(rename = "clone")]
1274 Clone,
1275 #[serde(rename = "create")]
1276 Create,
1277 #[serde(rename = "migrate")]
1278 Migrate,
1279 #[serde(rename = "rollback")]
1280 Rollback,
1281 #[serde(rename = "snapshot")]
1282 Snapshot,
1283 #[serde(rename = "snapshot-delete")]
1284 SnapshotDelete,
1285 #[serde(rename = "suspended")]
1286 Suspended,
1287 #[serde(rename = "suspending")]
1288 Suspending,
1289}
1290impl TryFrom<&str> for Lock {
1291 type Error = String;
1292 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
1293 match value {
1294 "backup" => Ok(Self::Backup),
1295 "clone" => Ok(Self::Clone),
1296 "create" => Ok(Self::Create),
1297 "migrate" => Ok(Self::Migrate),
1298 "rollback" => Ok(Self::Rollback),
1299 "snapshot" => Ok(Self::Snapshot),
1300 "snapshot-delete" => Ok(Self::SnapshotDelete),
1301 "suspended" => Ok(Self::Suspended),
1302 "suspending" => Ok(Self::Suspending),
1303 v => Err(format!("Unknown variant {v}")),
1304 }
1305 }
1306}
1307#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
1308#[doc = "Specify guest operating system."]
1309#[doc = ""]
1310#[doc = "Specify guest operating system. This is used to enable special"]
1311#[doc = ""]
1312#[doc = "optimization/features for specific operating systems:"]
1313#[doc = ""]
1314#[doc = "\\[horizontal\\]"]
1315#[doc = ""]
1316#[doc = "other;; unspecified OS"]
1317#[doc = ""]
1318#[doc = "wxp;; Microsoft Windows XP"]
1319#[doc = ""]
1320#[doc = "w2k;; Microsoft Windows 2000"]
1321#[doc = ""]
1322#[doc = "w2k3;; Microsoft Windows 2003"]
1323#[doc = ""]
1324#[doc = "w2k8;; Microsoft Windows 2008"]
1325#[doc = ""]
1326#[doc = "wvista;; Microsoft Windows Vista"]
1327#[doc = ""]
1328#[doc = "win7;; Microsoft Windows 7"]
1329#[doc = ""]
1330#[doc = "win8;; Microsoft Windows 8/2012/2012r2"]
1331#[doc = ""]
1332#[doc = "win10;; Microsoft Windows 10/2016/2019"]
1333#[doc = ""]
1334#[doc = "win11;; Microsoft Windows 11/2022/2025"]
1335#[doc = ""]
1336#[doc = "l24;; Linux 2.4 Kernel"]
1337#[doc = ""]
1338#[doc = "l26;; Linux 2.6 - 6.X Kernel"]
1339#[doc = ""]
1340#[doc = "solaris;; Solaris/OpenSolaris/OpenIndiania kernel"]
1341#[doc = ""]
1342pub enum Ostype {
1343 #[serde(rename = "l24")]
1344 L24,
1345 #[serde(rename = "l26")]
1346 L26,
1347 #[serde(rename = "other")]
1348 #[default]
1349 Other,
1350 #[serde(rename = "solaris")]
1351 Solaris,
1352 #[serde(rename = "w2k")]
1353 W2k,
1354 #[serde(rename = "w2k3")]
1355 W2k3,
1356 #[serde(rename = "w2k8")]
1357 W2k8,
1358 #[serde(rename = "win10")]
1359 Win10,
1360 #[serde(rename = "win11")]
1361 Win11,
1362 #[serde(rename = "win7")]
1363 Win7,
1364 #[serde(rename = "win8")]
1365 Win8,
1366 #[serde(rename = "wvista")]
1367 Wvista,
1368 #[serde(rename = "wxp")]
1369 Wxp,
1370}
1371impl TryFrom<&str> for Ostype {
1372 type Error = String;
1373 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
1374 match value {
1375 "l24" => Ok(Self::L24),
1376 "l26" => Ok(Self::L26),
1377 "other" => Ok(Self::Other),
1378 "solaris" => Ok(Self::Solaris),
1379 "w2k" => Ok(Self::W2k),
1380 "w2k3" => Ok(Self::W2k3),
1381 "w2k8" => Ok(Self::W2k8),
1382 "win10" => Ok(Self::Win10),
1383 "win11" => Ok(Self::Win11),
1384 "win7" => Ok(Self::Win7),
1385 "win8" => Ok(Self::Win8),
1386 "wvista" => Ok(Self::Wvista),
1387 "wxp" => Ok(Self::Wxp),
1388 v => Err(format!("Unknown variant {v}")),
1389 }
1390 }
1391}
1392#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq, Default)]
1393#[doc = "SCSI controller model"]
1394#[doc = ""]
1395pub enum Scsihw {
1396 #[serde(rename = "lsi")]
1397 #[default]
1398 Lsi,
1399 #[serde(rename = "lsi53c810")]
1400 Lsi53c810,
1401 #[serde(rename = "megasas")]
1402 Megasas,
1403 #[serde(rename = "pvscsi")]
1404 Pvscsi,
1405 #[serde(rename = "virtio-scsi-pci")]
1406 VirtioScsiPci,
1407 #[serde(rename = "virtio-scsi-single")]
1408 VirtioScsiSingle,
1409}
1410impl TryFrom<&str> for Scsihw {
1411 type Error = String;
1412 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
1413 match value {
1414 "lsi" => Ok(Self::Lsi),
1415 "lsi53c810" => Ok(Self::Lsi53c810),
1416 "megasas" => Ok(Self::Megasas),
1417 "pvscsi" => Ok(Self::Pvscsi),
1418 "virtio-scsi-pci" => Ok(Self::VirtioScsiPci),
1419 "virtio-scsi-single" => Ok(Self::VirtioScsiSingle),
1420 v => Err(format!("Unknown variant {v}")),
1421 }
1422 }
1423}
1424#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
1425#[doc = "QEMU process status."]
1426#[doc = ""]
1427pub enum Status {
1428 #[serde(rename = "running")]
1429 Running,
1430 #[serde(rename = "stopped")]
1431 Stopped,
1432}
1433impl TryFrom<&str> for Status {
1434 type Error = String;
1435 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
1436 match value {
1437 "running" => Ok(Self::Running),
1438 "stopped" => Ok(Self::Stopped),
1439 v => Err(format!("Unknown variant {v}")),
1440 }
1441 }
1442}
1443#[derive(Default)]
1444struct NumberedHostpcis;
1445impl crate::types::multi::NumberedItems for NumberedHostpcis {
1446 type Item = String;
1447 const PREFIX: &'static str = "hostpci";
1448}
1449#[derive(Default)]
1450struct NumberedIdes;
1451impl crate::types::multi::NumberedItems for NumberedIdes {
1452 type Item = String;
1453 const PREFIX: &'static str = "ide";
1454}
1455#[derive(Default)]
1456struct NumberedIpconfigs;
1457impl crate::types::multi::NumberedItems for NumberedIpconfigs {
1458 type Item = String;
1459 const PREFIX: &'static str = "ipconfig";
1460}
1461#[derive(Default)]
1462struct NumberedNets;
1463impl crate::types::multi::NumberedItems for NumberedNets {
1464 type Item = String;
1465 const PREFIX: &'static str = "net";
1466}
1467#[derive(Default)]
1468struct NumberedNumas;
1469impl crate::types::multi::NumberedItems for NumberedNumas {
1470 type Item = String;
1471 const PREFIX: &'static str = "numa";
1472}
1473#[derive(Default)]
1474struct NumberedParallels;
1475impl crate::types::multi::NumberedItems for NumberedParallels {
1476 type Item = ParallelNStr;
1477 const PREFIX: &'static str = "parallel";
1478}
1479#[derive(Default)]
1480struct NumberedSatas;
1481impl crate::types::multi::NumberedItems for NumberedSatas {
1482 type Item = String;
1483 const PREFIX: &'static str = "sata";
1484}
1485#[derive(Default)]
1486struct NumberedScsis;
1487impl crate::types::multi::NumberedItems for NumberedScsis {
1488 type Item = String;
1489 const PREFIX: &'static str = "scsi";
1490}
1491#[derive(Default)]
1492struct NumberedSerials;
1493impl crate::types::multi::NumberedItems for NumberedSerials {
1494 type Item = SerialNStr;
1495 const PREFIX: &'static str = "serial";
1496}
1497#[derive(Default)]
1498struct NumberedUnuseds;
1499impl crate::types::multi::NumberedItems for NumberedUnuseds {
1500 type Item = String;
1501 const PREFIX: &'static str = "unused";
1502}
1503#[derive(Default)]
1504struct NumberedUsbs;
1505impl crate::types::multi::NumberedItems for NumberedUsbs {
1506 type Item = String;
1507 const PREFIX: &'static str = "usb";
1508}
1509#[derive(Default)]
1510struct NumberedVirtiofss;
1511impl crate::types::multi::NumberedItems for NumberedVirtiofss {
1512 type Item = String;
1513 const PREFIX: &'static str = "virtiofs";
1514}
1515#[derive(Default)]
1516struct NumberedVirtios;
1517impl crate::types::multi::NumberedItems for NumberedVirtios {
1518 type Item = String;
1519 const PREFIX: &'static str = "virtio";
1520}
1521#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
1522pub struct CpuunitsInt(i128);
1523impl crate::types::bounded_integer::BoundedInteger for CpuunitsInt {
1524 const MIN: Option<i128> = Some(1i128);
1525 const MAX: Option<i128> = Some(262144i128);
1526 const DEFAULT: Option<i128> = None::<i128>;
1527 const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 262144";
1528 fn get(&self) -> i128 {
1529 self.0
1530 }
1531 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
1532 Self::validate(value)?;
1533 Ok(Self(value))
1534 }
1535}
1536impl std::convert::TryFrom<i128> for CpuunitsInt {
1537 type Error = crate::types::bounded_integer::BoundedIntegerError;
1538 fn try_from(value: i128) -> Result<Self, Self::Error> {
1539 crate::types::bounded_integer::BoundedInteger::new(value)
1540 }
1541}
1542impl ::serde::Serialize for CpuunitsInt {
1543 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1544 where
1545 S: ::serde::Serializer,
1546 {
1547 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
1548 }
1549}
1550impl<'de> ::serde::Deserialize<'de> for CpuunitsInt {
1551 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1552 where
1553 D: ::serde::Deserializer<'de>,
1554 {
1555 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
1556 }
1557}
1558#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
1559pub struct SharesInt(i128);
1560impl crate::types::bounded_integer::BoundedInteger for SharesInt {
1561 const MIN: Option<i128> = Some(0i128);
1562 const MAX: Option<i128> = Some(50000i128);
1563 const DEFAULT: Option<i128> = Some(1000i128);
1564 const TYPE_DESCRIPTION: &'static str = "an integer between 0 and 50000";
1565 fn get(&self) -> i128 {
1566 self.0
1567 }
1568 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
1569 Self::validate(value)?;
1570 Ok(Self(value))
1571 }
1572}
1573impl std::convert::TryFrom<i128> for SharesInt {
1574 type Error = crate::types::bounded_integer::BoundedIntegerError;
1575 fn try_from(value: i128) -> Result<Self, Self::Error> {
1576 crate::types::bounded_integer::BoundedInteger::new(value)
1577 }
1578}
1579impl ::serde::Serialize for SharesInt {
1580 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1581 where
1582 S: ::serde::Serializer,
1583 {
1584 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
1585 }
1586}
1587impl<'de> ::serde::Deserialize<'de> for SharesInt {
1588 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1589 where
1590 D: ::serde::Deserializer<'de>,
1591 {
1592 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
1593 }
1594}
1595#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
1596pub struct VcpusInt(i128);
1597impl crate::types::bounded_integer::BoundedInteger for VcpusInt {
1598 const MIN: Option<i128> = Some(1i128);
1599 const MAX: Option<i128> = None::<i128>;
1600 const DEFAULT: Option<i128> = Some(0i128);
1601 const TYPE_DESCRIPTION: &'static str = "an integer greater than or equal to 1";
1602 fn get(&self) -> i128 {
1603 self.0
1604 }
1605 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
1606 Self::validate(value)?;
1607 Ok(Self(value))
1608 }
1609}
1610impl std::convert::TryFrom<i128> for VcpusInt {
1611 type Error = crate::types::bounded_integer::BoundedIntegerError;
1612 fn try_from(value: i128) -> Result<Self, Self::Error> {
1613 crate::types::bounded_integer::BoundedInteger::new(value)
1614 }
1615}
1616impl ::serde::Serialize for VcpusInt {
1617 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1618 where
1619 S: ::serde::Serializer,
1620 {
1621 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
1622 }
1623}
1624impl<'de> ::serde::Deserialize<'de> for VcpusInt {
1625 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1626 where
1627 D: ::serde::Deserializer<'de>,
1628 {
1629 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
1630 }
1631}
1632#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
1633pub struct VmidInt(i128);
1634impl crate::types::bounded_integer::BoundedInteger for VmidInt {
1635 const MIN: Option<i128> = Some(100i128);
1636 const MAX: Option<i128> = Some(999999999i128);
1637 const DEFAULT: Option<i128> = None::<i128>;
1638 const TYPE_DESCRIPTION: &'static str = "an integer between 100 and 999999999";
1639 fn get(&self) -> i128 {
1640 self.0
1641 }
1642 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
1643 Self::validate(value)?;
1644 Ok(Self(value))
1645 }
1646}
1647impl std::convert::TryFrom<i128> for VmidInt {
1648 type Error = crate::types::bounded_integer::BoundedIntegerError;
1649 fn try_from(value: i128) -> Result<Self, Self::Error> {
1650 crate::types::bounded_integer::BoundedInteger::new(value)
1651 }
1652}
1653impl ::serde::Serialize for VmidInt {
1654 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1655 where
1656 S: ::serde::Serializer,
1657 {
1658 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
1659 }
1660}
1661impl<'de> ::serde::Deserialize<'de> for VmidInt {
1662 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1663 where
1664 D: ::serde::Deserializer<'de>,
1665 {
1666 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
1667 }
1668}
1669#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
1670pub struct CpulimitNum(f64);
1671impl crate::types::bounded_number::BoundedNumber for CpulimitNum {
1672 const MIN: Option<f64> = Some(0f64);
1673 const MAX: Option<f64> = Some(128f64);
1674 const DEFAULT: Option<f64> = Some(0f64);
1675 const TYPE_DESCRIPTION: &'static str = "an number between 0 and 128";
1676 fn get(&self) -> f64 {
1677 self.0
1678 }
1679 fn new(value: f64) -> Result<Self, crate::types::bounded_number::BoundedNumberError> {
1680 Self::validate(value)?;
1681 Ok(Self(value))
1682 }
1683}
1684impl std::convert::TryFrom<f64> for CpulimitNum {
1685 type Error = crate::types::bounded_number::BoundedNumberError;
1686 fn try_from(value: f64) -> Result<Self, Self::Error> {
1687 crate::types::bounded_number::BoundedNumber::new(value)
1688 }
1689}
1690impl std::convert::TryFrom<f32> for CpulimitNum {
1691 type Error = crate::types::bounded_number::BoundedNumberError;
1692 fn try_from(value: f32) -> Result<Self, Self::Error> {
1693 crate::types::bounded_number::BoundedNumber::new(value as f64)
1694 }
1695}
1696impl std::convert::TryFrom<i32> for CpulimitNum {
1697 type Error = crate::types::bounded_number::BoundedNumberError;
1698 fn try_from(value: i32) -> Result<Self, Self::Error> {
1699 crate::types::bounded_number::BoundedNumber::new(value as f64)
1700 }
1701}
1702impl std::convert::TryFrom<i64> for CpulimitNum {
1703 type Error = crate::types::bounded_number::BoundedNumberError;
1704 fn try_from(value: i64) -> Result<Self, Self::Error> {
1705 crate::types::bounded_number::BoundedNumber::new(value as f64)
1706 }
1707}
1708impl ::serde::Serialize for CpulimitNum {
1709 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1710 where
1711 S: ::serde::Serializer,
1712 {
1713 crate::types::bounded_number::serialize_bounded_number(self, serializer)
1714 }
1715}
1716impl<'de> ::serde::Deserialize<'de> for CpulimitNum {
1717 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1718 where
1719 D: ::serde::Deserializer<'de>,
1720 {
1721 crate::types::bounded_number::deserialize_bounded_number(deserializer)
1722 }
1723}
1724#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
1725pub struct MigrateDowntimeNum(f64);
1726impl crate::types::bounded_number::BoundedNumber for MigrateDowntimeNum {
1727 const MIN: Option<f64> = Some(0f64);
1728 const MAX: Option<f64> = None::<f64>;
1729 const DEFAULT: Option<f64> = Some(0.1f64);
1730 const TYPE_DESCRIPTION: &'static str = "an number greater than or equal to 0";
1731 fn get(&self) -> f64 {
1732 self.0
1733 }
1734 fn new(value: f64) -> Result<Self, crate::types::bounded_number::BoundedNumberError> {
1735 Self::validate(value)?;
1736 Ok(Self(value))
1737 }
1738}
1739impl std::convert::TryFrom<f64> for MigrateDowntimeNum {
1740 type Error = crate::types::bounded_number::BoundedNumberError;
1741 fn try_from(value: f64) -> Result<Self, Self::Error> {
1742 crate::types::bounded_number::BoundedNumber::new(value)
1743 }
1744}
1745impl std::convert::TryFrom<f32> for MigrateDowntimeNum {
1746 type Error = crate::types::bounded_number::BoundedNumberError;
1747 fn try_from(value: f32) -> Result<Self, Self::Error> {
1748 crate::types::bounded_number::BoundedNumber::new(value as f64)
1749 }
1750}
1751impl std::convert::TryFrom<i32> for MigrateDowntimeNum {
1752 type Error = crate::types::bounded_number::BoundedNumberError;
1753 fn try_from(value: i32) -> Result<Self, Self::Error> {
1754 crate::types::bounded_number::BoundedNumber::new(value as f64)
1755 }
1756}
1757impl std::convert::TryFrom<i64> for MigrateDowntimeNum {
1758 type Error = crate::types::bounded_number::BoundedNumberError;
1759 fn try_from(value: i64) -> Result<Self, Self::Error> {
1760 crate::types::bounded_number::BoundedNumber::new(value as f64)
1761 }
1762}
1763impl ::serde::Serialize for MigrateDowntimeNum {
1764 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1765 where
1766 S: ::serde::Serializer,
1767 {
1768 crate::types::bounded_number::serialize_bounded_number(self, serializer)
1769 }
1770}
1771impl<'de> ::serde::Deserialize<'de> for MigrateDowntimeNum {
1772 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1773 where
1774 D: ::serde::Deserializer<'de>,
1775 {
1776 crate::types::bounded_number::deserialize_bounded_number(deserializer)
1777 }
1778}
1779#[derive(Debug, Clone, PartialEq, PartialOrd)]
1780pub struct ArchiveStr {
1781 value: String,
1782}
1783impl crate::types::bounded_string::BoundedString for ArchiveStr {
1784 const MIN_LENGTH: Option<usize> = None::<usize>;
1785 const MAX_LENGTH: Option<usize> = Some(255usize);
1786 const DEFAULT: Option<&'static str> = None::<&'static str>;
1787 const PATTERN: Option<&'static str> = None::<&'static str>;
1788 const TYPE_DESCRIPTION: &'static str = "a string with length at most 255";
1789 fn get_value(&self) -> &str {
1790 &self.value
1791 }
1792 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
1793 Self::validate(&value)?;
1794 Ok(Self { value })
1795 }
1796}
1797impl std::convert::TryFrom<String> for ArchiveStr {
1798 type Error = crate::types::bounded_string::BoundedStringError;
1799 fn try_from(value: String) -> Result<Self, Self::Error> {
1800 crate::types::bounded_string::BoundedString::new(value)
1801 }
1802}
1803impl ::serde::Serialize for ArchiveStr {
1804 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1805 where
1806 S: ::serde::Serializer,
1807 {
1808 crate::types::bounded_string::serialize_bounded_string(self, serializer)
1809 }
1810}
1811impl<'de> ::serde::Deserialize<'de> for ArchiveStr {
1812 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1813 where
1814 D: ::serde::Deserializer<'de>,
1815 {
1816 crate::types::bounded_string::deserialize_bounded_string(deserializer)
1817 }
1818}
1819#[derive(Debug, Clone, PartialEq, PartialOrd)]
1820pub struct BootdiskStr {
1821 value: String,
1822}
1823impl crate::types::bounded_string::BoundedString for BootdiskStr {
1824 const MIN_LENGTH: Option<usize> = None::<usize>;
1825 const MAX_LENGTH: Option<usize> = None::<usize>;
1826 const DEFAULT: Option<&'static str> = None::<&'static str>;
1827 const PATTERN: Option<&'static str> = Some("(ide|sata|scsi|virtio)\\d+");
1828 const TYPE_DESCRIPTION: &'static str =
1829 "a string with pattern r\"(ide|sata|scsi|virtio)\\d+\" and no length constraints";
1830 fn get_value(&self) -> &str {
1831 &self.value
1832 }
1833 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
1834 Self::validate(&value)?;
1835 Ok(Self { value })
1836 }
1837}
1838impl std::convert::TryFrom<String> for BootdiskStr {
1839 type Error = crate::types::bounded_string::BoundedStringError;
1840 fn try_from(value: String) -> Result<Self, Self::Error> {
1841 crate::types::bounded_string::BoundedString::new(value)
1842 }
1843}
1844impl ::serde::Serialize for BootdiskStr {
1845 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1846 where
1847 S: ::serde::Serializer,
1848 {
1849 crate::types::bounded_string::serialize_bounded_string(self, serializer)
1850 }
1851}
1852impl<'de> ::serde::Deserialize<'de> for BootdiskStr {
1853 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1854 where
1855 D: ::serde::Deserializer<'de>,
1856 {
1857 crate::types::bounded_string::deserialize_bounded_string(deserializer)
1858 }
1859}
1860#[derive(Debug, Clone, PartialEq, PartialOrd)]
1861pub struct DescriptionStr {
1862 value: String,
1863}
1864impl crate::types::bounded_string::BoundedString for DescriptionStr {
1865 const MIN_LENGTH: Option<usize> = None::<usize>;
1866 const MAX_LENGTH: Option<usize> = Some(8192usize);
1867 const DEFAULT: Option<&'static str> = None::<&'static str>;
1868 const PATTERN: Option<&'static str> = None::<&'static str>;
1869 const TYPE_DESCRIPTION: &'static str = "a string with length at most 8192";
1870 fn get_value(&self) -> &str {
1871 &self.value
1872 }
1873 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
1874 Self::validate(&value)?;
1875 Ok(Self { value })
1876 }
1877}
1878impl std::convert::TryFrom<String> for DescriptionStr {
1879 type Error = crate::types::bounded_string::BoundedStringError;
1880 fn try_from(value: String) -> Result<Self, Self::Error> {
1881 crate::types::bounded_string::BoundedString::new(value)
1882 }
1883}
1884impl ::serde::Serialize for DescriptionStr {
1885 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1886 where
1887 S: ::serde::Serializer,
1888 {
1889 crate::types::bounded_string::serialize_bounded_string(self, serializer)
1890 }
1891}
1892impl<'de> ::serde::Deserialize<'de> for DescriptionStr {
1893 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1894 where
1895 D: ::serde::Deserializer<'de>,
1896 {
1897 crate::types::bounded_string::deserialize_bounded_string(deserializer)
1898 }
1899}
1900#[derive(Debug, Clone, PartialEq, PartialOrd)]
1901pub struct ParallelNStr {
1902 value: String,
1903}
1904impl crate::types::bounded_string::BoundedString for ParallelNStr {
1905 const MIN_LENGTH: Option<usize> = None::<usize>;
1906 const MAX_LENGTH: Option<usize> = None::<usize>;
1907 const DEFAULT: Option<&'static str> = None::<&'static str>;
1908 const PATTERN: Option<&'static str> = Some("/dev/parport\\d+|/dev/usb/lp\\d+");
1909 const TYPE_DESCRIPTION: &'static str =
1910 "a string with pattern r\"/dev/parport\\d+|/dev/usb/lp\\d+\" and no length constraints";
1911 fn get_value(&self) -> &str {
1912 &self.value
1913 }
1914 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
1915 Self::validate(&value)?;
1916 Ok(Self { value })
1917 }
1918}
1919impl std::convert::TryFrom<String> for ParallelNStr {
1920 type Error = crate::types::bounded_string::BoundedStringError;
1921 fn try_from(value: String) -> Result<Self, Self::Error> {
1922 crate::types::bounded_string::BoundedString::new(value)
1923 }
1924}
1925impl ::serde::Serialize for ParallelNStr {
1926 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1927 where
1928 S: ::serde::Serializer,
1929 {
1930 crate::types::bounded_string::serialize_bounded_string(self, serializer)
1931 }
1932}
1933impl<'de> ::serde::Deserialize<'de> for ParallelNStr {
1934 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1935 where
1936 D: ::serde::Deserializer<'de>,
1937 {
1938 crate::types::bounded_string::deserialize_bounded_string(deserializer)
1939 }
1940}
1941#[derive(Debug, Clone, PartialEq, PartialOrd)]
1942pub struct SerialNStr {
1943 value: String,
1944}
1945impl crate::types::bounded_string::BoundedString for SerialNStr {
1946 const MIN_LENGTH: Option<usize> = None::<usize>;
1947 const MAX_LENGTH: Option<usize> = None::<usize>;
1948 const DEFAULT: Option<&'static str> = None::<&'static str>;
1949 const PATTERN: Option<&'static str> = Some("(/dev/.+|socket)");
1950 const TYPE_DESCRIPTION: &'static str =
1951 "a string with pattern r\"(/dev/.+|socket)\" and no length constraints";
1952 fn get_value(&self) -> &str {
1953 &self.value
1954 }
1955 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
1956 Self::validate(&value)?;
1957 Ok(Self { value })
1958 }
1959}
1960impl std::convert::TryFrom<String> for SerialNStr {
1961 type Error = crate::types::bounded_string::BoundedStringError;
1962 fn try_from(value: String) -> Result<Self, Self::Error> {
1963 crate::types::bounded_string::BoundedString::new(value)
1964 }
1965}
1966impl ::serde::Serialize for SerialNStr {
1967 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1968 where
1969 S: ::serde::Serializer,
1970 {
1971 crate::types::bounded_string::serialize_bounded_string(self, serializer)
1972 }
1973}
1974impl<'de> ::serde::Deserialize<'de> for SerialNStr {
1975 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1976 where
1977 D: ::serde::Deserializer<'de>,
1978 {
1979 crate::types::bounded_string::deserialize_bounded_string(deserializer)
1980 }
1981}
1982#[derive(Debug, Clone, PartialEq, PartialOrd)]
1983pub struct Smbios1Str {
1984 value: String,
1985}
1986impl crate::types::bounded_string::BoundedString for Smbios1Str {
1987 const MIN_LENGTH: Option<usize> = None::<usize>;
1988 const MAX_LENGTH: Option<usize> = Some(512usize);
1989 const DEFAULT: Option<&'static str> = None::<&'static str>;
1990 const PATTERN: Option<&'static str> = None::<&'static str>;
1991 const TYPE_DESCRIPTION: &'static str = "a string with length at most 512";
1992 fn get_value(&self) -> &str {
1993 &self.value
1994 }
1995 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
1996 Self::validate(&value)?;
1997 Ok(Self { value })
1998 }
1999}
2000impl std::convert::TryFrom<String> for Smbios1Str {
2001 type Error = crate::types::bounded_string::BoundedStringError;
2002 fn try_from(value: String) -> Result<Self, Self::Error> {
2003 crate::types::bounded_string::BoundedString::new(value)
2004 }
2005}
2006impl ::serde::Serialize for Smbios1Str {
2007 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2008 where
2009 S: ::serde::Serializer,
2010 {
2011 crate::types::bounded_string::serialize_bounded_string(self, serializer)
2012 }
2013}
2014impl<'de> ::serde::Deserialize<'de> for Smbios1Str {
2015 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2016 where
2017 D: ::serde::Deserializer<'de>,
2018 {
2019 crate::types::bounded_string::deserialize_bounded_string(deserializer)
2020 }
2021}
2022#[derive(Debug, Clone, PartialEq, PartialOrd)]
2023pub struct StartdateStr {
2024 value: String,
2025}
2026impl crate::types::bounded_string::BoundedString for StartdateStr {
2027 const MIN_LENGTH: Option<usize> = None::<usize>;
2028 const MAX_LENGTH: Option<usize> = None::<usize>;
2029 const DEFAULT: Option<&'static str> = Some("now");
2030 const PATTERN: Option<&'static str> =
2031 Some("(now|\\d{4}-\\d{1,2}-\\d{1,2}(T\\d{1,2}:\\d{1,2}:\\d{1,2})?)");
2032 const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"(now|\\d{4}-\\d{1,2}-\\d{1,2}(T\\d{1,2}:\\d{1,2}:\\d{1,2})?)\" and no length constraints";
2033 fn get_value(&self) -> &str {
2034 &self.value
2035 }
2036 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
2037 Self::validate(&value)?;
2038 Ok(Self { value })
2039 }
2040}
2041impl std::convert::TryFrom<String> for StartdateStr {
2042 type Error = crate::types::bounded_string::BoundedStringError;
2043 fn try_from(value: String) -> Result<Self, Self::Error> {
2044 crate::types::bounded_string::BoundedString::new(value)
2045 }
2046}
2047impl ::serde::Serialize for StartdateStr {
2048 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2049 where
2050 S: ::serde::Serializer,
2051 {
2052 crate::types::bounded_string::serialize_bounded_string(self, serializer)
2053 }
2054}
2055impl<'de> ::serde::Deserialize<'de> for StartdateStr {
2056 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2057 where
2058 D: ::serde::Deserializer<'de>,
2059 {
2060 crate::types::bounded_string::deserialize_bounded_string(deserializer)
2061 }
2062}
2063#[derive(Debug, Clone, PartialEq, PartialOrd)]
2064pub struct VmgenidStr {
2065 value: String,
2066}
2067impl crate::types::bounded_string::BoundedString for VmgenidStr {
2068 const MIN_LENGTH: Option<usize> = None::<usize>;
2069 const MAX_LENGTH: Option<usize> = None::<usize>;
2070 const DEFAULT: Option<&'static str> = Some("1 (autogenerated)");
2071 const PATTERN: Option<&'static str> =
2072 Some("(?:[a-fA-F0-9]{8}(?:-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}|[01])");
2073 const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"(?:[a-fA-F0-9]{8}(?:-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}|[01])\" and no length constraints";
2074 fn get_value(&self) -> &str {
2075 &self.value
2076 }
2077 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
2078 Self::validate(&value)?;
2079 Ok(Self { value })
2080 }
2081}
2082impl std::convert::TryFrom<String> for VmgenidStr {
2083 type Error = crate::types::bounded_string::BoundedStringError;
2084 fn try_from(value: String) -> Result<Self, Self::Error> {
2085 crate::types::bounded_string::BoundedString::new(value)
2086 }
2087}
2088impl ::serde::Serialize for VmgenidStr {
2089 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2090 where
2091 S: ::serde::Serializer,
2092 {
2093 crate::types::bounded_string::serialize_bounded_string(self, serializer)
2094 }
2095}
2096impl<'de> ::serde::Deserialize<'de> for VmgenidStr {
2097 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2098 where
2099 D: ::serde::Deserializer<'de>,
2100 {
2101 crate::types::bounded_string::deserialize_bounded_string(deserializer)
2102 }
2103}
2104impl<T> QemuClient<T>
2105where
2106 T: crate::client::Client,
2107{
2108 pub fn vmid(&self, vmid: crate::types::VmId) -> vmid::VmidClient<T> {
2109 vmid::VmidClient::<T>::new(self.client.clone(), &self.path, vmid)
2110 }
2111}