# This code is auto generated, at src/scripts/generate-docs with the version 2.0.4 do NOT alter it directly

swagger: '2.0'
info:
  version: 2.1.0
  title: Cybus System Control API
basePath: /api
schemes:
  - https
produces:
  - application/json
consumes:
  - application/json
paths:
  /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
            required:
              - time
              - version
              - license
            properties:
              time:
                type: string
              version:
                type: string
              license:
                type: object
                properties:
                  name:
                    type: string
                  file:
                    type: object
                    properties:
                      id:
                        type: string
                      associatedAccount:
                        type: string
                      connectwareLicenseClass:
                        type: string
                      expiration:
                        type: string
                        format: date
                  valid:
                    type: boolean
  /system/preflight:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - system-preflight
      summary: Retrieve preflight information
      operationId: systemPreflight
      responses:
        '200':
          description: Success
          schema:
            type: object
            required:
              - dockerHub
              - cybusRegistry
              - cybusPortal
            properties:
              dockerHub:
                $ref: '#/definitions/ResourceReachability'
              cybusRegistry:
                $ref: '#/definitions/ResourceReachability'
              cybusPortal:
                $ref: '#/definitions/ResourceReachability'
              currentVersions:
                type: object
                properties:
                  series:
                    type: object
                    properties:
                      active:
                        type: object
                        properties:
                          latest:
                            type: object
                            required:
                              - version
                              - urlReleaseNotes
                              - installerUrl
                            properties:
                              version:
                                type: string
                              urlReleaseNotes:
                                type: string
                              installerUrl:
                                type: string
  /system/licensefile:
    put:
      security:
        - ApiKeyHeader: []
      tags:
        - system-licensefile
      summary: Upload licensefile
      operationId: systemLicenseFileUpload
      parameters:
        - in: body
          name: body
          description: File contents
          required: true
          schema:
            type: object
            properties:
              payload:
                type: string
            required:
              - payload
      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
          schema:
            type: object
  /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
          schema:
            type: object
            additionalProperties: true
  /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
  /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
  /system/metrics:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - system-metrics
      summary: Provides system metrics for the running Connectware instance
      operationId: systemMetrics
      parameters:
        - name: hourly
          in: query
          type: boolean
        - name: daily
          in: query
          type: boolean
      responses:
        '200':
          description: Success
          schema:
            type:
              - object
              - 'null'
            properties:
              hourly:
                type:
                  - 'null'
                  - array
                items:
                  type: object
                  required:
                    - timestamp
                    - numberOfConnectedDatapoints
                    - numberOfReceivedMessages
                  properties:
                    timestamp:
                      type: string
                      format: date
                    numberOfConnectedDatapoints:
                      type: number
                    numberOfReceivedMessages:
                      type: number
              daily:
                type:
                  - 'null'
                  - array
                items:
                  type: object
                  required:
                    - date
                    - numberOfConnectedDatapoints
                    - numberOfReceivedMessages
                  properties:
                    date:
                      type: string
                    numberOfConnectedDatapoints:
                      type: number
                    numberOfReceivedMessages:
                      type: number
        '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
  /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: array
            items:
              type: object
              properties:
                name:
                  type: string
                status:
                  type: string
                  deprecated: true
                version:
                  type: string
                hostname:
                  type: string
                classes:
                  type: object
                  additionalProperties:
                    type: object
                    properties:
                      instances:
                        type: array
                        items:
                          type: string
                    required:
                      - instances
              required:
                - name
                - status
                - version
                - hostname
                - classes
        '400':
          description: Not able to fetch system agents
  /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'
  /marketplace/app:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - app-details
        - app-download
      summary: '"Fetch app information with given name from portal"'
      operationId: appDetails
      parameters:
        - name: directory
          in: query
          type: string
          required: true
        - name: filename
          in: query
          type: string
          required: true
      responses:
        '200':
          description: Success
          schema:
            type: object
            required:
              - data
            properties:
              data:
                type: string
        '400':
          description: Invalid request
  /marketplace/app/meta:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - app-details
        - app-download
      summary: '"Fetch app meta information with given name from portal"'
      operationId: appDetailsMetadata
      parameters:
        - name: directory
          in: query
          type: string
          required: true
        - name: filename
          in: query
          type: string
          required: true
      responses:
        '200':
          description: Success
          schema:
            type: object
            required:
              - content
              - meta
            properties:
              content:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: string
              meta:
                type: object
                required:
                  - updatedAt
                  - version
                properties:
                  updatedAt:
                    type: string
                    format: date-time
                  version:
                    type: string
        '400':
          description: Invalid request
securityDefinitions:
  ApiKeyHeader:
    type: apiKey
    in: header
    name: Authorization
definitions:
  ResourceReachability:
    type: object
    required:
      - status
      - statusText
      - url
    properties:
      status:
        type: boolean
      statusText:
        type: string
      url:
        type: string
  File:
    type: object
    required:
      - availableInLicense
      - category
      - description
      - directory
      - filename
      - homepage
      - isTemplate
      - name
      - provider
      - updatedAt
      - version
    properties:
      category:
        type: string
      isTemplate:
        type: boolean
      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
