Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: apigw add internationalization #166

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions sdks/apigw-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,24 @@ stage:
# set:
# X-Token: "token"


# 支持定义多个stage,如果定义多个,则同步脚本需要添加对应的同步命令,并指明:namespace(默认:stage) eg:stage2
# 同步脚本 sync-apigateway.sh 需要新增以下命令:
# python manage.py sync_apigw_stage --gateway-name=${gateway_name} --file="${definition_file}" --namespace="stage2"

#stage2:
# name: "test"
# description: "这是一个测试"
# description_en: "This is a test"
# proxy_http:
# timeout: 60
# upstreams:
# loadbalance: "roundrobin"
# hosts:
# - host: "https://httpbin.org"
# weight: 100


# 主动授权,网关主动给应用,添加访问网关所有资源或者具体某个资源的权限;
# 用于命令 `grant_apigw_permissions`
grant_permissions:
Expand Down Expand Up @@ -209,6 +227,50 @@ resource_docs:
basedir: "support-files/apidocs/"
```

#### 4. 国际化支持

##### 网关描述国际化
在 definition.yaml 中利用字段 description_en 指定英文描述。样例:

```yaml
apigateway:
description: "xxxx"
description_en: "This is the English description"
is_public: true
maintainers:
- "admin"
```
##### 环境描述国际化
在 definition.yaml 中利用字段 description_en 指定英文描述。样例:

```yaml
stage:
name: "prod"
description: "xxx"
description_en: "This is the English description"
```
##### 资源描述国际化
可以在resources.yaml对应的 `x-bk-apigateway-resource` 的 `descriptionEn` 指定英文描述
```yaml
x-bk-apigateway-resource:
isPublic: false
allowApplyPermission: false
matchSubpath: false
backend:
type: HTTP
method: get
path: /anything
matchSubpath: false
timeout: 0
upstreams: {}
transformHeaders: {}
authConfig:
appVerifiedRequired: true
userVerifiedRequired: false
resourcePermissionRequired: false
descriptionEn: anything

```
### 方案一:直接使用 Django Command 同步

此方案适用于 Django 项目,具体请参考 [sync-apigateway-with-django.md](docs/sync-apigateway-with-django.md)
Expand Down
Loading