def computehosts_update(host_id, data): """Update computehost. Only name changing may be proceeded.""" if len(data) == 0: return api_utils.internal_error(status_code=400, descr="No data to update") else: return api_utils.render(host=_api.update_computehost(host_id, data))
def make_json_error(ex): if isinstance(ex, werkzeug_exceptions.HTTPException): status_code = ex.code description = ex.description else: status_code = 500 description = str(ex) return api_utils.render({'error': status_code, 'error_message': description}, status=status_code)
def version_list(): return api_utils.render({ "versions": [ {"id": "v1.0", "status": "CURRENT", "links": [{"href": "{0}v1".format(flask.request.host_url), "rel": "self"}] }, ], }, status="300 Multiple Choices")
def version_list(): return api_utils.render( { "versions": [ { "id": "v1.0", "status": "CURRENT", "links": [{ "href": "{0}v1".format(flask.request.host_url), "rel": "self" }], "min_version": api_version_request.MIN_API_VERSION, "max_version": api_version_request.MAX_API_VERSION, }, ], }, status="300 Multiple Choices")
def computehosts_delete(host_id): """Delete specified computehost.""" _api.delete_computehost(host_id) return api_utils.render()
def computehosts_get(host_id): """Get computehost by its ID.""" return api_utils.render(host=_api.get_computehost(host_id))
def computehosts_create(data): """Create new computehost.""" return api_utils.render(host=_api.create_computehost(data))
def leases_delete(req, lease_id): """Delete specified lease.""" _api.delete_lease(lease_id) return api_utils.render()
def leases_get(req, lease_id): """Get lease by its ID.""" return api_utils.render(lease=_api.get_lease(lease_id))
def floatingips_delete(req, floatingip_id): """Delete specified floatingip.""" _api.delete_floatingip(floatingip_id) return api_utils.render()
def floatingips_get(req, floatingip_id): """Get floatingip by its ID.""" return api_utils.render(floatingip=_api.get_floatingip(floatingip_id))
def floatingips_create(req, data): """Create new floatingip.""" return api_utils.render(floatingip=_api.create_floatingip(data))
def floatingips_list(req): """List all existing floatingips.""" return api_utils.render(floatingips=_api.get_floatingips())
def leases_list(): """List all existing leases.""" return api_utils.render(leases=_api.get_leases())
def leases_list(req, query): """List all existing leases.""" return api_utils.render(leases=_api.get_leases(query))
def allocations_list(query): """List all allocations on all computehosts.""" return api_utils.render(allocations=_api.list_allocations(query))
def leases_create(req, data): """Create new lease.""" return api_utils.render(lease=_api.create_lease(data))
def allocations_get(host_id, query): """List all allocations on a specific host.""" return api_utils.render(allocation=_api.get_allocations(host_id, query))
def leases_update(req, lease_id, data): """Update lease.""" return api_utils.render(lease=_api.update_lease(lease_id, data))
def computehosts_list(): """List all existing computehosts.""" return api_utils.render(hosts=_api.get_computehosts())
def plugins_list(): """List all possible plugins.""" return api_utils.render(plugins=_api.get_plugins())
def computehosts_list(req, query=None): """List all existing computehosts.""" return api_utils.render(hosts=_api.get_computehosts(query))