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
use serde::{Deserialize, Serialize};
use tardis::basic::field::TrimString;
use tardis::chrono::{DateTime, Utc};
use tardis::db::sea_orm;
use tardis::web::poem_openapi;
use crate::rbum::rbum_enumeration::RbumScopeLevelKind;
/// Add request for resource kind
///
/// 资源类型添加请求
#[derive(Serialize, Deserialize, Debug, poem_openapi::Object)]
pub struct RbumKindAddReq {
/// Resource kind module
///
/// 资源类型模块
///
/// Default is ``empty``
///
/// 默认为 ``空``
///
/// Used to further divide the resource kind. For example, there are multiple resource kinds under the ``cmdb compute`` module, such as ``ecs, ec2, k8s``.
///
/// 用于对资源类型做简单的分类。比如 ``cmdb计算`` 模块下可以有 ``ecs、ec2、k8s`` 等多个资源类型。
#[oai(validator(min_length = "2", max_length = "255"))]
pub module: Option<String>,
/// Resource kind code
///
/// 资源类型编码
///
/// Resource kind code, which is required to conform to the scheme specification in the uri, matching the regular: ``^[a-z0-9-.]+$`` .
///
/// 资源类型编码,需要符合uri中的scheme规范,匹配正则:``^[a-z0-9-.]+$`` 。
#[oai(validator(min_length = "2", max_length = "255"))]
pub code: TrimString,
/// Resource kind name
///
/// 资源类型名称
#[oai(validator(min_length = "2", max_length = "255"))]
pub name: TrimString,
/// Resource kind note
///
/// 资源类型备注
#[oai(validator(min_length = "2", max_length = "2000"))]
pub note: Option<String>,
/// Resource kind icon
///
/// 资源类型图标
#[oai(validator(min_length = "2", max_length = "1000"))]
pub icon: Option<String>,
/// Resource kind sort
///
/// 资源类型排序
pub sort: Option<i64>,
/// Extension table name
///
/// 扩展表名
///
/// Each resource kind can specify an extension table for storing customized data.
///
/// 每个资源类型可以指定一个扩展表用于存储自定义数据。
#[oai(validator(min_length = "2", max_length = "255"))]
pub ext_table_name: Option<String>,
pub scope_level: Option<RbumScopeLevelKind>,
}
/// Modify request for resource kind
///
/// 资源类型修改请求
#[derive(Serialize, Deserialize, Debug, poem_openapi::Object)]
pub struct RbumKindModifyReq {
/// Resource kind module
///
/// 资源类型模块
///
/// Used to further divide the resource kind. For example, there are multiple resource kinds under the ``cmdb compute`` module, such as ``ecs, ec2, k8s``.
///
/// 用于对资源类型做简单的分类。比如 ``cmdb计算`` 模块下可以有 ``ecs、ec2、k8s`` 等多个资源类型。
#[oai(validator(min_length = "2", max_length = "255"))]
pub module: Option<String>,
/// Resource kind name
///
/// 资源类型名称
#[oai(validator(min_length = "2", max_length = "255"))]
pub name: Option<TrimString>,
/// Resource kind note
///
/// 资源类型备注
#[oai(validator(min_length = "2", max_length = "2000"))]
pub note: Option<String>,
/// Resource kind icon
///
/// 资源类型图标
#[oai(validator(min_length = "2", max_length = "1000"))]
pub icon: Option<String>,
/// Resource kind sort
///
/// 资源类型排序
pub sort: Option<i64>,
/// Extension table name
///
/// 扩展表名
///
/// Each resource kind can specify an extension table for storing customized data.
///
/// 每个资源类型可以指定一个扩展表用于存储自定义数据。
#[oai(validator(min_length = "2", max_length = "255"))]
pub ext_table_name: Option<String>,
pub scope_level: Option<RbumScopeLevelKind>,
}
/// Resource kind summary information
///
/// 资源类型概要信息
#[derive(Serialize, Deserialize, Debug, Clone, poem_openapi::Object, sea_orm::FromQueryResult)]
pub struct RbumKindSummaryResp {
/// Resource kind id
///
/// 资源类型id
pub id: String,
/// Resource kind module
///
/// 资源类型模块
pub module: String,
/// Resource kind code
///
/// 资源类型编码
pub code: String,
/// Resource kind name
///
/// 资源类型名称
pub name: String,
/// Resource kind icon
///
/// 资源类型图标
pub icon: String,
/// Resource kind sort
///
/// 资源类型排序
pub sort: i64,
/// Extension table name
///
/// 扩展表名
pub ext_table_name: String,
pub own_paths: String,
pub owner: String,
pub create_time: DateTime<Utc>,
pub update_time: DateTime<Utc>,
pub scope_level: RbumScopeLevelKind,
}
/// Resource kind detail information
///
/// 资源类型详细信息
#[derive(Serialize, Deserialize, Debug, Clone, poem_openapi::Object, sea_orm::FromQueryResult)]
pub struct RbumKindDetailResp {
/// Resource kind id
///
/// 资源类型id
pub id: String,
/// Resource kind module
///
/// 资源类型模块
pub module: String,
/// Resource kind code
///
/// 资源类型编码
pub code: String,
/// Resource kind name
///
/// 资源类型名称
pub name: String,
/// Resource kind note
///
/// 资源类型备注
pub note: String,
/// Resource kind icon
///
/// 资源类型图标
pub icon: String,
/// Resource kind sort
///
/// 资源类型排序
pub sort: i64,
/// Extension table name
///
/// 扩展表名
pub ext_table_name: String,
pub own_paths: String,
pub owner: String,
pub owner_name: Option<String>,
pub create_time: DateTime<Utc>,
pub update_time: DateTime<Utc>,
pub scope_level: RbumScopeLevelKind,
}