clientapi_pve/models/pve_meta_config.rs
1/*
2 * Proxmox Virtual Environment API
3 *
4 * Generated from apidoc.js. NOT an official Proxmox specification. See https://pve.proxmox.com/pve-docs/api-viewer/ for the upstream documentation.
5 *
6 * The version of the OpenAPI document: 9.x
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct PveMetaConfig {
16
17 /// The QEMU (machine) version from the time this VM was created.
18 #[serde(rename = "creation-qemu", skip_serializing_if = "Option::is_none")]
19 pub creation_qemu: Option<String>,
20
21 /// The guest creation timestamp as UNIX epoch time
22 #[serde(rename = "ctime", skip_serializing_if = "Option::is_none")]
23 pub ctime: Option<i64>,
24
25
26}
27
28impl PveMetaConfig {
29 pub fn new() -> PveMetaConfig {
30 PveMetaConfig {
31
32 creation_qemu: None,
33
34 ctime: None,
35
36 }
37 }
38}
39
40
41impl PveMetaConfig {
42 /// Serialise this PveMetaConfig into Proxmox's CLI-style shorthand
43 /// string (`key=value,…`). The property marked `x-pve-default-key`
44 /// is emitted positionally without a `key=` prefix; aliases collapse
45 /// multiple property names to the same wire key.
46 ///
47 /// Example: `PveMetaConfig `
48 /// → `"virtio,bridge=vmbr0"`
49 pub fn to_shorthand(&self) -> String {
50 let mut parts: Vec<String> = Vec::new();
51
52
53
54 if let Some(ref v) = self.creation_qemu {
55 parts.push(format!("creation-qemu={}", v));
56 }
57
58
59 if let Some(ref v) = self.ctime {
60 parts.push(format!("ctime={}", v));
61 }
62
63 parts.join(",")
64 }
65}
66