@@ -319,6 +319,7 @@ def user_service(self):
319
319
Requests information about user from /user/service endpoint if such exists in self.url server.
320
320
321
321
Returns response from server as JSON dict or None if endpoint is not found
322
+ This can be removed once our SaaS server is upgraded to support workspaces
322
323
"""
323
324
324
325
try :
@@ -331,6 +332,24 @@ def user_service(self):
331
332
332
333
return response
333
334
335
+ def workspace_service (self , workspace_id ):
336
+ """
337
+ This Requests information about a workspace service from /workspace/{id}/service endpoint,
338
+ if such exists in self.url server.
339
+
340
+ Returns response from server as JSON dict or None if endpoint is not found
341
+ """
342
+
343
+ try :
344
+ response = self .get (f"/v1/workspace/{ workspace_id } /service" )
345
+ except ClientError as e :
346
+ self .log .debug (f"Unable to query for /workspace/{ workspace_id } /service endpoint" )
347
+ return
348
+
349
+ response = json .loads (response .read ())
350
+
351
+ return response
352
+
334
353
def server_type (self ):
335
354
"""
336
355
Returns the deployment type of the server
@@ -344,11 +363,13 @@ def server_type(self):
344
363
try :
345
364
resp = self .get ("/config" )
346
365
config = json .load (resp )
347
- if "user_workspaces_allowed" in config :
348
- self ._server_type = ServerType .EE
349
- if "global_workspace" in config :
366
+ if config ["server_type" ] == "ce" :
350
367
self ._server_type = ServerType .CE
351
- except ClientError as e :
368
+ elif config ["server_type" ] == "ee" :
369
+ self ._server_type = ServerType .EE
370
+ elif config ["server_type" ] == "saas" :
371
+ self ._server_type = ServerType .SAAS
372
+ except (ClientError , KeyError ):
352
373
self ._server_type = ServerType .OLD
353
374
354
375
return self ._server_type
0 commit comments