Skip to content

Commit

Permalink
update jobv3 confapis (#1097)
Browse files Browse the repository at this point in the history
* update jobv3 confapis

* update release version
  • Loading branch information
alex-smile authored Jul 18, 2023
1 parent 5c953c0 commit c8d25ba
Show file tree
Hide file tree
Showing 77 changed files with 4,739 additions and 802 deletions.
2 changes: 1 addition & 1 deletion paas2/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.14.54
2.14.55
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
### Function Description

Bulk query of job execution logs by ip list

### Request Parameters

{{ common_args_desc }}

#### Interface parameters

| Fields | Type | Required | Description |
|-----------|------------|--------|------------|
| bk_scope_type | string | yes | Resource range type. Optional values: biz - Business, biz_set - Business Set |
| bk_scope_id | string | yes | Resource range ID. Corresponds to bk_scope_type, which means business ID or business set ID |
| job_instance_id | long | yes | Job instance ID |
| step_instance_id | long | yes | Step instance ID |
| ip_list | array | yes | Source/target host IP list, see ip for definition |

##### ip

| Fields | Type | Required | Description |
| ----------- | ------ | -------- | ------------- |
| bk_cloud_id | int | yes | BK-Net ID |
| ip | string | yes | IP address |

### Example of request

```json
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx",
"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"
}
]
}
```

### Example of response

#### Script execution steps
```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"
}
]
}
]
}
}
```

**File distribution task return result description**

- If you need to return the upload log of the file source, you need to add the source file server IP to ip_list

### Return Result Description

#### response
| Fields | Type | Description |
|-----------|-----------|-----------|
| result | bool | Request success or failure. true: Request successful; false: Request failed |
| code | int | Error code. 0 means SUCCESS, >0 means FAIL |
| message | string | Error message |
| data | object | Data returned by request |
| permission | object | Permission information |
| request_id | string | Request chain id |

#### data

| Fields | Type | Description |
|-----------|-----------|-----------|
| bk_cloud_id | int | Target server cloud area ID |
| ip | string | Target server IP address |
| log_type | int | Log type. 1 - Script execution task log; 2 - File distribution task log |
| script_task_logs | array | Log of script execution task. See script_task_log for definition |
| file_task_logs | array | File distribution task log. See file_task_log for definition |

#### script_task_log

| Fields | Type | Description |
|-----------|------------|--------|
| bk_cloud_id | long | BK-Net ID |
| ip | string | Target IP address |
| log_content | string | Script execution log content |

#### file_task_log

| Fields | Type | Description |
|-----------|------------|--------|
| bk_cloud_id | long | BK-Net ID |
| ip | string | Source/target IP address |
| file_logs | array | File distribution log content. See file_log for definition |

#### file_log

| Fields | Type | Description |
|-----------|-----------|-----------|
| mode | int | Distribution mode. 0: Upload; 1: Download |
| src_ip | object |File source host IP. see ip for definition |
| src_path | string | Source file paths |
| dest_ip | object | Distribute the target host IP, with value for mode=1. See ip for definition. |
| dest_path | string | Target path, with value for mode=1 |
| status | int | Task status. 1-Waiting; 2-Uploading; 3-Downloading; 4- Success; 5- Failure |
| log_content | string | File distribution log contents |

#### ip

| Fields | Type | Description |
|-----------|------------|--------|
| bk_cloud_id | long | BK-Net ID |
| ip | string | IP Address |
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Function Description

This component is only used to present the callback protocol when job finished.


### Request Parameters

| Fields | Type | Required | Description |
|-----------------|------------|--------|------------|
| job_instance_id | long | yes | Job instance ID |
| status | int | yes | Job status code. 1 - Pending; 2 - Running 3 - Successful; 4 - Failed; 5 - Skipped; 6 - Ignore Error; 7 - Waiting; 8 - Terminated; 9 - Abnormal; 10 - Terminating; 11 - Terminate Success; 13 - Termination Confirmed; 14 - Abandoned|
| step_instance_list | array | yes | The execution result of steps |

#### step_instances

| Fields | Type | Required | Description |
|-----------------|------------|--------|------------|
| step_instance_id | long | yes | Job step instance ID |
| status | int | yes | Job step status code: 1 - Pending; 2 - Running 3 - Successful; 4 - Failed; 5 - Skipped; 6 - Ignore Error; 7 - Waiting; 8 - Terminated; 9 - Abnormal; 10 - Terminating; 11 - Terminate Success; 13 - Termination Confirmed; 14 - Abandoned|

### Example of request

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

### Callback response

The success of the callback is based on HTTP status, if it succeeds, the status code 200, the other indicates failure, Job will do a retry for the failed one, if it still fails, the failure will be ignored and no more callbacks.
45 changes: 45 additions & 0 deletions paas2/esb/components/confapis/jobv3/apidocs/en/common.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Common Fields and Conventions

#### global_var

| Fields | Type | **Required** | **Description** |
|-------------|------------|--------|------------|
| id | long | no | Global variables ID . If id is empty, then name is used as the unique identifier |
| name | string | no | Global variables name |
| description | string | no | Global variables description |
| type | int | no | Global variables types |
| required | int | no | Is this variable required |
| value | string | no | Values of global variables of String, Ciphertext, Namespace, and Array types |
| server | object | no | Value of global variable of Host type |

#### server
| Fields | Type | **Required** | **Description** |
|-----------------------|-------|--------|------------|
| ip_list | array | no | Static IP list, see ip for definition |
| dynamic_group_list | array | no | Dynamic grouping list, see dynamic_group for definition |
| topo_node_list | array | no | Dynamic topo node list, see topo_node for definition |

#### ip
| Fields | Type | **Required** | **Description** |
|-------------|---------|--------|---------|
| bk_cloud_id | int | yes | BK-Net ID |
| ip | string | yes | IP Address |

#### dynamic_group

| Fields | Type | **Required** | **Description** |
| ------ | ------ | ------------ | --------------------- |
| id | string | yes | CMDB Dynamic Group ID |

#### topo_node

| Fields | Type | **Required** | **Description** |
|------------------|--------|--------|------------|
| id | long | yes | Dynamic topo node ID, corresponding to bk_inst_id in CMDB API |
| node_type | string | yes | Dynamic topo node type, corresponding to bk_obj_id in CMDB API, such as "module", "set" |

#### account
| Fields | Type | **Required** | **Description** |
|-------|--------|--------|------------|
| id | long | no | Account ID |
| name | string | no | Account name |
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
### **Description** Function Description

Create credential.

### Request Parameters

{{ common_args_desc }}

#### Interface parameters

| Fields | Type | Required | Description |
|----------------------------|------------|--------|------------|
| bk_scope_type | string | yes | Resource range type. Optional values: biz - Business,biz_set - Business Set |
| bk_scope_id | string | yes | Resource range ID. Corresponds to bk_scope_type, which means business ID or business set ID |
| name | string | yes | Required Credential Name |
| type | string | yes | Credential type,value can be ACCESS_KEY_SECRET_KEY,PASSWORD,USERNAME_PASSWORD,SECRET_KEY |
| description | string | no | Credentials Description |
| credential_access_key | string | no | When the credential type is ACCESS_KEY_SECRET_KEY, required |
| credential_secret_key | string | no | When the credential type is ACCESS_KEY_SECRET_KEY/SECRET_KEY, required |
| credential_username | string | no | When the credential type is USERNAME_PASSWORD, required |
| credential_password | string | no | When the credential type is USERNAME_PASSWORD/PASSWORD, required |


### Example of request

```json
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx",
"bk_scope_type": "biz",
"bk_scope_id": "1",
"name": "testCredential",
"type": "USERNAME_PASSWORD",
"description": "This is a test credential",
"credential_username": "admin",
"credential_password": "password"
}
```

### Example of responses

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

### Response Description

#### response
| **Fields** | **Type** | **Description** |
|-----------|-----------|-----------|
| result | bool | Success or failure of the request. true: request successful; false: request failed |
| code | int | Error code. 0 means SUCCESS, >0 means FAIL |
| message | string | Error message |
| data | object | Data returned by request |
| permission | object | Permission information |
| request_id | string | Request chain id |

#### data

| Fields | **Type** |Whether the field must exist | **Description** |
|-----------|-------|---------------|---------|
| id | string |yes | Credential ID |
Loading

0 comments on commit c8d25ba

Please sign in to comment.