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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
use super::*;
impl<'a, TS: KeycloakTokenSupplier> KeycloakRealmAdmin<'a, TS> {
// <h4>Workflows</h4>
/// List workflows
///
/// Parameters:
///
/// - `realm`: realm name (not id!)
/// - `exact`: Boolean which defines whether the param 'search' must match exactly or not
/// - `first`: The position of the first result to be processed (pagination offset)
/// - `max`: The maximum number of results to be returned - defaults to 10
/// - `search`: A String representing the workflow name - either partial or exact
///
/// Resource: `Workflows`
///
/// `GET /admin/realms/{realm}/workflows`
///
/// Documentation: <https://www.keycloak.org/docs-api/26.6.0/rest-api/index.html#_get_adminrealmsrealmworkflows>
pub fn workflows_get(&'a self) -> RealmWorkflowsGet<'a, TS> {
RealmWorkflowsGet { realm_admin: self }
}
/// Create workflow
///
/// Parameters:
///
/// - `realm`: realm name (not id!)
/// - `body`
///
/// Returns response for future processing.
///
/// Resource: `Workflows`
///
/// `POST /admin/realms/{realm}/workflows`
///
/// Documentation: <https://www.keycloak.org/docs-api/26.6.0/rest-api/index.html#_post_adminrealmsrealmworkflows>
pub fn workflows_post(
&'a self,
body: WorkflowRepresentation,
) -> impl Future<Output = Result<DefaultResponse, KeycloakError>> + use<'a, TS> {
self.admin.realm_workflows_post(self.realm, body)
}
/// Migrate scheduled resources from one step to another
///
/// Parameters:
///
/// - `realm`: realm name (not id!)
/// - `from`: A String representing the id of the step to migrate from
/// - `to`: A String representing the id of the step to migrate to
///
/// Returns response for future processing.
///
/// Resource: `Workflows`
///
/// `POST /admin/realms/{realm}/workflows/migrate`
///
/// Documentation: <https://www.keycloak.org/docs-api/26.6.0/rest-api/index.html#_post_adminrealmsrealmworkflowsmigrate>
pub fn workflows_migrate_post(&'a self) -> RealmWorkflowsMigratePost<'a, TS> {
RealmWorkflowsMigratePost { realm_admin: self }
}
/// List scheduled workflows for resource
///
/// Parameters:
///
/// - `realm`: realm name (not id!)
/// - `resource_id`: Identifier of the resource associated with the scheduled workflows
///
/// Resource: `Workflows`
///
/// `GET /admin/realms/{realm}/workflows/scheduled/{resource_id}`
///
/// Documentation: <https://www.keycloak.org/docs-api/26.6.0/rest-api/index.html#_get_adminrealmsrealmworkflowsscheduledresource_id>
///
/// REST method: `GET /admin/realms/{realm}/workflows/scheduled/{resource-id}`
pub fn workflows_scheduled_with_resource_id_get(
&'a self,
resource_id: &'a str,
) -> impl Future<Output = Result<WorkflowRepresentation, KeycloakError>> + use<'a, TS> {
self.admin
.realm_workflows_scheduled_with_resource_id_get(self.realm, resource_id)
}
/// Get workflow
///
/// Parameters:
///
/// - `realm`: realm name (not id!)
/// - `id`: Workflow identifier
/// - `include_id`: Indicates whether the workflow and step ids should be included in the representation or not - defaults to true
///
/// Resource: `Workflows`
///
/// `GET /admin/realms/{realm}/workflows/{id}`
///
/// Documentation: <https://www.keycloak.org/docs-api/26.6.0/rest-api/index.html#_get_adminrealmsrealmworkflowsid>
pub fn workflows_with_id_get(&'a self, id: &'a str) -> RealmWorkflowsWithIdGet<'a, TS> {
RealmWorkflowsWithIdGet {
realm_admin: self,
id,
}
}
/// Update workflow
///
/// Parameters:
///
/// - `realm`: realm name (not id!)
/// - `id`: Workflow identifier
/// - `body`
///
/// Returns response for future processing.
///
/// Resource: `Workflows`
///
/// `PUT /admin/realms/{realm}/workflows/{id}`
///
/// Documentation: <https://www.keycloak.org/docs-api/26.6.0/rest-api/index.html#_put_adminrealmsrealmworkflowsid>
pub fn workflows_with_id_put(
&'a self,
id: &'a str,
body: WorkflowRepresentation,
) -> impl Future<Output = Result<DefaultResponse, KeycloakError>> + use<'a, TS> {
self.admin.realm_workflows_with_id_put(self.realm, id, body)
}
/// Delete workflow
///
/// Parameters:
///
/// - `realm`: realm name (not id!)
/// - `id`: Workflow identifier
///
/// Returns response for future processing.
///
/// Resource: `Workflows`
///
/// `DELETE /admin/realms/{realm}/workflows/{id}`
///
/// Documentation: <https://www.keycloak.org/docs-api/26.6.0/rest-api/index.html#_delete_adminrealmsrealmworkflowsid>
pub fn workflows_with_id_delete(
&'a self,
id: &'a str,
) -> impl Future<Output = Result<DefaultResponse, KeycloakError>> + use<'a, TS> {
self.admin.realm_workflows_with_id_delete(self.realm, id)
}
/// Activate workflow for resource
///
/// Parameters:
///
/// - `realm`: realm name (not id!)
/// - `id`: Workflow identifier
/// - `resource_id`: Resource identifier
/// - `type_`: Resource type
/// - `not_before`: Optional value representing the time to schedule the first workflow step. The value is either an integer representing the seconds from now, an integer followed by 'ms' representing milliseconds from now, or an ISO-8601 date string.
///
/// Returns response for future processing.
///
/// Resource: `Workflows`
///
/// `POST /admin/realms/{realm}/workflows/{id}/activate/{type_}/{resource_id}`
///
/// Documentation: <https://www.keycloak.org/docs-api/26.6.0/rest-api/index.html#_post_adminrealmsrealmworkflowsidactivatetyperesourceid>
///
/// REST method: `POST /admin/realms/{realm}/workflows/{id}/activate/{type}/{resourceId}`
pub fn workflows_with_id_activate_with_type_with_resource_id_post(
&'a self,
id: &'a str,
resource_id: &'a str,
type_: &'a str,
) -> RealmWorkflowsWithIdActivateWithTypeWithResourceIdPost<'a, TS> {
RealmWorkflowsWithIdActivateWithTypeWithResourceIdPost {
realm_admin: self,
id,
resource_id,
type_,
}
}
/// Deactivate workflow for resource
///
/// Parameters:
///
/// - `realm`: realm name (not id!)
/// - `id`: Workflow identifier
/// - `resource_id`: Resource identifier
/// - `type_`: Resource type
///
/// Returns response for future processing.
///
/// Resource: `Workflows`
///
/// `POST /admin/realms/{realm}/workflows/{id}/deactivate/{type_}/{resource_id}`
///
/// Documentation: <https://www.keycloak.org/docs-api/26.6.0/rest-api/index.html#_post_adminrealmsrealmworkflowsiddeactivatetyperesourceid>
///
/// REST method: `POST /admin/realms/{realm}/workflows/{id}/deactivate/{type}/{resourceId}`
pub fn workflows_with_id_deactivate_with_type_with_resource_id_post(
&'a self,
id: &'a str,
resource_id: &'a str,
type_: &'a str,
) -> impl Future<Output = Result<DefaultResponse, KeycloakError>> + use<'a, TS> {
self.admin
.realm_workflows_with_id_deactivate_with_type_with_resource_id_post(
self.realm,
id,
resource_id,
type_,
)
}
}
// <h4>Workflows</h4>
pub struct RealmWorkflowsGet<'a, TS: KeycloakTokenSupplier> {
/// Realm admin client
pub realm_admin: &'a KeycloakRealmAdmin<'a, TS>,
}
#[derive(Default)]
pub struct RealmWorkflowsGetArgs {
/// Boolean which defines whether the param 'search' must match exactly or not
pub exact: Option<bool>,
/// The position of the first result to be processed (pagination offset)
pub first: Option<i32>,
/// The maximum number of results to be returned - defaults to 10
pub max: Option<i32>,
/// A String representing the workflow name - either partial or exact
pub search: Option<String>,
}
impl<'a, TS: KeycloakTokenSupplier + Send + Sync> KeycloakRealmAdminMethod
for RealmWorkflowsGet<'a, TS>
{
type Output = WorkflowRepresentation;
type Args = RealmWorkflowsGetArgs;
fn opts(
self,
Self::Args {
exact,
first,
max,
search,
}: Self::Args,
) -> impl Future<Output = Result<Self::Output, KeycloakError>> + use<'a, TS> {
self.realm_admin.admin.realm_workflows_get(
self.realm_admin.realm,
exact,
first,
max,
search,
)
}
}
impl<'a, TS> IntoFuture for RealmWorkflowsGet<'a, TS>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
type Output = Result<WorkflowRepresentation, KeycloakError>;
type IntoFuture = Pin<Box<dyn 'a + Future<Output = Self::Output> + Send>>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(self.opts(Default::default()))
}
}
pub struct RealmWorkflowsMigratePost<'a, TS: KeycloakTokenSupplier> {
/// Realm admin client
pub realm_admin: &'a KeycloakRealmAdmin<'a, TS>,
}
#[derive(Default)]
pub struct RealmWorkflowsMigratePostArgs {
/// A String representing the id of the step to migrate from
pub from: Option<String>,
/// A String representing the id of the step to migrate to
pub to: Option<String>,
}
impl<'a, TS: KeycloakTokenSupplier + Send + Sync> KeycloakRealmAdminMethod
for RealmWorkflowsMigratePost<'a, TS>
{
type Output = DefaultResponse;
type Args = RealmWorkflowsMigratePostArgs;
fn opts(
self,
Self::Args { from, to }: Self::Args,
) -> impl Future<Output = Result<Self::Output, KeycloakError>> + use<'a, TS> {
self.realm_admin
.admin
.realm_workflows_migrate_post(self.realm_admin.realm, from, to)
}
}
impl<'a, TS> IntoFuture for RealmWorkflowsMigratePost<'a, TS>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
type Output = Result<DefaultResponse, KeycloakError>;
type IntoFuture = Pin<Box<dyn 'a + Future<Output = Self::Output> + Send>>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(self.opts(Default::default()))
}
}
pub struct RealmWorkflowsWithIdGet<'a, TS: KeycloakTokenSupplier> {
/// Realm admin client
pub realm_admin: &'a KeycloakRealmAdmin<'a, TS>,
/// Workflow identifier
pub id: &'a str,
}
#[derive(Default)]
pub struct RealmWorkflowsWithIdGetArgs {
/// Indicates whether the workflow and step ids should be included in the representation or not - defaults to true
pub include_id: Option<bool>,
}
impl<'a, TS: KeycloakTokenSupplier + Send + Sync> KeycloakRealmAdminMethod
for RealmWorkflowsWithIdGet<'a, TS>
{
type Output = WorkflowRepresentation;
type Args = RealmWorkflowsWithIdGetArgs;
fn opts(
self,
Self::Args { include_id }: Self::Args,
) -> impl Future<Output = Result<Self::Output, KeycloakError>> + use<'a, TS> {
self.realm_admin.admin.realm_workflows_with_id_get(
self.realm_admin.realm,
self.id,
include_id,
)
}
}
impl<'a, TS> IntoFuture for RealmWorkflowsWithIdGet<'a, TS>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
type Output = Result<WorkflowRepresentation, KeycloakError>;
type IntoFuture = Pin<Box<dyn 'a + Future<Output = Self::Output> + Send>>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(self.opts(Default::default()))
}
}
pub struct RealmWorkflowsWithIdActivateWithTypeWithResourceIdPost<'a, TS: KeycloakTokenSupplier> {
/// Realm admin client
pub realm_admin: &'a KeycloakRealmAdmin<'a, TS>,
/// Workflow identifier
pub id: &'a str,
/// Resource identifier
pub resource_id: &'a str,
/// Resource type
pub type_: &'a str,
}
#[derive(Default)]
pub struct RealmWorkflowsWithIdActivateWithTypeWithResourceIdPostArgs {
/// Optional value representing the time to schedule the first workflow step. The value is either an integer representing the seconds from now, an integer followed by 'ms' representing milliseconds from now, or an ISO-8601 date string.
pub not_before: Option<String>,
}
impl<'a, TS: KeycloakTokenSupplier + Send + Sync> KeycloakRealmAdminMethod
for RealmWorkflowsWithIdActivateWithTypeWithResourceIdPost<'a, TS>
{
type Output = DefaultResponse;
type Args = RealmWorkflowsWithIdActivateWithTypeWithResourceIdPostArgs;
fn opts(
self,
Self::Args { not_before }: Self::Args,
) -> impl Future<Output = Result<Self::Output, KeycloakError>> + use<'a, TS> {
self.realm_admin
.admin
.realm_workflows_with_id_activate_with_type_with_resource_id_post(
self.realm_admin.realm,
self.id,
self.resource_id,
self.type_,
not_before,
)
}
}
impl<'a, TS> IntoFuture for RealmWorkflowsWithIdActivateWithTypeWithResourceIdPost<'a, TS>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
type Output = Result<DefaultResponse, KeycloakError>;
type IntoFuture = Pin<Box<dyn 'a + Future<Output = Self::Output> + Send>>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(self.opts(Default::default()))
}
}
#[cfg(feature = "builder")]
mod builder {
use crate::builder::Builder;
use super::*;
// <h4>Workflows</h4>
impl<'a, TS> RealmWorkflowsGet<'a, TS>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
/// Boolean which defines whether the param 'search' must match exactly or not
pub fn exact(self, value: impl Into<Option<bool>>) -> Builder<'a, Self> {
self.builder().exact(value)
}
/// The position of the first result to be processed (pagination offset)
pub fn first(self, value: impl Into<Option<i32>>) -> Builder<'a, Self> {
self.builder().first(value)
}
/// The maximum number of results to be returned - defaults to 10
pub fn max(self, value: impl Into<Option<i32>>) -> Builder<'a, Self> {
self.builder().max(value)
}
/// A String representing the workflow name - either partial or exact
pub fn search(self, value: impl Into<Option<String>>) -> Builder<'a, Self> {
self.builder().search(value)
}
}
impl<TS> Builder<'_, RealmWorkflowsGet<'_, TS>>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
/// Boolean which defines whether the param 'search' must match exactly or not
pub fn exact(mut self, value: impl Into<Option<bool>>) -> Self {
self.args.exact = value.into();
self
}
/// The position of the first result to be processed (pagination offset)
pub fn first(mut self, value: impl Into<Option<i32>>) -> Self {
self.args.first = value.into();
self
}
/// The maximum number of results to be returned - defaults to 10
pub fn max(mut self, value: impl Into<Option<i32>>) -> Self {
self.args.max = value.into();
self
}
/// A String representing the workflow name - either partial or exact
pub fn search(mut self, value: impl Into<Option<String>>) -> Self {
self.args.search = value.into();
self
}
}
impl<'a, TS> RealmWorkflowsMigratePost<'a, TS>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
/// A String representing the id of the step to migrate from
pub fn from(self, value: impl Into<Option<String>>) -> Builder<'a, Self> {
self.builder().from(value)
}
/// A String representing the id of the step to migrate to
pub fn to(self, value: impl Into<Option<String>>) -> Builder<'a, Self> {
self.builder().to(value)
}
}
impl<TS> Builder<'_, RealmWorkflowsMigratePost<'_, TS>>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
/// A String representing the id of the step to migrate from
pub fn from(mut self, value: impl Into<Option<String>>) -> Self {
self.args.from = value.into();
self
}
/// A String representing the id of the step to migrate to
pub fn to(mut self, value: impl Into<Option<String>>) -> Self {
self.args.to = value.into();
self
}
}
impl<'a, TS> RealmWorkflowsWithIdGet<'a, TS>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
/// Indicates whether the workflow and step ids should be included in the representation or not - defaults to true
pub fn include_id(self, value: impl Into<Option<bool>>) -> Builder<'a, Self> {
self.builder().include_id(value)
}
}
impl<TS> Builder<'_, RealmWorkflowsWithIdGet<'_, TS>>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
/// Indicates whether the workflow and step ids should be included in the representation or not - defaults to true
pub fn include_id(mut self, value: impl Into<Option<bool>>) -> Self {
self.args.include_id = value.into();
self
}
}
impl<'a, TS> RealmWorkflowsWithIdActivateWithTypeWithResourceIdPost<'a, TS>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
/// Optional value representing the time to schedule the first workflow step. The value is either an integer representing the seconds from now, an integer followed by 'ms' representing milliseconds from now, or an ISO-8601 date string.
pub fn not_before(self, value: impl Into<Option<String>>) -> Builder<'a, Self> {
self.builder().not_before(value)
}
}
impl<TS> Builder<'_, RealmWorkflowsWithIdActivateWithTypeWithResourceIdPost<'_, TS>>
where
TS: KeycloakTokenSupplier + Send + Sync,
{
/// Optional value representing the time to schedule the first workflow step. The value is either an integer representing the seconds from now, an integer followed by 'ms' representing milliseconds from now, or an ISO-8601 date string.
pub fn not_before(mut self, value: impl Into<Option<String>>) -> Self {
self.args.not_before = value.into();
self
}
}
}