summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qtip/api/__main__.py5
-rw-r--r--qtip/api/controllers/metric.py23
-rw-r--r--qtip/api/controllers/plan.py29
-rw-r--r--qtip/api/controllers/qpi.py23
-rw-r--r--qtip/api/swagger/swagger.yaml200
-rw-r--r--setup.cfg2
6 files changed, 279 insertions, 3 deletions
diff --git a/qtip/api/__main__.py b/qtip/api/__main__.py
index aa2941a7..7b9cdaf5 100644
--- a/qtip/api/__main__.py
+++ b/qtip/api/__main__.py
@@ -8,10 +8,13 @@
##############################################################################
import connexion
+import os
+
+swagger_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'swagger/'))
def main():
- app = connexion.App(__name__, specification_dir='swagger/')
+ app = connexion.App(__name__, specification_dir=swagger_dir)
app.add_api('swagger.yaml', base_path='/v1.0')
app.run(host='0.0.0.0', port='5000')
diff --git a/qtip/api/controllers/metric.py b/qtip/api/controllers/metric.py
new file mode 100644
index 00000000..a026b5fc
--- /dev/null
+++ b/qtip/api/controllers/metric.py
@@ -0,0 +1,23 @@
+##############################################################################
+# Copyright (c) 2017 akhil.batra@research.iiit.ac.in and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import connexion
+import httplib
+
+
+def list_metrics():
+ return connexion.problem(httplib.NOT_IMPLEMENTED,
+ 'List metrics',
+ 'Metrics listing not implemented')
+
+
+def get_metric(name):
+ return connexion.problem(httplib.NOT_IMPLEMENTED,
+ 'Get a metric',
+ 'metric retrieval not implemented')
diff --git a/qtip/api/controllers/plan.py b/qtip/api/controllers/plan.py
new file mode 100644
index 00000000..e202b413
--- /dev/null
+++ b/qtip/api/controllers/plan.py
@@ -0,0 +1,29 @@
+##############################################################################
+# Copyright (c) 2017 akhil.batra@research.iiit.ac.in and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import connexion
+import httplib
+
+
+def list_plans():
+ return connexion.problem(httplib.NOT_IMPLEMENTED,
+ 'List plans',
+ 'Plans listing not implemented')
+
+
+def get_plan(name):
+ return connexion.problem(httplib.NOT_IMPLEMENTED,
+ 'Get a plan',
+ 'Plan retrieval not implemented')
+
+
+def run_plan(name, action="run"):
+ return connexion.problem(httplib.NOT_IMPLEMENTED,
+ 'Run a plan',
+ 'Plan runner not implemented')
diff --git a/qtip/api/controllers/qpi.py b/qtip/api/controllers/qpi.py
new file mode 100644
index 00000000..0b5c5b09
--- /dev/null
+++ b/qtip/api/controllers/qpi.py
@@ -0,0 +1,23 @@
+##############################################################################
+# Copyright (c) 2017 akhil.batra@research.iiit.ac.in and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import connexion
+import httplib
+
+
+def list_qpis():
+ return connexion.problem(httplib.NOT_IMPLEMENTED,
+ 'List QPIs',
+ 'QPIs listing not implemented')
+
+
+def get_qpi(name):
+ return connexion.problem(httplib.NOT_IMPLEMENTED,
+ 'Get a QPI',
+ 'QPI retrieval not implemented')
diff --git a/qtip/api/swagger/swagger.yaml b/qtip/api/swagger/swagger.yaml
index a5a815f1..96d34681 100644
--- a/qtip/api/swagger/swagger.yaml
+++ b/qtip/api/swagger/swagger.yaml
@@ -10,9 +10,207 @@
swagger: '2.0'
info:
title: QTIP-API
+ version: "1.0"
consumes:
- application/json
produces:
- application/json
paths:
- #TODO (akhil) add paths \ No newline at end of file
+ /plans:
+ get:
+ summary: List all plans
+ operationId: qtip.api.controllers.plan.list_plans
+ tags:
+ - Plan
+ - standalone
+ responses:
+ 200:
+ description: A list of plans
+ #TODO (akhil) add item with properties and parameters
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ /plans/{name}:
+ get:
+ summary: Get a plan by plan name
+ operationId: qtip.api.controllers.plan.get_plan
+ tags:
+ - Plan
+ - standalone
+ parameters:
+ - name: name
+ in: path
+ description: Plan name
+ required: true
+ type: string
+ responses:
+ 200:
+ description: Plan information
+ #TODO (akhil) define schema
+ 404:
+ description: Plan not found
+ schema:
+ $ref: '#/definitions/Error'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ post:
+ summary: Run a plan and return results
+ operationId: qtip.api.controllers.plan.run_plan
+ tags:
+ - Plan
+ - Standalone
+ parameters:
+ - name: name
+ in: path
+ description: Plan name
+ required: true
+ type: string
+ - name: action
+ in: query
+ description: action for a plan
+ required: true
+ type: string
+ responses:
+ 200:
+ description: Result of the run of the plan
+ #TODO (akhil) define schema
+ 404:
+ description: Plan not found
+ schema:
+ $ref: '#/definitions/Error'
+ 400:
+ description: Invalid parameters
+ schema:
+ $ref: '#/definitions/Error'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ /qpis:
+ get:
+ summary: List all QPIs
+ operationId: qtip.api.controllers.qpi.list_qpis
+ tags:
+ - QPI
+ - Standalone
+ - Agent
+ responses:
+ 200:
+ description: A list of QPIs
+ #TODO (akhil) add item with properties and parameters
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ /qpis/{name}:
+ get:
+ summary: Get a QPI
+ operationId: qtip.api.controllers.qpi.get_qpi
+ tags:
+ - QPI
+ - Standalone
+ - Agent
+ parameters:
+ - name: name
+ in: path
+ description: QPI name
+ required: true
+ type: string
+ responses:
+ 200:
+ description: QPI information
+ #TODO (akhil) define schema
+ 404:
+ description: QPI not found
+ schema:
+ $ref: '#/definitions/Error'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ /metrics:
+ get:
+ summary: List all metrics
+ operationId: qtip.api.controllers.metric.list_metrics
+ tags:
+ - Metric
+ - Standalone
+ - Agent
+ responses:
+ 200:
+ description: A list of metrics
+ #TODO (akhil) add item with properties and parameters
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+ /metrics/{name}:
+ get:
+ summary: Get a metric
+ operationId: qtip.api.controllers.metric.get_metric
+ tags:
+ - Metric
+ - Standalone
+ - Agent
+ parameters:
+ - name: name
+ in: path
+ description: Metric name
+ required: true
+ type: string
+ responses:
+ 200:
+ description: Metric information
+ #TODO (akhil) define schema
+ 404:
+ description: Metric not found
+ schema:
+ $ref: '#/definitions/Error'
+ 501:
+ description: Resource not implemented
+ schema:
+ $ref: '#/definitions/Error'
+ default:
+ description: Unexpected error
+ schema:
+ $ref: '#/definitions/Error'
+definitions:
+ Error:
+ type: object
+ properties:
+ status:
+ type: integer
+ format: int32
+ title:
+ type: string
+ detail:
+ type: string
+ type:
+ type: string \ No newline at end of file
diff --git a/setup.cfg b/setup.cfg
index 5b9b9567..bd263e70 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -14,7 +14,7 @@ setup-hooks =
[entry_points]
console_scripts =
qtip = qtip.cli.entry:cli
- # TODO(akhil) add qtip-api
+ qtip-api = qtip.api.__main__:main
[files]
packages =