Skip to main content

proxmox_api/generated/nodes/node/
replication.rs

1pub mod id;
2#[derive(Debug, Clone)]
3pub struct ReplicationClient<T> {
4    client: T,
5    path: String,
6}
7impl<T> ReplicationClient<T>
8where
9    T: crate::client::Client,
10{
11    pub fn new(client: T, parent_path: &str) -> Self {
12        Self {
13            client,
14            path: format!("{}{}", parent_path, "/replication"),
15        }
16    }
17}
18impl<T> ReplicationClient<T>
19where
20    T: crate::client::Client,
21{
22    #[doc = "List status of all replication jobs on this node."]
23    #[doc = ""]
24    #[doc = "Requires the VM.Audit permission on /vms/\\<vmid\\>."]
25    pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
26        let path = self.path.to_string();
27        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &params).await?;
28        Ok(optional_vec.unwrap_or_default())
29    }
30}
31impl GetOutputItems {
32    pub fn new(id: String) -> Self {
33        Self {
34            id,
35            additional_properties: ::std::default::Default::default(),
36        }
37    }
38}
39#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
40pub struct GetOutputItems {
41    pub id: String,
42    #[serde(
43        flatten,
44        default,
45        skip_serializing_if = "::std::collections::HashMap::is_empty"
46    )]
47    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
48}
49#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
50pub struct GetParams {
51    #[serde(skip_serializing_if = "Option::is_none", default)]
52    #[doc = "Only list replication jobs for this guest."]
53    #[doc = ""]
54    pub guest: Option<GuestInt>,
55    #[serde(
56        flatten,
57        default,
58        skip_serializing_if = "::std::collections::HashMap::is_empty"
59    )]
60    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
61}
62#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
63pub struct GuestInt(i128);
64impl crate::types::bounded_integer::BoundedInteger for GuestInt {
65    const MIN: Option<i128> = Some(100i128);
66    const MAX: Option<i128> = Some(999999999i128);
67    const DEFAULT: Option<i128> = None::<i128>;
68    const TYPE_DESCRIPTION: &'static str = "an integer between 100 and 999999999";
69    fn get(&self) -> i128 {
70        self.0
71    }
72    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
73        Self::validate(value)?;
74        Ok(Self(value))
75    }
76}
77impl std::convert::TryFrom<i128> for GuestInt {
78    type Error = crate::types::bounded_integer::BoundedIntegerError;
79    fn try_from(value: i128) -> Result<Self, Self::Error> {
80        crate::types::bounded_integer::BoundedInteger::new(value)
81    }
82}
83impl ::serde::Serialize for GuestInt {
84    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
85    where
86        S: ::serde::Serializer,
87    {
88        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
89    }
90}
91impl<'de> ::serde::Deserialize<'de> for GuestInt {
92    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
93    where
94        D: ::serde::Deserializer<'de>,
95    {
96        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
97    }
98}
99impl<T> ReplicationClient<T>
100where
101    T: crate::client::Client,
102{
103    pub fn id(&self, id: &str) -> id::IdClient<T> {
104        id::IdClient::<T>::new(self.client.clone(), &self.path, id)
105    }
106}