diff options
author | 2017-08-17 11:12:52 +0000 | |
---|---|---|
committer | 2017-08-17 11:12:52 +0000 | |
commit | f01fb5609298c7c4b0f19cfe8d54fc331dd5a0ad (patch) | |
tree | 36b2ffb2b8d56dfabe02b0e85ff30d3822fca51a /functest/api/resources/v1/envs.py | |
parent | c582427bd2586347fd21bcee3b28a2f7e75faf3d (diff) | |
parent | ecaecd74a20e4845fb748077b759a5697ba86f1c (diff) |
Merge "API proposal for functest"
Diffstat (limited to 'functest/api/resources/v1/envs.py')
-rw-r--r-- | functest/api/resources/v1/envs.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/functest/api/resources/v1/envs.py b/functest/api/resources/v1/envs.py new file mode 100644 index 00000000..35bffb04 --- /dev/null +++ b/functest/api/resources/v1/envs.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# +# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 + +""" +Resources to handle environment related requests +""" + +from flask import jsonify + +from functest.api.base import ApiResource +from functest.cli.commands.cli_env import Env +import functest.utils.functest_utils as ft_utils + + +class V1Envs(ApiResource): + """ V1Envs Resource class""" + + def get(self): # pylint: disable=no-self-use + """ Get environment """ + environment_show = Env().show() + return jsonify(environment_show) + + def post(self): + """ Used to handle post request """ + return self._dispatch_post() + + def prepare(self, args): # pylint: disable=no-self-use, unused-argument + """ Prepare environment """ + ft_utils.execute_command("prepare_env start") |