summaryrefslogtreecommitdiffstats
path: root/result_collection_api/opnfv_testapi/resources/pod_handlers.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-10-18 17:30:31 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-10-18 17:30:31 +0800
commit2cea85b0b4b18af73ed6afd7d837d443da43fd2b (patch)
treed9a674e8f79fa1950500ec77989b720a6aad6aad /result_collection_api/opnfv_testapi/resources/pod_handlers.py
parentcf29e20418012f850d0fa18de5bd24a49f819886 (diff)
rename result_collection_api to testapi
Change-Id: Iec4e3db23cd44f30831e17c127eda74e9d9b5d14 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'result_collection_api/opnfv_testapi/resources/pod_handlers.py')
-rw-r--r--result_collection_api/opnfv_testapi/resources/pod_handlers.py87
1 files changed, 0 insertions, 87 deletions
diff --git a/result_collection_api/opnfv_testapi/resources/pod_handlers.py b/result_collection_api/opnfv_testapi/resources/pod_handlers.py
deleted file mode 100644
index 8f44439..0000000
--- a/result_collection_api/opnfv_testapi/resources/pod_handlers.py
+++ /dev/null
@@ -1,87 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Orange
-# guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com
-# 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
-##############################################################################
-from opnfv_testapi.tornado_swagger import swagger
-from handlers import GenericApiHandler
-from pod_models import Pod
-from opnfv_testapi.common.constants import HTTP_FORBIDDEN
-
-
-class GenericPodHandler(GenericApiHandler):
- def __init__(self, application, request, **kwargs):
- super(GenericPodHandler, self).__init__(application, request, **kwargs)
- self.table = 'pods'
- self.table_cls = Pod
-
-
-class PodCLHandler(GenericPodHandler):
- @swagger.operation(nickname='list-all')
- def get(self):
- """
- @description: list all pods
- @return 200: list all pods, empty list is no pod exist
- @rtype: L{Pods}
- """
- self._list()
-
- @swagger.operation(nickname='create')
- def post(self):
- """
- @description: create a pod
- @param body: pod to be created
- @type body: L{PodCreateRequest}
- @in body: body
- @rtype: L{CreateResponse}
- @return 200: pod is created.
- @raise 403: pod already exists
- @raise 400: body or name not provided
- """
- def query(data):
- return {'name': data.name}
-
- def error(data):
- message = '{} already exists as a pod'.format(data.name)
- return HTTP_FORBIDDEN, message
-
- miss_checks = ['name']
- db_checks = [(self.table, False, query, error)]
- self._create(miss_checks, db_checks)
-
-
-class PodGURHandler(GenericPodHandler):
- @swagger.operation(nickname='get-one')
- def get(self, pod_name):
- """
- @description: get a single pod by pod_name
- @rtype: L{Pod}
- @return 200: pod exist
- @raise 404: pod not exist
- """
- query = dict()
- query['name'] = pod_name
- self._get_one(query)
-
- def delete(self, pod_name):
- """ Remove a POD
-
- # check for an existing pod to be deleted
- mongo_dict = yield self.db.pods.find_one(
- {'name': pod_name})
- pod = TestProject.pod(mongo_dict)
- if pod is None:
- raise HTTPError(HTTP_NOT_FOUND,
- "{} could not be found as a pod to be deleted"
- .format(pod_name))
-
- # just delete it, or maybe save it elsewhere in a future
- res = yield self.db.projects.remove(
- {'name': pod_name})
-
- self.finish_request(answer)
- """
- pass