diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-25 13:50:49 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-25 13:50:49 +0200 |
| commit | a1589e75358558eada7ffc2efc7e3fa7160d233e (patch) | |
| tree | 7889a2364292cd8b90fe996da7907bebf200d3dc /opendc/api/v1/datacenters/datacenterId | |
| parent | 1f34466d41ba01a3dd36b0866696367d397daf7e (diff) | |
Reformat codebase and fix spelling errors
Diffstat (limited to 'opendc/api/v1/datacenters/datacenterId')
| -rw-r--r-- | opendc/api/v1/datacenters/datacenterId/endpoint.py | 5 | ||||
| -rw-r--r-- | opendc/api/v1/datacenters/datacenterId/rooms/endpoint.py | 14 |
2 files changed, 11 insertions, 8 deletions
diff --git a/opendc/api/v1/datacenters/datacenterId/endpoint.py b/opendc/api/v1/datacenters/datacenterId/endpoint.py index 75d0a9cf..9444fb80 100644 --- a/opendc/api/v1/datacenters/datacenterId/endpoint.py +++ b/opendc/api/v1/datacenters/datacenterId/endpoint.py @@ -1,7 +1,8 @@ from opendc.models.datacenter import Datacenter -from opendc.util import database, exceptions +from opendc.util import exceptions from opendc.util.rest import Response + def GET(request): """Get this Datacenter.""" @@ -9,7 +10,7 @@ def GET(request): try: request.check_required_parameters( - path = { + path={ 'datacenterId': 'int' } ) diff --git a/opendc/api/v1/datacenters/datacenterId/rooms/endpoint.py b/opendc/api/v1/datacenters/datacenterId/rooms/endpoint.py index 31545a1e..cd96f97f 100644 --- a/opendc/api/v1/datacenters/datacenterId/rooms/endpoint.py +++ b/opendc/api/v1/datacenters/datacenterId/rooms/endpoint.py @@ -1,8 +1,9 @@ -from opendc.models.room import Room from opendc.models.datacenter import Datacenter -from opendc.util import database, exceptions +from opendc.models.room import Room +from opendc.util import exceptions from opendc.util.rest import Response + def GET(request): """Get this Datacenter's Rooms.""" @@ -10,7 +11,7 @@ def GET(request): try: request.check_required_parameters( - path = { + path={ 'datacenterId': 'int' } ) @@ -41,6 +42,7 @@ def GET(request): [x.to_JSON() for x in rooms] ) + def POST(request): """Add a Room.""" @@ -48,10 +50,10 @@ def POST(request): try: request.check_required_parameters( - path = { + path={ 'datacenterId': 'int' }, - body = { + body={ 'room': { 'id': 'int', 'datacenterId': 'int', @@ -61,7 +63,7 @@ def POST(request): ) except exceptions.ParameterError as e: return Response(400, e.message) - + # Make sure the passed object's datacenter id matches the path datacenter id if request.params_path['datacenterId'] != request.params_body['room']['datacenterId']: |
