Browse Source

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
changes/90/133790/3
digambar 7 years ago
committed by Davanum Srinivas (dims)
parent
commit
39500ae678
  1. 2
      containers/api/controllers/root.py
  2. 30
      containers/api/controllers/v2.py

2
containers/api/controllers/root.py

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

30
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
Loading…
Cancel
Save