Skip to content

RESTful API For Host

Echo edited this page Apr 5, 2018 · 7 revisions
获取指定主机信息
Request
GET /saltshaker/api/v1.0/host/h-dcf2af4c389411e881ef000c298454d8

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

{
    "host": {
        "id": "h-dcf2af4c389411e881ef000c298454d8",
        "tag": "",
        "group_id": [],
        "minion_id": "10.11.1.10",
        "product_id": "p-b4aaef1e322611e8ab56000c298454d8"
    }
}
获取指定产品的主机列表
Request
GET /saltshaker/api/v1.0/host?product_id=p-b4aaef1e322611e8ab56000c298454d8

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

{
    "hosts": {
        "host": [
            {
                "id": "h-dcf2af4c389411e881ef000c298454d8",
                "tag": "",
                "group_id": [],
                "minion_id": "10.11.1.10",
                "product_id": "p-b4aaef1e322611e8ab56000c298454d8"
            },
            {
                "id": "h-dcf2af4d389411e881ef000c298454d8",
                "tag": "",
                "group_id": [],
                "minion_id": "119.45.44.44",
                "product_id": "p-b4aaef1e322611e8ab56000c298454d8"
            }
        ]
    }
}
添加组
Request
POST /saltshaker/api/v1.0/groups

POST Body
{
	"name": "test01",
	"product_id": "p-bbfc8b5221d611e894b0000c298454d8"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "status": true,
    "message": ""
}
删除组
Request
DELETE /saltshaker/api/v1.0/groups/g-42fcb22e28fa11e8a7e3000c298454d8

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

{
    "status": true,
    "message": ""
}
修改主机
Request
PUT /saltshaker/api/v1.0/groups/g-42fcb22e28fa11e8a7e3000c298454d8
PUT Body
{
    "tag": "error",
    "group_id": ["g-142120c8323411e8ab56000c298454d8","g-191b9cc0323411e8ab56000c298454d8"],
    "product_id":"p-b4aaef1e322611e8ab56000c298454d8"

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

{
    "status": true,
    "message": ""
}
Clone this wiki locally