swagger: '2.0'
info:
  version: 2.1.0
  title: Cybus System Control API
basePath: /api
schemes:
  - https
produces:
  - application/json
consumes:
  - application/json
paths:
  /api/system/info:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - system-info
      summary: >
        Provides system information including features, license period and
        validity of the running Connectware instance
      operationId: systemInfo
      responses:
        '200':
          description: Success
          schema:
            type: object
            properties:
              time:
                type: string
              version:
                type: string
              license:
                type: object
                properties:
                  name:
                    type: string
                  file:
                    type: object
        '400':
          description: Invalid request
  /api/system/preflight:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - system-preflight
      summary: Retrieve preflight information
      operationId: systemPreflight
      responses:
        '200':
          description: Success
          schema:
            type: object
            properties:
              dockerHub:
                type: object
                properties:
                  status:
                    type: boolean
                  statusText:
                    type: string
                  url:
                    type: string
              cybusRegistry:
                type: object
                properties:
                  status:
                    type: boolean
                  statusText:
                    type: string
                  url:
                    type: string
              cybusPortal:
                type: object
                properties:
                  status:
                    type: boolean
                  statusText:
                    type: string
                  url:
                    type: string
              currentVersions:
                type: object
                properties:
                  series:
                    type: object
        '400':
          description: Invalid request
  /api/system/licensefile:
    put:
      security:
        - ApiKeyHeader: []
      tags:
        - system-licensefile
      summary: Upload licensefile
      operationId: systemLicenseFileUpload
      responses:
        '200':
          description: Success
          schema:
            type: object
            properties:
              time:
                type: string
              version:
                type: string
              license:
                type: object
                properties:
                  name:
                    type: string
                  file:
                    type: object
        '400':
          description: Invalid request
  /api/system/refresh:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - system-refresh
      summary: >-
        "Endpoint to trigger a refresh of the Connectware license file with the
        Cybus Portal"
      operationId: systemRefresh
      responses:
        '200':
          description: Success
          schema:
            type: object
            properties:
              time:
                type: string
              version:
                type: string
              license:
                type: object
                properties:
                  name:
                    type: string
                  file:
                    type: object
        '400':
          description: Invalid request
  /api/system/health:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - system-health
      summary: >-
        "Endpoint to fetch health data of system container and later service
        container"
      operationId: systemHealth
      responses:
        '200':
          description: Success
          schema:
            type: object
            properties:
              system:
                type: object
                properties:
                  status:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        status:
                          type: string
                        uptime:
                          type: string
        '400':
          description: Invalid request
  /api/system/vrpcHealth:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - system-vrpc-health
      summary: '"Endpoint to fetch VRPC health data"'
      operationId: vrpcHealth
      responses:
        '200':
          description: Success
          schema:
            type: object
            properties:
              agentStatus:
                type: object
                properties:
                  agentName:
                    type: string
                  status:
                    type: string
              VRPCInterServiceCommunication:
                type: array
                items:
                  type: object
                  properties:
                    agentName:
                      type: string
                    providers:
                      type: array
                      items:
                        type: object
                        properties:
                          providerName:
                            type: string
                          reachable:
                            type: boolean
                          functionalityAffectedIfFailed:
                            type: array
                            items:
                              type: string
  /api/system/metrics:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - system-metrics
      summary: Provides system metrics for the running Connectware instance
      operationId: systemMetrics
      responses:
        '200':
          description: Success
          schema:
            type: object
        '400':
          description: Invalid request
    put:
      security:
        - ApiKeyHeader: []
      tags:
        - system-metrics
      summary: Trigger to send metrics to the portal
      operationId: sendSystemMetrics
      responses:
        '200':
          description: Success
          schema:
            type: object
        '400':
          description: Invalid request
  /api/system/agents:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - system-agents
      summary: Provides the system's agents for the running Connectware instance
      operationId: systemAgents
      responses:
        '200':
          description: Success
          schema:
            type: object
            properties:
              name:
                type: string
              status:
                type: string
              version:
                type: string
              hostname:
                type: string
              classes:
                type: object
                properties:
                  instances:
                    type: array
                    items:
                      type: string
        '400':
          description: Invalid request
  /api/marketplace/apps:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - apps
      summary: >-
        "List all available apps from portal according to the current
        Connectware license"
      operationId: apps
      responses:
        '200':
          description: Success
          schema:
            type: array
            items:
              $ref: '#/definitions/File'
        '400':
          description: Invalid request
  /api/marketplace/app:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - app-details
        - app-download
      summary: '"Fetch app information with given name from portal"'
      operationId: appDetails
      responses:
        '200':
          description: Success
          schema:
            type: object
        '400':
          description: Invalid request
  /api/marketplace/app/meta:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - app-details
        - app-download
      summary: '"Fetch app meta information with given name from portal"'
      operationId: appDetails
      responses:
        '200':
          description: Success
          schema:
            type: object
        '400':
          description: Invalid request
securityDefinitions:
  ApiKeyHeader:
    type: apiKey
    in: header
    name: Authorization
definitions:
  File:
    type: object
    properties:
      directory:
        type: string
      filename:
        type: string
      name:
        type: string
      description:
        type: string
      homepage:
        type: string
      icon:
        type: string
      version:
        type: string
      provider:
        type: string
      availableInLicense:
        type: boolean
      publiclyOffered:
        type: boolean
      createdAt:
        type: string
      updatedAt:
        type: string
  FileDownload:
    type: object
    properties:
      filename:
        type: string
      data:
        type: string
      contentType:
        type: string
      size:
        type: integer
      version:
        type: string
      updatedAt:
        type: string
