Skip to content

RESTful API For Period Task

Echo edited this page Jun 28, 2018 · 5 revisions
获取指定Period Task信息
Request
GET /saltshaker/api/v1.0/period/t-87d4f516640811e8aae8000c298454d8

Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": {
        "id": "t-2b2cb4387a7511e8ba85000c298454d8",
        "sls": "",
        "cron": "",
        "date": "2018-06-27T16:00:00.000Z",
        "name": "test02",
        "time": "00:00:04",
        "type": "shell",
        "shell": "uptime",
        "module": "",
        "period": "once",
        "result": [
            {
                "time": "2018-06-28 09:47:09",
                "result": {
                    "10.10.10.22": " 09:47:55 up 28 days, 16:17,  0 users,  load average: 0.15, 0.12, 0.10"
                }
            },
            {
                "time": "2018-06-28 09:48:48",
                "result": {
                    "10.10.10.22": " 09:49:34 up 28 days, 16:18,  0 users,  load average: 0.06, 0.10, 0.10"
                }
            }
        ],
        "status": "完成",
        "target": [
            {
                "name": "BX-sinax-test",
                "id": "g-2ba1a7ec787311e8a6ae000c298454d8"
            }
        ],
        "timestamp": "2018-06-28 09:47:08",
        "concurrent": 0,
        "product_id": "xidan",
        "description": "test02"
    },
    "status": true,
    "message": ""
}
获取指定产品线Period Task列表
Request
GET /saltshaker/api/v1.0/period?product_id=p-4bc4a5b83bd011e8aa0e000c298454d8

Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "data": [
        {
            "id": "t-2b2cb4387a7511e8ba85000c298454d8",
            "sls": "",
            "cron": "",
            "date": "2018-06-27T16:00:00.000Z",
            "name": "test02",
            "time": "00:00:04",
            "type": "shell",
            "shell": "uptime",
            "module": "",
            "period": "once",
            "result": [],
            "status": "完成",
            "target": [
                {
                    "id": "g-2ba1a7ec787311e8a6ae000c298454d8",
                    "name": "BX-sinax-test"
                }
            ],
            "timestamp": "2018-06-28 09:47:08",
            "concurrent": 0,
            "product_id": "p-4bc4a5b83bd011e8aa0e000c298454d8",
            "description": "test02"
        },
        {
            "id": "t-9021e9bc7a7011e8ba85000c298454d8",
            "sls": "",
            "cron": "",
            "date": "2018-06-27T16:00:00.000Z",
            "name": "test01",
            "time": "05:05:05",
            "type": "shell",
            "shell": "ls -l /boot",
            "module": "",
            "period": "once",
            "result": [],
            "status": "完成",
            "target": [
                {
                    "id": "g-2ba1a7ec787311e8a6ae000c298454d8",
                    "name": "BX-sinax-test"
                },
                {
                    "id": "g-3d36b51a787311e8a6ae000c298454d8",
                    "name": "SX-sina-test"
                }
            ],
            "timestamp": "2018-06-28 09:14:10",
            "concurrent": 0,
            "product_id": "p-4bc4a5b83bd011e8aa0e000c298454d8",
            "description": "test01"
        },
        {
            "id": "t-0f00b3cc7a7011e8ba85000c298454d8",
            "sls": "",
            "cron": "",
            "date": "2018-06-26T16:00:00.000Z",
            "name": "test",
            "time": "00:02:02",
            "type": "shell",
            "shell": "sleep 6 & uname -a",
            "module": "",
            "period": "once",
            "result": [],
            "status": "完成",
            "target": [
                {
                    "id": "g-2ba1a7ec787311e8a6ae000c298454d8",
                    "name": "BX-sinax-test"
                },
                {
                    "id": "g-3d36b51a787311e8a6ae000c298454d8",
                    "name": "SX-sina-test"
                }
            ],
            "timestamp": "2018-06-28 09:10:34",
            "concurrent": 0,
            "product_id": "p-4bc4a5b83bd011e8aa0e000c298454d8",
            "description": "test"
        }
    ],
    "status": true,
    "message": ""
}
删除指定产品线Period
Request
DELETE /saltshaker/api/v1.0/period/t-0f00b3cc7a7011e8ba85000c298454d8
Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "status": true,
    "message": ""
}
###### 重开指定产品线Period

Request PUT /saltshaker/api/v1.0/period/reopen/t-2b2cb4387a7511e8ba85000c298454d8?product_id=p-4bc4a5b83bd011e8aa0e000c29


Response HTTP/1.1 200 OK Content-Type: application/json

{ "status": true, "message": "" }