예제 #1
0
    def on_get(self, req, res, event_id=None):
        helpers.validate_authorization(req, self._default_authorized_roles)
        tenant_id = helpers.get_tenant_id(req)

        if event_id:
            helpers.validate_authorization(req, self._default_authorized_roles)
            tenant_id = helpers.get_tenant_id(req)
            result = self._list_event(tenant_id, event_id)
            helpers.add_links_to_resource(result[0], re.sub("/" + event_id, "", req.uri))
            res.body = helpers.dumpit_utf8(result)
            res.status = falcon.HTTP_200
        else:
            offset = helpers.normalize_offset(helpers.get_query_param(req, "offset"))
            limit = helpers.get_query_param(req, "limit")

            result = self._list_events(tenant_id, req.uri, offset, limit)
            res.body = helpers.dumpit_utf8(result)
            res.status = falcon.HTTP_200
예제 #2
0
 def on_get(self, req, res, transform_id=None):
     if transform_id:
         helpers.validate_authorization(req, self._default_authorized_roles)
         tenant_id = helpers.get_tenant_id(req)
         result = self._list_transform(tenant_id, transform_id, req.uri)
         helpers.add_links_to_resource(
             result, re.sub('/' + transform_id, '', req.uri))
         res.body = json.dumps(result, cls=MyEncoder)
         res.status = falcon.HTTP_200
     else:
         helpers.validate_authorization(req, self._default_authorized_roles)
         tenant_id = helpers.get_tenant_id(req)
         limit = helpers.get_query_param(req, 'limit')
         offset = helpers.normalize_offset(helpers.get_query_param(
             req,
             'offset'))
         result = self._list_transforms(tenant_id, limit, offset, req.uri)
         res.body = json.dumps(result, cls=MyEncoder)
         res.status = falcon.HTTP_200
    def on_get(self, req, res, stream_id=None):
        if stream_id:
            helpers.validate_authorization(req, self._default_authorized_roles)
            tenant_id = helpers.get_tenant_id(req)

            result = self._stream_definition_show(tenant_id, stream_id)

            helpers.add_links_to_resource(
                result, re.sub('/' + stream_id, '', req.uri))
            res.body = helpers.dumpit_utf8(result)
            res.status = falcon.HTTP_200
        else:
            helpers.validate_authorization(req, self._default_authorized_roles)
            tenant_id = helpers.get_tenant_id(req)
            name = helpers.get_query_name(req)
            offset = helpers.normalize_offset(
                helpers.get_query_param(req, 'offset'))
            limit = helpers.get_query_param(req, 'limit')
            result = self._stream_definition_list(tenant_id, name,
                                                  req.uri, offset, limit)

            res.body = helpers.dumpit_utf8(result)
            res.status = falcon.HTTP_200