Chuyển tới nội dung chính

Ranger-compatible policy service API

Ranger Admin REST serving surface polled by engine plugins (read-only policy/service-def download).

This page lists 6 endpoints (OpenAPI tag ranger). It is generated from openapi.json; see the REST API overview for authentication, CSRF and error conventions.

MethodPathOperation idNotes
GET/service/plugins/definitionslist_defs
GET/service/plugins/definitions/name/{name}get_def
GET/service/plugins/policies/download/{service}download_policiesGET /plugins/policies/download/\{service\}?lastKnownVersion=N
GET/service/plugins/policies/{id}get_policy
GET/service/plugins/serviceslist_services
GET/service/tags/download/{service}download_tagsGET /tags/download/\{service\}?lastKnownVersion=N

GET /service/plugins/definitions​

Operation id: list_defs. Auth: Bearer token equal to ranger.auth_token (open when the token is empty).

Response 200 (application/json): RangerServiceDefs

FieldTypeRequiredDescription
serviceDefsobject[]yesEach element is a raw Ranger service-definition object (stored verbatim).
StatusMeaning
200All stored Ranger service-definitions
401Missing or invalid bearer token (when a ranger auth token is configured)
500Internal error

GET /service/plugins/definitions/name/{name}​

Operation id: get_def. Auth: Bearer token equal to ranger.auth_token (open when the token is empty).

ParameterInTypeRequiredDescription
namepathstringyesService-definition name (e.g. trino)

Response 200 (application/json): object

StatusMeaning
200The raw Ranger service-definition
401Missing or invalid bearer token (when a ranger auth token is configured)
404No such service-definition
500Internal error

GET /service/plugins/policies/download/{service}​

Operation id: download_policies. Auth: Bearer token equal to ranger.auth_token (open when the token is empty).

GET /plugins/policies/download/\{service\}?lastKnownVersion=N

Returns 304 when the plugin's cached version matches; 200 + ServicePolicies otherwise.

ParameterInTypeRequiredDescription
servicepathstringyesPolicy profile (Ranger service) name
lastKnownVersionqueryinteger (int64)noThe plugin's cached policy version; a match yields 304 Not Modified.

Response 200 (application/json): RangerServicePolicies

FieldTypeRequiredDescription
serviceNamestringyes
serviceIdinteger (int64)yes
policyVersioninteger (int64)yes
policyUpdateTimeinteger (int64), nullablenoepoch millis; omitted when unknown
serviceDefobjectyesThe raw Ranger service-definition (stored verbatim).
policiesobject[]yesThe service's enabled policies, each a raw Ranger policy object.
auditModestringyes
StatusMeaning
200The service's enabled policies + service-def (plugin download envelope)
304Not modified — the plugin's lastKnownVersion matches the current policy version
401Missing or invalid bearer token (when a ranger auth token is configured)
404No such policy profile
500Internal error

GET /service/plugins/policies/{id}​

Operation id: get_policy. Auth: Bearer token equal to ranger.auth_token (open when the token is empty).

ParameterInTypeRequiredDescription
idpathinteger (int64)yesPolicy id

Response 200 (application/json): object

StatusMeaning
200The raw stored Ranger policy body (with id)
401Missing or invalid bearer token (when a ranger auth token is configured)
404No such policy
500Internal error

GET /service/plugins/services​

Operation id: list_services. Auth: Bearer token equal to ranger.auth_token (open when the token is empty).

Response 200 (application/json): array of RangerServiceRef

FieldTypeRequiredDescription
idinteger (int64)yes
namestringyes
typestringyes
configsobjectyesThe service's config map (stored verbatim).
policyVersioninteger (int64)yes
isEnabledbooleanyes
StatusMeaning
200All policy profiles (Ranger services)
401Missing or invalid bearer token (when a ranger auth token is configured)
500Internal error

GET /service/tags/download/{service}​

Operation id: download_tags. Auth: Bearer token equal to ranger.auth_token (open when the token is empty).

GET /tags/download/\{service\}?lastKnownVersion=N

Serves the real resource→tag mapping (catalog_tag_assignments) for the service's warehouse(s) as a Ranger ServiceTags. Returns 304 when the plugin's cached tagVersion matches the current one; 200 otherwise.

ParameterInTypeRequiredDescription
servicepathstringyesPolicy profile (Ranger service) name
lastKnownVersionqueryinteger (int64)noThe plugin's cached policy version; a match yields 304 Not Modified.

Response 200 (application/json): RangerServiceTags

FieldTypeRequiredDescription
opstringyes
serviceNamestringyes
tagVersioninteger (int64)yes
tagsobjectyesTag map keyed by numeric tag-id → tag-def instance.
serviceResourcesobject[]yes
resourceToTagIdsobjectyes\{ "<resourceId>": [<tagId>, ...] \} linking each resource to its tags.
StatusMeaning
200The service's catalog tag assignments (plugin tag-download envelope)
304Not modified — the plugin's lastKnownVersion matches the current tag version
401Missing or invalid bearer token (when a ranger auth token is configured)
404No such policy profile
500Internal error