Apache Ranger Public REST APIs
Also available as:
PDF

Create Policy

Reference information for the Ranger REST API service/public/v2/api/policy.

API name Create Policy
Request Type POST
Request URL service/public/v2/api/policy
Request Params
{
    "allowExceptions": [],
    "denyExceptions": [],
    "denyPolicyItems": [
        {
            "accesses": [
                {
                    "isAllowed": true,
                    "type": "drop"
                }
            ],
            "conditions": [],
            "delegateAdmin": true,
            "groups": [],
            "users": [
        "hadoop"
            ]
        }
    ],
    "description": "Policy for Service: cl1_test",
    "isAuditEnabled": true,
    "isEnabled": true,
    "name": "cl1_test-1",
    "policyItems": [
        {
            "accesses": [
                {
                    "isAllowed": true,
                    "type": "select"
                },
                {
                    "isAllowed": true,
                    "type": "update"
                },
                {
                    "isAllowed": true,
                    "type": "create"
                },
                {
                    "isAllowed": true,
                    "type": "drop"
                }
            ],
            "conditions": [],
            "delegateAdmin": true,
            "groups": ["public"],
            "users": [
            ]
        }
    ],
    "resources": {
        "root": {
            "isExcludes": false,
            "isRecursive": false,
            "values": [
                "abc"
            ]
        },
        "sub": {
            "isExcludes": false,
            "isRecursive": false,
            "values": [
                "*"
            ]
        }
    },
    "service": "cl1_test",
    "version": 1
}
Response
{
    "allowExceptions": [],
    "createTime": 1451350456093,
    "createdBy": "Admin",
    "denyExceptions": [],
    "denyPolicyItems": [
        {
            "accesses": [
                {
                    "isAllowed": true,
                    "type": "drop"
                }
            ],
            "conditions": [],
            "delegateAdmin": true,
            "groups": [],
            "users": [
                "hadoop"
            ]
        }
    ],
    "description": "Policy for Service: cl1_test",
    "guid": "ff0b3c4a-6aa0-4803-9314-17f3b8950482",
    "id": 8,
    "isAuditEnabled": true,
    "isEnabled": true,
    "name": "cl1_test-1",
    "policyItems": [
        {
            "accesses": [
                {
                    "isAllowed": true,
                    "type": "select"
                },
                {
                    "isAllowed": true,
                    "type": "update"
                },
                {
                    "isAllowed": true,
                    "type": "create"
                },
                {
                    "isAllowed": true,
                    "type": "drop"
                }
            ],
            "conditions": [],
            "delegateAdmin": true,
            "groups": [
                "public"
            ],
            "users": []
        }
    ],
    "resourceSignature": "8a2fac99ba72c687defacff39d6354fb",
    "resources": {
        "root": {
            "isExcludes": false,
            "isRecursive": false,
            "values": [
                "abc"
            ]
        },
        "sub": {
            "isExcludes": false,
            "isRecursive": false,
            "values": [
                "*"
            ]
        }
    },
    "service": "cl1_test",
    "updateTime": 1451350456094,
    "updatedBy": "Admin",
    "version": 1
}