<s> from __future__ import with_statement <EOL> from libcloud . common . base import ConnectionUserAndKey , BaseDriver <EOL> __all__ = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> class Container ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , id , name , image , state , <EOL> ip_addresses , driver , extra = None ) : <EOL> """<STR_LIT>""" <EOL> self . id = str ( id ) if id else None <EOL> self . name = name <EOL> self . image = image <EOL> self . state = state <EOL> self . ip_addresses = ip_addresses <EOL> self . driver = driver <EOL> self . extra = extra or { } <EOL> def start ( self ) : <EOL> return self . driver . start_container ( container = self ) <EOL> def stop ( self ) : <EOL> return self . driver . stop_container ( container = self ) <EOL> def restart ( self ) : <EOL> return self . driver . restart_container ( container = self ) <EOL> def destroy ( self ) : <EOL> return self . driver . destroy_container ( container = self ) <EOL> def __repr__ ( self ) : <EOL> return ( '<STR_LIT>' <EOL> '<STR_LIT>' % <EOL> ( self . id , self . name , self . state , <EOL> self . driver . name ) ) <EOL> class ContainerImage ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , id , name , path , version , driver , extra = None ) : <EOL> """<STR_LIT>""" <EOL> self . id = str ( id ) if id else None <EOL> self . name = name <EOL> self . path = path <EOL> self . version = version <EOL> self . driver = driver <EOL> self . extra = extra or { } <EOL> def deploy ( self , name , parameters , * args , ** kwargs ) : <EOL> return self . driver . deploy_container ( name = name , <EOL> image = self , <EOL> parameters = parameters , <EOL> * args , <EOL> ** kwargs ) <EOL> def __repr__ ( self ) : <EOL> return ( '<STR_LIT>' % <EOL> ( self . id , self . name , self . path ) ) <EOL> class ContainerCluster ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , id , name , driver , extra = None ) : <EOL> """<STR_LIT>""" <EOL> self . id = str ( id ) if id else None <EOL> self . name = name <EOL> self . driver = driver <EOL> self . extra = extra or { } <EOL> def list_containers ( self ) : <EOL> return self . driver . list_containers ( cluster = self ) <EOL> def destroy ( self ) : <EOL> return self . driver . destroy_cluster ( cluster = self ) <EOL> def __repr__ ( self ) : <EOL> return ( '<STR_LIT>' % <EOL> ( self . id , self . name , self . driver . name ) ) <EOL> class ClusterLocation ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , id , name , country , driver ) : <EOL> """<STR_LIT>""" <EOL> self . id = str ( id ) <EOL> self . name = name <EOL> self . country = country <EOL> self . driver = driver <EOL> def __repr__ ( self ) : <EOL> return ( ( '<STR_LIT>' ) <EOL> % ( self . id , self . name , self . country , self . driver . name ) ) <EOL> class ContainerDriver ( BaseDriver ) : <EOL> """<STR_LIT>""" <EOL> connectionCls = ConnectionUserAndKey <EOL> name = None <EOL> website = None <EOL> supports_clusters = False <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , key , secret = None , secure = True , host = None , port = None , <EOL> ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> super ( ContainerDriver , self ) . __init__ ( <EOL> key = key , secret = secret , secure = secure , <EOL> host = host , port = port , ** kwargs ) <EOL> def install_image ( self , path ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def list_images ( self ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def list_containers ( self , image = None , cluster = None ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def deploy_container ( self , name , image , cluster = None , <EOL> parameters = None , start = True ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def get_container ( self , id ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def start_container ( self , container ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def stop_container ( self , container ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def restart_container ( self , container ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def destroy_container ( self , container ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def list_locations ( self ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def create_cluster ( self , name , location = None ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def destroy_cluster ( self , cluster ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def list_clusters ( self , location = None ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) <EOL> def get_cluster ( self , id ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' ) </s>
