<s> import os <EOL> import time <EOL> from libcloud . loadbalancer . base import Member , Algorithm <EOL> from libcloud . loadbalancer . types import Provider , State <EOL> from libcloud . loadbalancer . providers import get_driver <EOL> def main ( ) : <EOL> cls = get_driver ( Provider . RACKSPACE ) <EOL> driver = cls ( '<STR_LIT:username>' , '<STR_LIT>' , region = '<STR_LIT>' ) <EOL> balancers = driver . list_balancers ( ) <EOL> print ( balancers ) <EOL> new_balancer_name = '<STR_LIT>' + os . urandom ( <NUM_LIT:4> ) . encode ( '<STR_LIT>' ) <EOL> members = ( Member ( None , '<STR_LIT>' , <NUM_LIT> ) , <EOL> Member ( None , '<STR_LIT>' , <NUM_LIT> ) ) <EOL> new_balancer = driver . create_balancer ( name = new_balancer_name , <EOL> algorithm = Algorithm . ROUND_ROBIN , <EOL> port = <NUM_LIT> , <EOL> protocol = '<STR_LIT:http>' , <EOL> members = members ) <EOL> print ( new_balancer ) <EOL> while True : <EOL> balancer = driver . get_balancer ( balancer_id = new_balancer . id ) <EOL> if balancer . state == State . RUNNING : <EOL> break <EOL> print ( '<STR_LIT>' ) <EOL> time . sleep ( <NUM_LIT:30> ) <EOL> members = balancer . list_members ( ) <EOL> print ( members ) <EOL> balancer . detach_member ( members [ <NUM_LIT:0> ] ) <EOL> driver . destroy_balancer ( new_balancer ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
