def list(self, detailed=True, search_opts=None, marker=None, limit=None):
        """
        Get a list of loadbalancers.

        :param detailed: Whether to return detailed loadbalancer info (optional).
        :param search_opts: Search options to filter out loadbalancers (optional).
        :param marker: Begin returning loadbalancers that appear later in the loadbalancer
                       list than that represented by this loadbalancer id (optional).
        :param limit: Maximum number of loadbalancers to return (optional).

        :rtype: list of :class:`Loadbalancer`
        """
        if search_opts is None:
            search_opts = {}

        qparams = {}

        for opt, val in six.iteritems(search_opts):
            if val:
                qparams[opt] = val

        if marker:
            qparams['marker'] = marker

        if limit:
            qparams['limit'] = limit

        query_string = "?%s" % urlutils.urlencode(qparams) if qparams else ""

        return self._list("/loadbalancers%s" % (query_string,), "loadBalancers")
예제 #2
0
    def get(self, reserved=False, tenant_id=None):
        """
        Get a specific extension.

        :rtype: :class:`Limits`
        """
        opts = {}
        if reserved:
            opts['reserved'] = 1
        if tenant_id:
            opts['tenant_id'] = tenant_id
        query_string = "?%s" % urlutils.urlencode(opts) if opts else ""

        return self._get("/limits%s" % query_string, "limits")