Beispiel #1
0
    def get_all(self, requester_user, show_secrets=None, limit=None, offset=0):
        """
            List all keys.

            Handles requests:
                GET /apikeys/
        """
        mask_secrets = self._get_mask_secrets(show_secrets=show_secrets,
                                              requester_user=requester_user)

        if limit and int(limit) > self.max_limit:
            msg = 'Limit "%s" specified, maximum value is "%s"' % (limit, self.max_limit)
            raise ValueError(msg)

        api_key_dbs = ApiKey.get_all(limit=limit, offset=offset)

        try:
            api_keys = [ApiKeyAPI.from_model(api_key_db, mask_secrets=mask_secrets)
                        for api_key_db in api_key_dbs]
        except OverflowError:
            msg = 'Offset "%s" specified is more than 32 bit int' % (offset)
            raise ValueError(msg)

        resp = Response(json=api_keys)
        resp.headers['X-Total-Count'] = str(api_key_dbs.count())

        if limit:
            resp.headers['X-Limit'] = str(limit)

        return resp
Beispiel #2
0
    def get_all(self, requester_user, show_secrets=None, limit=None, offset=0):
        """
            List all keys.

            Handles requests:
                GET /apikeys/
        """
        mask_secrets = self._get_mask_secrets(show_secrets=show_secrets,
                                              requester_user=requester_user)

        limit = resource.validate_limit_query_param(limit, requester_user=requester_user)

        try:
            api_key_dbs = ApiKey.get_all(limit=limit, offset=offset)
            api_keys = [ApiKeyAPI.from_model(api_key_db, mask_secrets=mask_secrets)
                        for api_key_db in api_key_dbs]
        except OverflowError:
            msg = 'Offset "%s" specified is more than 32 bit int' % (offset)
            raise ValueError(msg)

        resp = Response(json=api_keys)
        resp.headers['X-Total-Count'] = str(api_key_dbs.count())

        if limit:
            resp.headers['X-Limit'] = str(limit)

        return resp
Beispiel #3
0
    def get_all(self, **kw):
        """
            List all keys.

            Handles requests:
                GET /keys/
        """

        api_key_dbs = ApiKey.get_all(**kw)
        api_keys = [ApiKeyAPI.from_model(api_key_db, mask_secrets=True)
                    for api_key_db in api_key_dbs]

        return api_keys
Beispiel #4
0
    def get_all(self, **kw):
        """
            List all keys.

            Handles requests:
                GET /keys/
        """

        api_key_dbs = ApiKey.get_all(**kw)
        api_keys = [ApiKeyAPI.from_model(api_key_db, mask_secrets=True)
                    for api_key_db in api_key_dbs]

        return api_keys
Beispiel #5
0
    def get_all(self, requester_user, show_secrets=None):
        """
            List all keys.

            Handles requests:
                GET /apikeys/
        """
        mask_secrets = self._get_mask_secrets(show_secrets=show_secrets,
                                              requester_user=requester_user)
        api_key_dbs = ApiKey.get_all()
        api_keys = [ApiKeyAPI.from_model(api_key_db, mask_secrets=mask_secrets)
                    for api_key_db in api_key_dbs]

        return api_keys