1pub mod realm;
2pub struct DomainsClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> DomainsClient<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, "/domains"),
14 }
15 }
16}
17impl<T> DomainsClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Authentication domain index."]
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> DomainsClient<T>
28where
29 T: crate::client::Client,
30{
31 #[doc = "Add an authentication server."]
32 pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
35 }
36}
37impl GetOutputItems {
38 pub fn new(realm: String, ty: String) -> Self {
39 Self {
40 realm,
41 ty,
42 comment: Default::default(),
43 tfa: Default::default(),
44 additional_properties: Default::default(),
45 }
46 }
47}
48#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
49pub struct GetOutputItems {
50 #[serde(skip_serializing_if = "Option::is_none", default)]
51 #[doc = "A comment. The GUI use this text when you select a domain (Realm) on the login window."]
52 pub comment: Option<String>,
53 pub realm: String,
54 #[serde(skip_serializing_if = "Option::is_none", default)]
55 #[doc = "Two-factor authentication provider."]
56 pub tfa: Option<Tfa>,
57 #[serde(rename = "type")]
58 pub ty: String,
59 #[serde(
60 flatten,
61 default,
62 skip_serializing_if = "::std::collections::HashMap::is_empty"
63 )]
64 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
65}
66impl PostParams {
67 pub fn new(realm: String, ty: Type) -> Self {
68 Self {
69 realm,
70 ty,
71 acr_values: Default::default(),
72 autocreate: Default::default(),
73 base_dn: Default::default(),
74 bind_dn: Default::default(),
75 capath: Default::default(),
76 case_sensitive: Default::default(),
77 cert: Default::default(),
78 certkey: Default::default(),
79 check_connection: Default::default(),
80 client_id: Default::default(),
81 client_key: Default::default(),
82 comment: Default::default(),
83 default: Default::default(),
84 domain: Default::default(),
85 filter: Default::default(),
86 group_classes: Default::default(),
87 group_dn: Default::default(),
88 group_filter: Default::default(),
89 group_name_attr: Default::default(),
90 issuer_url: Default::default(),
91 mode: Default::default(),
92 password: Default::default(),
93 port: Default::default(),
94 prompt: Default::default(),
95 scopes: Default::default(),
96 secure: Default::default(),
97 server1: Default::default(),
98 server2: Default::default(),
99 sslversion: Default::default(),
100 sync_defaults_options: Default::default(),
101 sync_attributes: Default::default(),
102 tfa: Default::default(),
103 user_attr: Default::default(),
104 user_classes: Default::default(),
105 username_claim: Default::default(),
106 verify: Default::default(),
107 additional_properties: Default::default(),
108 }
109 }
110}
111#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
112pub struct PostParams {
113 #[serde(rename = "acr-values")]
114 #[serde(skip_serializing_if = "Option::is_none", default)]
115 #[doc = "Specifies the Authentication Context Class Reference values that theAuthorization Server is being requested to use for the Auth Request."]
116 pub acr_values: Option<String>,
117 #[serde(
118 serialize_with = "crate::types::serialize_bool_optional",
119 deserialize_with = "crate::types::deserialize_bool_optional"
120 )]
121 #[serde(skip_serializing_if = "Option::is_none", default)]
122 #[doc = "Automatically create users if they do not exist."]
123 pub autocreate: Option<bool>,
124 #[serde(skip_serializing_if = "Option::is_none", default)]
125 #[doc = "LDAP base domain name"]
126 pub base_dn: Option<String>,
127 #[serde(skip_serializing_if = "Option::is_none", default)]
128 #[doc = "LDAP bind domain name"]
129 pub bind_dn: Option<String>,
130 #[serde(skip_serializing_if = "Option::is_none", default)]
131 #[doc = "Path to the CA certificate store"]
132 pub capath: Option<String>,
133 #[serde(rename = "case-sensitive")]
134 #[serde(
135 serialize_with = "crate::types::serialize_bool_optional",
136 deserialize_with = "crate::types::deserialize_bool_optional"
137 )]
138 #[serde(skip_serializing_if = "Option::is_none", default)]
139 #[doc = "username is case-sensitive"]
140 pub case_sensitive: Option<bool>,
141 #[serde(skip_serializing_if = "Option::is_none", default)]
142 #[doc = "Path to the client certificate"]
143 pub cert: Option<String>,
144 #[serde(skip_serializing_if = "Option::is_none", default)]
145 #[doc = "Path to the client certificate key"]
146 pub certkey: Option<String>,
147 #[serde(rename = "check-connection")]
148 #[serde(
149 serialize_with = "crate::types::serialize_bool_optional",
150 deserialize_with = "crate::types::deserialize_bool_optional"
151 )]
152 #[serde(skip_serializing_if = "Option::is_none", default)]
153 #[doc = "Check bind connection to the server."]
154 pub check_connection: Option<bool>,
155 #[serde(rename = "client-id")]
156 #[serde(skip_serializing_if = "Option::is_none", default)]
157 #[doc = "OpenID Client ID"]
158 pub client_id: Option<String>,
159 #[serde(rename = "client-key")]
160 #[serde(skip_serializing_if = "Option::is_none", default)]
161 #[doc = "OpenID Client Key"]
162 pub client_key: Option<String>,
163 #[serde(skip_serializing_if = "Option::is_none", default)]
164 #[doc = "Description."]
165 pub comment: Option<String>,
166 #[serde(
167 serialize_with = "crate::types::serialize_bool_optional",
168 deserialize_with = "crate::types::deserialize_bool_optional"
169 )]
170 #[serde(skip_serializing_if = "Option::is_none", default)]
171 #[doc = "Use this as default realm"]
172 pub default: Option<bool>,
173 #[serde(skip_serializing_if = "Option::is_none", default)]
174 #[doc = "AD domain name"]
175 pub domain: Option<String>,
176 #[serde(skip_serializing_if = "Option::is_none", default)]
177 #[doc = "LDAP filter for user sync."]
178 pub filter: Option<String>,
179 #[serde(skip_serializing_if = "Option::is_none", default)]
180 #[doc = "The objectclasses for groups."]
181 pub group_classes: Option<String>,
182 #[serde(skip_serializing_if = "Option::is_none", default)]
183 #[doc = "LDAP base domain name for group sync. If not set, the base_dn will be used."]
184 pub group_dn: Option<String>,
185 #[serde(skip_serializing_if = "Option::is_none", default)]
186 #[doc = "LDAP filter for group sync."]
187 pub group_filter: Option<String>,
188 #[serde(skip_serializing_if = "Option::is_none", default)]
189 #[doc = "LDAP attribute representing a groups name. If not set or found, the first value of the DN will be used as name."]
190 pub group_name_attr: Option<String>,
191 #[serde(rename = "issuer-url")]
192 #[serde(skip_serializing_if = "Option::is_none", default)]
193 #[doc = "OpenID Issuer Url"]
194 pub issuer_url: Option<String>,
195 #[serde(skip_serializing_if = "Option::is_none", default)]
196 #[doc = "LDAP protocol mode."]
197 pub mode: Option<Mode>,
198 #[serde(skip_serializing_if = "Option::is_none", default)]
199 #[doc = "LDAP bind password. Will be stored in '/etc/pve/priv/realm/\\<REALM\\>.pw'."]
200 pub password: Option<String>,
201 #[serde(
202 serialize_with = "crate::types::serialize_int_optional",
203 deserialize_with = "crate::types::deserialize_int_optional"
204 )]
205 #[serde(skip_serializing_if = "Option::is_none", default)]
206 #[doc = "Server port."]
207 pub port: Option<u64>,
208 #[serde(skip_serializing_if = "Option::is_none", default)]
209 #[doc = "Specifies whether the Authorization Server prompts the End-User for reauthentication and consent."]
210 pub prompt: Option<String>,
211 #[doc = "Authentication domain ID"]
212 pub realm: String,
213 #[serde(skip_serializing_if = "Option::is_none", default)]
214 #[doc = "Specifies the scopes (user details) that should be authorized and returned, for example 'email' or 'profile'."]
215 pub scopes: Option<String>,
216 #[serde(
217 serialize_with = "crate::types::serialize_bool_optional",
218 deserialize_with = "crate::types::deserialize_bool_optional"
219 )]
220 #[serde(skip_serializing_if = "Option::is_none", default)]
221 #[doc = "Use secure LDAPS protocol. DEPRECATED: use 'mode' instead."]
222 pub secure: Option<bool>,
223 #[serde(skip_serializing_if = "Option::is_none", default)]
224 #[doc = "Server IP address (or DNS name)"]
225 pub server1: Option<String>,
226 #[serde(skip_serializing_if = "Option::is_none", default)]
227 #[doc = "Fallback Server IP address (or DNS name)"]
228 pub server2: Option<String>,
229 #[serde(skip_serializing_if = "Option::is_none", default)]
230 #[doc = "LDAPS TLS/SSL version. It's not recommended to use version older than 1.2!"]
231 pub sslversion: Option<Sslversion>,
232 #[serde(rename = "sync-defaults-options")]
233 #[serde(skip_serializing_if = "Option::is_none", default)]
234 #[doc = "The default options for behavior of synchronizations."]
235 pub sync_defaults_options: Option<String>,
236 #[serde(skip_serializing_if = "Option::is_none", default)]
237 #[doc = "Comma separated list of key=value pairs for specifying which LDAP attributes map to which PVE user field. For example, to map the LDAP attribute 'mail' to PVEs 'email', write 'email=mail'. By default, each PVE user field is represented by an LDAP attribute of the same name."]
238 pub sync_attributes: Option<String>,
239 #[serde(skip_serializing_if = "Option::is_none", default)]
240 #[doc = "Use Two-factor authentication."]
241 pub tfa: Option<String>,
242 #[serde(rename = "type")]
243 #[doc = "Realm type."]
244 pub ty: Type,
245 #[serde(skip_serializing_if = "Option::is_none", default)]
246 #[doc = "LDAP user attribute name"]
247 pub user_attr: Option<String>,
248 #[serde(skip_serializing_if = "Option::is_none", default)]
249 #[doc = "The objectclasses for users."]
250 pub user_classes: Option<String>,
251 #[serde(rename = "username-claim")]
252 #[serde(skip_serializing_if = "Option::is_none", default)]
253 #[doc = "OpenID claim used to generate the unique username."]
254 pub username_claim: Option<String>,
255 #[serde(
256 serialize_with = "crate::types::serialize_bool_optional",
257 deserialize_with = "crate::types::deserialize_bool_optional"
258 )]
259 #[serde(skip_serializing_if = "Option::is_none", default)]
260 #[doc = "Verify the server's SSL certificate"]
261 pub verify: Option<bool>,
262 #[serde(
263 flatten,
264 default,
265 skip_serializing_if = "::std::collections::HashMap::is_empty"
266 )]
267 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
268}
269#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
270pub enum Mode {
271 #[serde(rename = "ldap")]
272 Ldap,
273 #[serde(rename = "ldap+starttls")]
274 LdapStarttls,
275 #[serde(rename = "ldaps")]
276 Ldaps,
277}
278impl Default for Mode {
279 fn default() -> Self {
280 Self::Ldap
281 }
282}
283#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
284pub enum Sslversion {
285 #[serde(rename = "tlsv1")]
286 Tlsv1,
287 #[serde(rename = "tlsv1_1")]
288 Tlsv11,
289 #[serde(rename = "tlsv1_2")]
290 Tlsv12,
291 #[serde(rename = "tlsv1_3")]
292 Tlsv13,
293}
294#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
295pub enum Tfa {
296 #[serde(rename = "oath")]
297 Oath,
298 #[serde(rename = "yubico")]
299 Yubico,
300}
301#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
302pub enum Type {
303 #[serde(rename = "ad")]
304 Ad,
305 #[serde(rename = "ldap")]
306 Ldap,
307 #[serde(rename = "openid")]
308 Openid,
309 #[serde(rename = "pam")]
310 Pam,
311 #[serde(rename = "pve")]
312 Pve,
313}
314impl<T> DomainsClient<T>
315where
316 T: crate::client::Client,
317{
318 pub fn realm(&self, realm: &str) -> realm::RealmClient<T> {
319 realm::RealmClient::<T>::new(self.client.clone(), &self.path, realm)
320 }
321}