Commit a5b888e1 authored by Rafael Monnerat's avatar Rafael Monnerat

Implement new REST API.

parent 604b5108
...@@ -111,41 +111,29 @@ def availableSoftwareRelease(): ...@@ -111,41 +111,29 @@ def availableSoftwareRelease():
def softwareReleaseError(): def softwareReleaseError():
return 'Ignored' return 'Ignored'
@app.route('/buildingComputerPartition', methods=['POST']) @app.route('/<computer_id>/partition/<computer_partition_id>/building', methods=['POST'])
def buildingComputerPartition(): def buildingComputerPartition(computer_id, computer_partition_id):
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
return 'Ignored' return 'Ignored'
@app.route('/availableComputerPartition', methods=['POST']) @app.route('/<computer_id>/partition/<computer_partition_id>/available', methods=['POST'])
def availableComputerPartition(): def availableComputerPartition(computer_id, computer_partition_id):
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
return 'Ignored' return 'Ignored'
@app.route('/softwareInstanceError', methods=['POST']) @app.route('/<computer_id>/partition/<computer_partition_id>/error', methods=['POST'])
def softwareInstanceError(): def softwareInstanceError(computer_id, computer_partition_id):
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
error_log = request.form['error_log'] error_log = request.form['error_log']
return 'Ignored' return 'Ignored'
@app.route('/startedComputerPartition', methods=['POST']) @app.route('/<computer_id>/partition/<computer_partition_id>/started', methods=['POST'])
def startedComputerPartition(): def startedComputerPartition(computer_id, computer_partition_id):
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
return 'Ignored' return 'Ignored'
@app.route('/stoppedComputerPartition', methods=['POST']) @app.route('/<computer_id>/partition/<computer_partition_id>/stopped', methods=['POST'])
def stoppedComputerPartition(): def stoppedComputerPartition(computer_id, computer_partition_id):
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
return 'Ignored' return 'Ignored'
@app.route('/destroyedComputerPartition', methods=['POST']) @app.route('/<computer_id>/partition/<computer_partition_id>/destroyed', methods=['POST'])
def destroyedComputerPartition(): def destroyedComputerPartition(computer_id, computer_partition_id):
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
return 'Ignored' return 'Ignored'
#@app.route('/partition/<partition_reference>', methods=['PUT']) #@app.route('/partition/<partition_reference>', methods=['PUT'])
...@@ -241,9 +229,8 @@ def requestComputerPartition(partition_reference = ''): ...@@ -241,9 +229,8 @@ def requestComputerPartition(partition_reference = ''):
filter_json = request.form.get('filter_json') filter_json = request.form.get('filter_json')
raise NotImplementedError raise NotImplementedError
@app.route('/useComputer', methods=['POST']) @app.route('/<computer_id>/usage', methods=['POST'])
def useComputer(): def useComputer(computer_id):
computer_id = request.form['computer_id']
use_string = request.form['use_string'] use_string = request.form['use_string']
return 'Ignored' return 'Ignored'
......
...@@ -317,32 +317,29 @@ class ComputerPartition(SlapDocument): ...@@ -317,32 +317,29 @@ class ComputerPartition(SlapDocument):
'computer_partition_id': self._partition_id}) 'computer_partition_id': self._partition_id})
def available(self): def available(self):
self._connection_helper.POST('/availableComputerPartition', { url = "/%s/partition/%s/available" % (self._computer_id,
'computer_id': self._computer_id, self._partition_id)
'computer_partition_id': self._partition_id}) self._connection_helper.POST(url)
def destroyed(self): def destroyed(self):
self._connection_helper.POST('/destroyedComputerPartition', { url = "/%s/partition/%s/destroyed" % (self._computer_id,
'computer_id': self._computer_id, self._partition_id)
'computer_partition_id': self._partition_id, self._connection_helper.POST(url)
})
def started(self): def started(self):
self._connection_helper.POST('/startedComputerPartition', { url = "/%s/partition/%s/started" % (self._computer_id,
'computer_id': self._computer_id, self._partition_id)
'computer_partition_id': self._partition_id, self._connection_helper.POST(url)
})
def stopped(self): def stopped(self):
self._connection_helper.POST('/stoppedComputerPartition', { url = "/%s/partition/%s/stopped" % (self._computer_id,
'computer_id': self._computer_id, self._partition_id)
'computer_partition_id': self._partition_id, self._connection_helper.POST(url)
})
def error(self, error_log): def error(self, error_log):
self._connection_helper.POST('/softwareInstanceError', { url = "/%s/partition/%s/error" % (self._computer_id,
'computer_id': self._computer_id, self._partition_id)
'computer_partition_id': self._partition_id, self._connection_helper.POST(url, {
'error_log': error_log}) 'error_log': error_log})
def getId(self): def getId(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment