proxmox_api/generated/nodes/node/qemu/vmid/
clone.rs1pub struct CloneClient<T> {
2 client: T,
3 path: String,
4}
5impl<T> CloneClient<T>
6where
7 T: crate::client::Client,
8{
9 pub fn new(client: T, parent_path: &str) -> Self {
10 Self {
11 client,
12 path: format!("{}{}", parent_path, "/clone"),
13 }
14 }
15}
16impl<T> CloneClient<T>
17where
18 T: crate::client::Client,
19{
20 #[doc = "Create a copy of virtual machine/template."]
21 pub fn post(&self, params: PostParams) -> Result<String, T::Error> {
22 let path = self.path.to_string();
23 self.client.post(&path, ¶ms)
24 }
25}
26impl PostParams {
27 pub fn new(newid: crate::types::VmId) -> Self {
28 Self {
29 newid,
30 bwlimit: Default::default(),
31 description: Default::default(),
32 format: Default::default(),
33 full: Default::default(),
34 name: Default::default(),
35 pool: Default::default(),
36 snapname: Default::default(),
37 storage: Default::default(),
38 target: Default::default(),
39 additional_properties: Default::default(),
40 }
41 }
42}
43#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
44pub struct PostParams {
45 #[serde(skip_serializing_if = "Option::is_none", default)]
46 #[doc = "Override I/O bandwidth limit (in KiB/s)."]
47 pub bwlimit: Option<()>,
48 #[serde(skip_serializing_if = "Option::is_none", default)]
49 #[doc = "Description for the new VM."]
50 pub description: Option<String>,
51 #[serde(skip_serializing_if = "Option::is_none", default)]
52 #[doc = "Target format for file storage. Only valid for full clone."]
53 pub format: Option<Format>,
54 #[serde(
55 serialize_with = "crate::types::serialize_bool_optional",
56 deserialize_with = "crate::types::deserialize_bool_optional"
57 )]
58 #[serde(skip_serializing_if = "Option::is_none", default)]
59 #[doc = "Create a full copy of all disks. This is always done when you clone a normal VM. For VM templates, we try to create a linked clone by default."]
60 pub full: Option<bool>,
61 #[serde(skip_serializing_if = "Option::is_none", default)]
62 #[doc = "Set a name for the new VM."]
63 pub name: Option<String>,
64 #[doc = "VMID for the clone."]
65 pub newid: crate::types::VmId,
66 #[serde(skip_serializing_if = "Option::is_none", default)]
67 #[doc = "Add the new VM to the specified pool."]
68 pub pool: Option<String>,
69 #[serde(skip_serializing_if = "Option::is_none", default)]
70 #[doc = "The name of the snapshot."]
71 pub snapname: Option<String>,
72 #[serde(skip_serializing_if = "Option::is_none", default)]
73 #[doc = "Target storage for full clone."]
74 pub storage: Option<String>,
75 #[serde(skip_serializing_if = "Option::is_none", default)]
76 #[doc = "Target node. Only allowed if the original VM is on shared storage."]
77 pub target: Option<String>,
78 #[serde(
79 flatten,
80 default,
81 skip_serializing_if = "::std::collections::HashMap::is_empty"
82 )]
83 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
84}
85#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
86pub enum Format {
87 #[serde(rename = "qcow2")]
88 Qcow2,
89 #[serde(rename = "raw")]
90 Raw,
91 #[serde(rename = "vmdk")]
92 Vmdk,
93}