From 39500ae67888fd854f4a0167711b48075dfa7a54 Mon Sep 17 00:00:00 2001 From: digambar Date: Wed, 10 Sep 2014 22:49:28 +0530 Subject: [PATCH] Added the base API call like POST, GET, PUT & DELETE. Co-Authored-By: Digambar Patil Co-Authored-By: Steven Dake Change-Id: I02f065b8f1e1de514db19c7da493cbcfa65c054f --- containers/api/controllers/root.py | 2 +- containers/api/controllers/v2.py | 30 ++++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/containers/api/controllers/root.py b/containers/api/controllers/root.py index bfbdac741e..6bd74c3b67 100644 --- a/containers/api/controllers/root.py +++ b/containers/api/controllers/root.py @@ -3,4 +3,4 @@ from api.controllers import v2 class RootController(object): - v2 = v2.VersionController() + v2 = v2.ContainerController() diff --git a/containers/api/controllers/v2.py b/containers/api/controllers/v2.py index 2df0a078da..27daefac34 100644 --- a/containers/api/controllers/v2.py +++ b/containers/api/controllers/v2.py @@ -1,8 +1,30 @@ import pecan -from pecan import rest +from pecan import rest, response -class VersionController(rest.RestController): - @pecan.expose('json') +class ContainerController(rest.RestController): + + @pecan.expose("json") def get(self): - return {"version":"2.0.0"} + #TODO: Returns all the containers + return { + "200": "It returns all the containers." + } + + @pecan.expose() + def post(self): + # TODO: Create a new container + response.status = 201 + return + + @pecan.expose() + def put(self): + # TODO: Edit the containers values (return 200 or 204) + response.status = 204 + return + + @pecan.expose() + def delete(self): + # TODO: DELETE the containers + response.status = 200 + return