summaryrefslogtreecommitdiff
path: root/opendc/api/v2/tiles/tileId/rack/machines/position
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/tiles/tileId/rack/machines/position
parent6fdb3e75dad15523d996e457c216647755b29101 (diff)
Add formatter
Diffstat (limited to 'opendc/api/v2/tiles/tileId/rack/machines/position')
-rw-r--r--opendc/api/v2/tiles/tileId/rack/machines/position/endpoint.py64
1 files changed, 20 insertions, 44 deletions
diff --git a/opendc/api/v2/tiles/tileId/rack/machines/position/endpoint.py b/opendc/api/v2/tiles/tileId/rack/machines/position/endpoint.py
index 99011fa4..d82014b3 100644
--- a/opendc/api/v2/tiles/tileId/rack/machines/position/endpoint.py
+++ b/opendc/api/v2/tiles/tileId/rack/machines/position/endpoint.py
@@ -10,12 +10,7 @@ def GET(request):
# Make sure required parameters are there
try:
- request.check_required_parameters(
- path={
- 'tileId': 'int',
- 'position': 'int'
- }
- )
+ request.check_required_parameters(path={'tileId': 'int', 'position': 'int'})
except exceptions.ParameterError as e:
return Response(400, e.message)
@@ -38,34 +33,28 @@ def GET(request):
machine.read()
- return Response(
- 200,
- 'Successfully retrieved {}.'.format(machine),
- machine.to_JSON()
- )
+ return Response(200, 'Successfully retrieved {}.'.format(machine), machine.to_JSON())
def PUT(request):
"""Update the Machine at this location in this Rack."""
try:
- request.check_required_parameters(
- path={
- 'tileId': 'int',
- 'position': 'int'
- },
- body={
- 'machine': {
- 'rackId': 'int',
- 'position': 'int',
- 'tags': 'list-string',
- 'cpuIds': 'list-int',
- 'gpuIds': 'list-int',
- 'memoryIds': 'list-int',
- 'storageIds': 'list-int'
- }
- }
- )
+ request.check_required_parameters(path={
+ 'tileId': 'int',
+ 'position': 'int'
+ },
+ body={
+ 'machine': {
+ 'rackId': 'int',
+ 'position': 'int',
+ 'tags': 'list-string',
+ 'cpuIds': 'list-int',
+ 'gpuIds': 'list-int',
+ 'memoryIds': 'list-int',
+ 'storageIds': 'list-int'
+ }
+ })
except exceptions.ParameterError as e:
return Response(400, e.message)
@@ -114,11 +103,7 @@ def PUT(request):
machine.read()
- return Response(
- 200,
- 'Successfully updated {}.'.format(machine),
- machine.to_JSON()
- )
+ return Response(200, 'Successfully updated {}.'.format(machine), machine.to_JSON())
def DELETE(request):
@@ -127,12 +112,7 @@ def DELETE(request):
# Make sure required parameters are there
try:
- request.check_required_parameters(
- path={
- 'tileId': 'int',
- 'position': 'int'
- }
- )
+ request.check_required_parameters(path={'tileId': 'int', 'position': 'int'})
except exceptions.ParameterError as e:
return Response(400, e.message)
@@ -157,8 +137,4 @@ def DELETE(request):
# Return this Machine
- return Response(
- 200,
- 'Successfully deleted {}.'.format(machine),
- machine.to_JSON()
- )
+ return Response(200, 'Successfully deleted {}.'.format(machine), machine.to_JSON())