Commit a5b888e1 authored by Rafael Monnerat's avatar Rafael Monnerat

Implement new REST API.

parent 604b5108
......@@ -111,41 +111,29 @@ def availableSoftwareRelease():
def softwareReleaseError():
return 'Ignored'
@app.route('/buildingComputerPartition', methods=['POST'])
def buildingComputerPartition():
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
@app.route('/<computer_id>/partition/<computer_partition_id>/building', methods=['POST'])
def buildingComputerPartition(computer_id, computer_partition_id):
return 'Ignored'
@app.route('/availableComputerPartition', methods=['POST'])
def availableComputerPartition():
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
@app.route('/<computer_id>/partition/<computer_partition_id>/available', methods=['POST'])
def availableComputerPartition(computer_id, computer_partition_id):
return 'Ignored'
@app.route('/softwareInstanceError', methods=['POST'])
def softwareInstanceError():
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
@app.route('/<computer_id>/partition/<computer_partition_id>/error', methods=['POST'])
def softwareInstanceError(computer_id, computer_partition_id):
error_log = request.form['error_log']
return 'Ignored'
@app.route('/startedComputerPartition', methods=['POST'])
def startedComputerPartition():
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
@app.route('/<computer_id>/partition/<computer_partition_id>/started', methods=['POST'])
def startedComputerPartition(computer_id, computer_partition_id):
return 'Ignored'
@app.route('/stoppedComputerPartition', methods=['POST'])
def stoppedComputerPartition():
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
@app.route('/<computer_id>/partition/<computer_partition_id>/stopped', methods=['POST'])
def stoppedComputerPartition(computer_id, computer_partition_id):
return 'Ignored'
@app.route('/destroyedComputerPartition', methods=['POST'])
def destroyedComputerPartition():
computer_id = request.form['computer_id']
computer_partition_id = request.form['computer_partition_id']
@app.route('/<computer_id>/partition/<computer_partition_id>/destroyed', methods=['POST'])
def destroyedComputerPartition(computer_id, computer_partition_id):
return 'Ignored'
#@app.route('/partition/<partition_reference>', methods=['PUT'])
......@@ -241,9 +229,8 @@ def requestComputerPartition(partition_reference = ''):
filter_json = request.form.get('filter_json')
raise NotImplementedError
@app.route('/useComputer', methods=['POST'])
def useComputer():
computer_id = request.form['computer_id']
@app.route('/<computer_id>/usage', methods=['POST'])
def useComputer(computer_id):
use_string = request.form['use_string']
return 'Ignored'
......
......@@ -317,32 +317,29 @@ class ComputerPartition(SlapDocument):
'computer_partition_id': self._partition_id})
def available(self):
self._connection_helper.POST('/availableComputerPartition', {
'computer_id': self._computer_id,
'computer_partition_id': self._partition_id})
url = "/%s/partition/%s/available" % (self._computer_id,
self._partition_id)
self._connection_helper.POST(url)
def destroyed(self):
self._connection_helper.POST('/destroyedComputerPartition', {
'computer_id': self._computer_id,
'computer_partition_id': self._partition_id,
})
url = "/%s/partition/%s/destroyed" % (self._computer_id,
self._partition_id)
self._connection_helper.POST(url)
def started(self):
self._connection_helper.POST('/startedComputerPartition', {
'computer_id': self._computer_id,
'computer_partition_id': self._partition_id,
})
url = "/%s/partition/%s/started" % (self._computer_id,
self._partition_id)
self._connection_helper.POST(url)
def stopped(self):
self._connection_helper.POST('/stoppedComputerPartition', {
'computer_id': self._computer_id,
'computer_partition_id': self._partition_id,
})
url = "/%s/partition/%s/stopped" % (self._computer_id,
self._partition_id)
self._connection_helper.POST(url)
def error(self, error_log):
self._connection_helper.POST('/softwareInstanceError', {
'computer_id': self._computer_id,
'computer_partition_id': self._partition_id,
url = "/%s/partition/%s/error" % (self._computer_id,
self._partition_id)
self._connection_helper.POST(url, {
'error_log': error_log})
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