Exemplo n.º 1
0
    def get_slbinstance_id(self, format, page, limit):
        from aliyunsdkslb.request.v20140515.DescribeLoadBalancersRequest import DescribeLoadBalancersRequest
        request = DescribeLoadBalancersRequest()

        request.set_accept_format(format)
        request.set_PageNumber(page)
        request.set_PageSize(limit)
        try:
            response = self.client.do_action_with_exception(request)
        except:
            return False
        return response
Exemplo n.º 2
0
    def get_slbs(self, page_num=1, page_size=20):
        '''
        '''
        request = DescribeLoadBalancersRequest()
        request.set_accept_format('json')
        request.set_PageNumber(page_num)
        request.set_PageSize(page_size)

        data = self._request(request)
        total = data.get('TotalCount')
        data = data.get('LoadBalancers')
        data_list = data.get('LoadBalancer')
        data = {
            'total': total,
            'data_list': data_list,
        }
        return data