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

feat: 提供账号查询、创建、删除的APIGW接口 #2472 #2495

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
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
100 changes: 100 additions & 0 deletions docs/apidoc/bk-api-gateway/v3/zh/create_account.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
### 功能描述

创建账号(当前仅支持系统账号)

### 请求参数

{{ 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 |
| account | string | 是 | 账号名称 |
| type | int | 是 | 账号类型(1:Linux,2:Windows)|
| category | int | 是 | 账号用途(1:系统账号)|
| password | string | 否 | 系统账号密码,账号用途为系统账号且账号类型为Windows时必传 |
| alias | string | 否 | 别名,不传则以账号名称作为别名 |
| description | string | 否 | 描述 |

### 请求参数示例

- POST
```json
{
"bk_scope_type": "biz",
"bk_scope_id": "1",
"account": "Admin",
"type": 2,
"category": 1,
"password": "AdminPassword",
"alias": "Admin",
"description": "An account for windows"
}
```

### 返回结果示例

```json
{
"code": 0,
"message": null,
"result": true,
"data": {
"id": 70,
"bk_scope_type": "biz",
"bk_scope_id": "1",
"account": "Admin",
"alias": "Admin",
"category": 1,
"type": 2,
"os": "Windows",
"description": "An account for windows",
"creator": "admin",
"create_time": 1614659536108,
"last_modify_user": "admin",
"last_modify_time": 1614659536116
},
"job_request_id": "4e7acb216087eb96"
}
```

### 返回结果参数说明

#### response
| 字段 | 类型 | 描述 |
|--------------|-----------|-----------|
| result | bool | 请求成功与否。true:请求成功;false请求失败 |
| code | int | 错误编码。 0表示success,>0表示失败错误 |
| message | string | 请求失败返回的错误信息|
| data | object | 请求返回的数据|
| permission | object | 权限信息|


#### data

| 字段 | 类型 | 描述 |
|-----------------------|-----------|-----------|
| id | long | 账号ID |
| bk_scope_type | string | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| account | string | 账号名称 |
| alias | string | 账号别名 |
| category | int | 账号用途(1:系统账号) |
| type | int | 账号类型(1:Linux,2:Windows)|
| os | string | 账号用途为系统账号时该字段生效,账号对应的OS |
| description | string | 账号描述 |
| creator | string | 创建人 |
| create_time | long | 创建时间Unix时间戳(ms) |
| last_modify_user | string | 最近一次修改人 |
| last_modify_time | long | 最近一次修改时间Unix时间戳(ms) |
88 changes: 88 additions & 0 deletions docs/apidoc/bk-api-gateway/v3/zh/delete_account.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
### 功能描述

删除账号。

### 请求参数

{{ 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|

#### Query参数

| 字段 | 类型 | 必选 | 描述 |
|---------------|------------|--------|------------|
| bk_scope_type | string | 是 | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | 是 | 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| id | long | 否 | 账号ID |

### 请求参数示例

- DELETE
```json
/api/v3/delete_account?bk_scope_type=biz&bk_scope_id=1&id=70
```

### 返回结果示例

```json
{
"code": 0,
"message": null,
"result": true,
"data": {
"id": 70,
"bk_scope_type": "biz",
"bk_scope_id": "1",
"account": "Admin",
"alias": "Admin",
"category": 1,
"type": 2,
"db_system_account_id": null,
"os": "Windows",
"description": "An account for windows",
"creator": "admin",
"create_time": 1614659536108,
"last_modify_user": "admin",
"last_modify_time": 1614659536116
},
"job_request_id": "4e7acb216087eb96"
}
```

### 返回结果参数说明

#### response
| 字段 | 类型 | 描述 |
|--------------|-----------|-----------|
| result | bool | 请求成功与否。true:请求成功;false请求失败 |
| code | int | 错误编码。 0表示success,>0表示失败错误 |
| message | string | 请求失败返回的错误信息|
| data | object | 请求返回的数据|
| permission | object | 权限信息|


#### data

| 字段 | 类型 | 描述 |
|-----------------------|-----------|-----------|
| id | long | 账号ID |
| bk_scope_type | string | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| account | string | 账号名称 |
| alias | string | 账号别名 |
| category | int | 账号用途(1:系统账号,2:数据库账号) |
| type | int | 账号类型(1:Linux,2:Windows,9:MySQL,10:Oracle,11:DB2)|
| db_system_account_id | long | 账号用途为数据库账号时该字段生效,表示数据库账号对应的系统账号ID |
| os | string | 账号用途为系统账号时该字段生效,账号对应的OS |
| description | string | 描述 |
| creator | string | 创建人 |
| create_time | long | 创建时间Unix时间戳(ms) |
| last_modify_user | string | 最近一次修改人 |
| last_modify_time | long | 最近一次修改时间Unix时间戳(ms) |
94 changes: 94 additions & 0 deletions docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/create_account.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
### 功能描述

创建账号(当前仅支持系统账号)

### 请求参数

{{ common_args_desc }}

#### 接口参数

| 字段 | 类型 | 必选 | 描述 |
|---------------|------------|--------|------------|
| bk_scope_type | string | 是 | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | 是 | 资源范围ID,与bk_scope_type对应,表示业务ID或者业务集ID |
| account | string | 是 | 账号名称 |
| type | int | 是 | 账号类型(1:Linux,2:Windows)|
| category | int | 是 | 账号用途(1:系统账号)|
| password | string | 否 | 系统账号密码,账号用途为系统账号且账号类型为Windows时必传 |
| alias | string | 否 | 别名,不传则以账号名称作为别名 |
| description | string | 否 | 描述 |

### 请求参数示例

```json
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx",
"bk_scope_type": "biz",
"bk_scope_id": "1",
"account": "Admin",
"type": 2,
"category": 1,
"password": "AdminPassword",
"alias": "Admin",
"description": "An account for windows"
}
```

### 返回结果示例

```json
{
"code": 0,
"message": null,
"result": true,
"data": {
"id": 70,
"bk_scope_type": "biz",
"bk_scope_id": "1",
"account": "Admin",
"alias": "Admin",
"category": 1,
"type": 2,
"os": "Windows",
"description": "An account for windows",
"creator": "admin",
"create_time": 1614659536108,
"last_modify_user": "admin",
"last_modify_time": 1614659536116
},
"job_request_id": "4e7acb216087eb96"
}
```

### 返回结果参数说明

#### response
| 字段 | 类型 | 描述 |
|--------------|-----------|-----------|
| result | bool | 请求成功与否。true:请求成功;false请求失败 |
| code | int | 错误编码。 0表示success,>0表示失败错误 |
| message | string | 请求失败返回的错误信息|
| data | object | 请求返回的数据|
| permission | object | 权限信息|


#### data

| 字段 | 类型 | 描述 |
|-----------------------|-----------|-----------|
| id | long | 账号ID |
| bk_scope_type | string | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| account | string | 账号名称 |
| alias | string | 账号别名 |
| category | int | 账号用途(1:系统账号) |
| type | int | 账号类型(1:Linux,2:Windows)|
| os | string | 账号用途为系统账号时该字段生效,账号对应的OS |
| description | string | 账号描述 |
| creator | string | 创建人 |
| create_time | long | 创建时间Unix时间戳(ms) |
| last_modify_user | string | 最近一次修改人 |
| last_modify_time | long | 最近一次修改时间Unix时间戳(ms) |
86 changes: 86 additions & 0 deletions docs/apidoc/esb/jobv3-confapis/apidocs/zh_hans/delete_account.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
### 功能描述

删除账号。

### 请求参数

{{ common_args_desc }}

#### 接口参数

| 字段 | 类型 | 必选 | 描述 |
|---------------|------------|--------|------------|
| bk_scope_type | string | 是 | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | 是 | 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| id | long | 否 | 账号ID |

### 请求参数示例

```json
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx",
"bk_scope_type": "biz",
"bk_scope_id": "1",
"id": 70
}
```

### 返回结果示例

```json
{
"code": 0,
"message": null,
"result": true,
"data": {
"id": 70,
"bk_scope_type": "biz",
"bk_scope_id": "1",
"account": "Admin",
"alias": "Admin",
"category": 1,
"type": 2,
"db_system_account_id": null,
"os": "Windows",
"description": "An account for windows",
"creator": "admin",
"create_time": 1614659536108,
"last_modify_user": "admin",
"last_modify_time": 1614659536116
},
"job_request_id": "4e7acb216087eb96"
}
```

### 返回结果参数说明

#### response
| 字段 | 类型 | 描述 |
|--------------|-----------|-----------|
| result | bool | 请求成功与否。true:请求成功;false请求失败 |
| code | int | 错误编码。 0表示success,>0表示失败错误 |
| message | string | 请求失败返回的错误信息|
| data | object | 请求返回的数据|
| permission | object | 权限信息|


#### data

| 字段 | 类型 | 描述 |
|-----------------------|-----------|-----------|
| id | long | 账号ID |
| bk_scope_type | string | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| account | string | 账号名称 |
| alias | string | 账号别名 |
| category | int | 账号用途(1:系统账号,2:数据库账号) |
| type | int | 账号类型(1:Linux,2:Windows,9:MySQL,10:Oracle,11:DB2)|
| db_system_account_id | long | 账号用途为数据库账号时该字段生效,表示数据库账号对应的系统账号ID |
| os | string | 账号用途为系统账号时该字段生效,账号对应的OS |
| description | string | 描述 |
| creator | string | 创建人 |
| create_time | long | 创建时间Unix时间戳(ms) |
| last_modify_user | string | 最近一次修改人 |
| last_modify_time | long | 最近一次修改时间Unix时间戳(ms) |
24 changes: 23 additions & 1 deletion docs/apidoc/esb/jobv3-confapis/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -495,4 +495,26 @@
comp_codename: generic.v2.jobv3.job_component
dest_path: /api/job/v3/job-manage/delete_script/
dest_http_method: POST



- path: /v2/jobv3/create_account/
name: create_account
label: 创建账号
label_en: Create account
suggest_method: POST
api_type: operate
comp_codename: generic.v2.jobv3.job_component
dest_path: /api/job/v3/job-manage/create_account/
dest_http_method: POST


- path: /v2/jobv3/delete_account/
name: delete_account
label: 删除账号
label_en: Delete account
suggest_method: POST
api_type: operate
comp_codename: generic.v2.jobv3.job_component
dest_path: /api/job/v3/job-manage/delete_account/
dest_http_method: POST

Loading
Loading