def delete_load_balancer(self, request, tenant_id, lb_id): """ Creates a load balancer and adds it to the load balancer store. Returns the newly created load balancer with response code 200 """ response_data = self.session(tenant_id).del_load_balancer(lb_id) request.setResponseCode(response_data[1]) return json_dump(response_data[0])
def delete_nodes_from_load_balancer(self, request, tenant_id, lb_id): """ Deletes multiple nodes from a LB. """ node_ids = map(int, request.args.get('id', [])) response_data = self.session(tenant_id).delete_nodes(lb_id, node_ids) request.setResponseCode(response_data[1]) return json_dump(response_data[0])
def delete_health_monitor(self, request, tenant_id, lb_id): """ Delete health monitor setting of given LB. https://developer.rackspace.com/docs/cloud-load-balancers/v1/developer-guide/#delete-health-monitor """ body, code = self.session(tenant_id).delete_health_monitor(lb_id) request.setResponseCode(code) return json_dump(body)
def get_health_monitor(self, request, tenant_id, lb_id): """ Return health monitor setting of given LB. https://developer.rackspace.com/docs/cloud-load-balancers/v1/developer-guide/#show-health-monitor-configuration """ body, code = self.session(tenant_id).get_health_monitor(lb_id) request.setResponseCode(code) return json_dump(body)
def update_health_monitor(self, request, tenant_id, lb_id): """ Update health monitor setting of given LB. https://developer.rackspace.com/docs/cloud-load-balancers/v1/developer-guide/#update-health-monitor """ try: content = json_from_request(request) except ValueError: request.setResponseCode(400) return json.dumps(invalid_resource("Invalid JSON request body")) body, code = self.session(tenant_id).update_health_monitor( lb_id, content) request.setResponseCode(code) return json_dump(body)