Apache Ranger Policies API

The Policies API from Apache Ranger — 2 operation(s) for policies.

OpenAPI Specification

apache-ranger-policies-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Apache Ranger REST Audit Policies API
  description: Apache Ranger provides centralized security administration and policy management for Hadoop ecosystem services. This API covers policy management, service definitions, audit logs, user/group management, and security zones.
  version: 2.4.0
  contact:
    name: Apache Ranger
    url: https://ranger.apache.org/
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: https://ranger.example.com/service
  description: Apache Ranger Policy Manager
security:
- basicAuth: []
tags:
- name: Policies
paths:
  /plugins/policies:
    get:
      operationId: listPolicies
      summary: Apache Ranger List Policies
      description: List all security policies managed by Ranger.
      tags:
      - Policies
      x-microcks-operation:
        dispatcher: RANDOM
      parameters:
      - name: serviceType
        in: query
        schema:
          type: string
        description: Filter by service type (hdfs, hive, hbase, etc.)
      - name: serviceName
        in: query
        schema:
          type: string
      responses:
        '200':
          description: List of policies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PolicyList'
    post:
      operationId: createPolicy
      summary: Apache Ranger Create Policy
      description: Create a new security policy in Ranger.
      tags:
      - Policies
      x-microcks-operation:
        dispatcher: RANDOM
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Policy'
      responses:
        '200':
          description: Policy created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Policy'
  /plugins/policies/{id}:
    get:
      operationId: getPolicy
      summary: Apache Ranger Get Policy
      description: Retrieve a specific security policy by ID.
      tags:
      - Policies
      x-microcks-operation:
        dispatcher: URI_PARTS
        dispatcherRules: id
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: Policy details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Policy'
    put:
      operationId: updatePolicy
      summary: Apache Ranger Update Policy
      description: Update an existing security policy.
      tags:
      - Policies
      x-microcks-operation:
        dispatcher: URI_PARTS
        dispatcherRules: id
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Policy'
      responses:
        '200':
          description: Policy updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Policy'
    delete:
      operationId: deletePolicy
      summary: Apache Ranger Delete Policy
      description: Delete a security policy by ID.
      tags:
      - Policies
      x-microcks-operation:
        dispatcher: URI_PARTS
        dispatcherRules: id
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '204':
          description: Policy deleted
components:
  schemas:
    AccessType:
      type: object
      description: Access type in a policy item
      properties:
        type:
          type: string
          description: Access type name (read, write, execute, etc.)
        isAllowed:
          type: boolean
          description: Whether the access is allowed
    PolicyResource:
      type: object
      description: Resource specification in a Ranger policy
      properties:
        values:
          type: array
          items:
            type: string
          description: Resource values (paths, tables, etc.)
        isRecursive:
          type: boolean
          description: Whether to apply recursively
        isExcludes:
          type: boolean
          description: Whether this is an exclusion list
    Policy:
      type: object
      description: Ranger security policy definition
      properties:
        id:
          type: integer
          description: Policy identifier
        name:
          type: string
          description: Policy name
        serviceType:
          type: string
          description: Service type this policy applies to (hdfs, hive, hbase)
        serviceName:
          type: string
          description: Service name this policy applies to
        description:
          type: string
          description: Policy description
        isEnabled:
          type: boolean
          description: Whether the policy is active
        isAuditEnabled:
          type: boolean
          description: Whether audit logging is enabled
        resources:
          type: object
          description: Resources protected by this policy
          additionalProperties:
            $ref: '#/components/schemas/PolicyResource'
        policyItems:
          type: array
          items:
            $ref: '#/components/schemas/PolicyItem'
    PolicyList:
      type: object
      description: List of Ranger security policies
      properties:
        totalCount:
          type: integer
          description: Total number of policies
        pageSize:
          type: integer
        resultSize:
          type: integer
        policies:
          type: array
          items:
            $ref: '#/components/schemas/Policy'
    PolicyItem:
      type: object
      description: Policy item defining access permissions
      properties:
        users:
          type: array
          items:
            type: string
          description: Users granted access
        groups:
          type: array
          items:
            type: string
          description: Groups granted access
        accesses:
          type: array
          items:
            $ref: '#/components/schemas/AccessType'
        conditions:
          type: array
          items:
            type: string
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic