Skip to content

Commit 0c9c5c0

Browse files
committed
Client for instance-info API
1 parent ef2ca0a commit 0c9c5c0

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

dataikuapi/dssclient.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,19 @@ def apply_kubernetes_namespaces_policies(self):
10321032
resp = self._perform_json("POST", "/admin/container-exec/actions/apply-kubernetes-policies")
10331033
return DSSFuture.from_resp(self, resp)
10341034

1035+
1036+
########################################################
1037+
# Global Instance Info
1038+
########################################################
1039+
1040+
def get_instance_info(self):
1041+
"""
1042+
Get global information about the DSS instance
1043+
:return: a :classss:`DSSInstanceInfo`
1044+
"""
1045+
resp = self._perform_json("GET", "/instance-info")
1046+
return DSSInstanceInfo(resp)
1047+
10351048
########################################################
10361049
# Licensing
10371050
########################################################
@@ -1156,3 +1169,33 @@ def execute(self, settings=None):
11561169
settings["_"] = "_"
11571170
return self.client._perform_json("POST", "/projects/import/%s/process" % (self.import_id),
11581171
body = settings)
1172+
1173+
class DSSInstanceInfo(object):
1174+
"""Global information about the DSS instance"""
1175+
1176+
def __init__(self, data):
1177+
"""Do not call this directly, use :meth:`DSSClient.get_instance_info`"""
1178+
self._data = data
1179+
1180+
@property
1181+
def raw(self):
1182+
"""Returns all data as a Python dictionary"""
1183+
return self._data
1184+
1185+
@property
1186+
def node_id(self):
1187+
"""Returns the node id (as defined in Cloud Stacks or in install.ini)"""
1188+
return self._data["nodeId"]
1189+
1190+
@property
1191+
def node_name(self):
1192+
"""Returns the node name as it appears in the navigation bar"""
1193+
return self._data["nodeName"]
1194+
1195+
@property
1196+
def node_type(self):
1197+
"""
1198+
Returns the node type
1199+
:return: One of DESIGN, AUTOMATION or DEPLOYER
1200+
"""
1201+
return self._data["nodeType"]

0 commit comments

Comments
 (0)