proxmox_api/generated/nodes/node/storage/storage/
prunebackups.rs

1pub struct PrunebackupsClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> PrunebackupsClient<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, "/prunebackups"),
13        }
14    }
15}
16impl<T> PrunebackupsClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Prune backups. Only those using the standard naming scheme are considered."]
21    pub fn delete(&self, params: DeleteParams) -> Result<String, T::Error> {
22        let path = self.path.to_string();
23        self.client.delete(&path, &params)
24    }
25}
26impl<T> PrunebackupsClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Get prune information for backups. NOTE: this is only a preview and might not be what a subsequent prune call does if backups are removed/added in the meantime."]
31    pub fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
32        let path = self.path.to_string();
33        self.client.get(&path, &params)
34    }
35}
36#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
37pub struct DeleteParams {
38    #[serde(rename = "prune-backups")]
39    #[serde(skip_serializing_if = "Option::is_none", default)]
40    #[doc = "Use these retention options instead of those from the storage configuration."]
41    pub prune_backups: Option<String>,
42    #[serde(rename = "type")]
43    #[serde(skip_serializing_if = "Option::is_none", default)]
44    #[doc = "Either 'qemu' or 'lxc'. Only consider backups for guests of this type."]
45    pub ty: Option<Type>,
46    #[serde(skip_serializing_if = "Option::is_none", default)]
47    #[doc = "Only prune backups for this VM."]
48    pub vmid: Option<crate::types::VmId>,
49    #[serde(
50        flatten,
51        default,
52        skip_serializing_if = "::std::collections::HashMap::is_empty"
53    )]
54    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
55}
56impl GetOutputItems {
57    pub fn new(ctime: u64, mark: Mark, ty: String, volid: String) -> Self {
58        Self {
59            ctime,
60            mark,
61            ty,
62            volid,
63            vmid: Default::default(),
64            additional_properties: Default::default(),
65        }
66    }
67}
68#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
69pub struct GetOutputItems {
70    #[serde(
71        serialize_with = "crate::types::serialize_int",
72        deserialize_with = "crate::types::deserialize_int"
73    )]
74    #[doc = "Creation time of the backup (seconds since the UNIX epoch)."]
75    pub ctime: u64,
76    #[doc = "Whether the backup would be kept or removed. Backups that are protected or don't use the standard naming scheme are not removed."]
77    pub mark: Mark,
78    #[serde(rename = "type")]
79    #[doc = "One of 'qemu', 'lxc', 'openvz' or 'unknown'."]
80    pub ty: String,
81    #[serde(
82        serialize_with = "crate::types::serialize_int_optional",
83        deserialize_with = "crate::types::deserialize_int_optional"
84    )]
85    #[serde(skip_serializing_if = "Option::is_none", default)]
86    #[doc = "The VM the backup belongs to."]
87    pub vmid: Option<u64>,
88    #[doc = "Backup volume ID."]
89    pub volid: String,
90    #[serde(
91        flatten,
92        default,
93        skip_serializing_if = "::std::collections::HashMap::is_empty"
94    )]
95    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
96}
97#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
98pub struct GetParams {
99    #[serde(rename = "prune-backups")]
100    #[serde(skip_serializing_if = "Option::is_none", default)]
101    #[doc = "Use these retention options instead of those from the storage configuration."]
102    pub prune_backups: Option<String>,
103    #[serde(rename = "type")]
104    #[serde(skip_serializing_if = "Option::is_none", default)]
105    #[doc = "Either 'qemu' or 'lxc'. Only consider backups for guests of this type."]
106    pub ty: Option<Type>,
107    #[serde(skip_serializing_if = "Option::is_none", default)]
108    #[doc = "Only consider backups for this guest."]
109    pub vmid: Option<crate::types::VmId>,
110    #[serde(
111        flatten,
112        default,
113        skip_serializing_if = "::std::collections::HashMap::is_empty"
114    )]
115    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
116}
117#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
118pub enum Mark {
119    #[serde(rename = "keep")]
120    Keep,
121    #[serde(rename = "protected")]
122    Protected,
123    #[serde(rename = "remove")]
124    Remove,
125    #[serde(rename = "renamed")]
126    Renamed,
127}
128#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
129pub enum Type {
130    #[serde(rename = "lxc")]
131    Lxc,
132    #[serde(rename = "qemu")]
133    Qemu,
134}