proxmox_api/generated/cluster/
replication.rs

1pub mod id;
2pub struct ReplicationClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> ReplicationClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}{}", parent_path, "/replication"),
14        }
15    }
16}
17impl<T> ReplicationClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "List replication jobs."]
22    pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
23        let path = self.path.to_string();
24        self.client.get(&path, &())
25    }
26}
27impl<T> ReplicationClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "Create a new replication job"]
32    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33        let path = self.path.to_string();
34        self.client.post(&path, &params)
35    }
36}
37#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
38pub struct GetOutputItems {
39    #[serde(
40        flatten,
41        default,
42        skip_serializing_if = "::std::collections::HashMap::is_empty"
43    )]
44    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
45}
46impl PostParams {
47    pub fn new(id: String, target: String, ty: Type) -> Self {
48        Self {
49            id,
50            target,
51            ty,
52            comment: Default::default(),
53            disable: Default::default(),
54            rate: Default::default(),
55            remove_job: Default::default(),
56            schedule: Default::default(),
57            source: Default::default(),
58            additional_properties: Default::default(),
59        }
60    }
61}
62#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
63pub struct PostParams {
64    #[serde(skip_serializing_if = "Option::is_none", default)]
65    #[doc = "Description."]
66    pub comment: Option<String>,
67    #[serde(
68        serialize_with = "crate::types::serialize_bool_optional",
69        deserialize_with = "crate::types::deserialize_bool_optional"
70    )]
71    #[serde(skip_serializing_if = "Option::is_none", default)]
72    #[doc = "Flag to disable/deactivate the entry."]
73    pub disable: Option<bool>,
74    #[doc = "Replication Job ID. The ID is composed of a Guest ID and a job number, separated by a hyphen, i.e. '\\<GUEST\\>-\\<JOBNUM\\>'."]
75    pub id: String,
76    #[serde(
77        serialize_with = "crate::types::serialize_number_optional",
78        deserialize_with = "crate::types::deserialize_number_optional"
79    )]
80    #[serde(skip_serializing_if = "Option::is_none", default)]
81    #[doc = "Rate limit in mbps (megabytes per second) as floating point number."]
82    pub rate: Option<f64>,
83    #[serde(skip_serializing_if = "Option::is_none", default)]
84    #[doc = "Mark the replication job for removal. The job will remove all local replication snapshots. When set to 'full', it also tries to remove replicated volumes on the target. The job then removes itself from the configuration file."]
85    pub remove_job: Option<RemoveJob>,
86    #[serde(skip_serializing_if = "Option::is_none", default)]
87    #[doc = "Storage replication schedule. The format is a subset of `systemd` calendar events."]
88    pub schedule: Option<String>,
89    #[serde(skip_serializing_if = "Option::is_none", default)]
90    #[doc = "For internal use, to detect if the guest was stolen."]
91    pub source: Option<String>,
92    #[doc = "Target node."]
93    pub target: String,
94    #[serde(rename = "type")]
95    #[doc = "Section type."]
96    pub ty: Type,
97    #[serde(
98        flatten,
99        default,
100        skip_serializing_if = "::std::collections::HashMap::is_empty"
101    )]
102    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
103}
104#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
105pub enum RemoveJob {
106    #[serde(rename = "full")]
107    Full,
108    #[serde(rename = "local")]
109    Local,
110}
111#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
112pub enum Type {
113    #[serde(rename = "local")]
114    Local,
115}
116impl<T> ReplicationClient<T>
117where
118    T: crate::client::Client,
119{
120    pub fn id(&self, id: &str) -> id::IdClient<T> {
121        id::IdClient::<T>::new(self.client.clone(), &self.path, id)
122    }
123}