swagger: '2.0'
info:
  description: |-
    This document provides API specs for Admin user. The specification is compatible starting from version 1.4.3 of the IEM.
  version: v1.0.0
  title: Admin API
basePath: /admin/api/v1
tags:
  - name: admin
paths:
  '/devices':
    get:
      tags:
        - admin
      summary: List Edge Devices
      description: This method returns a list of all Edge Devices available for the admin and co-admin user
      operationId: admin-list-devices
      produces:
        - application/json
      parameters:
        - name: Authorization
          in: header
          description: The authentication token
          required: true
          type: string
        - name: size
          in: query
          description: The size of the page
          required: false
          default: 5
          type: string
        - name: page
          in: query
          description: The page number
          required: false
          default: 1
          type: string
      responses:
        '200':
          description: Successful operation
          schema:
            $ref: '#/definitions/DeviceResponse'
        '401':
          description: auth.missingAuthToken
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: auth.unauthorizedToken
          schema:
             $ref: '#/definitions/errors'
        '500':
          description: something.wrong
          schema:
             $ref: '#/definitions/errors'
  /log-downloads:
    post:
      tags:
        - admin
      summary: This method returns the download url of logs file.
      description: This method returns the download url of logs file.
      operationId: get-logs
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - name: Authorization
          in: header
          description: Authorization token
          required: true
          type: string
      responses:
        '200':
          description: successful operation (return public path of the log file)
          schema:
            type: object
            properties:
                download-url:
                  type: string
        '401':
          description: |-
             auth.missingAuthToken 
             auth.tokenExpired
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: |-
             auth.unauthorizedToken 
             auth.accessDenied 
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: |-
            something.wrong 
            log.file.not.created
          schema:
            $ref: '#/definitions/errors'

definitions:
  PageResponse:
    type: object
    properties:
      pageNo:
        type: integer
      pageSize:
        type: integer
      totalPages:
        type: integer
        
  DeviceResponse:
    type: object
    properties:
      devices:
        type: array
        items:
          $ref: '#/definitions/DeviceExternalVO'
      page:
        $ref: '#/definitions/PageResponse'
  DeviceExternalVO:
    type: object
    properties:
      userId:
        type: string
      deviceId:
        type: string
      deviceName:
        type: string
      deviceStatus:
        type: string
        enum:
          - ACTIVE
          - PENDING
          - SUSPENDED
          - DELETED
          - PUBLISHED
          - FAILED
          - BEING_DELETED
      hostName:
        type: string
      description:
        type: string
      platformId:
        type: string
      swPlatformId:
        type: string
      createdDate:
        type: integer
        format: int64
      modifiedDate:
        type: integer
        format: int64
      softwarePlatformName:
        type: string
        enum:
          - DOCKER_COMPOSE
          - KUBERNETES
  errors:
    type: object
    properties:
      errors:
        type: array
        items:
          $ref: '#/definitions/error'
  error:
    type: object
    properties:
      code:
        type: string
      message:
        type: string
      errorCode:
        type: integer
      field:
        type: string
      logref:
        type: string
        description: Log reference id - b2a90aa1-78d6-40d4-af45-a41558642130
      parentLogref:
        type: string
        description: parent log reference id