<s> from libcloud . loadbalancer . base import Algorithm <EOL> from lib . actions import BaseAction <EOL> __all__ = [ <EOL> '<STR_LIT>' <EOL> ] <EOL> class CreateBalancerAction ( BaseAction ) : <EOL> def run ( self , region , network_domain_id , name , port , protocol , <EOL> algorithm = Algorithm . ROUND_ROBIN ) : <EOL> driver = self . _get_lb_driver ( region ) <EOL> _VALUE_TO_ALGORITHM_MAP = { <EOL> '<STR_LIT>' : Algorithm . ROUND_ROBIN , <EOL> '<STR_LIT>' : Algorithm . LEAST_CONNECTIONS , <EOL> '<STR_LIT>' : Algorithm . SHORTEST_RESPONSE , <EOL> '<STR_LIT>' : Algorithm . PERSISTENT_IP <EOL> } <EOL> if algorithm is not Algorithm . ROUND_ROBIN : <EOL> algorithm = _VALUE_TO_ALGORITHM_MAP [ algorithm ] <EOL> driver . network_domain_id = network_domain_id <EOL> record = driver . create_balancer ( name = name , <EOL> port = port , <EOL> protocol = protocol , <EOL> algorithm = algorithm , <EOL> members = None ) <EOL> return self . resultsets . formatter ( record ) </s>
