openapi: 3.0.0
info:
  title: Rbac Authorization Permissions APIs.
  description: Rbac Authorization Permissions APIs.
  termsOfService: https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/product/vmware-product-guide.pdf
  contact:
    name: VMware
  license:
    name: Copyright (c) 2020-2021 VMware, Inc. All rights reserved.
  version: "1.0"
servers:
- url: /admin/hybridity/api/authz/rbac
tags:
- name: RbacPermissions
  description: Rbac Authorization Permissions Apis
paths:
  /permissions/query:
    post:
      tags:
      - RbacPermissions
      summary: Query Rbac authorization permissions
      description: Query Rbac authorization permissions
      operationId: getPermissionsByFilter
      requestBody:
        description: Filter object.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/permissionFilter'
        required: true
      responses:
        "200":
          description: Successfully retrived requested permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/permissionList'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Permission not found
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
  /permissions/validate:
    post:
      tags:
      - RbacPermissions
      summary: Validate Rbac authorization permission request.
      description: Validate Rbac authorization permission request.
      operationId: validateAuthorizationPermission
      requestBody:
        description: request payload.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/permission'
        required: true
      responses:
        "200":
          description: Successfully validated permission request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/validatePermissionResponse'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
  /permissions:
    post:
      tags:
      - RbacPermissions
      summary: Create Rbac authorization permission.
      description: Create Rbac authorization permission.
      operationId: createAuthorizationPermission
      requestBody:
        description: request payload.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/permission'
        required: true
      responses:
        "200":
          description: Successfully created permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/permission'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
  /permissions/{permissionId}:
    put:
      tags:
      - RbacPermissions
      summary: Update Rbac authorization permission.
      description: Update Rbac authorization permissions.
      operationId: updateAuthorizationPermission
      parameters:
      - name: permissionId
        in: path
        description: permission ID
        required: true
        style: simple
        explode: false
        schema:
          type: string
      requestBody:
        description: request payload.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/permission'
        required: true
      responses:
        "200":
          description: Successfully updated requested permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/permission'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "400":
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResponse'
    delete:
      tags:
      - RbacPermissions
      summary: Delete Rbac authorization permission.
      description: Delete Rbac authorization permission.
      operationId: deleteAuthorizationPermission
      parameters:
      - name: permissionId
        in: path
        description: permission ID
        required: true
        style: simple
        explode: false
        schema:
          type: string
      responses:
        "200":
          $ref: '#/components/schemas/permission'
        "400":
          $ref: '#/components/schemas/errorResponse'
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "500":
          $ref: '#/components/schemas/errorResponse'
components:
  schemas:
    permission:
      required:
      - roleId
      - usersAndGroups
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        objectFilters:
          type: array
          items:
            $ref: ./components/schemas/objectFilter.yaml
        roleId:
          type: string
        creationDate:
          type: string
        roleName:
          type: string
        usersAndGroups:
          type: array
          items:
            type: string
    permissionList:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: ./components/schemas/permission.yaml
    permissionFilter:
      type: object
      properties:
        filter:
          $ref: '#/components/schemas/permissionFilter_filter'
    errorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: ../../../api-common/swagger/1.0/components/schemas/error.yaml
    validatePermissionResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: ../../../api-common/swagger/1.0/components/schemas/error.yaml
        warnings:
          type: array
          items:
            $ref: ../../../api-common/swagger/1.0/components/schemas/warning.yaml
    permissionFilter_filter:
      type: object
      properties:
        roleId:
          type: array
          items:
            type: string
        id:
          type: array
          items:
            type: string
  parameters:
    permissionIdParam:
      name: permissionId
      in: path
      description: permission ID
      required: true
      style: simple
      explode: false
      schema:
        type: string
  securitySchemes:
    x-hm-authorization:
      type: apiKey
      description: Obtained from /hybridity/api/session
      name: x-hm-authorization
      in: header
