blob: ffe6dbf653fd9fce6e6f001b6395e7e6048714b4 [file] [log] [blame]
刘洪青2fdb2cb2020-10-09 15:07:18 +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: '管理中心菜单'
26 - name: Permission
27 description: '云平台权限'
28paths:
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
64 '/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
198components:
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": "读取后台菜单"
210 "admincenter:v1:readAdminCenterPermission": "读取权限"
211
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: '异常响应'
刘洪青6acaef92021-01-12 10:42:52 +0800233 type: object
刘洪青2fdb2cb2020-10-09 15:07:18 +0800234 required:
235 - code
236 - message
237 properties:
238 code:
239 title: 异常代码
240 type: integer
241 format: int32
242 default: -1
243 message:
244 title: 异常信息
245 type: string
246 default: "未知错误"
247
248 # DTO
249
250 GrantedMenu:
251 title: DTO - 菜单数据
252 type: object
253 properties:
254 id:
255 title: ID
256 type: string
257 code:
258 title: 代码
259 type: string
260 name:
261 title: 名称
262 type: string
263 memo:
264 title: 备注
265 type: string
266 status:
267 title: 状态(1 启用,0 停用)
268 type: string
269 applicationId:
270 title: 系统ID
271 type: string
272 parentId:
273 title: 父级ID
274 type: string
275 icon:
276 title: 菜单图标
277 type: string
278 origin:
279 title: 来源系统
280 type: string
281 url:
282 title: URL地址
283 type: string
284 order:
285 title: 排序
286 type: integer
287 format: int32
288
289 GrantedOperation:
290 title: DTO - 操作数据
291 type: object
292 properties:
293 id:
294 title: ID
295 type: string
296 code:
297 title: 代码
298 type: string
299 name:
300 title: 名称
301 type: string
302 memo:
303 title: 备注
304 type: string
305 status:
306 title: 状态(1 启用,0 停用)
307 type: string
308 applicationId:
309 title: 系统ID
310 type: string
311 parentId:
312 title: 父级ID
313 type: string
314 order:
315 title: 排序
316 type: integer
317 format: int32
318
319 GrantedResource:
320 title: DTO - 资源数据
321 type: object
322 properties:
323 id:
324 title: ID
325 type: string
326 code:
327 title: 代码
328 type: string
329 name:
330 title: 名称
331 type: string
332 memo:
333 title: 备注
334 type: string
335 status:
336 title: 状态(1 启用,0 停用)
337 type: string
338 applicationId:
339 title: 系统ID
340 type: string
341 origin:
342 title: 来源系统
343 type: string
344 method:
345 title: 请求方式(GET、POST、PUT、DELETE 等)
346 type: string
347 path:
348 title: 请求路径
349 type: string
350 access:
351 title: 访问规则(匿名访问anonymous、认证访问authenticate、授权访问authorize、允许所有permitAll、拒绝所有denyAll)
352 type: string
353
354
355 # Request VO
356
357
358 # Response Data
359
360 GrantedMenusResponseData:
361 title: 响应数据 - 菜单列表
362 type: object
363 properties:
364 menus:
365 title: 菜单列表
366 type: array
367 items:
368 $ref: '#/components/schemas/GrantedMenu'
369
370 GrantedOperationsResponseData:
371 title: 响应数据 - 操作列表
372 type: object
373 properties:
374 operations:
375 title: 操作列表
376 type: array
377 items:
378 $ref: '#/components/schemas/GrantedOperation'
379
380 GrantedResourcesResponseData:
381 title: 响应数据 - 资源列表
382 type: object
383 properties:
384 resource:
385 title: 资源列表
386 type: array
387 items:
388 $ref: '#/components/schemas/GrantedResource'
389
390 GrantedPermissionsResponseData:
391 title: 响应数据 - 权限列表
392 type: object
393 properties:
394 menus:
395 title: 菜单列表
396 type: array
397 items:
398 $ref: '#/components/schemas/GrantedMenu'
399 operations:
400 title: 操作列表
401 type: array
402 items:
403 $ref: '#/components/schemas/GrantedOperation'
404 resource:
405 title: 资源列表
406 type: array
407 items:
408 $ref: '#/components/schemas/GrantedResource'
409
410
411 # Response VO
412
413 ApiDataResponse:
414 title: 响应
刘洪青6acaef92021-01-12 10:42:52 +0800415 type: object
刘洪青2fdb2cb2020-10-09 15:07:18 +0800416 properties:
417 code:
418 title: 响应代码
419 type: integer
420 format: int32
421 default: 0
422 message:
423 title: 响应信息
424 type: string
425 data:
426 title: 响应数据
427 type: object
428
429 DefaultApiDataResponse:
430 allOf:
431 - $ref: '#/components/schemas/ApiDataResponse'
432 - type: object
433 title: 响应
434 properties:
435 data:
436 title: 响应数据
437 type: object
438
439 GrantedMenusResponse:
440 allOf:
441 - $ref: '#/components/schemas/DefaultApiDataResponse'
442 - type: object
443 title: 响应
444 properties:
445 data:
446 allOf:
447 - $ref: '#/components/schemas/GrantedMenusResponseData'
448
449 GrantedOperationsResponse:
450 allOf:
451 - $ref: '#/components/schemas/DefaultApiDataResponse'
452 - type: object
453 title: 响应
454 properties:
455 data:
456 allOf:
457 - $ref: '#/components/schemas/GrantedOperationsResponseData'
458
459 GrantedResourcesResponse:
460 allOf:
461 - $ref: '#/components/schemas/DefaultApiDataResponse'
462 - type: object
463 title: 响应
464 properties:
465 data:
466 allOf:
467 - $ref: '#/components/schemas/GrantedResourcesResponseData'
468
469 GrantedPermissionsResponse:
470 allOf:
471 - $ref: '#/components/schemas/DefaultApiDataResponse'
472 - type: object
473 title: 响应
474 properties:
475 data:
476 allOf:
477 - $ref: '#/components/schemas/GrantedPermissionsResponseData'