aboutsummaryrefslogtreecommitdiffstats
path: root/api/resources
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-07-14 03:39:06 +0000
committerchenjiankun <chenjiankun1@huawei.com>2017-07-14 06:26:46 +0000
commit4b47f130f31dc7a82e3dfa842acc169cd5d05a07 (patch)
tree4a7fc54b794d2f902bba372e38e0f2f80c6b0753 /api/resources
parent3f1a658fce4b3d81fa2b15ab1879fd37aad80760 (diff)
Add API(v2) to get pod info
JIRA: YARDSTICK-724 API: /api/v2/yardstick/pods/<pod_id> METHOD: GET Change-Id: I49608eab1f1625cd4358732da052ce3745e28c24 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'api/resources')
-rw-r--r--api/resources/v2/pods.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/api/resources/v2/pods.py b/api/resources/v2/pods.py
index f5cdc3b7b..ffb8a6046 100644
--- a/api/resources/v2/pods.py
+++ b/api/resources/v2/pods.py
@@ -58,3 +58,22 @@ class V2Pods(ApiResource):
environment_handler.update_attr(environment_id, {'pod_id': pod_id})
return result_handler(consts.API_SUCCESS, {'uuid': pod_id, 'pod': data})
+
+
+class V2Pod(ApiResource):
+
+ def get(self, pod_id):
+ try:
+ uuid.UUID(pod_id)
+ except ValueError:
+ return result_handler(consts.API_ERROR, 'invalid pod id')
+
+ pod_handler = V2PodHandler()
+ try:
+ pod = pod_handler.get_by_uuid(pod_id)
+ except ValueError:
+ return result_handler(consts.API_ERROR, 'no such pod')
+
+ content = jsonutils.loads(pod.content)
+
+ return result_handler(consts.API_SUCCESS, {'pod': content})