swagger: '2.0'
info:
  title: Container Manager API
  version: 0.1.0
basePath: /api
schemes:
  - https
produces:
  - application/json
consumes:
  - application/json
paths:
  /api/containers:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - containers
      summary: Get all service containers
      operationId: getContainers
      responses:
        '200':
          description: All service containers
          schema:
            type: array
            items:
              type: object
        '404':
          description: Failed to get all service containers
  /api/containers/{name}/inspect:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - containers
      summary: Inspect service container
      operationId: inspectContainer
      responses:
        '200':
          description: Service container inspect
          schema:
            type: object
        '404':
          description: Failed to inspect service container
  /api/containers/{name}/logs:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - containers
      summary: Get service container logs
      operationId: getContainerLogsStream
      parameters:
        - name: name
          in: path
          description: Name of the service container
          type: string
          required: true
        - in: query
          name: timestamps
          description: If the logs should yield timestamp
          type: string
          enum:
            - 'true'
            - 'false'
        - in: query
          name: tail
          description: Use 'all' to retrieve all, or a number for a limited set
          type: string
          default: all
        - in: query
          name: since
          description: Timestamp for the start
          type: string
          default: null
        - in: query
          name: until
          description: Timestamp for the end
          type: string
          default: null
      responses:
        '200':
          description: Service container logs
          schema:
            type: string
        '404':
          description: Failed to get container logs
  /api/containers/{name}/state:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - containers
      summary: Get container state
      operationId: getContainerState
      responses:
        '200':
          description: Service container state
          schema:
            type: object
        '404':
          description: Failed to get service container state
  /api/containers/orchestrator:
    get:
      tags:
        - meta
      summary: Returns info about orchestrator being used to run Connectware
      operationId: orchestrator
      responses:
        '200':
          description: Returns the name of the orchestrator being used to run Connectware
          schema:
            type: object
            properties:
              orchestrator:
                type: string
                enum:
                  - Docker
                  - Kubernetes
  /api/containers/{name}/operation:
    put:
      security:
        - ApiKeyHeader: []
      tags:
        - containers
      summary: Perform an operation on a service container
      operationId: executeServiceContainerOperation
      parameters:
        - name: name
          in: path
          description: Name of the service container
          type: string
          required: true
        - in: body
          name: body
          description: Operation to perform on the service container
          required: true
          schema:
            type: object
            required:
              - operation
            properties:
              operation:
                type: string
                enum:
                  - start
                  - stop
                  - restart
      responses:
        '200':
          description: Service container inspection after operation is performed
          schema:
            type: object
        '400':
          description: Invalid request
        '404':
          description: Service container not found
  /api/core-containers:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - containers
      summary: Get all core containers
      operationId: getCoreContainers
      responses:
        '200':
          description: All core containers
          schema:
            type: array
            items:
              type: object
        '404':
          description: Failed to get all core containers
  /api/core-containers/{name}/inspect:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - containers
      summary: Inspect core container
      operationId: inspectCoreContainer
      responses:
        '200':
          description: Core container inspect
          schema:
            type: object
        '404':
          description: Failed to inspect core container
  /api/core-containers/{name}/logs:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - containers
      summary: Get core container logs
      operationId: getCoreContainerLogsStream
      parameters:
        - name: name
          in: path
          description: Name of the core container
          type: string
          required: true
        - in: query
          name: timestamps
          description: If the logs should yield timestamp
          type: string
          enum:
            - 'true'
            - 'false'
        - in: query
          name: tail
          description: Use 'all' to retrieve all, or a number for a limited set
          type: string
          default: all
        - in: query
          name: since
          description: Timestamp for the start
          type: string
          default: null
        - in: query
          name: until
          description: Timestamp for the end
          type: string
          default: null
      responses:
        '200':
          description: Core container logs
          schema:
            type: string
        '404':
          description: Failed to get core container logs
  /api/core-containers/{name}/state:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - containers
      summary: Get core container state
      operationId: getCoreContainerState
      responses:
        '200':
          description: Core Container state
          schema:
            type: object
        '404':
          description: Failed to get core container state
  /api/core-containers/orchestrator:
    get:
      tags:
        - meta
      summary: Returns info about orchestrator being used to run Connectware
      operationId: coreOrchestrator
      responses:
        '200':
          description: Returns the name of the orchestrator being used to run Connectware
          schema:
            type: object
            properties:
              orchestrator:
                type: string
                enum:
                  - Docker
                  - Kubernetes
  /api/core-containers/{name}/operation:
    put:
      security:
        - ApiKeyHeader: []
      tags:
        - containers
      summary: Perform an operation on a core container
      operationId: executeCoreContainerOperation
      parameters:
        - name: name
          in: path
          description: Name of the core container
          type: string
          required: true
        - in: body
          name: body
          description: Operation to perform on the core container
          required: true
          schema:
            type: object
            required:
              - operation
            properties:
              operation:
                type: string
                enum:
                  - start
                  - stop
                  - restart
      responses:
        '200':
          description: Core container inspection after operation is performed
          schema:
            type: object
        '400':
          description: Invalid request
        '404':
          description: Core container not found
  /api/images:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - images
      summary: Get all images
      operationId: getImages
      responses:
        '200':
          description: All images
          schema:
            type: array
            items:
              type: object
        '404':
          description: Failed to get all images
  /api/images/{name}/inspect:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - images
      summary: Inspect a image
      operationId: inspectImages
      responses:
        '200':
          description: Image inspect
          schema:
            type: object
        '404':
          description: Failed to inspect image
  /api/networks:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - networks
      summary: Get all networks
      operationId: getNetworks
      responses:
        '200':
          description: All networks
          schema:
            type: array
            items:
              type: object
        '404':
          description: Failed to get all networks
  /api/networks/{name}/inspect:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - networks
      summary: Inspect a network
      operationId: inspectNetworks
      responses:
        '200':
          description: Network inspect
          schema:
            type: object
        '404':
          description: Failed to inspect network
  /api/volumes:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - volumes
      summary: Get all volumes
      operationId: getVolumes
      responses:
        '200':
          description: All volumes
          schema:
            type: array
            items:
              type: object
        '404':
          description: Failed to get all volumes
  /api/volumes/{name}/inspect:
    get:
      security:
        - ApiKeyHeader: []
      tags:
        - volumes
      summary: Inspect a volume
      operationId: inspectVolumes
      responses:
        '200':
          description: Volume inspect
          schema:
            type: object
        '404':
          description: Failed to inspect volume
