<s> """<STR_LIT>""" <EOL> from cafe . engine . http . client import AutoMarshallingHTTPClient <EOL> from cloudcafe . compute . hosts_api . models . hosts import Host <EOL> from cloudcafe . compute . hosts_api . models . requests import UpdateHostRequest <EOL> from cloudcafe . compute . hosts_api . models . responses import HostUpdateResponse <EOL> class HostsClient ( AutoMarshallingHTTPClient ) : <EOL> def __init__ ( self , url , auth_token , serialize_format = None , <EOL> deserialize_format = None ) : <EOL> """<STR_LIT>""" <EOL> super ( HostsClient , self ) . __init__ ( serialize_format , <EOL> deserialize_format ) <EOL> self . auth_token = auth_token <EOL> self . default_headers [ '<STR_LIT>' ] = auth_token <EOL> ct = '<STR_LIT>' . join ( [ '<STR_LIT>' , self . serialize_format ] ) <EOL> accept = '<STR_LIT>' . join ( [ '<STR_LIT>' , self . deserialize_format ] ) <EOL> self . default_headers [ '<STR_LIT:Content-Type>' ] = ct <EOL> self . default_headers [ '<STR_LIT>' ] = accept <EOL> self . url = url <EOL> def list_hosts ( self , requestslib_kwargs = None ) : <EOL> """<STR_LIT>""" <EOL> url = "<STR_LIT>" . format ( url = self . url ) <EOL> host_response = self . request ( '<STR_LIT:GET>' , url , <EOL> response_entity_type = Host , <EOL> requestslib_kwargs = requestslib_kwargs ) <EOL> return host_response <EOL> def get_host ( self , host_name , requestslib_kwargs = None ) : <EOL> """<STR_LIT>""" <EOL> url = "<STR_LIT>" . format ( url = self . url , <EOL> host_name = host_name ) <EOL> host_response = self . request ( '<STR_LIT:GET>' , url , <EOL> response_entity_type = Host , <EOL> requestslib_kwargs = requestslib_kwargs ) <EOL> return host_response <EOL> def update_host ( self , host_name , status = None , maintenance_mode = None ) : <EOL> """<STR_LIT>""" <EOL> update_host_request_object = UpdateHostRequest ( status , <EOL> maintenance_mode ) <EOL> url = "<STR_LIT>" . format ( <EOL> url = self . url , host_name = host_name ) <EOL> host_response = self . request ( '<STR_LIT>' , url , <EOL> response_entity_type = HostUpdateResponse , <EOL> request_entity = update_host_request_object ) <EOL> return host_response <EOL> def shutdown ( self , host_name , requestslib_kwargs = None ) : <EOL> """<STR_LIT>""" <EOL> url = "<STR_LIT>" . format ( <EOL> url = self . url , host_name = host_name ) <EOL> host_response = self . request ( '<STR_LIT:GET>' , url , <EOL> response_entity_type = HostUpdateResponse , <EOL> requestslib_kwargs = requestslib_kwargs ) <EOL> return host_response <EOL> def reboot ( self , host_name , requestslib_kwargs = None ) : <EOL> """<STR_LIT>""" <EOL> url = "<STR_LIT>" . format ( <EOL> url = self . url , host_name = host_name ) <EOL> host_response = self . request ( '<STR_LIT:GET>' , url , <EOL> response_entity_type = HostUpdateResponse , <EOL> requestslib_kwargs = requestslib_kwargs ) <EOL> return host_response </s>
