aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/resources/v2/pods.py19
-rw-r--r--api/urls.py1
2 files changed, 20 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})
diff --git a/api/urls.py b/api/urls.py
index be453a651..82df17541 100644
--- a/api/urls.py
+++ b/api/urls.py
@@ -30,4 +30,5 @@ urlpatterns = [
Url('/api/v2/yardstick/environments/openrcs/<openrc_id>', 'v2_openrc'),
Url('/api/v2/yardstick/pods/action', 'v2_pods'),
+ Url('/api/v2/yardstick/pods/<pod_id>', 'v2_pod'),
]