Skip to content

Commit

Permalink
Merge pull request #431 from alex-smile/update_esb_apis_0720
Browse files Browse the repository at this point in the history
更新 ESB 组件
  • Loading branch information
MrLYC authored Jul 20, 2021
2 parents 60d41fd + 97561db commit 59c2bdb
Show file tree
Hide file tree
Showing 12 changed files with 398 additions and 8 deletions.
2 changes: 1 addition & 1 deletion paas2/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.12.22
2.12.23
11 changes: 11 additions & 0 deletions paas2/esb/components/confapis/bk_log/bk_log.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
dest_http_method: POST
is_hidden: True

- path: /v2/bk_log/esquery_monitor/
name: esquery_monitor
label: 日志平台索引集查询接口
label_en: bk_log index-set search api for bkmonitor
method: POST
api_type: query
comp_codename: generic.v2.bk_log.bk_log_component
dest_path: /api/v1/esquery/search/
dest_http_method: POST
is_hidden: True

- path: /v2/bk_log/esquery_dsl/
name: esquery_dsl
label: ES-DSL查询接口
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
### 功能描述

新建凭据。

### 请求参数

{{ common_args_desc }}

#### 接口参数

| 字段 | 类型 | 必选 | 描述 |
|-----------------|------------|--------|------------|
| bk_biz_id | long || 业务 ID |
| name | string || 凭据名称 |
| type | string || 凭据类型,取值可为ACCESS_KEY_SECRET_KEY,PASSWORD,USERNAME_PASSWORD,SECRET_KEY |
| description | string || 凭据描述 |
| access_key | string || 凭据类型为ACCESS_KEY_SECRET_KEY时填写 |
| secret_key | string || 凭据类型为ACCESS_KEY_SECRET_KEY/SECRET_KEY时填写 |
| username | string || 凭据类型为USERNAME_PASSWORD时填写 |
| password | string || 凭据类型为USERNAME_PASSWORD/PASSWORD时填写 |


### 请求参数示例

```json
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx",
"bk_biz_id": 1,
"name": "testCredential",
"type": "USERNAME_PASSWORD",
"description": "This is a test credential",
"username": "admin",
"password": "password"
}
```

### 返回结果示例

```json
{
"result": true,
"code": 0,
"message": "success",
"data": {
"id": "06644309e10e4068b3c7b32799668210"
}
}
```

### 返回结果参数说明

#### data

| 字段 | 类型 |字段是否一定存在 | 描述 |
|-----------|-------|---------------|---------|
| id | string || 凭据ID |
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
### 功能描述

新建文件源,当前仅支持创建关联自动选择公共接入点的蓝鲸制品库文件源。
创建的文件源具备以下默认特性:

| 特性 | 取值 |
|-----------------|------------|
|存储类型|对象存储|
|文件源类型|蓝鲸制品库|
|是否为公共文件源||
|接入点选择范围|公共接入点|
|接入点选择模式|自动|

### 请求参数

{{ common_args_desc }}

#### 接口参数

| 字段 | 类型 | 必选 | 描述 |
|-----------------|------------|--------|------------|
| bk_biz_id | long || 业务 ID |
| code | string || 文件源标识,英文字符开头,1-32位英文字符、下划线、数字组成,创建后不可更改 |
| alias | string || 文件源别名 |
| type | string || 文件源类型,当前仅支持蓝鲸制品库,BLUEKING_ARTIFACTORY |
| access_params | object || 文件源接入参数,根据type传入不同的对象,见后续说明 |
| credential_id | string || 文件源使用的凭据Id |
| file_prefix | string || Job对从该文件源分发的文件加上的前缀,不传默认不加前缀 |

### access_params
**type为BLUEKING_ARTIFACTORY**

| 字段 | 类型 | 必选 | 描述 |
|-----------------|------------|--------|------------|
| base_url | string || 对接的制品库实例根地址,例如:https://bkrepo.com |

### 请求参数示例

```json
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx",
"bk_biz_id": 1,
"code": "sopsArtifactory",
"alias": "标准运维制品库文件源",
"type": "BLUEKING_ARTIFACTORY",
"access_params": {
"base_url": "https://bkrepo.com"
},
"credential_id": "06644309e10e4068b3c7b32799668210",
"file_prefix": ""
}
```

### 返回结果示例

```json
{
"result": true,
"code": 0,
"message": "success",
"data": {
"id": 1
}
}
```

### 返回结果参数说明

#### data

| 字段 | 类型 |字段是否一定存在 | 描述 |
|-----------|-------|---------------|---------|
| id | int || 文件源ID |
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
"message": "success",
"data": {
"job_instance_name": "API Quick execution script1521100521303",
"job_instance_id": 10000
"job_instance_id": 10000,
"step_instance_id": 10001
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
"message": "success",
"data": {
"job_instance_name": "API Quick SQL Execution1524454292038",
"job_instance_id": 10000
"job_instance_id": 10000,
"step_instance_id": 10001
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"message": "success",
"data": {
"job_instance_name": "API Quick Distribution File1521101427176",
"job_instance_id": 10000
"job_instance_id": 10000,
"step_instance_id": 10001
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
| bk_biz_id | long || 业务ID |
| job_instance_id | long || 作业实例ID |
| step_instance_id | long || 步骤实例ID |
| bk_cloud_id | int || 云区域ID |
| ip | string || IP |
| bk_cloud_id | int || 目标服务器云区域ID |
| ip | string || 目标服务器IP |

### 请求参数示例

Expand All @@ -33,24 +33,95 @@

### 返回结果示例

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

#### 文件分发步骤

```json
{
"result": true,
"code": 0,
"message": "",
"data": {
"log_type": 2,
"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"
},
{
"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"
}
]
}
}
```

**返回结果说明**

- 文件分发日志,除了目标服务器的文件下载任务日志,也会返回源服务器的文件上传任务日志(mode=0)
- dest_ip 与请求参数的bk_cloud_id/ip对应

### 返回结果参数说明

#### data

| 字段 | 类型 | 描述 |
|-----------|-----------|-----------|
| bk_cloud_id | int | 云区域ID |
| ip | string | IP地址 |
| bk_cloud_id | int | 目标服务器云区域ID |
| ip | string | 目标服务器IP地址 |
| log_type | int | 日志类型。1-脚本执行任务日志;2-文件分发任务日志 |
| log_content | string | 作业脚本输出的日志内容 |
| 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地址 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
### 功能描述

更新凭据。

### 请求参数

{{ common_args_desc }}

#### 接口参数

| 字段 | 类型 | 必选 | 描述 |
|-----------------|------------|--------|------------|
| bk_biz_id | long || 业务 ID |
| id | string || 凭据 ID |
| name | string || 凭据名称 |
| type | string || 凭据类型,取值可为ACCESS_KEY_SECRET_KEY,PASSWORD,USERNAME_PASSWORD,SECRET_KEY |
| description | string || 凭据描述 |
| access_key | string || 凭据类型为ACCESS_KEY_SECRET_KEY时填写 |
| secret_key | string || 凭据类型为ACCESS_KEY_SECRET_KEY/SECRET_KEY时填写 |
| username | string || 凭据类型为USERNAME_PASSWORD时填写 |
| password | string || 凭据类型为USERNAME_PASSWORD/PASSWORD时填写 |


### 请求参数示例

```json
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx",
"bk_biz_id": 1,
"id": "06644309e10e4068b3c7b32799668210",
"name": "testCredential",
"type": "USERNAME_PASSWORD",
"description": "This is a new credential",
"username": "admin",
"password": "newPassword"
}
```

### 返回结果示例

```json
{
"result": true,
"code": 0,
"message": "success",
"data": {
"id": "06644309e10e4068b3c7b32799668210"
}
}
```

### 返回结果参数说明

#### data

| 字段 | 类型 |字段是否一定存在 | 描述 |
|-----------|-------|---------------|---------|
| id | string || 凭据ID |
Loading

0 comments on commit 59c2bdb

Please sign in to comment.