模块管理

说明

  • 管理作业中默认的模块,用于批量命令中模块参数选择的默认值

1、模块管理列表、新增模块管理、批量删除模块管理 API

请求方式: GET(查询) POST(新增) DELETE(批量删除)

请求地址: /api/system/system/module/

Content-Type:

新增数据的时候需要指定Content-Type,以下对Content-Type进行说明:

application/x-www-form-urlencoded —— 表示通过表单方式提交
application/json —— 表示传入数据为json格式字符串

查询参数:

参数 数据类型 是否必须 说明
offset int 数据起始位置
limit int 查询条数
name string 模块名称
search string 模糊查询,查询字段为name和comment

输入参数(新增):

参数 数据类型 是否必须 说明
name string 模块名称
weight int 权重
comment string 模块描述

输出参数:

参数 数据类型 是否必须 说明
id int 模块id
name string 模块名称
weight int 权重
comment string 模块描述

批量删除参数:

参数 数据类型 是否必须 说明
pk string 与pk[]不能都为空 主键,多个主键用半角逗号隔开。通过http body传入
pk[] array 与pk不能都为空 主键数组。通过http body传入

排序:

参数 数据类型 是否必须 说明
ordering string
一般默认按id倒叙
  • ordering=id表示按id排序ordering=-id表示按id倒叙
  • 多个字段排序用半角逗号分隔

GET返回数据例子:

{
    "count": 13,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 1,
            "name": "command",
            "weight": 0,
            "comment": "命令"
        },
        {
            "id": 2,
            "name": "yum",
            "weight": 0,
            "comment": "使用yum包管理工具管理Rad Hat上的包"
        },
        {
            "id": 3,
            "name": "pip",
            "weight": 0,
            "comment": "试用pip管理python依赖库"
        },
        {
            "id": 4,
            "name": "service",
            "weight": 0,
            "comment": "服务管理"
        },
        {
            "id": 5,
            "name": "copy",
            "weight": 0,
            "comment": "将文件复制到远程节点上"
        },
        {
            "id": 6,
            "name": "file",
            "weight": 0,
            "comment": "设置文件或者文件夹属性"
        },
        {
            "id": 7,
            "name": "script",
            "weight": 0,
            "comment": "将本地脚本传输到远程节点上运行"
        },
        {
            "id": 8,
            "name": "user",
            "weight": 0,
            "comment": "管理用户账户"
        },
        {
            "id": 9,
            "name": "group",
            "weight": 0,
            "comment": "添加或删除GROUP"
        },
        {
            "id": 10,
            "name": "template",
            "weight": 0,
            "comment": "将模板文件传输到远程服务器"
        },
        {
            "id": 11,
            "name": "unarchive",
            "weight": 0,
            "comment": "解压文件、复制到远程服务器上"
        },
        {
            "id": 12,
            "name": "mysql_db",
            "weight": 0,
            "comment": "管理MySQL数据库,创建或删除用户、数据库、导入表等"
        },
        {
            "id": 14,
            "name": "shell",
            "weight": 0,
            "comment": "命令"
        }
    ]
}

新增模块管理返回数据例子:

{
    "id": 1,
    "name": "command",
    "weight": 0,
    "comment": "命令"
}

2、获取单个模块管理,修改模块管理、删除模块管理 API

请求方式: GET(查询) PUT(修改) PATCH(修改) DELETE(删除)

请求地址: /api/system/system/module/1/

请求地址中1为模块管理的id

输入/输出参数: 见章节1中输入和输出参数说明,修改数据时输入参数均为非必须

返回数据例子:

{
    "id": 1,
    "name": "command",
    "weight": 0,
    "comment": "命令"
}