proxmox_api/generated/cluster/jobs/
realm_sync.rs1pub mod id;
2#[derive(Debug, Clone)]
3pub struct RealmSyncClient<T> {
4 client: T,
5 path: String,
6}
7impl<T> RealmSyncClient<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, "/realm-sync"),
15 }
16 }
17}
18impl<T> RealmSyncClient<T>
19where
20 T: crate::client::Client,
21{
22 #[doc = "List configured realm-sync-jobs."]
23 #[doc = ""]
24 #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
25 pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
26 let path = self.path.to_string();
27 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
28 Ok(optional_vec.unwrap_or_default())
29 }
30}
31impl GetOutputItems {
32 pub fn new(enabled: bool, id: String, realm: RealmStr, schedule: String) -> Self {
33 Self {
34 enabled,
35 id,
36 realm,
37 schedule,
38 comment: ::std::default::Default::default(),
39 last_run: ::std::default::Default::default(),
40 next_run: ::std::default::Default::default(),
41 remove_vanished: ::std::default::Default::default(),
42 scope: ::std::default::Default::default(),
43 additional_properties: ::std::default::Default::default(),
44 }
45 }
46}
47#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
48pub struct GetOutputItems {
49 #[serde(skip_serializing_if = "Option::is_none", default)]
50 #[doc = "A comment for the job."]
51 #[doc = ""]
52 pub comment: Option<String>,
53 #[serde(
54 serialize_with = "crate::types::serialize_bool",
55 deserialize_with = "crate::types::deserialize_bool"
56 )]
57 #[doc = "If the job is enabled or not."]
58 #[doc = ""]
59 pub enabled: bool,
60 #[doc = "The ID of the entry."]
61 #[doc = ""]
62 pub id: String,
63 #[serde(rename = "last-run")]
64 #[serde(
65 serialize_with = "crate::types::serialize_int_optional",
66 deserialize_with = "crate::types::deserialize_int_optional"
67 )]
68 #[serde(skip_serializing_if = "Option::is_none", default)]
69 #[doc = "Last execution time of the job in seconds since the beginning of the UNIX epoch"]
70 #[doc = ""]
71 pub last_run: Option<i64>,
72 #[serde(rename = "next-run")]
73 #[serde(
74 serialize_with = "crate::types::serialize_int_optional",
75 deserialize_with = "crate::types::deserialize_int_optional"
76 )]
77 #[serde(skip_serializing_if = "Option::is_none", default)]
78 #[doc = "Next planned execution time of the job in seconds since the beginning of the UNIX epoch."]
79 #[doc = ""]
80 pub next_run: Option<i64>,
81 #[doc = "Authentication domain ID"]
82 #[doc = ""]
83 pub realm: RealmStr,
84 #[serde(rename = "remove-vanished")]
85 #[serde(skip_serializing_if = "Option::is_none", default)]
86 #[doc = "A semicolon-separated list of things to remove when they or the user vanishes during a sync. The following values are possible: 'entry' removes the user/group when not returned from the sync. 'properties' removes the set properties on existing user/group that do not appear in the source (even custom ones). 'acl' removes acls when the user/group is not returned from the sync. Instead of a list it also can be 'none' (the default)."]
87 #[doc = ""]
88 pub remove_vanished: Option<RemoveVanishedStr>,
89 #[doc = "The configured sync schedule."]
90 #[doc = ""]
91 pub schedule: String,
92 #[serde(skip_serializing_if = "Option::is_none", default)]
93 #[doc = "Select what to sync."]
94 #[doc = ""]
95 pub scope: Option<Scope>,
96 #[serde(
97 flatten,
98 default,
99 skip_serializing_if = "::std::collections::HashMap::is_empty"
100 )]
101 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
102}
103#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
104#[doc = "Select what to sync."]
105#[doc = ""]
106pub enum Scope {
107 #[serde(rename = "both")]
108 Both,
109 #[serde(rename = "groups")]
110 Groups,
111 #[serde(rename = "users")]
112 Users,
113}
114impl TryFrom<&str> for Scope {
115 type Error = String;
116 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
117 match value {
118 "both" => Ok(Self::Both),
119 "groups" => Ok(Self::Groups),
120 "users" => Ok(Self::Users),
121 v => Err(format!("Unknown variant {v}")),
122 }
123 }
124}
125#[derive(Debug, Clone, PartialEq, PartialOrd)]
126pub struct RealmStr {
127 value: String,
128}
129impl crate::types::bounded_string::BoundedString for RealmStr {
130 const MIN_LENGTH: Option<usize> = None::<usize>;
131 const MAX_LENGTH: Option<usize> = Some(32usize);
132 const DEFAULT: Option<&'static str> = None::<&'static str>;
133 const PATTERN: Option<&'static str> = None::<&'static str>;
134 const TYPE_DESCRIPTION: &'static str = "a string with length at most 32";
135 fn get_value(&self) -> &str {
136 &self.value
137 }
138 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
139 Self::validate(&value)?;
140 Ok(Self { value })
141 }
142}
143impl std::convert::TryFrom<String> for RealmStr {
144 type Error = crate::types::bounded_string::BoundedStringError;
145 fn try_from(value: String) -> Result<Self, Self::Error> {
146 crate::types::bounded_string::BoundedString::new(value)
147 }
148}
149impl ::serde::Serialize for RealmStr {
150 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
151 where
152 S: ::serde::Serializer,
153 {
154 crate::types::bounded_string::serialize_bounded_string(self, serializer)
155 }
156}
157impl<'de> ::serde::Deserialize<'de> for RealmStr {
158 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
159 where
160 D: ::serde::Deserializer<'de>,
161 {
162 crate::types::bounded_string::deserialize_bounded_string(deserializer)
163 }
164}
165#[derive(Debug, Clone, PartialEq, PartialOrd)]
166pub struct RemoveVanishedStr {
167 value: String,
168}
169impl crate::types::bounded_string::BoundedString for RemoveVanishedStr {
170 const MIN_LENGTH: Option<usize> = None::<usize>;
171 const MAX_LENGTH: Option<usize> = None::<usize>;
172 const DEFAULT: Option<&'static str> = Some("none");
173 const PATTERN: Option<&'static str> =
174 Some("(?:(?:(?:acl|properties|entry);)*(?:acl|properties|entry))|none");
175 const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"(?:(?:(?:acl|properties|entry);)*(?:acl|properties|entry))|none\" and no length constraints";
176 fn get_value(&self) -> &str {
177 &self.value
178 }
179 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
180 Self::validate(&value)?;
181 Ok(Self { value })
182 }
183}
184impl std::convert::TryFrom<String> for RemoveVanishedStr {
185 type Error = crate::types::bounded_string::BoundedStringError;
186 fn try_from(value: String) -> Result<Self, Self::Error> {
187 crate::types::bounded_string::BoundedString::new(value)
188 }
189}
190impl ::serde::Serialize for RemoveVanishedStr {
191 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
192 where
193 S: ::serde::Serializer,
194 {
195 crate::types::bounded_string::serialize_bounded_string(self, serializer)
196 }
197}
198impl<'de> ::serde::Deserialize<'de> for RemoveVanishedStr {
199 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
200 where
201 D: ::serde::Deserializer<'de>,
202 {
203 crate::types::bounded_string::deserialize_bounded_string(deserializer)
204 }
205}
206impl<T> RealmSyncClient<T>
207where
208 T: crate::client::Client,
209{
210 pub fn id(&self, id: &str) -> id::IdClient<T> {
211 id::IdClient::<T>::new(self.client.clone(), &self.path, id)
212 }
213}