summaryrefslogtreecommitdiff
path: root/opendc/api/v2/simulations/simulationId/datacenters/endpoint.py
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-06-24 09:13:09 +0200
committerGeorgios Andreadis <info@gandreadis.com>2020-06-24 09:13:09 +0200
commitbae760a62fc6a480fbe615dff6a7de03c7fd6d1d (patch)
tree06fc47f9922add14a3ac50fcfdfeb3d4fdc00363 /opendc/api/v2/simulations/simulationId/datacenters/endpoint.py
parent6fdb3e75dad15523d996e457c216647755b29101 (diff)
Add formatter
Diffstat (limited to 'opendc/api/v2/simulations/simulationId/datacenters/endpoint.py')
-rw-r--r--opendc/api/v2/simulations/simulationId/datacenters/endpoint.py24
1 files changed, 7 insertions, 17 deletions
diff --git a/opendc/api/v2/simulations/simulationId/datacenters/endpoint.py b/opendc/api/v2/simulations/simulationId/datacenters/endpoint.py
index e28402e4..88c5fe21 100644
--- a/opendc/api/v2/simulations/simulationId/datacenters/endpoint.py
+++ b/opendc/api/v2/simulations/simulationId/datacenters/endpoint.py
@@ -10,17 +10,11 @@ def POST(request):
# Make sure required parameters are there
try:
- request.check_required_parameters(
- path={
- 'simulationId': 'int'
- },
- body={
- 'datacenter': {
- 'starred': 'int',
- 'simulationId': 'int'
- }
- }
- )
+ request.check_required_parameters(path={'simulationId': 'int'},
+ body={'datacenter': {
+ 'starred': 'int',
+ 'simulationId': 'int'
+ }})
except exceptions.ParameterError as e:
return Response(400, e.message)
@@ -32,7 +26,7 @@ def POST(request):
# Instantiate a Simulation from the database
- simulation = Simulation.from_primary_key((request.params_path['simulationId'],))
+ simulation = Simulation.from_primary_key((request.params_path['simulationId'], ))
# Make sure this Simulation exists
@@ -54,8 +48,4 @@ def POST(request):
datacenter.read()
- return Response(
- 200,
- 'Successfully added {}.'.format(datacenter),
- datacenter.to_JSON()
- )
+ return Response(200, 'Successfully added {}.'.format(datacenter), datacenter.to_JSON())