def get(self): """Return this assembly.""" request.check_request_for_https() handler = assembly_handler.AssemblyHandler( pecan.request.security_context) return assembly.Assembly.from_db_model(handler.get(self._id), pecan.request.host_url)
def post(self, data): """Create a new app.""" request.check_request_for_https() if not data: raise exception.BadRequest(reason='No data.') self._validate(data) handler = app_handler.AppHandler(pecan.request.security_context) app_data = data.as_dict(app.App) try: raw_content = yamlutils.load(pecan.request.body) except ValueError: try: raw_content = json.loads(pecan.request.body) except ValueError as exp: LOG.exception(exp) raise exception.BadRequest(reason='Invalid app data.') app_data['raw_content'] = json.dumps(raw_content) new_app = handler.create(app_data) created_app = app.App.from_db_model(new_app, pecan.request.host_url) return created_app
def get_all(self): """Return all assemblies, based on the query provided.""" request.check_request_for_https() handler = assembly_handler.AssemblyHandler( pecan.request.security_context) return [assembly.Assembly.from_db_model(assm, pecan.request.host_url) for assm in handler.get_all()]
def get_all(self): """Return all apps, based on the query provided.""" request.check_request_for_https() handler = app_handler.AppHandler(pecan.request.security_context) all_apps = [app.App.from_db_model(obj, pecan.request.host_url) for obj in handler.get_all()] return all_apps
def post(self, data): """Create a new workflow.""" request.check_request_for_https() if not data: raise exception.BadRequest(reason='No data.') ahandler = app_handler.AppHandler(pecan.request.security_context) app_model = ahandler.get(self.app_id) handler = wf_handler.WorkflowHandler(pecan.request.security_context) data.app_id = app_model.id data.config = app_model.workflow_config data.source = app_model.source wf_data = data.as_dict(workflow.Workflow) du_id = None if data.du_id: du_id = data.du_id self._verify_du_exists(pecan.request.security_context, du_id) return workflow.Workflow.from_db_model( handler.create(wf_data, commit_sha='', status_url='', du_id=du_id), pecan.request.host_url)
def post(self, data): """Create a new workflow.""" request.check_request_for_https() if not data: raise exception.BadRequest(reason='No data.') ahandler = app_handler.AppHandler(pecan.request.security_context) app_model = ahandler.get(self.app_id) handler = wf_handler.WorkflowHandler(pecan.request.security_context) data.app_id = app_model.id data.config = app_model.workflow_config data.source = app_model.source wf_data = data.as_dict(workflow.Workflow) du_id = None if data.du_id: du_id = data.du_id self._verify_du_exists(pecan.request.security_context, du_id) return workflow.Workflow.from_db_model(handler.create(wf_data, commit_sha='', status_url='', du_id=du_id), pecan.request.host_url)
def get(self): """Return this app.""" request.check_request_for_https() handler = app_handler.AppHandler(pecan.request.security_context) app_model = handler.get(self._id) app_model = app.App.from_db_model(app_model, pecan.request.host_url) return app_model
def get(self): """Return this workflow.""" request.check_request_for_https() handler = wf_handler.WorkflowHandler(pecan.request.security_context) wf_model = handler.get(self.wf_id) wf_model = workflow.Workflow.from_db_model(wf_model, pecan.request.host_url) return wf_model
def get_all(self): """Return all of one app's workflows, based on the query provided.""" request.check_request_for_https() handler = wf_handler.WorkflowHandler(pecan.request.security_context) all_wfs = [workflow.Workflow.from_db_model(obj, pecan.request.host_url) for obj in handler.get_all(app_id=self.app_id)] return all_wfs
def get(self): """Return this assembly.""" policy.check('show_assembly', pecan.request.security_context) request.check_request_for_https() handler = assembly_handler.AssemblyHandler( pecan.request.security_context) host_url = pecan.request.application_url.rstrip('/') return assembly.Assembly.from_db_model(handler.get(self._id), host_url)
def get(self): """Return this app.""" request.check_request_for_https() handler = app_handler.AppHandler(pecan.request.security_context) app_model = handler.get(self._id) host_url = pecan.request.application_url.rstrip('/') app_model = app.App.from_db_model(app_model, host_url) return app_model
def get_all(self): """Return all assemblies, based on the query provided.""" policy.check('get_assemblies', pecan.request.security_context) request.check_request_for_https() handler = assembly_handler.AssemblyHandler( pecan.request.security_context) host_url = pecan.request.application_url.rstrip('/') return [assembly.Assembly.from_db_model(assm, host_url) for assm in handler.get_all()]
def get_all(self): """Return all assemblies, based on the query provided.""" policy.check('get_assemblies', pecan.request.security_context) request.check_request_for_https() handler = assembly_handler.AssemblyHandler( pecan.request.security_context) host_url = pecan.request.application_url.rstrip('/') return [ assembly.Assembly.from_db_model(assm, host_url) for assm in handler.get_all() ]
def patch(self, data): """Modify this app.""" request.check_request_for_https() handler = app_handler.AppHandler(pecan.request.security_context) handler.get(self._id) if not data: raise exception.BadRequest(reason="No body detected") updated_app = handler.patch(self._id, data) updated_app = app.App.from_db_model(updated_app, pecan.request.host_url) return updated_app
def post(self, data): """Create a new app.""" request.check_request_for_https() if not data: raise exception.BadRequest(reason='No data.') self._validate(data) handler = app_handler.AppHandler(pecan.request.security_context) app_data = data.as_dict(app.App) new_app = handler.create(app_data) created_app = app.App.from_db_model(new_app, pecan.request.host_url) return created_app