@@ -144,6 +144,11 @@ async def connect(self, *args, **kwargs):
144144 raise ValueError ('Authentication parameters are required '
145145 'if controller_name not given' )
146146 await self ._connector .connect (** kwargs )
147+ info = await self .info ()
148+ self ._connector ._connection .endpoints = [
149+ (e , info .results [0 ].cacert )
150+ for e in info .results [0 ].addresses
151+ ]
147152
148153 async def connect_current (self ):
149154 """
@@ -181,12 +186,13 @@ def controller_uuid(self):
181186 return self ._connector .controller_uuid
182187
183188 @property
184- def api_endpoints (self ):
185- controller_name = self ._connector .jujudata .current_controller ()
186- if controller_name :
187- return self ._connector .jujudata .controllers ().get (controller_name ).get (
188- "api-endpoints"
189- )
189+ async def api_endpoints (self ):
190+ """Get API endpoints
191+
192+ :return list string: List of API Endpoints
193+ """
194+ info = await self .info ()
195+ return info .results [0 ].addresses
190196
191197 async def disconnect (self ):
192198 """Shut down the watcher task and close websockets.
@@ -273,6 +279,17 @@ async def add_cloud(self, name, cloud):
273279 result = await self .cloud (name = name )
274280 return result .cloud
275281
282+ async def info (self ):
283+ """Show Controller Info from connection
284+
285+ :return ControllerAPIInfoResult
286+ """
287+ log .debug ('Getting information' )
288+ uuids = await self .model_uuids ()
289+ controller_facade = client .ControllerFacade .from_connection (self .connection ())
290+ params = [client .Entity (tag .model (uuids ["controller" ]))]
291+ return await controller_facade .ControllerAPIInfoForModels (entities = params )
292+
276293 async def remove_cloud (self , name ):
277294 """Remove a cloud from this controller.
278295
0 commit comments