blob: d44c849127b7c7f236ce91107450fb0472684548 [file] [log] [blame]
刘洪青47205852020-08-14 13:39:30 +08001# admin-center-poa.v1.yaml
2#
3# 1. 创建服务
4# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services' -H 'Content-Type: application/json' -d '{"id": "admincenter", "origin": "http://admin-center-poa-svc.admin-center.svc.cluster.local:8080", "name": "管理中心", "description": "管理中心"}'
5#
6# 2. 创建版本
7# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/admincenter/apiVersions/v1'
8#
9# 3. 上传OAS Yaml
10# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/admincenter/apiVersions/v1/apiSpecs' -H 'Content-Type: application/yaml' --data-binary @admin-center-poa.v1.yaml
11#
12# 4. 发布版本
13# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/admincenter/apiVersions/v1/publish'
14#
15openapi: 3.0.2
16info:
17 title: Admin Center Platform Open APIs
18 version: v1
19 description: '管理中心 - 平台开放接口'
20servers:
21 - url: '${POA_SERVER_URL}/apis/admincenter/v1'
22 description: '正式环境'
23tags:
24 - name: Menu
25 description: '管理中心菜单'
刘洪青00f5acf2020-10-02 21:58:21 +080026 - name: Permission
27 description: '云平台权限'
刘洪青47205852020-08-14 13:39:30 +080028paths:
29
30 '/menus/accountName/{accountName}/menus':
31 get:
32 summary: 获取用户帐号可访问的菜单
33 description: 获取用户帐号可访问的菜单
34 operationId: loadAccountMenus
35 tags:
36 - Menu
37 security:
38 - oauth2:
39 - "admincenter:v1:readMenu"
40 parameters:
41 - name: accountName
42 in: path
43 required: true
44 description: 用户名
45 schema:
46 type: string
47 # - name: applicationId
48 # in: query
49 # required: true
50 # description: 应用标识
51 # schema:
52 # type: string
53 responses:
54 '200':
55 description: 菜单列表
56 content:
57 application/json:
58 schema:
59 $ref: '#/components/schemas/GrantedMenusResponse'
60 default:
61 $ref: '#/components/responses/DefaultErrorResponse'
62
63
刘洪青00f5acf2020-10-02 21:58:21 +080064 '/permissions/accountName/{accountName}/permissions':
65 get:
66 summary: 获取用户帐号拥有的权限
67 description: 获取用户帐号拥有的权限
68 operationId: loadAccountPermissions
69 tags:
70 - Permission
71 security:
72 - oauth2:
73 - "admincenter:v1:readAdminCenterPermission"
74 parameters:
75 - name: accountName
76 in: path
77 required: true
78 description: 用户名
79 schema:
80 type: string
81 - name: applicationId
82 in: query
83 required: false
84 description: 应用标识
85 schema:
86 type: string
87 responses:
88 '200':
89 description: 权限(菜单、操作、资源)列表
90 content:
91 application/json:
92 schema:
93 $ref: '#/components/schemas/GrantedPermissionsResponse'
94 default:
95 $ref: '#/components/responses/DefaultErrorResponse'
96
97
98 '/permissions/accountName/{accountName}/menus':
99 get:
100 summary: 获取用户帐号拥有的菜单
101 description: 获取用户帐号拥有的菜单
102 operationId: loadAccountPermissionMenus
103 tags:
104 - Permission
105 security:
106 - oauth2:
107 - "admincenter:v1:readAdminCenterPermission"
108 parameters:
109 - name: accountName
110 in: path
111 required: true
112 description: 用户名
113 schema:
114 type: string
115 - name: applicationId
116 in: query
117 required: false
118 description: 应用标识
119 schema:
120 type: string
121 responses:
122 '200':
123 description: 权限(菜单)列表
124 content:
125 application/json:
126 schema:
127 $ref: '#/components/schemas/GrantedMenusResponse'
128 default:
129 $ref: '#/components/responses/DefaultErrorResponse'
130
131 '/permissions/accountName/{accountName}/operations':
132 get:
133 summary: 获取用户帐号拥有的操作
134 description: 获取用户帐号拥有的操作
135 operationId: loadAccountPermissionOperations
136 tags:
137 - Permission
138 security:
139 - oauth2:
140 - "admincenter:v1:readAdminCenterPermission"
141 parameters:
142 - name: accountName
143 in: path
144 required: true
145 description: 用户名
146 schema:
147 type: string
148 - name: applicationId
149 in: query
150 required: false
151 description: 应用标识
152 schema:
153 type: string
154 responses:
155 '200':
156 description: 权限(操作)列表
157 content:
158 application/json:
159 schema:
160 $ref: '#/components/schemas/GrantedOperationsResponse'
161 default:
162 $ref: '#/components/responses/DefaultErrorResponse'
163
164 '/permissions/accountName/{accountName}/resources':
165 get:
166 summary: 获取用户帐号拥有的资源
167 description: 获取用户帐号拥有的资源
168 operationId: loadAccountPermissionResources
169 tags:
170 - Permission
171 security:
172 - oauth2:
173 - "admincenter:v1:readAdminCenterPermission"
174 parameters:
175 - name: accountName
176 in: path
177 required: true
178 description: 用户名
179 schema:
180 type: string
181 - name: applicationId
182 in: query
183 required: false
184 description: 应用标识
185 schema:
186 type: string
187 responses:
188 '200':
189 description: 菜单列表
190 content:
191 application/json:
192 schema:
193 $ref: '#/components/schemas/GrantedResourcesResponse'
194 default:
195 $ref: '#/components/responses/DefaultErrorResponse'
196
197
刘洪青47205852020-08-14 13:39:30 +0800198components:
199
200 # Security Schemes
201
202 securitySchemes:
203 oauth2:
204 type: oauth2
205 flows:
206 clientCredentials:
207 tokenUrl: ${POA_SERVER_URL}/oauth2/token
208 scopes:
209 "admincenter:v1:readMenu": "读取后台菜单"
刘洪青00f5acf2020-10-02 21:58:21 +0800210 "admincenter:v1:readAdminCenterPermission": "读取权限"
刘洪青47205852020-08-14 13:39:30 +0800211
212 responses:
213 'ErrorResponse400':
214 description: unexpected error
215 content:
216 application/json:
217 schema:
218 $ref: '#/components/schemas/ErrorResponse'
219
220 DefaultErrorResponse:
221 description: unexpected error
222 content:
223 application/json:
224 schema:
225 $ref: '#/components/schemas/ErrorResponse'
226
227 schemas:
228
229 # Error
230
231 ErrorResponse:
232 title: '异常响应'
233 required:
234 - code
235 - message
236 properties:
237 code:
238 title: 异常代码
239 type: integer
240 format: int32
241 default: -1
242 message:
243 title: 异常信息
244 type: string
245 default: "未知错误"
246
247 # DTO
248
249 GrantedMenu:
250 title: DTO - 菜单数据
251 type: object
252 properties:
253 id:
254 title: ID
255 type: string
256 code:
257 title: 代码
258 type: string
259 name:
260 title: 名称
261 type: string
262 memo:
263 title: 备注
264 type: string
265 status:
266 title: 状态(1 启用,0 停用)
267 type: string
刘洪青00f5acf2020-10-02 21:58:21 +0800268 applicationId:
269 title: 系统ID
270 type: string
271 parentId:
272 title: 父级ID
273 type: string
刘洪青47205852020-08-14 13:39:30 +0800274 icon:
275 title: 菜单图标
276 type: string
277 origin:
278 title: 来源系统
279 type: string
280 url:
281 title: URL地址
282 type: string
刘洪青00f5acf2020-10-02 21:58:21 +0800283 order:
284 title: 排序
285 type: integer
286 format: int32
287
288 GrantedOperation:
289 title: DTO - 操作数据
290 type: object
291 properties:
292 id:
293 title: ID
294 type: string
295 code:
296 title: 代码
297 type: string
298 name:
299 title: 名称
300 type: string
301 memo:
302 title: 备注
303 type: string
304 status:
305 title: 状态(1 启用,0 停用)
306 type: string
刘洪青47205852020-08-14 13:39:30 +0800307 applicationId:
308 title: 系统ID
309 type: string
310 parentId:
311 title: 父级ID
312 type: string
313 order:
314 title: 排序
刘洪青00f5acf2020-10-02 21:58:21 +0800315 type: integer
316 format: int32
317
318 GrantedResource:
319 title: DTO - 资源数据
320 type: object
321 properties:
322 id:
323 title: ID
324 type: string
325 code:
326 title: 代码
327 type: string
328 name:
329 title: 名称
330 type: string
331 memo:
332 title: 备注
333 type: string
334 status:
335 title: 状态(1 启用,0 停用)
336 type: string
337 applicationId:
338 title: 系统ID
339 type: string
340 origin:
341 title: 来源系统
342 type: string
343 method:
344 title: 请求方式(GET、POST、PUT、DELETE 等)
345 type: string
346 path:
347 title: 请求路径
348 type: string
349 access:
350 title: 访问规则(匿名访问anonymous、认证访问authenticate、授权访问authorize、允许所有permitAll、拒绝所有denyAll)
刘洪青47205852020-08-14 13:39:30 +0800351 type: string
352
353
354 # Request VO
355
356
357 # Response Data
358
359 GrantedMenusResponseData:
360 title: 响应数据 - 菜单列表
361 type: object
362 properties:
363 menus:
364 title: 菜单列表
365 type: array
366 items:
367 $ref: '#/components/schemas/GrantedMenu'
368
刘洪青00f5acf2020-10-02 21:58:21 +0800369 GrantedOperationsResponseData:
370 title: 响应数据 - 操作列表
371 type: object
372 properties:
373 operations:
374 title: 操作列表
375 type: array
376 items:
377 $ref: '#/components/schemas/GrantedOperation'
378
379 GrantedResourcesResponseData:
380 title: 响应数据 - 资源列表
381 type: object
382 properties:
383 resource:
384 title: 资源列表
385 type: array
386 items:
387 $ref: '#/components/schemas/GrantedResource'
388
389 GrantedPermissionsResponseData:
390 title: 响应数据 - 权限列表
391 type: object
392 properties:
393 menus:
394 title: 菜单列表
395 type: array
396 items:
397 $ref: '#/components/schemas/GrantedMenu'
398 operations:
399 title: 操作列表
400 type: array
401 items:
402 $ref: '#/components/schemas/GrantedOperation'
403 resource:
404 title: 资源列表
405 type: array
406 items:
407 $ref: '#/components/schemas/GrantedResource'
408
刘洪青47205852020-08-14 13:39:30 +0800409
410 # Response VO
411
412 ApiDataResponse:
413 title: 响应
414 properties:
415 code:
416 title: 响应代码
417 type: integer
418 format: int32
419 default: 0
420 message:
421 title: 响应信息
422 type: string
423 data:
424 title: 响应数据
425 type: object
426
427 DefaultApiDataResponse:
428 allOf:
429 - $ref: '#/components/schemas/ApiDataResponse'
430 - type: object
431 title: 响应
432 properties:
433 data:
434 title: 响应数据
435 type: object
436
437 GrantedMenusResponse:
438 allOf:
439 - $ref: '#/components/schemas/DefaultApiDataResponse'
440 - type: object
441 title: 响应
442 properties:
443 data:
444 allOf:
445 - $ref: '#/components/schemas/GrantedMenusResponseData'
刘洪青00f5acf2020-10-02 21:58:21 +0800446
447 GrantedOperationsResponse:
448 allOf:
449 - $ref: '#/components/schemas/DefaultApiDataResponse'
450 - type: object
451 title: 响应
452 properties:
453 data:
454 allOf:
455 - $ref: '#/components/schemas/GrantedOperationsResponseData'
456
457 GrantedResourcesResponse:
458 allOf:
459 - $ref: '#/components/schemas/DefaultApiDataResponse'
460 - type: object
461 title: 响应
462 properties:
463 data:
464 allOf:
465 - $ref: '#/components/schemas/GrantedResourcesResponseData'
466
467 GrantedPermissionsResponse:
468 allOf:
469 - $ref: '#/components/schemas/DefaultApiDataResponse'
470 - type: object
471 title: 响应
472 properties:
473 data:
474 allOf:
475 - $ref: '#/components/schemas/GrantedPermissionsResponseData'