1. 资源管理
1.1. 资源说明
1.1.1. 资源管理定义
资源管理用于批量删除、转移系统内不同用户的不同资源,资源包括:应用、链接、数据集成、数据科学
1.2. 接口说明
- 资源管理的所有接口都需要用户拥有
系统管理员角色 
1.2.1. 获取资源列表
请求URL
GET /api/resource-managements
需要认证:是
请求参数
URL 参数
| 字段 | 类型 | 是否必须 | 说明 | 
|---|---|---|---|
| types | SET<STRING> | 
否 | 要查询的资源类型 | 
| userIds | SET<LONG> | 
否 | 指定查询哪些用户下的资源 | 
| q | STRING | 否 | 搜索关键字 | 
| offset | INTEGER | 可选,分页字段,起始查询位置 | |
| limit | INTEGER | 可选,分页字段,查询数量 | |
| orderBy | STRING | 可选,排序字段,默认是按照更新时间降序排序 | |
| orderType | STRING | 可选,排序类型,asc - 表示升序,desc - 表示降序 | 
返回对象的格式说明
| 字段 | 类型 | 说明 | 
|---|---|---|
| version | STRING | 当前系统版本哈希值 | 
| data | OBJECT | 每种应用参数的共同结构见应用参数结构说明。 | 
接口示例1: 获取资源列表
GET /api/resource-managements?offset=0&limit=20&types=connection&userIds=2&orderBy=type&orderType=asc&q=CA
返回:
{
  "version": "3.2-SNAPSHOT@@git.commit.id.abbrev@#null",
  "code": 0,
  "msg": "success",
  "data": [
    {
      "id": 7,
      "title": "Local",
      "type": "connection",
      "createdBy": 2,
      "createdAt": "2020-05-26 14:59:12",
      "updatedBy": 2,
      "updatedAt": "2020-05-26 14:59:12",
      "creator": {
        "id": 2,
        "name": "test2",
        "email": "test2@hengshi.com"
      },
      "updater": {
        "id": 2,
        "name": "test2",
        "email": "test2@hengshi.com"
      }
    },
    {
      "id": 115,
      "title": "Local",
      "type": "connection",
      "createdBy": 2,
      "createdAt": "2020-05-26 14:57:58",
      "updatedBy": 2,
      "updatedAt": "2020-05-26 14:57:58",
      "creator": {
        "id": 2,
        "name": "test2",
        "email": "test2@hengshi.com"
      },
      "updater": {
        "id": 2,
        "name": "test2",
        "email": "test2@hengshi.com"
      }
    }
  ],
  "totalHits": 2,
  "offset": 0
}
1.2.2. 资源转移
请求URL
PUT /api/resource-managements/transfer
需要认证:是
请求参数
Request Body 参数
| 字段 | 类型 | 是否必须 | 说明 | 
|---|---|---|---|
| targetUserId | LONG | 是 | 资源转移目标用户 | 
| resourceMap | MAP<STRING, LIST<OBJECT>> | 
是 | 被转移资源列表 | 
返回对象的格式说明
| 字段 | 类型 | 说明 | 
|---|---|---|
| version | STRING | 当前系统版本哈希值 | 
| data | OBJECT | 每种应用参数的共同结构见应用参数结构说明。 | 
接口示例1: 资源转移
PUT /api/resource-managements/transfer
{
  "targetUserId": 9,
  "resourceMap": {
    "app": [
      {
        "id": 31,
        "createdBy": 2
      }
    ],
    "notebook": [
      {
        "id": 8,
        "createdBy": 2
      }
    ],
    "connection": [
      {
        "id": 6,
        "createdBy": 2
      }
    ]
  }
}
返回:
{
  "version": "3.2-SNAPSHOT@@git.commit.id.abbrev@#null",
  "code": 0,
  "msg": "success"
}
1.2.3. 资源删除
请求URL
DELETE /api/resource-managements
需要认证:是
请求参数
Request Body 参数
| 字段 | 类型 | 是否必须 | 说明 | 
|---|---|---|---|
| resourceMap | MAP<STRING, LIST<OBJECT>> | 
是 | 被转移资源列表 | 
返回对象的格式说明
| 字段 | 类型 | 说明 | 
|---|---|---|
| version | STRING | 当前系统版本哈希值 | 
| data | OBJECT | 每种应用的共同结构见应用参数结构说明。 | 
接口示例1: 资源删除
DELETE /api/resource-managements
{
  "resourceMap": {
    "app": [
      {
        "id": 31,
        "createdBy": 9
      }
    ],
    "notebook": [
      {
        "id": 8,
        "createdBy": 9
      }
    ],
    "connection": [
      {
        "id": 6,
        "createdBy": 9
      }
    ]
  }
}
返回:
{
  "version": "3.2-SNAPSHOT@@git.commit.id.abbrev@#null",
  "code": 0,
  "msg": "success"
}