monkeyDluffy6017 commented on PR #9522:
URL: https://github.com/apache/apisix/pull/9522#issuecomment-1611779708
## Secret
Secret 指的是 `Secrets Management`(密钥管理),可以使用任何支持的密钥管理器,例如 `vault`。
### 请求地址
Secret 资源请求地址:/apisix/admin/secrets/{secretmanager}/{id}
### 请求方法
| 方法 | 请求URI | 请求主体 | 描述
|
| ------ | ------------------------------------------- | -------- |
------------------------------------------------------------ |
| GET | /apisix/admin/secrets | NULL | 获取所有
secret 的列表。 |
| GET | /apisix/admin/secrets/{manager}/{id} | NULL | 根据 id
获取指定的 secret 。 |
| PUT | /apisix/admin/secrets/{manager} | {…} | 创建新的
secret 配置。 |
| DELETE | /apisix/admin/secrets/{manager}/{id} | NULL | 删除具有指定
id 的 secret。 |
| PATCH | /apisix/admin/secrets/{manager}/{id} | {…} | 更新指定
secret 的选定属性。如果要删除一个属性,可以将该属性的值设置为null。 |
| PATCH | /apisix/admin/secrets/{manager}/{id}/{path} | {…} |
更新路径中指定的属性。其他属性的值保持不变。 |
### body 请求参数
当`{secretmanager}`是`vault`时:
| 参数 | 是否必需 | 类型 | 描述 | 示例 |
| ---------- | -------- | ------ | ------------------ | ---- |
| uri | 是 | URI | Vault服务器的URI。 | |
| prefix | 是 | string | 密钥前缀 | |
| token | 是 | string | Vault令牌。 | |
配置示例:
```
{
"uri": "https://localhost/vault",
"prefix": "/apisix/kv",
"token": "343effad"
}
```
使用示例:
```
curl -i http://127.0.0.1:9180/apisix/admin/secrets/vault/test2 \
-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"uri": "http://xxx/get",
"prefix" : "apisix",
"token" : "apisix"
}'
```
```
HTTP/1.1 200 OK
{"key":"\/apisix\/secrets\/vault\/test2","value":{"id":"vault\/test2","token":"apisix","prefix":"apisix","update_time":1669625828,"create_time":1669625828,"uri":"http:\/\/xxx\/get"}}
```
### 应答参数
当前的响应是从etcd返回的。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]