Skip to content

Commit

Permalink
添加网关 bk-apigateway 网关 API 文档 (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-smile authored Jul 20, 2023
1 parent 849d86e commit fdc561e
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
### 描述

回收蓝鲸应用访问网关资源的权限

### 输入参数

#### 路径参数

| 参数名称 | 参数类型 | 必选 | 描述 |
| -------- | -------- | ---- | ------ |
| api_name | string || 网关名 |

#### 请求参数

| 参数名称 | 参数类型 | 必选 | 描述 |
| ---------------- | -------- | ---- | --------------------------------- |
| target_app_codes | array || 待回收权限的应用列表 |
| grant_dimension | string || 授权维度,可选值:api(按网关授权) |

### 请求参数示例

```json
{
"target_app_codes": ["bk-sops"],
"grant_dimension": "api"
}
```

### SDK 调用示例

```python
from bkapi.bk_apigateway.shortcuts import get_client_by_request

client = get_client_by_request(request)
result = client.api.revoke_permissions(
{
"target_app_codes": ["bk-sops"],
"grant_dimension": "api"
},
path_params={
"api_name": "demo",
},
headers={"Content-Type": "application/json"},
)
```


### 响应示例

```json
{
"code": 0,
"message": "OK",
"data": null
}
```

### 响应参数说明

| 字段 | 类型 | 描述 |
| ------- | ------ | ---------------------------------- |
| code | int | 返回码,0 表示成功,其它值表示失败 |
| message | string | 错误信息 |
| data | object ||
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
release:
version: 1.0.1
title: 为网关同步SDK提供接口
comment: 为网关同步SDK提供接口
version: 1.0.2
title: 更新网关 API 文档
comment: 更新网关 API 文档

apigateway:
description: 蓝鲸API网关,官方内置网关,请勿修改
Expand All @@ -22,3 +22,6 @@ stage:
grant_permissions:
- bk_app_code: visual-layout
- bk_app_code: bk_lesscode

resource_docs:
basedir: "{{ settings.BASE_DIR }}/data/apidocs/"
1 change: 1 addition & 0 deletions src/dashboard/bin/post_migrate
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sync_bk_apigateway() {
python manage.py sync_apigw_config --api-name=bk-apigateway --host=${DASHBOARD_INNER_URL}/backend --file="${APIGW_DEFINITIONS_DIR}/bk-apigateway-definition.yaml"
python manage.py sync_apigw_stage --api-name=bk-apigateway --host=${DASHBOARD_INNER_URL}/backend --file="${APIGW_DEFINITIONS_DIR}/bk-apigateway-definition.yaml"
python manage.py sync_apigw_resources --delete --api-name=bk-apigateway --host=${DASHBOARD_INNER_URL}/backend --file="${APIGW_DEFINITIONS_DIR}/bk-apigateway-resources.yaml"
python manage.py sync_resource_docs_by_archive --api-name=bk-apigateway --host=${DASHBOARD_INNER_URL}/backend --file="${APIGW_DEFINITIONS_DIR}/bk-apigateway-definition.yaml"
python manage.py grant_apigw_permissions --api-name=bk-apigateway --host=${DASHBOARD_INNER_URL}/backend --file="${APIGW_DEFINITIONS_DIR}/bk-apigateway-definition.yaml"
python manage.py fetch_apigw_public_key --api-name=bk-apigateway --host=${DASHBOARD_INNER_URL}/backend
python manage.py create_version_and_release_apigw --generate-sdks --api-name=bk-apigateway --host=${DASHBOARD_INNER_URL}/backend --file="${APIGW_DEFINITIONS_DIR}/bk-apigateway-definition.yaml"
Expand Down

0 comments on commit fdc561e

Please sign in to comment.