bios-basic 0.2.0

An embeddable message queue system
Documentation
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
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
use std::collections::HashMap;
use std::default::Default;

use serde::{Deserialize, Serialize};
use tardis::basic::field::TrimString;

use tardis::web::poem_openapi;

use crate::rbum::rbum_enumeration::{RbumCertConfStatusKind, RbumCertRelKind, RbumCertStatusKind, RbumRelFromKind, RbumScopeLevelKind, RbumSetCateLevelQueryKind};

/// Resource basic filter
///
/// 资源基础过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumBasicFilterReq {
    /// Whether to ignore the scope
    ///
    /// 是否忽略作用域
    ///
    /// If ``true``, it means that only the ownership path is related, and the scope is not considered.
    ///
    /// 为 ``true`` 时表示只与所有权路径有关,不考虑作用域。
    pub ignore_scope: bool,
    /// Scope
    ///
    /// 作用域
    ///
    /// Only valid when ``ignore_scope = true``.
    ///
    /// 仅当 ``ignore_scope = true`` 有效。
    pub scope_level: Option<RbumScopeLevelKind>,
    /// Whether to include sub-ownership paths
    ///
    /// 是否包含子所有权路径
    pub with_sub_own_paths: bool,
    /// Whether to include the owner of the context
    ///
    /// 是否包含上下文所有者
    pub rel_ctx_owner: bool,
    /// Ownership path
    ///
    /// 所有权路径
    pub own_paths: Option<String>,
    /// Object id set
    ///
    /// 对象id集合
    pub ids: Option<Vec<String>>,
    /// Object name
    ///
    /// 对象名称
    pub name: Option<String>,
    /// Object names
    ///
    /// 对象名称集合
    pub names: Option<Vec<String>>,
    /// Object code
    ///
    /// 对象编码
    pub code: Option<String>,
    /// Object codes
    ///
    /// 对象编码集合
    pub codes: Option<Vec<String>>,
    /// Whether to include only enabled objects
    ///
    /// 是否仅包含启用的对象
    pub enabled: Option<bool>,
    /// Resource kind id
    ///
    /// 资源类型id
    pub rbum_kind_id: Option<String>,
    /// Resource domain id
    ///
    /// 资源域id
    pub rbum_domain_id: Option<String>,
}

/// Resource certificate configuration filter
///
/// 资源凭证配置过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumCertConfFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Certificate configuration type
    ///
    /// 凭证配置类型
    pub kind: Option<TrimString>,
    /// Certificate configuration supplier
    ///
    /// 凭证配置供应商
    pub supplier: Option<String>,
    /// Certificate configuration status
    ///
    /// 凭证配置状态
    pub status: Option<RbumCertConfStatusKind>,
    /// Associated resource domain id
    ///
    /// 关联的资源域id
    pub rel_rbum_domain_id: Option<String>,
    /// Associated resource item id
    ///
    /// 关联的资源项id
    pub rel_rbum_item_id: Option<String>,
}

/// Resource certificate filter
///
/// 资源凭证过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumCertFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Certificate id
    ///
    /// 凭证id
    pub id: Option<String>,
    /// Certificate ak
    ///
    /// 凭证ak
    pub ak: Option<String>,
    /// Certificate ak(left like)
    ///
    /// 凭证id(左包含)
    pub ak_like: Option<String>,
    /// Certificate type
    ///
    /// 凭证类型
    pub kind: Option<String>,
    /// Certificate supplier
    ///
    /// 凭证供应商
    pub suppliers: Option<Vec<String>>,
    /// Certificate status
    ///
    /// 凭证状态
    pub status: Option<RbumCertStatusKind>,
    /// Certificate extension information
    ///
    /// 凭证扩展信息
    pub ext: Option<String>,
    /// Association type
    ///
    /// 关联类型
    pub rel: Option<RbumItemRelFilterReq>,
    /// Associated resource kind id
    ///
    /// 关联的资源类型id
    pub rel_rbum_kind: Option<RbumCertRelKind>,
    /// Associated object id
    ///
    /// 关联的对象id
    pub rel_rbum_id: Option<String>,
    /// Associated object id set
    ///
    /// 关联的对象id集合
    pub rel_rbum_ids: Option<Vec<String>>,
    /// Associated resource certificate configuration id set
    ///
    /// 关联的凭证配置id集合
    pub rel_rbum_cert_conf_ids: Option<Vec<String>>,
}

/// Resource kind filter
///
/// 资源类型过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumKindFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Module
    ///
    /// 模块
    pub module: Option<String>,
}

/// Resource kind attribute filter
///
/// 资源类型属性过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumKindAttrFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Whether it is a secret
    ///
    /// 是否是秘密
    pub secret: Option<bool>,
    /// Parent attribute name
    ///
    /// 父属性名称
    pub parent_attr_name: Option<String>,
}

/// Resource item attribute filter
///
/// 资源项属性过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumItemAttrFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Associated resource item id
    ///
    /// 关联的资源项id
    pub rel_rbum_item_id: Option<String>,
    /// Associated resource kind attribute id
    ///
    /// 关联的资源类型属性id
    pub rel_rbum_kind_attr_id: Option<String>,
}

/// Resource relation filter
///
/// 资源关联过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumRelFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Associated tag
    ///
    /// 关联的标签
    pub tag: Option<String>,
    /// ``from`` party kind
    ///
    /// ``from`` 方的类型
    pub from_rbum_kind: Option<RbumRelFromKind>,
    /// ``from`` party object id
    ///
    /// ``from`` 方的对象id
    pub from_rbum_id: Option<String>,
    /// ``from`` party scope levels
    ///
    /// ``from`` 方的作用域集合
    pub from_rbum_scope_levels: Option<Vec<i16>>,
    /// ``to`` party object id
    ///
    /// ``to`` 方的对象id
    pub to_rbum_item_id: Option<String>,
    /// ``to`` party scope levels
    ///
    /// ``to`` 方的作用域集合
    pub to_rbum_item_scope_levels: Option<Vec<i16>>,
    /// ``to`` party ownership
    ///
    /// ``to`` 方的所有权
    pub to_own_paths: Option<String>,
    /// Extension information(equal)
    ///
    /// 扩展信息(相等)
    pub ext_eq: Option<String>,
    /// Extension information(like)
    ///
    /// 扩展信息(包含)
    pub ext_like: Option<String>,
}

/// Resource relation extension filter
///
/// 资源关联扩展过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumRelExtFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Associated resource relation id
    ///
    /// 关联的资源关联id
    pub rel_rbum_rel_id: Option<String>,
}

/// Resource set filter
///
/// 资源集过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
pub struct RbumSetFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Resource relation filter
    ///
    /// 资源关联过滤
    pub rel: Option<RbumItemRelSimpleFilterReq>,
    /// Resource kind id
    ///
    /// 资源类型id
    pub kind: Option<String>,
}

/// Resource set category(node) filter
///
/// 资源集分类(节点)过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
pub struct RbumSetCateFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Resource relation filter
    ///
    /// 资源关联过滤
    pub rel: Option<RbumItemRelSimpleFilterReq>,
    /// Resource set id
    ///
    /// 资源集id
    pub rel_rbum_set_id: Option<String>,
    /// Resource category (node) sys_codes
    ///
    /// 资源分类(节点)sys_code 列表
    pub sys_codes: Option<Vec<String>>,
    /// Resource set category(node) query kind
    ///
    /// 资源集分类(节点)的查询类型
    ///
    /// Only valid when ``sys_codes`` exists.
    ///
    /// 仅当 ``sys_codes`` 存在时有效。
    pub sys_code_query_kind: Option<RbumSetCateLevelQueryKind>,
    /// Resource set category(node) query depth
    ///
    /// 资源集分类(节点)查询深度
    ///
    /// Only valid when ``sys_codes`` exists and ``sys_code_query_kind = CurrentAndSub or Sub``.
    ///
    /// 仅当 ``sys_codes`` 存在并且 ``sys_code_query_kind = CurrentAndSub or Sub`` 时有效。
    pub sys_code_query_depth: Option<i16>,
    /// Resource category (node) extension information
    ///
    /// 资源分类(节点)扩展信息
    pub cate_exts: Option<Vec<String>>,
}

/// Resource set category(node) mount resource item filter
///
/// 资源集分类(节点)挂载资源项的过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
pub struct RbumSetItemFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Resource set id
    ///
    /// 资源集id
    pub rel_rbum_set_id: Option<String>,
    /// Resource set category(node) query kind
    ///
    /// 资源集分类(节点)的查询类型
    ///
    /// Only valid when ``sys_codes`` exists.
    ///
    /// 仅当 ``sys_codes`` 存在时有效。
    pub sys_code_query_kind: Option<RbumSetCateLevelQueryKind>,
    /// Resource set category(node) query depth
    ///
    /// 资源集分类(节点)查询深度
    ///
    /// Only valid when ``sys_codes`` exists and ``sys_code_query_kind = CurrentAndSub or Sub``.
    ///
    /// 仅当 ``sys_codes`` 存在并且 ``sys_code_query_kind = CurrentAndSub or Sub`` 时有效。
    pub sys_code_query_depth: Option<i16>,
    /// Resource category (node) sys_codes
    ///
    /// 资源分类(节点)sys_code 列表
    pub rel_rbum_set_cate_sys_codes: Option<Vec<String>>,
    /// Resource category (node) id set
    ///
    /// 资源分类(节点)id 列表
    pub rel_rbum_set_cate_ids: Option<Vec<String>>,
    /// Resource category (node) code
    ///
    /// 资源分类(节点)code
    pub rel_rbum_set_item_cate_code: Option<String>,
    /// Whether the associated resource item can not exist
    ///
    /// 关联的资源项是否可以不存在
    ///
    /// Default is ``true``
    ///
    /// 默认为 ``true``
    pub rel_rbum_item_can_not_exist: Option<bool>,
    /// Associated resource item id set
    /// 关联的资源项id列表
    pub rel_rbum_item_ids: Option<Vec<String>>,
    /// Associated resource item scope level
    ///
    /// 关联的资源项作用域级别
    pub rel_rbum_item_scope_level: Option<RbumScopeLevelKind>,
    /// Associated resource item kind id set
    ///
    /// 关联的资源项类型id列表
    pub rel_rbum_item_kind_ids: Option<Vec<String>>,
    /// Associated resource item domain id set
    ///
    /// 关联的资源项域id列表
    pub rel_rbum_item_domain_ids: Option<Vec<String>>,
    /// Whether the associated resource item is disabled
    ///
    /// 关联的资源项是否已禁用
    pub rel_rbum_item_disabled: Option<bool>,
}

/// Resource set filter
///
/// 资源集过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
pub struct RbumSetTreeFilterReq {
    /// Resource category (node) sys_codes
    ///
    /// 资源分类(节点)sys_code 列表
    pub sys_codes: Option<Vec<String>>,
    /// Resource set category(node) query kind
    ///
    /// 资源集分类(节点)的查询类型
    ///
    /// Only valid when ``sys_codes`` exists.
    ///
    /// 仅当 ``sys_codes`` 存在时有效。
    pub sys_code_query_kind: Option<RbumSetCateLevelQueryKind>,
    /// Resource set category(node) query depth
    ///
    /// 资源集分类(节点)查询深度
    ///
    /// Only valid when ``sys_codes`` exists and ``sys_code_query_kind = CurrentAndSub or Sub``.
    ///
    /// 仅当 ``sys_codes`` 存在并且 ``sys_code_query_kind = CurrentAndSub or Sub`` 时有效。
    pub sys_code_query_depth: Option<i16>,
    /// Resource category (node) extension information
    ///
    /// 资源分类(节点)扩展信息
    pub cate_exts: Option<Vec<String>>,
    /// Whether to get the associated resource items
    ///
    /// 是否获取关联的资源项
    pub fetch_cate_item: bool,
    /// Whether to not get the associated resource items and the disabled ones
    ///
    /// 是否不获取包含关联的且已禁用的资源项
    ///
    /// Only valid when ``fetch_cate_item = true``.
    ///
    /// 仅当 ``fetch_cate_item = true`` 时有效。
    pub hide_item_with_disabled: bool,
    /// Whether to filter out nodes that do not have associated resource items
    ///
    /// 返回的树是否过滤掉没有关联资源项的节点
    ///
    /// Only valid when ``fetch_cate_item = true``.
    ///
    /// 仅当 ``fetch_cate_item = true`` 时有效。
    pub hide_cate_with_empty_item: bool,
    /// Associated resource item id set
    ///
    /// 关联的资源项id列表
    ///
    /// Only valid when ``fetch_cate_item = true``.
    ///
    /// 仅当 ``fetch_cate_item = true`` 时有效。
    pub rel_rbum_item_ids: Option<Vec<String>>,
    /// Associated resource item kind id set
    ///
    /// 关联的资源项类型id列表
    ///
    /// Only valid when ``fetch_cate_item = true``.
    ///
    /// 仅当 ``fetch_cate_item = true`` 时有效。
    pub rel_rbum_item_kind_ids: Option<Vec<String>>,
    /// Associated resource item domain id set
    ///
    /// 关联的资源项域id列表
    ///
    /// Only valid when ``fetch_cate_item = true``.
    ///
    /// 仅当 ``fetch_cate_item = true`` 时有效。
    pub rel_rbum_item_domain_ids: Option<Vec<String>>,
}

/// Resource set category (node) associated filter for mounted resource items
///
/// 资源集分类(节点)挂载资源项的关联过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumSetItemRelFilterReq {
    /// Resource set id and resource category (node) id set
    ///
    /// 资源集Id与资源分类(节点)Id集合
    ///
    /// There is an ``or`` relationship between different resource sets, and the Id set of each resource category (node) in the same resource set is an ``or`` relationship.
    ///
    /// 不同资源集之间为 ``or`` 关系,同一资源集的每个资源分类(节点)Id集合为 ``or`` 关系。
    pub set_ids_and_cate_codes: Option<HashMap<String, Vec<String>>>,
    /// Whether the resource category (node) is associated with descendants
    ///
    /// 资源分类(节点)是否包含子孙级
    pub with_sub_set_cate_codes: bool,
    /// Associated object id set
    ///
    /// 关联的对象id集合
    pub rel_item_ids: Option<Vec<String>>,
}

/// Simple Resource item relation filter
///
/// 简单的资源项关联过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumItemRelSimpleFilterReq {
    /// Whether the related party is a ``from`` party
    ///
    /// 关联方是否是 ``from`` 方
    pub rel_by_from: bool,
    /// Associated tag
    ///
    /// 关联的标签
    pub tag: Option<String>,
    /// ``from`` party kind
    ///
    /// ``from`` 方的类型
    pub from_rbum_kind: Option<RbumRelFromKind>,
    /// Associated object id
    ///
    /// 关联的对象id
    pub rel_item_id: Option<String>,
}

/// Resource item relation filter
///
/// 资源项关联过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumItemRelFilterReq {
    /// Is it optional
    ///
    /// 是否可选
    ///
    /// When it is ``true``, it means that records with empty associations can be returned (corresponding to left join),
    /// otherwise records that fully satisfy the association filtering (corresponding to inner join) are returned.
    ///
    /// 为 ``true`` 时表示可返回关联为空的记录(对应于left join),反之返回完全满足关联过滤的记录(对应于inner join)。
    pub optional: bool,
    /// Whether the related party is a ``from`` party
    ///
    /// 关联方是否是 ``from`` 方
    pub rel_by_from: bool,
    /// Associated tag
    ///
    /// 关联的标签
    pub tag: Option<String>,
    /// ``from`` party kind
    ///
    /// ``from`` 方的类型
    pub from_rbum_kind: Option<RbumRelFromKind>,
    /// Associated object id
    ///
    /// 关联的对象id
    pub rel_item_id: Option<String>,
    /// Associated object id set
    ///
    /// 关联的对象id集合
    pub rel_item_ids: Option<Vec<String>>,
    /// Extension information(equal)
    ///
    /// 扩展信息(相等)
    pub ext_eq: Option<String>,
    /// Extension information(like)
    ///
    /// 扩展信息(包含)
    pub ext_like: Option<String>,
    pub own_paths: Option<String>,
}

/// Resource item filter fetcher
///
/// 资源项过滤获取器
pub trait RbumItemFilterFetcher {
    /// Basic filter
    ///
    /// 基础过滤
    fn basic(&self) -> &RbumBasicFilterReq;
    /// Resource item relation filter 1
    ///
    /// 资源项关联过滤1
    fn rel(&self) -> &Option<RbumItemRelFilterReq>;
    /// Resource item relation filter 2
    ///
    /// 资源项关联过滤2
    fn rel2(&self) -> &Option<RbumItemRelFilterReq>;
}

/// Resource item basic filter
///
/// 资源项基础过滤器
#[derive(Serialize, Deserialize, Debug, Clone, Default, poem_openapi::Object)]
#[serde(default)]
pub struct RbumItemBasicFilterReq {
    /// Basic filter
    ///
    /// 基础过滤
    pub basic: RbumBasicFilterReq,
    /// Resource item relation filter 1
    ///
    /// 资源项关联过滤1
    pub rel: Option<RbumItemRelFilterReq>,
}

impl RbumItemFilterFetcher for RbumItemBasicFilterReq {
    fn basic(&self) -> &RbumBasicFilterReq {
        &self.basic
    }
    fn rel(&self) -> &Option<RbumItemRelFilterReq> {
        &self.rel
    }
    fn rel2(&self) -> &Option<RbumItemRelFilterReq> {
        &self.rel
    }
}