summaryrefslogtreecommitdiffstats
path: root/api/views.py
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2016-11-28 01:51:47 +0000
committerchenjiankun <chenjiankun1@huawei.com>2016-11-30 03:05:23 +0000
commitc383ae3fa6ccb865575eacf78209fdd3ac7efa69 (patch)
treebe26b8357aa7a8c6af162dfe3beb61503efbda36 /api/views.py
parent893294646833bed300586ee36040d4fde3c20842 (diff)
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 <chenjiankun1@huawei.com>
Diffstat (limited to 'api/views.py')
-rw-r--r--api/views.py13
1 files changed, 13 insertions, 0 deletions
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')