Added the base API call like POST, GET, PUT & DELETE.

Co-Authored-By: Digambar Patil <digambarpat@gmail.com>
Co-Authored-By: Steven Dake <sdake@redhat.com>

Change-Id: I02f065b8f1e1de514db19c7da493cbcfa65c054f
This commit is contained in:
digambar 2014-09-10 22:49:28 +05:30 committed by Davanum Srinivas (dims)
parent 227e1dd272
commit 39500ae678
2 changed files with 27 additions and 5 deletions

View File

@ -3,4 +3,4 @@ from api.controllers import v2
class RootController(object): class RootController(object):
v2 = v2.VersionController() v2 = v2.ContainerController()

View File

@ -1,8 +1,30 @@
import pecan import pecan
from pecan import rest from pecan import rest, response
class VersionController(rest.RestController): class ContainerController(rest.RestController):
@pecan.expose('json')
@pecan.expose("json")
def get(self): 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