Skip to content

Commit

Permalink
doc: 增加ESB、蓝鲸Gateway API 文档 TencentBlueKing#2474
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu096 committed Sep 25, 2023
1 parent fde01b2 commit b75a961
Show file tree
Hide file tree
Showing 127 changed files with 14,011 additions and 0 deletions.
187 changes: 187 additions & 0 deletions docs/apidoc/bk-api-gateway/v3/zh/batch_get_job_instance_ip_log.md
@@ -0,0 +1,187 @@
### 功能描述

根据主机列表批量查询作业执行日志

### 请求参数

{{ bkapi_authorization_description }}

#### Header参数

| 字段 | 类型 | 必选 | 描述 |
|-----------|------------|--------|------------|
| X-Bkapi-Authorization | string || 认证信息。详情参考[调用网关 API](https://github.com/TencentBlueKing/BKDocs/blob/master/ZH/7.0/APIGateway/apigateway/use-api/use-apigw-api.md) |
| Accept | string || 固定值。application/json|
| Content-Type | string || 固定值。application/json|

#### Body参数

| 字段 | 类型 | 必选 | 描述 |
|-----------|------------|--------|------------|
| bk_scope_type | string || 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string || 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| bk_biz_id | long || *已弃用*。业务ID。此字段已被弃用并由字段bk_scope_type+bk_scope_id替换 |
| job_instance_id | long || 作业实例ID |
| step_instance_id | long || 步骤实例ID |
| ip_list | array || 源/目标主机IP列表,定义见ip |

##### ip

| 字段 | 类型 | 必选 | 描述 |
| ----------- | ------ | ---- | -------- |
| bk_cloud_id | int || 管控区域ID |
| ip | string || IP地址 |

### 请求参数示例
- POST
```json
{
"bk_scope_type": "biz",
"bk_scope_id": "1",
"job_instance_id": 100,
"step_instance_id": 200,
"ip_list": [
{
"bk_cloud_id": 0,
"ip": "10.0.0.1"
},
{
"bk_cloud_id": 0,
"ip": "10.0.0.2"
}
]
}
```

### 返回结果示例

#### 脚本执行步骤
```json
{
"result": true,
"code": 0,
"message": "",
"data": {
"log_type": 1,
"task_instance_id": 100,
"step_instance_id": 200,
"script_task_logs": [
{
"ip": "10.0.0.1",
"bk_cloud_id": 0,
"log_content": "[2018-03-15 14:39:30][PID:56875] job_start\n"
},
{
"ip": "10.0.0.2",
"bk_cloud_id": 0,
"log_content": "[2018-03-15 14:39:30][PID:16789] job_start\n"
}
]
}
}
```

#### 文件分发步骤

```json
{
"result": true,
"code": 0,
"message": "",
"data": {
"log_type": 2,
"task_instance_id": 100,
"step_instance_id": 200,
"file_task_logs": [
{
"ip": "10.0.0.1",
"bk_cloud_id": 0,
"file_logs": [
{
"mode": 1,
"src_ip": {
"bk_cloud_id": 0,
"ip": "10.0.0.2"
},
"src_path": "/data/1.log",
"dest_ip": {
"bk_cloud_id": 0,
"ip": "10.0.0.1"
},
"dest_path": "/tmp/1.log",
"status": 4,
"log_content": "[2021-06-28 11:32:16] FileName: /tmp/1.log FileSize: 9.0 Bytes State: dest agent success download file Speed: 1 KB/s Progress: 100% StatusDesc: dest agent success download file Detail: success"
}
]
},
{
"ip": "10.0.0.2",
"bk_cloud_id": 0,
"file_logs": [
{
"mode": 0,
"src_ip": {
"bk_cloud_id": 0,
"ip": "10.0.0.2"
},
"src_path": "/data/1.log",
"status": 4,
"log_content": "[2021-06-28 11:32:16] FileName: /data/1.log FileSize: 9.0 Bytes State: source agent success upload file Speed: 1 KB/s Progress: 100% StatusDesc: source agent success upload file Detail: success upload"
}
]
}
]
}
}
```

**文件任务返回结果说明**

- 如果需要返回文件源的上传日志,需要在ip_list添加源文件服务器IP

### 返回结果说明

##### data

| 字段 | 类型 | 描述 |
|-----------|-----------|-----------|
| bk_cloud_id | int | 目标服务器管控区域ID |
| ip | string | 目标服务器IP地址 |
| log_type | int | 日志类型。1-脚本执行任务日志;2-文件分发任务日志 |
| script_task_logs | array | 脚本执行任务日志。定义见script_task_log|
| file_task_logs | array | 文件分发任务日志。定义见file_task_log|

##### script_task_log

| 字段 | 类型 | 描述 |
|-----------|------------|--------|
| bk_cloud_id | long | 管控区域ID |
| ip | string | 目标IP地址 |
| log_content | string | 脚本执行日志内容 |

##### file_task_log

| 字段 | 类型 | 描述 |
|-----------|------------|--------|
| bk_cloud_id | long | 管控区域ID |
| ip | string | 源/目标IP地址 |
| file_logs | array | 文件分发日志内容。定义见file_log |

##### file_log

| 字段 | 类型 | 描述 |
|-----------|-----------|-----------|
| mode | 分发模式 | 0:上传;1:下载|
| src_ip | object |文件源主机IP。定义见ip |
| src_path | string | 源文件路径 |
| dest_ip | object | 分发目标主机IP,mode=1时有值。定义见ip |
| dest_path | string | 目标路径,mode=1时有值 |
| status | int | 任务状态。1-等待开始;2-上传中;3-下载中;4-成功;5-失败 |
| log_content | string | 文件分发日志内容 |

##### ip

| 字段 | 类型 | 描述 |
|-----------|------------|--------|
| bk_cloud_id | long | 管控区域ID |
| ip | string | IP地址 |
43 changes: 43 additions & 0 deletions docs/apidoc/bk-api-gateway/v3/zh/callback_protocol.md
@@ -0,0 +1,43 @@
### 功能描述

此组件仅用于展示回调协议文档。

对作业执行类的请求传入的回调 callback_url 地址进行回调时所传递的报文结构描述。

### 请求参数

| 字段 | 类型 | 必选 | 描述 |
|-----------------|------------|--------|------------|
| job_instance_id | long || 作业实例ID |
| status | int || 作业状态码: 1.等待执行; 2.正在执行; 3.执行成功; 4.执行失败; 5.跳过; 6.忽略错误; 7.等待用户; 8.强制终止; 9.状态异常; 10.强制终止中; 11.强制终止成功,13.确认终止 |
| step_instance_list | array || 步骤块中包含的各个步骤执行状态 |

#### step_instances

| 字段 | 类型 | 必选 | 描述 |
|-----------------|------------|--------|------------|
| step_instance_id | long || 作业步骤实例ID |
| status | int || 作业步骤状态码: 1.等待执行; 2.正在执行; 3.执行成功; 4.执行失败; 5.跳过; 6.忽略错误; 7.等待用户; 8.强制终止; 9.状态异常; 10.强制终止中; 11.强制终止成功,13.确认终止 |

### 请求参数示例

```json
{
"job_instance_id": 12345,
"status": 2,
"step_instance_list": [
{
"step_instance_id": 16271,
"status": 3
},
{
"step_instance_id": 16272,
"status": 2
}
]
}
```

### 回调响应

回调成功以HTTP状态为准,如果成功,则状态码200,其他表示失败,Job会对失败的做一次重试,如还失败,则忽略失败,不再回调。
45 changes: 45 additions & 0 deletions docs/apidoc/bk-api-gateway/v3/zh/common.md
@@ -0,0 +1,45 @@
## 通用字段和约定

#### global_var

| 字段 | 类型 | 必选 | 描述 |
|-------------|------------|--------|------------|
| id | long || 全局变量 id,唯一标识。如果 id 为空,那么使用 name 作为唯一标识 |
| name | string || 全局变量名 |
| description | string || 全局变量描述 |
| type | int || 全局变量类型 |
| required | int || 模版/执行方案中该变量是否必填 |
| value | string || 字符、密码、数组类型的全局变量的值 |
| server | object || 主机类型全局变量的值 |

#### server
| 字段 | 类型 | 必选 | 描述 |
|-----------------------|-------|--------|------------|
| ip_list | array || 静态 IP 列表,定义见ip |
| dynamic_group_list | array || 动态分组列表,定义见dynamic_group |
| topo_node_list | array || 动态 topo 节点列表,定义见topo_node |

#### ip
| 字段 | 类型 | 必选 | 描述 |
|-------------|---------|--------|---------|
| bk_cloud_id | int || 管控区域ID |
| ip | string || IP地址 |

#### dynamic_group

| 字段 | 类型 | 必选 | 描述 |
| ---- | ------ | ---- | -------------- |
| id | string || CMDB动态分组ID |

#### topo_node

| 字段 | 类型 | 必选 | 描述 |
|------------------|--------|--------|------------|
| id | long || 动态topo节点ID,对应CMDB API 中的 bk_inst_id |
| node_type | string || 动态topo节点类型,对应CMDB API 中的 bk_obj_id,比如"module","set"|

#### account
| 字段 | 类型 | 必选 | 描述 |
|-------|--------|--------|------------|
| id | long || 账号 ID |
| name | string || 账号名 |

0 comments on commit b75a961

Please sign in to comment.