def __init__(self, group, permission):
     super(PermissionFileFilter, self).__init__()
     if not validate_constant(Permissions, permission):
         raise GenestackException("Invalid permission")
     self._dict.update(
         {'permission': {
             'group': group,
             'value': permission
         }})
Esempio n. 2
0
    def find_files(
            self,
            file_filter,
            sort_order=SortOrder.DEFAULT,
            ascending=False,
            offset=0,
            limit=MAX_FILE_SEARCH_LIMIT
    ):
        """
        Search for files with ``file_filter`` and return dictionary with two key/value pairs:

         - ``'total'``: total number (``int``) of files matching the query
         - ``'result'``: list of file info dictionaries for subset of matching files
                         (from ``offset`` to ``offset+limit``). See the documentation of
                         :py:meth:`~genestack_client.FilesUtil.get_infos` for the structure
                         of these objects.

        :param file_filter: file filter
        :type file_filter: FileFilter
        :param sort_order: sorting order for the results,
                           see :py:class:`~genestack_client.files_util.SortOrder`
        :type sort_order: str
        :param ascending: should the results be in ascending order? (default: False)
        :type ascending: bool
        :param offset: search offset (default: 0, cannot be negative)
        :type offset: int
        :param limit: maximum number of results to return (max and default: 100)
        :type limit: int
        :return: a dictionary with search response
        :rtype: dict[str, int|list[dict[str, str|dict]]]
        """
        limit = min(self.MAX_FILE_SEARCH_LIMIT, limit)
        if offset < 0 or limit < 0:
            raise GenestackException("Search offset/limit cannot be negative")
        if not validate_constant(SortOrder, sort_order):
            raise GenestackException("Invalid sort order")
        return self.invoke('findFiles', file_filter.get_dict(), sort_order, ascending, offset, limit)
    def find_files(self,
                   file_filter,
                   sort_order=SortOrder.DEFAULT,
                   ascending=False,
                   offset=0,
                   limit=MAX_FILE_SEARCH_LIMIT):
        """
        Search for files with ``file_filter`` and return dictionary with two key/value pairs:

         - ``'total'``: total number (``int``) of files matching the query
         - ``'result'``: list of file info dictionaries for subset of matching files
                         (from ``offset`` to ``offset+limit``). See the documentation of
                         :py:meth:`~genestack_client.FilesUtil.get_infos` for the structure
                         of these objects.

        :param file_filter: file filter
        :type file_filter: FileFilter
        :param sort_order: sorting order for the results,
                           see :py:class:`~genestack_client.files_util.SortOrder`
        :type sort_order: str
        :param ascending: should the results be in ascending order? (default: False)
        :type ascending: bool
        :param offset: search offset (default: 0, cannot be negative)
        :type offset: int
        :param limit: maximum number of results to return (max and default: 100)
        :type limit: int
        :return: a dictionary with search response
        :rtype: dict[str, int|list[dict[str, str|dict]]]
        """
        limit = min(self.MAX_FILE_SEARCH_LIMIT, limit)
        if offset < 0 or limit < 0:
            raise GenestackException("Search offset/limit cannot be negative")
        if not validate_constant(SortOrder, sort_order):
            raise GenestackException("Invalid sort order")
        return self.invoke('findFiles', file_filter.get_dict(), sort_order,
                           ascending, offset, limit)
 def __init__(self, file_type):
     super(TypeFileFilter, self).__init__()
     if not validate_constant(FileTypes, file_type):
         raise GenestackException("Invalid file type")
     self._dict.update({'type': file_type})
 def __init__(self, permission):
     super(ActualPermissionFileFilter, self).__init__()
     if not validate_constant(Permissions, permission):
         raise GenestackException("Invalid permission")
     self._dict.update({'access': permission})
Esempio n. 6
0
 def __init__(self, file_type):
     super(TypeFileFilter, self).__init__()
     if not validate_constant(FileTypes, file_type):
         raise GenestackException("Invalid file type")
     self._dict.update({'type': file_type})
Esempio n. 7
0
 def __init__(self, group, permission):
     super(PermissionFileFilter, self).__init__()
     if not validate_constant(Permissions, permission):
         raise GenestackException("Invalid permission")
     self._dict.update({'permission': {'group': group, 'value': permission}})
Esempio n. 8
0
 def __init__(self, permission):
     super(ActualPermissionFileFilter, self).__init__()
     if not validate_constant(Permissions, permission):
         raise GenestackException("Invalid permission")
     self._dict.update({'access': permission})