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

1pub 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 container clone/copy"]
21    pub fn post(&self, params: PostParams) -> Result<String, T::Error> {
22        let path = self.path.to_string();
23        self.client.post(&path, &params)
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            full: Default::default(),
33            hostname: Default::default(),
34            pool: Default::default(),
35            snapname: Default::default(),
36            storage: Default::default(),
37            target: Default::default(),
38            additional_properties: Default::default(),
39        }
40    }
41}
42#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
43pub struct PostParams {
44    #[serde(skip_serializing_if = "Option::is_none", default)]
45    #[doc = "Override I/O bandwidth limit (in KiB/s)."]
46    pub bwlimit: Option<()>,
47    #[serde(skip_serializing_if = "Option::is_none", default)]
48    #[doc = "Description for the new CT."]
49    pub description: Option<String>,
50    #[serde(
51        serialize_with = "crate::types::serialize_bool_optional",
52        deserialize_with = "crate::types::deserialize_bool_optional"
53    )]
54    #[serde(skip_serializing_if = "Option::is_none", default)]
55    #[doc = "Create a full copy of all disks. This is always done when you clone a normal CT. For CT templates, we try to create a linked clone by default."]
56    pub full: Option<bool>,
57    #[serde(skip_serializing_if = "Option::is_none", default)]
58    #[doc = "Set a hostname for the new CT."]
59    pub hostname: Option<String>,
60    #[doc = "VMID for the clone."]
61    pub newid: crate::types::VmId,
62    #[serde(skip_serializing_if = "Option::is_none", default)]
63    #[doc = "Add the new CT to the specified pool."]
64    pub pool: Option<String>,
65    #[serde(skip_serializing_if = "Option::is_none", default)]
66    #[doc = "The name of the snapshot."]
67    pub snapname: Option<String>,
68    #[serde(skip_serializing_if = "Option::is_none", default)]
69    #[doc = "Target storage for full clone."]
70    pub storage: Option<String>,
71    #[serde(skip_serializing_if = "Option::is_none", default)]
72    #[doc = "Target node. Only allowed if the original VM is on shared storage."]
73    pub target: Option<String>,
74    #[serde(
75        flatten,
76        default,
77        skip_serializing_if = "::std::collections::HashMap::is_empty"
78    )]
79    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
80}