blob: d44c849127b7c7f236ce91107450fb0472684548 [file] [log] [blame]
# admin-center-poa.v1.yaml
#
# 1. 创建服务
# 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": "管理中心"}'
#
# 2. 创建版本
# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/admincenter/apiVersions/v1'
#
# 3. 上传OAS Yaml
# 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
#
# 4. 发布版本
# curl -i -s -X POST 'https://poa-sa.dev.supwisdom.com/v1/services/admincenter/apiVersions/v1/publish'
#
openapi: 3.0.2
info:
title: Admin Center Platform Open APIs
version: v1
description: '管理中心 - 平台开放接口'
servers:
- url: '${POA_SERVER_URL}/apis/admincenter/v1'
description: '正式环境'
tags:
- name: Menu
description: '管理中心菜单'
- name: Permission
description: '云平台权限'
paths:
'/menus/accountName/{accountName}/menus':
get:
summary: 获取用户帐号可访问的菜单
description: 获取用户帐号可访问的菜单
operationId: loadAccountMenus
tags:
- Menu
security:
- oauth2:
- "admincenter:v1:readMenu"
parameters:
- name: accountName
in: path
required: true
description: 用户名
schema:
type: string
# - name: applicationId
# in: query
# required: true
# description: 应用标识
# schema:
# type: string
responses:
'200':
description: 菜单列表
content:
application/json:
schema:
$ref: '#/components/schemas/GrantedMenusResponse'
default:
$ref: '#/components/responses/DefaultErrorResponse'
'/permissions/accountName/{accountName}/permissions':
get:
summary: 获取用户帐号拥有的权限
description: 获取用户帐号拥有的权限
operationId: loadAccountPermissions
tags:
- Permission
security:
- oauth2:
- "admincenter:v1:readAdminCenterPermission"
parameters:
- name: accountName
in: path
required: true
description: 用户名
schema:
type: string
- name: applicationId
in: query
required: false
description: 应用标识
schema:
type: string
responses:
'200':
description: 权限(菜单、操作、资源)列表
content:
application/json:
schema:
$ref: '#/components/schemas/GrantedPermissionsResponse'
default:
$ref: '#/components/responses/DefaultErrorResponse'
'/permissions/accountName/{accountName}/menus':
get:
summary: 获取用户帐号拥有的菜单
description: 获取用户帐号拥有的菜单
operationId: loadAccountPermissionMenus
tags:
- Permission
security:
- oauth2:
- "admincenter:v1:readAdminCenterPermission"
parameters:
- name: accountName
in: path
required: true
description: 用户名
schema:
type: string
- name: applicationId
in: query
required: false
description: 应用标识
schema:
type: string
responses:
'200':
description: 权限(菜单)列表
content:
application/json:
schema:
$ref: '#/components/schemas/GrantedMenusResponse'
default:
$ref: '#/components/responses/DefaultErrorResponse'
'/permissions/accountName/{accountName}/operations':
get:
summary: 获取用户帐号拥有的操作
description: 获取用户帐号拥有的操作
operationId: loadAccountPermissionOperations
tags:
- Permission
security:
- oauth2:
- "admincenter:v1:readAdminCenterPermission"
parameters:
- name: accountName
in: path
required: true
description: 用户名
schema:
type: string
- name: applicationId
in: query
required: false
description: 应用标识
schema:
type: string
responses:
'200':
description: 权限(操作)列表
content:
application/json:
schema:
$ref: '#/components/schemas/GrantedOperationsResponse'
default:
$ref: '#/components/responses/DefaultErrorResponse'
'/permissions/accountName/{accountName}/resources':
get:
summary: 获取用户帐号拥有的资源
description: 获取用户帐号拥有的资源
operationId: loadAccountPermissionResources
tags:
- Permission
security:
- oauth2:
- "admincenter:v1:readAdminCenterPermission"
parameters:
- name: accountName
in: path
required: true
description: 用户名
schema:
type: string
- name: applicationId
in: query
required: false
description: 应用标识
schema:
type: string
responses:
'200':
description: 菜单列表
content:
application/json:
schema:
$ref: '#/components/schemas/GrantedResourcesResponse'
default:
$ref: '#/components/responses/DefaultErrorResponse'
components:
# Security Schemes
securitySchemes:
oauth2:
type: oauth2
flows:
clientCredentials:
tokenUrl: ${POA_SERVER_URL}/oauth2/token
scopes:
"admincenter:v1:readMenu": "读取后台菜单"
"admincenter:v1:readAdminCenterPermission": "读取权限"
responses:
'ErrorResponse400':
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
DefaultErrorResponse:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
schemas:
# Error
ErrorResponse:
title: '异常响应'
required:
- code
- message
properties:
code:
title: 异常代码
type: integer
format: int32
default: -1
message:
title: 异常信息
type: string
default: "未知错误"
# DTO
GrantedMenu:
title: DTO - 菜单数据
type: object
properties:
id:
title: ID
type: string
code:
title: 代码
type: string
name:
title: 名称
type: string
memo:
title: 备注
type: string
status:
title: 状态(1 启用,0 停用)
type: string
applicationId:
title: 系统ID
type: string
parentId:
title: 父级ID
type: string
icon:
title: 菜单图标
type: string
origin:
title: 来源系统
type: string
url:
title: URL地址
type: string
order:
title: 排序
type: integer
format: int32
GrantedOperation:
title: DTO - 操作数据
type: object
properties:
id:
title: ID
type: string
code:
title: 代码
type: string
name:
title: 名称
type: string
memo:
title: 备注
type: string
status:
title: 状态(1 启用,0 停用)
type: string
applicationId:
title: 系统ID
type: string
parentId:
title: 父级ID
type: string
order:
title: 排序
type: integer
format: int32
GrantedResource:
title: DTO - 资源数据
type: object
properties:
id:
title: ID
type: string
code:
title: 代码
type: string
name:
title: 名称
type: string
memo:
title: 备注
type: string
status:
title: 状态(1 启用,0 停用)
type: string
applicationId:
title: 系统ID
type: string
origin:
title: 来源系统
type: string
method:
title: 请求方式(GET、POST、PUT、DELETE 等)
type: string
path:
title: 请求路径
type: string
access:
title: 访问规则(匿名访问anonymous、认证访问authenticate、授权访问authorize、允许所有permitAll、拒绝所有denyAll)
type: string
# Request VO
# Response Data
GrantedMenusResponseData:
title: 响应数据 - 菜单列表
type: object
properties:
menus:
title: 菜单列表
type: array
items:
$ref: '#/components/schemas/GrantedMenu'
GrantedOperationsResponseData:
title: 响应数据 - 操作列表
type: object
properties:
operations:
title: 操作列表
type: array
items:
$ref: '#/components/schemas/GrantedOperation'
GrantedResourcesResponseData:
title: 响应数据 - 资源列表
type: object
properties:
resource:
title: 资源列表
type: array
items:
$ref: '#/components/schemas/GrantedResource'
GrantedPermissionsResponseData:
title: 响应数据 - 权限列表
type: object
properties:
menus:
title: 菜单列表
type: array
items:
$ref: '#/components/schemas/GrantedMenu'
operations:
title: 操作列表
type: array
items:
$ref: '#/components/schemas/GrantedOperation'
resource:
title: 资源列表
type: array
items:
$ref: '#/components/schemas/GrantedResource'
# Response VO
ApiDataResponse:
title: 响应
properties:
code:
title: 响应代码
type: integer
format: int32
default: 0
message:
title: 响应信息
type: string
data:
title: 响应数据
type: object
DefaultApiDataResponse:
allOf:
- $ref: '#/components/schemas/ApiDataResponse'
- type: object
title: 响应
properties:
data:
title: 响应数据
type: object
GrantedMenusResponse:
allOf:
- $ref: '#/components/schemas/DefaultApiDataResponse'
- type: object
title: 响应
properties:
data:
allOf:
- $ref: '#/components/schemas/GrantedMenusResponseData'
GrantedOperationsResponse:
allOf:
- $ref: '#/components/schemas/DefaultApiDataResponse'
- type: object
title: 响应
properties:
data:
allOf:
- $ref: '#/components/schemas/GrantedOperationsResponseData'
GrantedResourcesResponse:
allOf:
- $ref: '#/components/schemas/DefaultApiDataResponse'
- type: object
title: 响应
properties:
data:
allOf:
- $ref: '#/components/schemas/GrantedResourcesResponseData'
GrantedPermissionsResponse:
allOf:
- $ref: '#/components/schemas/DefaultApiDataResponse'
- type: object
title: 响应
properties:
data:
allOf:
- $ref: '#/components/schemas/GrantedPermissionsResponseData'