コード例 #1
0
ファイル: aliyun_api.py プロジェクト: kimkcn/cannon
    def get_slbinstance_count(self, format, instance_id):
        from aliyunsdkslb.request.v20140515.DescribeLoadBalancersRequest import DescribeLoadBalancersRequest
        request = DescribeLoadBalancersRequest()

        request.set_accept_format(format)
        request.set_LoadBalancerId(instance_id)
        try:
            response = self.client.do_action_with_exception(request)
        except:
            return False
        return response
コード例 #2
0
 def refresh(self):
     request = DescribeLoadBalancersRequest()
     request.set_LoadBalancerId(self.load_balancer_id)
     items = _get_response(self._client, request, {},
                           'LoadBalancers.LoadBalancer')
     if not items:
         raise ClientException(
             errors.ERROR_INVALID_SERVER_RESPONSE,
             "Failed to find load balancer data from DescribeLoadBalancers "
             "response. "
             "LoadBalancerId = {0}".format(self.load_balancer_id))
     self._assign_attributes(items[0])