示例#1
0
    def list(self,
             marker=None,
             limit=None,
             sort_key=None,
             sort_dir=None,
             detail=False,
             all_tenants=False):
        """Retrieve a list of containers.

        :param all_tenants: Optional, list containers in all tenants

        :param marker: Optional, the UUID of a containers, eg the last
                       containers from a previous result set. Return
                       the next result set.
        :param limit: The maximum number of results to return per
                      request, if:

            1) limit > 0, the maximum number of containers to return.
            2) limit == 0, return the entire list of containers.
            3) limit param is NOT specified (None), the number of items
               returned respect the maximum imposed by the ZUN API
               (see Zun's api.max_limit option).

        :param sort_key: Optional, field used for sorting.

        :param sort_dir: Optional, direction of sorting, either 'asc' (the
                         default) or 'desc'.

        :param detail: Optional, boolean whether to return detailed information
                       about containers.

        :returns: A list of containers.

        """
        if limit is not None:
            limit = int(limit)

        filters = utils.common_filters(marker, limit, sort_key, sort_dir,
                                       all_tenants)

        path = ''
        if detail:
            path += 'detail'
        if filters:
            path += '?' + '&'.join(filters)

        LOG.debug(
            'zunclient paymentmethod paymentmethod path=%s,  xxx list args xxx yyyy zzzzzzzzzzz',
            self._path(path))
        if limit is None:
            return self._list(self._path(path), "paymentmethods")
        else:
            return self._list_pagination(self._path(path),
                                         "paymentmethods",
                                         limit=limit)
示例#2
0
    def list(self,
             marker=None,
             limit=None,
             sort_key=None,
             sort_dir=None,
             detail=False):
        """Retrieve list of zun services.

        :param marker: Optional, the ID of a zun service, eg the last
                       services from a previous result set. Return
                       the next result set.
        :param limit: The maximum number of results to return per
                      request, if:

            1) limit > 0, the maximum number of services to return.
            2) limit == 0, return the entire list of services.
            3) limit param is NOT specified (None), the number of items
               returned respect the maximum imposed by the Zun API
               (see Zun's api.max_limit option).

        :param sort_key: Optional, field used for sorting.

        :param sort_dir: Optional, direction of sorting, either 'asc' (the
                         default) or 'desc'.

        :param detail: Optional, boolean whether to return detailed information
                       about services.

        :returns: A list of services.
        """

        if limit is not None:
            limit = int(limit)

        filters = utils.common_filters(marker, limit, sort_key, sort_dir)

        path = ''
        if detail:
            path += 'detail'
        if filters:
            path += '?' + '&'.join(filters)

        if limit is None:
            return self._list(self._path(path), "services")
        else:
            return self._list_pagination(self._path(path),
                                         "services",
                                         limit=limit)
示例#3
0
    def list(self,
             marker=None,
             limit=None,
             sort_key=None,
             sort_dir=None,
             all_projects=False,
             **kwargs):
        """Retrieve a list of containers.

        :param all_projects: Optional, list containers in all projects

        :param marker: Optional, the UUID of a containers, eg the last
                       containers from a previous result set. Return
                       the next result set.
        :param limit: The maximum number of results to return per
                      request, if:

            1) limit > 0, the maximum number of containers to return.
            2) limit param is NOT specified (None), the number of items
               returned respect the maximum imposed by the ZUN API
               (see Zun's api.max_limit option).

        :param sort_key: Optional, field used for sorting.

        :param sort_dir: Optional, direction of sorting, either 'asc' (the
                         default) or 'desc'.

        :returns: A list of containers.

        """
        if limit is not None:
            limit = int(limit)

        filters = utils.common_filters(marker, limit, sort_key, sort_dir,
                                       all_projects)
        path = ''
        if filters:
            path += '?' + '&'.join(filters)

        if limit is None:
            return self._list(self._path(path), "containers", qparams=kwargs)
        else:
            return self._list_pagination(self._path(path),
                                         "containers",
                                         limit=limit)
示例#4
0
    def list(self, marker=None, limit=None, sort_key=None,
             sort_dir=None, all_projects=False):
        """Retrieve a list of capsules.

        :param all_projects: Optional, list containers in all projects

        :param marker: Optional, the UUID of a containers, eg the last
                       containers from a previous result set. Return
                       the next result set.
        :param limit: The maximum number of results to return per
                      request, if:

            1) limit > 0, the maximum number of containers to return.
            2) limit param is NOT specified (None), the number of items
               returned respect the maximum imposed by the ZUN API
               (see Zun's api.max_limit option).

        :param sort_key: Optional, field used for sorting.

        :param sort_dir: Optional, direction of sorting, either 'asc' (the
                         default) or 'desc'.

        :returns: A list of containers.

        """
        if limit is not None:
            limit = int(limit)

        filters = utils.common_filters(marker, limit, sort_key,
                                       sort_dir, all_projects)

        path = ''
        if filters:
            path += '?' + '&'.join(filters)

        if limit is None:
            return self._list(self._path(path),
                              "capsules")
        else:
            return self._list_pagination(self._path(path),
                                         "capsules",
                                         limit=limit)
示例#5
0
文件: hosts.py 项目: numvc/LuxoftBot
    def list(self, marker=None, limit=None, sort_key=None, sort_dir=None):
        """Retrieve a list of hosts.

        :param marker: Optional, the UUID of an host, eg the last
                       host from a previous result set. Return
                       the next result set.
        :param limit: The maximum number of results to return per
                      request, if:

            1) limit > 0, the maximum number of hosts to return.
            2) limit param is NOT specified (None), the number of items
               returned respect the maximum imposed by the Zun api

        :param sort_key: Optional, field used for sorting.

        :param sort_dir: Optional, direction of sorting, either 'asc' (the
                         default) or 'desc'.

        :returns: A list of hosts.

        """
        if limit is not None:
            limit = int(limit)

        filters = utils.common_filters(marker, limit, sort_key, sort_dir)

        path = ''
        if filters:
            path += '?' + '&'.join(filters)

        if limit is None:
            return self._list(self._path(path), "hosts")
        else:
            return self._list_pagination(self._path(path),
                                         "hosts",
                                         limit=limit)
示例#6
0
 def test_other(self):
     for key in ('marker', 'sort_key', 'sort_dir'):
         result = utils.common_filters(**{key: 'test'})
         self.assertEqual(['%s=test' % key], result)
示例#7
0
 def test_limit_negative_number(self):
     result = utils.common_filters(limit=-2)
     self.assertEqual(['limit=-2'], result)
示例#8
0
 def test_limit_0(self):
     result = utils.common_filters(limit=0)
     self.assertEqual(['limit=0'], result)
示例#9
0
 def test_other(self):
     for key in ('marker', 'sort_key', 'sort_dir'):
         result = utils.common_filters(**{key: 'test'})
         self.assertEqual(['%s=test' % key], result)
示例#10
0
 def test_limit_negative_number(self):
     result = utils.common_filters(limit=-2)
     self.assertEqual(['limit=-2'], result)
示例#11
0
 def test_limit_0(self):
     result = utils.common_filters(limit=0)
     self.assertEqual(['limit=0'], result)