Skip to content

RESTful API For ACL

Echo edited this page Apr 16, 2018 · 4 revisions
获取指定ACL信息
Request
GET /saltshaker/api/v1.0/acl/a-977a2b3a2b2d11e886cb000c298454d8

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

{
    "data": {
        "id": "a-977a2b3a2b2d11e886cb000c298454d8",
        "deny": "rm -rf *;rm -rf /",
        "name": "safe",
        "allow": "",
        "description": "不允许使用rm相关命令"
    },
    "status": true,
    "message": ""
}
获取指定产品线ACL列表
Request
GET /saltshaker/api/v1.0/acl?product_id=p-4bc4a5b83bd011e8aa0e000c298454d8

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

{
    "data": [
        {
            "id": "a-d31f57f4411311e89ff9000c298454d8",
            "deny": [],
            "name": "rer",
            "allow": [],
            "product_id": "p-4bc4a5b83bd011e8aa0e000c298454d8",
            "description": "test"
        },
        {
            "id": "a-8293bc02411911e89ff9000c298454d8",
            "deny": [
                "rm -rm /*",
                "rm -rf",
            ],
            "name": "aaa",
            "allow": [
                "*",
            ],
            "product_id": "p-4bc4a5b83bd011e8aa0e000c298454d8",
            "description": "aaa"
        },
        {
            "id": "a-56cf3478411b11e89ff9000c298454d8",
            "deny": [
                "shutdown"
            ],
            "name": "shutdown",
            "allow": [
                "*"
            ],
            "product_id": "p-4bc4a5b83bd011e8aa0e000c298454d8",
            "description": "禁止关机"
        },
    ],
    "status": true,
    "message": ""
}
添加ACL
Request
POST /saltshaker/api/v1.0/acl

POST Body
{
	"name":"denger",
	"allow": "*",
	"deny":"",
	"description":"任何命名",
        "product_id":"p-4bc4a5b83bd011e8aa0e000c298454d8"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "status": true,
    "message": ""
}
删除ACL
Request
DELETE /saltshaker/api/v1.0/acl/a-4d1e3d2c2b2a11e886cb000c298454d8

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

{
    "status": true,
    "message": ""
}
修改ACL
Request
PUT /saltshaker/api/v1.0/acl/a-977a2b3a2b2d11e886cb000c298454d8

PUT Body
{
        "id": "a-977a2b3a2b2d11e886cb000c298454d8",
        "deny": "rm -rf *;'rm -rf /",
        "name": "safe",
        "description": "不允许使用rm相关命令"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

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