Skip to content

Commit 35f990c

Browse files
authored
docs: add 4 apis in apigw (#2191)
1 parent 67fb5df commit 35f990c

11 files changed

Lines changed: 467 additions & 5 deletions
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
### Function Description
2+
Create a Cloud-Native Application
3+
4+
### Request Parameters
5+
6+
#### 1. Path Parameters:
7+
| Parameter Name | Parameter Type | Required | Parameter Description |
8+
| ------------ | ------------ | ------ | ---------------- |
9+
| app_code | string | Yes | Application ID, e.g., "monitor" |
10+
| module | string | Yes | Module name, e.g., "default" |
11+
12+
#### 2. Interface Parameters:
13+
| Field | Type | Required | Description |
14+
| ------ | ------ | ------ | ------ |
15+
| is_plugin_app | boolean | No | Whether it is a plugin application |
16+
| code | string | Yes | Application ID |
17+
| name | string | Yes | Application name |
18+
| source_config | dict | Yes | Source configuration |
19+
| bkapp_spec | dict | Yes | Application specification |
20+
21+
**Field Description for `source_config`:**
22+
| Field | Type | Required | Description |
23+
| ------ | ------ | ------ | ------ |
24+
| source_init_template | string | Yes | Source initialization template |
25+
| source_control_type | string | Yes | Source control type |
26+
| source_repo_url | string | Yes | Source repository URL |
27+
| source_origin | integer | Yes | Application code source (value is 1 for code repositories) |
28+
| source_dir | string | Yes | Build directory |
29+
| source_repo_auth_info | dict | Yes | Source repository authentication information |
30+
31+
**Field Description for `source_repo_auth_info`:**
32+
| Field | Type | Required | Description |
33+
| ------ | ------ | ------ | ------ |
34+
| username | string | Yes | Username |
35+
| password | string | Yes | Password |
36+
37+
**Field Description for `bkapp_spec`:**
38+
| Field | Type | Required | Description |
39+
| ------ | ------ | ------ | ------ |
40+
| build_config | dict | Yes | Build configuration |
41+
42+
**Field Description for `build_config`:**
43+
| Field | Type | Required | Description |
44+
| ------ | ------ | ------ | ------ |
45+
| build_method | string | Yes | Build method (optional values: buildpack, dockerfile) |
46+
47+
### Request Example
48+
```bash
49+
curl -X POST -H 'Content-Type: application/json' -H 'X-Bkapi-Authorization: {"bk_app_code": "apigw-api-test", "bk_app_secret": "***", "bk_token": "***"}' -d '{ "is_plugin_app": false, "region": "default", "code": "plugin1", "name": "plugin1", "source_config": { "source_init_template": "bk-apigw-plugin-python", "source_control_type": "bare_git", "source_repo_url": "https://gitee.com/example/apps.git", "source_origin": 1, "source_dir": "plugin", "source_repo_auth_info": { "username": "xxxxxx ", "password": "***" } }, "bkapp_spec": { "build_config": { "build_method": "buildpack" } }}' --insecure https://bkapi.example.com/api/bkpaas3/stag/bkapps/cloud-native/
50+
```
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
### Function Description
2+
Retrieve the List of Code Repository Branches for an Application Module
3+
4+
### Request Parameters
5+
6+
#### 1. Path Parameters:
7+
| Parameter Name | Parameter Type | Required | Parameter Description |
8+
| ------------ | ------------ | ------ | ---------------- |
9+
| app_code | string | Yes | Application ID, e.g., "appid1" |
10+
| module | string | Yes | Module name, e.g., "default" |
11+
12+
#### 2. Interface Parameters:
13+
None.
14+
15+
### Request Example
16+
```bash
17+
curl -X GET -H 'X-Bkapi-Authorization: {"bk_app_code": "apigw-api-test", "bk_app_secret": "***", "bk_ticket": "***"}' -d '{}' --insecure http://bkapi.example.com/api/bkpaas3/prod/bkapps/applications/appid1/modules/default/repo/branches/
18+
```
19+
20+
### Response Example
21+
```json
22+
{
23+
"results": [
24+
{
25+
"name": "master",
26+
"type": "branch",
27+
"display_type": "branch",
28+
"revision": "31736e690ba0bfa7a81d3730ed6544b3566b3f19",
29+
"url": "http://git.example.com/app-test.git",
30+
"last_update": "2024-09-10 16:48:24",
31+
"message": "init repo",
32+
"extra": {}
33+
}
34+
]
35+
}
36+
```
37+
38+
### Response Parameter Description
39+
| Field | Type | Required | Description |
40+
| ------ | ------ | ------ | ------ |
41+
| results | list | Yes | List of branches |
42+
43+
**Results Field Description:**
44+
| Field | Type | Required | Description |
45+
| ------ | ------ | ------ | ------ |
46+
| name | string | Yes | Branch name |
47+
| type | string | Yes | Branch type (branch/tag) |
48+
| display_type | string | Yes | Display type (branch/tag) |
49+
| revision | string | Yes | Latest commit hash of the branch |
50+
| url | string | Yes | Repository URL |
51+
| last_update | string | Yes | Last update time |
52+
| message | string | Yes | Commit message of the latest commit |
53+
| extra | dict | Yes | Additional information |
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
### Function Description
2+
Retrieve Runtime Overview Information for an Application Module (Including Code Repository Details)
3+
4+
### Request Parameters
5+
6+
#### 1. Path Parameters:
7+
| Parameter Name | Parameter Type | Required | Parameter Description |
8+
| ------------ | ------------ | ------ | ---------------- |
9+
| app_code | string | Yes | Application ID, e.g., "appid1" |
10+
| module | string | Yes | Module name, e.g., "default" |
11+
12+
#### 2. Interface Parameters:
13+
None.
14+
15+
### Request Example
16+
```bash
17+
curl -X GET -H 'X-Bkapi-Authorization: {"bk_app_code": "apigw-api-test", "bk_app_secret": "***", "bk_ticket": "***"}' -d '{}' --insecure http://bkapi.example.com/api/bkpaas3/prod/bkapps/applications/appid1/modules/default/runtime/overview
18+
```
19+
20+
### Response Example
21+
```json
22+
{
23+
"repo": {
24+
"source_type": "github",
25+
"type": "github",
26+
"trunk_url": "http://git.example.com/app-test.git",
27+
"repo_url": "http://git.example.com/app-test.git",
28+
"source_dir": "",
29+
"repo_fullname": "app-test",
30+
"diff_feature": {
31+
"method": "external",
32+
"enabled": true
33+
}
34+
}
35+
}
36+
```
37+
38+
### Response Parameter Description
39+
| Field | Type | Required | Description |
40+
| ------ | ------ | ------ | ------ |
41+
| repo | dict | Yes | Code repository related information |
42+
43+
**Repo Field Description:**
44+
| Field | Type | Required | Description |
45+
| ------ | ------ | ------ | ------ |
46+
| source_type | string | Yes | Code source type (e.g., "github") |
47+
| type | string | Yes | Repository type (usually same as source_type) |
48+
| trunk_url | string | Yes | Main branch URL |
49+
| repo_url | string | Yes | Repository URL |
50+
| source_dir | string | Yes | Source code directory |
51+
| repo_fullname | string | Yes | Full repository name (e.g., "app-test") |
52+
| diff_feature | dict | Yes | Difference comparison feature configuration |
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### Function Description
2+
Update or Create Environment Variable Values for an Application
3+
4+
### Request Parameters
5+
6+
#### 1. Path Parameters:
7+
| Parameter Name | Parameter Type | Required | Parameter Description |
8+
| ------------ | ------------ | ------ | ---------------- |
9+
| app_code | string | Yes | Application ID, e.g., "appid1" |
10+
| module | string | Yes | Module name, e.g., "default" |
11+
| config_key | string | Yes | Configuration variable name, e.g., "KEY1" |
12+
13+
#### 2. Interface Parameters:
14+
| Parameter Name | Parameter Type | Required | Parameter Description |
15+
| ------------ | ------------ | ------ | ---------------- |
16+
| environment_name | string | Yes | Environment (stag for pre-production, prod for production) |
17+
| value | string | Yes | Value of the environment variable |
18+
| description | string | Yes | Description of the environment variable |
19+
20+
### Request Example
21+
```bash
22+
curl -X POST -H 'Content-Type: application/json' -H 'X-Bkapi-Authorization: {"bk_app_code": "apigw-api-test", "bk_app_secret": "***", "bk_token": "***"}' -d '{ "environment_name": "stag", "value": "0.0.1", "description": "d0.0.1 version"}' --insecure http://bkapi.example.com/api/bkpaas3/prod/bkapps/applications/appid1/modules/default/config_vars/KEY1/
23+
```
24+
25+
### Response Example
26+
27+
**Status Code Explanation:**
28+
- **201**: Configuration variable created or updated successfully
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
### 功能描述
2+
创建云原生应用
3+
4+
### 请求参数
5+
6+
#### 1、路径参数:
7+
| 参数名称 | 参数类型 | 必须 | 参数说明 |
8+
| ------------ | ------------ | ------ | ---------------- |
9+
| app_code | string || 应用 ID,如 "monitor" |
10+
| module | string || 模块名称,如 "default" |
11+
12+
#### 2、接口参数:
13+
| 字段 | 类型 | 是否必填 | 描述 |
14+
| ------ | ------ | ------ | ------ |
15+
| is_plugin_app | boolean || 是否为插件应用 |
16+
| code | string || 应用 ID |
17+
| name | string || 应用名称 |
18+
| source_config | dict || 源配置 |
19+
| bkapp_spec | dict || 应用规格 |
20+
21+
22+
**source_config 字段说明:**
23+
| 字段 | 类型 | 是否必填 | 描述 |
24+
| ------ | ------ | ------ | ------ |
25+
| source_init_template | string || 源初始化模板 |
26+
| source_control_type | string || 源控制类型 |
27+
| source_repo_url | string || 源仓库 URL |
28+
| source_origin | integer || 应用代码来源,代码仓库则值为 1 |
29+
| source_dir | string || 构建 |
30+
| source_repo_auth_info | dict || 源仓库认证信息 |
31+
32+
**source_repo_auth_info 字段说明:**
33+
| 字段 | 类型 | 是否必填 | 描述 |
34+
| ------ | ------ | ------ | ------ |
35+
| username | string || 用户名 |
36+
| password | string || 密码 |
37+
38+
**bkapp_spec 字段说明:**
39+
| 字段 | 类型 | 是否必填 | 描述 |
40+
| ------ | ------ | ------ | ------ |
41+
| build_config | dict || 构建配置 |
42+
43+
**build_config 字段说明:**
44+
| 字段 | 类型 | 是否必填 | 描述 |
45+
| ------ | ------ | ------ | ------ |
46+
| build_method | string || 构建方式,可选值为:buildpack、dockerfile |
47+
48+
### 请求示例
49+
```bash
50+
curl -X POST -H 'Content-Type: application/json' -H 'X-Bkapi-Authorization: {"bk_app_code": "apigw-api-test", "bk_app_secret": "***", "bk_token": "***"}' -d '{ "is_plugin_app": false, "region": "default", "code": "plugin1", "name": "plugin1", "source_config": { "source_init_template": "bk-apigw-plugin-python", "source_control_type": "bare_git", "source_repo_url": "https://gitee.com/example/apps.git", "source_origin": 1, "source_dir": "plugin", "source_repo_auth_info": { "username": "xxxxxx ", "password": "***" } }, "bkapp_spec": { "build_config": { "build_method": "buildpack" } }}' --insecure https://bkapi.example.com/api/bkpaas3/stag/bkapps/cloud-native/
51+
```
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
### 功能描述
2+
获取应用模块的代码仓库分支列表
3+
4+
### 请求参数
5+
6+
#### 1、路径参数:
7+
| 参数名称 | 参数类型 | 必须 | 参数说明 |
8+
| ------------ | ------------ | ------ | ---------------- |
9+
| app_code | string || 应用 ID,如 "appid1" |
10+
| module | string || 模块名称,如 "default" |
11+
12+
#### 2、接口参数:
13+
暂无。
14+
15+
### 请求示例
16+
```bash
17+
curl -X GET -H 'X-Bkapi-Authorization: {"bk_app_code": "apigw-api-test", "bk_app_secret": "***", "bk_ticket": "***"}' -d '{}' --insecure http://bkapi.example.com/api/bkpaas3/prod/bkapps/applications/appid1/modules/default/repo/branches/
18+
```
19+
20+
### 返回结果示例
21+
```json
22+
{
23+
"results": [
24+
{
25+
"name": "master",
26+
"type": "branch",
27+
"display_type": "branch",
28+
"revision": "31736e690ba0bfa7a81d3730ed6544b3566b3f19",
29+
"url": "http://git.example.com/app-test.git",
30+
"last_update": "2024-09-10 16:48:24",
31+
"message": "init repo",
32+
"extra": {}
33+
}
34+
]
35+
}
36+
```
37+
38+
### 返回结果参数说明
39+
| 字段 | 类型 | 是否必填 | 描述 |
40+
| ------ | ------ | ------ | ------ |
41+
| results | list || 分支列表 |
42+
43+
**results 字段说明:**
44+
| 字段 | 类型 | 是否必填 | 描述 |
45+
| ------ | ------ | ------ | ------ |
46+
| name | string || 分支名称 |
47+
| type | string || 分支类型(branch/tag) |
48+
| display_type | string || 显示类型(branch/tag) |
49+
| revision | string || 分支的最新提交哈希 |
50+
| url | string || 仓库 URL |
51+
| last_update | string || 最后更新时间 |
52+
| message | string || 最后提交的提交信息 |
53+
| extra | dict || 额外信息 |
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
### 功能描述
2+
获取应用模块的运行时概览信息(包括代码仓库相关信息)
3+
4+
### 请求参数
5+
6+
#### 1、路径参数:
7+
| 参数名称 | 参数类型 | 必须 | 参数说明 |
8+
| ------------ | ------------ | ------ | ---------------- |
9+
| app_code | string || 应用 ID,如 "appid1" |
10+
| module | string || 模块名称,如 "default" |
11+
12+
#### 2、接口参数:
13+
暂无。
14+
15+
### 请求示例
16+
```bash
17+
curl -X GET -H 'X-Bkapi-Authorization: {"bk_app_code": "apigw-api-test", "bk_app_secret": "***", "bk_ticket": "***"}' -d '{}' --insecure http://bkapi.example.com/api/bkpaas3/prod/bkapps/applications/appid1/modules/default/runtime/overview
18+
```
19+
20+
### 返回结果示例
21+
```json
22+
{
23+
"repo": {
24+
"source_type": "github",
25+
"type": "github",
26+
"trunk_url": "http://git.example.com/app-test.git",
27+
"repo_url": "http://git.example.com/app-test.git",
28+
"source_dir": "",
29+
"repo_fullname": "app-test",
30+
"diff_feature": {
31+
"method": "external",
32+
"enabled": true
33+
}
34+
}
35+
}
36+
```
37+
38+
### 返回结果参数说明
39+
| 字段 | 类型 | 是否必填 | 描述 |
40+
| ------ | ------ | ------ | ------ |
41+
| repo | dict || 代码仓库相关信息 |
42+
43+
**repo 字段说明:**
44+
| 字段 | 类型 | 是否必填 | 描述 |
45+
| ------ | ------ | ------ | ------ |
46+
| source_type | string || 代码来源类型(如 "github") |
47+
| type | string || 仓库类型(通常与 source_type 相同) |
48+
| trunk_url | string || 主分支 URL |
49+
| repo_url | string || 仓库 URL |
50+
| source_dir | string || 源代码目录 |
51+
| repo_fullname | string || 仓库完整名称(如 "app-test") |
52+
| diff_feature | dict || 差异对比功能配置 |
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
### 功能描述
2+
更新或创建应用的环境变量的值
3+
4+
### 请求参数
5+
6+
#### 1、路径参数:
7+
| 参数名称 | 参数类型 | 必须 | 参数说明 |
8+
| ------------ | ------------ | ------ | ---------------- |
9+
| app_code | string || 应用 ID,如 "appid1" |
10+
| module | string || 模块名称,如 "default" |
11+
| config_key | string || 配置变量名,如 "KEY1" |
12+
13+
#### 2、接口参数:
14+
| 参数名称 | 参数类型 | 必须 | 参数说明 |
15+
| ------------ | ------------ | ------ | ---------------- |
16+
| environment_name | string || 环境,预发布环境:stag、生产环境:prod |
17+
| value | string || 环境变量的值 |
18+
| description | string || 环境变量描述 |
19+
20+
### 请求示例
21+
```bash
22+
curl -X POST -H 'Content-Type: application/json' -H 'X-Bkapi-Authorization: {"bk_app_code": "apigw-api-test", "bk_app_secret": "***", "bk_token": "***"}' -d '{ "environment_name": "stag", "value": "0.0.1", "description": "d0.0.1版本"}' --insecure http://bkapi.example.com/api/bkpaas3/prod/bkapps/applications/appid1/modules/default/config_vars/KEY1/
23+
```
24+
25+
### 返回结果示例
26+
27+
**状态码说明:**
28+
- **201**:配置变量创建或更新成功

0 commit comments

Comments
 (0)