Merge "Add API(v2) to get certain task info"
[yardstick.git] / api / database / v2 / handlers.py
index eb73281..44c14df 100644 (file)
@@ -24,6 +24,9 @@ class V2EnvironmentHandler(object):
         db_session.commit()
         return environment
 
+    def list_all(self):
+        return V2Environment.query.all()
+
     def get_by_uuid(self, uuid):
         environment = V2Environment.query.filter_by(uuid=uuid).first()
         if not environment:
@@ -119,6 +122,12 @@ class V2ContainerHandler(object):
             raise ValueError
         return container
 
+    def update_attr(self, uuid, attr):
+        container = self.get_by_uuid(uuid)
+        for k, v in attr.items():
+            setattr(container, k, v)
+        db_session.commit()
+
     def delete_by_uuid(self, uuid):
         container = self.get_by_uuid(uuid)
         db_session.delete(container)
@@ -127,6 +136,9 @@ class V2ContainerHandler(object):
 
 class V2ProjectHandler(object):
 
+    def list_all(self):
+        return V2Project.query.all()
+
     def insert(self, kwargs):
         project = V2Project(**kwargs)
         db_session.add(project)