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