From c383ae3fa6ccb865575eacf78209fdd3ac7efa69 Mon Sep 17 00:00:00 2001 From: chenjiankun Date: Mon, 28 Nov 2016 01:51:47 +0000 Subject: Create API and command to create a influxDB container JIRA: YARDSTICK-425 This API is used to create a influxDB Container Add command line to create a influxDB Container, too Change-Id: If9c2d04b779924d492a5d5ea91f7968fa959570e Signed-off-by: chenjiankun --- api/views.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'api/views.py') diff --git a/api/views.py b/api/views.py index e78389f5a..7357625e0 100644 --- a/api/views.py +++ b/api/views.py @@ -14,6 +14,7 @@ from flask_restful import Resource from api.utils import common as common_utils from api.actions import test as test_action from api.actions import result as result_action +from api.actions import env as env_action logger = logging.getLogger(__name__) @@ -40,3 +41,15 @@ class Result(Resource): return getattr(result_action, action)(args) except AttributeError: return common_utils.error_handler('Wrong action') + + +class Env(Resource): + def post(self): + action = common_utils.translate_to_str(request.json.get('action', '')) + args = common_utils.translate_to_str(request.json.get('args', {})) + logger.debug('Input args is: action: %s, args: %s', action, args) + + try: + return getattr(env_action, action)(args) + except AttributeError: + return common_utils.error_handler('Wrong action') -- cgit 1.2.3-korg