Example #1
0
 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)
Example #2
0
    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
Example #3
0
 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()]
Example #4
0
 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
Example #5
0
    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
Example #6
0
    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)
Example #7
0
    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)
Example #8
0
 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)
Example #9
0
 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()]
Example #10
0
 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
Example #11
0
 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
Example #12
0
 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
Example #13
0
 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
Example #14
0
 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
Example #15
0
 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
Example #16
0
 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)
Example #17
0
 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
Example #18
0
 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
Example #19
0
 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
Example #20
0
 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)
Example #21
0
 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()]
Example #22
0
 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()
     ]
Example #23
0
    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
Example #24
0
    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
Example #25
0
    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
Example #26
0
    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