Add an API for managing job binaries in the savanna db
Change-Id: I5196e8564dbcb62d6dc01f99800377f484ed87c5
This commit is contained in:
parent
5ae999a027
commit
d8739a6d07
|
@ -13,7 +13,6 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from savanna.openstack.common import log as logging
|
||||
from savanna.service.edp import api
|
||||
from savanna.service import validation as v
|
||||
|
@ -96,10 +95,7 @@ def job_origin_list():
|
|||
@rest.post('/job-origins')
|
||||
@v.validate(v_j_o.JOB_ORIGIN_SCHEMA, v_j_o.check_job_origin_create)
|
||||
def job_origin_create(data):
|
||||
return u.render(api.create_job_origin(data))
|
||||
# ultimately this, but the object is missing at the moment
|
||||
# and the check_job_origin_create method is stubbed out
|
||||
#return u.render(api.create_job_origin(data).wrapped_dict)
|
||||
return u.render(api.create_job_origin(data).to_wrapped_dict())
|
||||
|
||||
|
||||
@rest.get('/job-origins/<job_origin_id>')
|
||||
|
@ -113,3 +109,26 @@ def job_origin_get(job_origin_id):
|
|||
def job_origin_delete(job_origin_id):
|
||||
api.delete_job_origin(job_origin_id)
|
||||
return u.render()
|
||||
|
||||
|
||||
@rest.put_file('/job-binaries/<name>')
|
||||
def job_binary_create(**values):
|
||||
return u.render(api.create_job_binary(values).to_wrapped_dict())
|
||||
|
||||
|
||||
@rest.get('/job-binaries')
|
||||
def job_binary_list():
|
||||
return u.render(binaries=[j.to_dict() for j in api.get_job_binaries()])
|
||||
|
||||
|
||||
@rest.get('/job-binaries/<job_binary_id>')
|
||||
@v.check_exists(api.get_job_binary, 'job_binary_id')
|
||||
def job_binary_get(job_binary_id):
|
||||
return u.render(api.get_job_binary(job_binary_id).to_wrapped_dict())
|
||||
|
||||
|
||||
@rest.delete('/job-binaries/<job_binary_id>')
|
||||
@v.check_exists(api.get_job_binary, id='job_binary_id')
|
||||
def job_binary_delete(job_binary_id):
|
||||
api.delete_job_binary(job_binary_id)
|
||||
return u.render()
|
||||
|
|
|
@ -75,5 +75,17 @@ def delete_job_origin(job_origin_id):
|
|||
return conductor.job_origin_destroy(context.ctx(), job_origin_id)
|
||||
|
||||
|
||||
def copy_job_origin(values):
|
||||
pass
|
||||
def create_job_binary(values):
|
||||
return conductor.job_binary_create(context.ctx(), values)
|
||||
|
||||
|
||||
def get_job_binaries():
|
||||
return conductor.job_binary_get_all(context.ctx())
|
||||
|
||||
|
||||
def get_job_binary(id):
|
||||
return conductor.job_binary_get(context.ctx(), id)
|
||||
|
||||
|
||||
def delete_job_binary(id):
|
||||
conductor.job_binary_destroy(context.ctx(), id)
|
||||
|
|
|
@ -39,6 +39,9 @@ class Rest(flask.Blueprint):
|
|||
def put(self, rule, status_code=202):
|
||||
return self._mroute('PUT', rule, status_code)
|
||||
|
||||
def put_file(self, rule, status_code=202):
|
||||
return self._mroute('PUT', rule, status_code, file_upload=True)
|
||||
|
||||
def delete(self, rule, status_code=204):
|
||||
return self._mroute('DELETE', rule, status_code)
|
||||
|
||||
|
|
Loading…
Reference in New Issue