from sahara.api import acl from sahara.openstack.common import log as logging from sahara.service.edp import api from sahara.service import validation as v from sahara.service.validations.edp import data_source as v_d_s from sahara.service.validations.edp import job as v_j from sahara.service.validations.edp import job_binary as v_j_b from sahara.service.validations.edp import job_binary_internal as v_j_b_i from sahara.service.validations.edp import job_execution as v_j_e import sahara.utils.api as u LOG = logging.getLogger(__name__) rest = u.Rest('v11', __name__) # Job execution ops @rest.get('/job-executions') @acl.enforce("job-executions:get_all") def job_executions_list(): job_executions = [je.to_dict() for je in api.job_execution_list( **u.get_request_args().to_dict())] return u.render(job_executions=job_executions) @rest.get('/job-executions/<job_execution_id>') @acl.enforce("job-executions:get") @v.check_exists(api.get_job_execution, id='job_execution_id')
from sahara.api import acl import sahara.api.base as b from sahara.service import api from sahara.service import validation as v from sahara.service.validations import cluster_templates as v_ct from sahara.service.validations import clusters as v_c from sahara.service.validations import clusters_scaling as v_c_s from sahara.service.validations import images as v_images from sahara.service.validations import node_group_templates as v_ngt from sahara.service.validations import plugins as v_p import sahara.utils.api as u LOG = logging.getLogger(__name__) rest = u.Rest('v10', __name__) # Cluster ops @rest.get('/clusters') @acl.enforce("clusters:get_all") def clusters_list(): return u.render(clusters=[ c.to_dict() for c in api.get_clusters(**u.get_request_args().to_dict()) ]) @rest.post('/clusters') @acl.enforce("clusters:create") @v.validate(v_c.CLUSTER_SCHEMA, v_c.check_cluster_create)