<s> """<STR_LIT>""" <EOL> from cafe . engine . http . client import AutoMarshallingHTTPClient <EOL> from cloudcafe . networking . networks . common . models . request . network import NetworkRequest <EOL> from cloudcafe . networking . networks . common . models . response . network import Network , Networks <EOL> class NetworksClient ( AutoMarshallingHTTPClient ) : <EOL> def __init__ ( self , url , auth_token , serialize_format = None , <EOL> deserialize_format = None , tenant_id = None ) : <EOL> """<STR_LIT>""" <EOL> super ( NetworksClient , 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>' . format ( <EOL> content_type = '<STR_LIT>' , <EOL> content_subtype = self . serialize_format ) <EOL> accept = '<STR_LIT>' . format ( <EOL> content_type = '<STR_LIT>' , <EOL> content_subtype = self . deserialize_format ) <EOL> self . default_headers [ '<STR_LIT:Content-Type>' ] = ct <EOL> self . default_headers [ '<STR_LIT>' ] = accept <EOL> if tenant_id : <EOL> self . default_headers [ '<STR_LIT>' ] = tenant_id <EOL> self . url = url <EOL> def create_network ( self , name = None , admin_state_up = None , shared = None , <EOL> tenant_id = None , requestslib_kwargs = None ) : <EOL> """<STR_LIT>""" <EOL> url = '<STR_LIT>' . format ( base_url = self . url ) <EOL> request = NetworkRequest ( name = name , admin_state_up = admin_state_up , <EOL> shared = shared , tenant_id = tenant_id ) <EOL> resp = self . request ( '<STR_LIT:POST>' , url , <EOL> response_entity_type = Network , <EOL> request_entity = request , <EOL> requestslib_kwargs = requestslib_kwargs ) <EOL> return resp <EOL> def update_network ( self , network_id , name = None , admin_state_up = None , <EOL> shared = None , tenant_id = None , requestslib_kwargs = None ) : <EOL> """<STR_LIT>""" <EOL> url = '<STR_LIT>' . format ( <EOL> base_url = self . url , network_id = network_id ) <EOL> request = NetworkRequest ( name = name , admin_state_up = admin_state_up , <EOL> shared = shared , tenant_id = tenant_id ) <EOL> resp = self . request ( '<STR_LIT>' , url , <EOL> response_entity_type = Network , <EOL> request_entity = request , <EOL> requestslib_kwargs = requestslib_kwargs ) <EOL> return resp <EOL> def get_network ( self , network_id , requestslib_kwargs = None ) : <EOL> """<STR_LIT>""" <EOL> url = '<STR_LIT>' . format ( <EOL> base_url = self . url , network_id = network_id ) <EOL> resp = self . request ( '<STR_LIT:GET>' , url , <EOL> response_entity_type = Network , <EOL> requestslib_kwargs = requestslib_kwargs ) <EOL> return resp <EOL> def list_networks ( self , network_id = None , name = None , status = None , <EOL> admin_state_up = None , shared = None , tenant_id = None , <EOL> limit = None , marker = None , page_reverse = None , <EOL> requestslib_kwargs = None ) : <EOL> """<STR_LIT>""" <EOL> params = { '<STR_LIT:id>' : network_id , '<STR_LIT:name>' : name , '<STR_LIT:status>' : status , <EOL> '<STR_LIT>' : admin_state_up , '<STR_LIT>' : shared , <EOL> '<STR_LIT>' : tenant_id , '<STR_LIT>' : limit , '<STR_LIT>' : marker , <EOL> '<STR_LIT>' : page_reverse } <EOL> url = '<STR_LIT>' . format ( base_url = self . url ) <EOL> resp = self . request ( '<STR_LIT:GET>' , url , params = params , <EOL> response_entity_type = Networks , <EOL> requestslib_kwargs = requestslib_kwargs ) <EOL> return resp <EOL> def delete_network ( self , network_id , requestslib_kwargs = None ) : <EOL> """<STR_LIT>""" <EOL> url = '<STR_LIT>' . format ( <EOL> base_url = self . url , network_id = network_id ) <EOL> resp = self . request ( '<STR_LIT>' , url , <EOL> requestslib_kwargs = requestslib_kwargs ) <EOL> return resp </s>
