完善 API Key 能力范围可视化和维护

This commit is contained in:
2026-06-07 19:01:32 +08:00
parent dc14866210
commit f47132a653
19 changed files with 1165 additions and 49 deletions
+142
View File
@@ -731,6 +731,24 @@ definitions:
example: manual recharge
type: string
type: object
httpapi.walletRechargeRequest:
properties:
amount:
example: 100
type: number
currency:
example: resource
type: string
idempotencyKey:
example: wallet-recharge-20260514-001
type: string
metadata:
additionalProperties: {}
type: object
reason:
example: manual recharge
type: string
type: object
store.APIKey:
properties:
createdAt:
@@ -2278,6 +2296,13 @@ definitions:
taskId:
type: string
type: object
store.UpdateAPIKeyScopesInput:
properties:
scopes:
items:
type: string
type: array
type: object
store.UserGroup:
properties:
billingDiscountPolicy:
@@ -4642,6 +4667,55 @@ paths:
summary: 设置用户钱包余额
tags:
- billing
/api/admin/users/{userID}/wallet/recharge:
post:
consumes:
- application/json
description: 管理端给指定用户钱包追加充值金额,并记录审计日志;amount 必须大于 0。
parameters:
- description: 用户 ID
in: path
name: userID
required: true
type: string
- description: 钱包充值请求
in: body
name: input
required: true
schema:
$ref: '#/definitions/httpapi.walletRechargeRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/httpapi.WalletAdjustmentResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"403":
description: Forbidden
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"404":
description: Not Found
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
security:
- BearerAuth: []
summary: 充值用户钱包余额
tags:
- billing
/api/playground/api-keys:
get:
description: 返回当前本地用户可在 Playground 中直接使用的 API Key 和 secret。
@@ -4799,6 +4873,51 @@ paths:
summary: 禁用 API Key
tags:
- api-keys
/api/v1/api-keys/{apiKeyID}/scopes:
patch:
consumes:
- application/json
description: 更新当前用户拥有的 API Key scopes,至少需要保留一个能力范围。
parameters:
- description: API Key ID
in: path
name: apiKeyID
required: true
type: string
- description: API Key scope 更新请求
in: body
name: input
required: true
schema:
$ref: '#/definitions/store.UpdateAPIKeyScopesInput'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/store.APIKey'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"404":
description: Not Found
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
security:
- BearerAuth: []
summary: 更新 API Key 能力范围
tags:
- api-keys
/api/v1/api-keys/access-rules:
get:
description: 返回当前本地用户可管理的 API Key 访问规则。
@@ -6096,6 +6215,29 @@ paths:
summary: 获取任务参数预处理日志
tags:
- tasks
/api/workspace/user-groups:
get:
description: 返回当前用户关联的用户组及策略摘要,供个人中心使用。
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/httpapi.UserGroupListResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/httpapi.ErrorEnvelope'
security:
- BearerAuth: []
summary: 获取当前用户组策略
tags:
- workspace
/api/workspace/wallet:
get:
description: 返回当前用户的钱包账户、余额和最近消费摘要,可按 currency 过滤。