openapi: 3.0.1
info:
  title: Configuration service
  contact:
    name: Cobrick
    url: https://cobrick.com
    email: aiops@cobrick.com
  license:
    name: Commercial
    url: https://cobrick.com
  version: v1
servers:
  - url: https://app.observe.digital/api/v1
    description: Production environment
  - url: https://stage.observe.digital/api/v1
    description: Staging environment
  - url: http://localhost:8080
    description: Local environment
paths:
  /configuration/dashboards:
    get:
      tags:
        - Dashboards
      summary: Get all dashboards
      operationId: getDashboards
      parameters:
        - name: X-Scope-OrgID
          in: header
          description: Tenant header
          schema:
            type: string
        - name: cursor
          in: query
          description: Paging cursor
          schema:
            type: string
            format: byte
        - name: direction
          in: query
          description: Paging direction
          schema:
            $ref: '#/components/schemas/PagingCommand.Direction'
        - name: pageSize
          in: query
          description: Page size
          schema:
            maximum: 100
            minimum: 1
            type: integer
        - name: Api-Version
          in: header
          description: API version
          schema:
            type: string
      responses:
        '200':
          description: Successfully returned dashboards
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Page_Object_'
        '401':
          description: Authorization information is missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
    post:
      tags:
        - Dashboards
      summary: Create a new dashboard
      operationId: createDashboard
      parameters:
        - name: X-Scope-OrgID
          in: header
          description: Tenant header
          schema:
            type: string
        - name: Api-Version
          in: header
          description: API version
          schema:
            type: string
      requestBody:
        description: JSON representation of the dashboard to be created
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Dashboard'
        required: true
      responses:
        '201':
          description: Successfully created new dashboard
        '400':
          description: Incorrect payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
        '401':
          description: Authorization information is missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
  /configuration/dashboards/{name}:
    get:
      tags:
        - Dashboards
      summary: Get dashboard by name
      operationId: getDashboard
      parameters:
        - name: X-Scope-OrgID
          in: header
          description: Tenant header
          schema:
            type: string
        - name: name
          in: path
          description: Dashboard name
          required: true
          schema:
            type: string
        - name: Api-Version
          in: header
          description: API version
          schema:
            type: string
      responses:
        '200':
          description: Successfully returned dashboard
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dashboard'
        '401':
          description: Authorization information is missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
        '404':
          description: The dashboard not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
    put:
      tags:
        - Dashboards
      summary: Update an existing dashboard
      operationId: updateDashboard
      parameters:
        - name: X-Scope-OrgID
          in: header
          description: Tenant header
          schema:
            type: string
        - name: name
          in: path
          description: Dashboard name
          required: true
          schema:
            type: string
        - name: Api-Version
          in: header
          description: API version
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Dashboard'
        required: true
      responses:
        '200':
          description: Successfully updated the dashboard
        '400':
          description: Incorrect payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
        '401':
          description: Authorization information is missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
        '404':
          description: The dashboard doesn't exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
    delete:
      tags:
        - Dashboards
      summary: Remove an existing dashboard
      operationId: deleteDashboard
      parameters:
        - name: X-Scope-OrgID
          in: header
          description: Tenant header
          schema:
            type: string
        - name: name
          in: path
          description: Dashboard name
          required: true
          schema:
            type: string
        - name: Api-Version
          in: header
          description: API version
          schema:
            type: string
      responses:
        '204':
          description: Successfully deleted the dashboard
        '401':
          description: Authorization information is missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
        '404':
          description: The dashboard doesn't exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
        '500':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JsonError'
components:
  schemas:
    AbstractResource_JsonError_:
      type: object
      properties:
        _links:
          type: object
          additionalProperties: true
        _embedded:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/Resource'
    Charset:
      type: object
      properties:
        registered:
          type: boolean
    Dashboard:
      required:
        - name
        - widgets
      type: object
      properties:
        name:
          maxLength: 255
          minLength: 1
          type: string
        default:
          type: boolean
        widgets:
          type: array
          items:
            $ref: '#/components/schemas/Dashboard.Widget'
      description: >-
        A model class representing domain data from a row in `dashboards`
        database table.
    Dashboard.Widget:
      required:
        - config
        - layouts
        - name
      type: object
      properties:
        name:
          type: string
        layouts:
          type: object
          additionalProperties:
            type: object
            additionalProperties:
              type: integer
              format: int32
        config:
          type: object
          additionalProperties:
            type: string
    JsonError:
      type: object
      allOf:
        - $ref: '#/components/schemas/AbstractResource_JsonError_'
        - required:
            - message
          properties:
            _links:
              type: object
              additionalProperties: true
            _embedded:
              type: object
              additionalProperties:
                type: array
                items:
                  $ref: '#/components/schemas/Resource'
            message:
              type: string
            logref:
              type: string
              nullable: true
            path:
              type: string
              nullable: true
    MediaType:
      required:
        - name
      type: object
      properties:
        name:
          type: string
        type:
          type: string
        subtype:
          type: string
        extension:
          type: string
        parameters:
          $ref: '#/components/schemas/OptionalValues_String_'
        quality:
          type: string
        qualityAsNumber:
          type: number
        version:
          type: string
        charset:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/Charset'
        textBased:
          type: boolean
    OptionalMultiValues_Link_:
      $ref: '#/components/schemas/OptionalValues_List_Link__'
    OptionalMultiValues_Resource_:
      $ref: '#/components/schemas/OptionalValues_List_Resource__'
    OptionalValues_List_Link__:
      type: object
      properties:
        empty:
          type: boolean
    OptionalValues_List_Resource__:
      type: object
      properties:
        empty:
          type: boolean
    OptionalValues_String_:
      type: object
      properties:
        empty:
          type: boolean
    Page_Object_:
      required:
        - data
        - paging
      type: object
      properties:
        data:
          type: array
          items:
            type: object
        paging:
          $ref: '#/components/schemas/PagingResponse'
      description: DTO class representing a page of data with paging information.
    PagingCommand.Direction:
      type: string
      enum:
        - NEXT
        - PREVIOUS
    PagingCursor:
      required:
        - firstName
        - lastName
      type: object
      properties:
        firstName:
          type: string
        lastName:
          type: string
      description: DTO class representing paging cursor
    PagingResponse:
      required:
        - cursor
        - hasNext
        - hasPrevious
      type: object
      properties:
        cursor:
          $ref: '#/components/schemas/PagingCursor'
        hasNext:
          type: boolean
        hasPrevious:
          type: boolean
      description: DTO class representing paging information for the response
    Resource:
      type: object
      properties:
        _links:
          $ref: '#/components/schemas/OptionalMultiValues_Link_'
        _embedded:
          $ref: '#/components/schemas/OptionalMultiValues_Resource_'
