完善 API Key 能力范围可视化和维护
This commit is contained in:
@@ -3575,6 +3575,82 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/users/{userID}/wallet/recharge": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "管理端给指定用户钱包追加充值金额,并记录审计日志;amount 必须大于 0。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"billing"
|
||||
],
|
||||
"summary": "充值用户钱包余额",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "用户 ID",
|
||||
"name": "userID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "钱包充值请求",
|
||||
"name": "input",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/httpapi.walletRechargeRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/playground/api-keys": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -3935,6 +4011,76 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/api-keys/{apiKeyID}/scopes": {
|
||||
"patch": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "更新当前用户拥有的 API Key scopes,至少需要保留一个能力范围。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"api-keys"
|
||||
],
|
||||
"summary": "更新 API Key 能力范围",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "API Key ID",
|
||||
"name": "apiKeyID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "API Key scope 更新请求",
|
||||
"name": "input",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/store.UpdateAPIKeyScopesInput"
|
||||
}
|
||||
}
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/auth/login": {
|
||||
"post": {
|
||||
"description": "使用用户名或邮箱登录本地账号,并返回 24 小时 JWT。",
|
||||
@@ -5828,6 +5974,43 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/workspace/user-groups": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "返回当前用户关联的用户组及策略摘要,供个人中心使用。",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"workspace"
|
||||
],
|
||||
"summary": "获取当前用户组策略",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/workspace/wallet": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -8937,6 +9120,31 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"httpapi.walletRechargeRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"type": "number",
|
||||
"example": 100
|
||||
},
|
||||
"currency": {
|
||||
"type": "string",
|
||||
"example": "resource"
|
||||
},
|
||||
"idempotencyKey": {
|
||||
"type": "string",
|
||||
"example": "wallet-recharge-20260514-001"
|
||||
},
|
||||
"metadata": {
|
||||
"type": "object",
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"reason": {
|
||||
"type": "string",
|
||||
"example": "manual recharge"
|
||||
}
|
||||
}
|
||||
},
|
||||
"store.APIKey": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -11220,6 +11428,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"store.UpdateAPIKeyScopesInput": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"scopes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"store.UserGroup": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -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 过滤。
|
||||
|
||||
Reference in New Issue
Block a user