77
88class DSSConnectionInfo (dict ):
99 """A class holding read-only information about a connection.
10- This class should not be created directly. Instead , use :meth:`DSSConnection.get_info`
10+ Do not create this object directly , use :meth:`DSSConnection.get_info` instead.
1111
1212 The main use case of this class is to retrieve the decrypted credentials for a connection,
1313 if allowed by the connection permissions.
1414
1515 Depending on the connection kind, the credential may be available using :meth:`get_basic_credential`
16- or :meth:`get_aws_credential`
16+ or :meth:`get_aws_credential`.
1717 """
1818 def __init__ (self , data ):
19- """Do not call this directly, use :meth:`DSSConnection.get_info`"""
2019 super (DSSConnectionInfo , self ).__init__ (data )
2120
2221 def get_type (self ):
@@ -54,9 +53,9 @@ def get_aws_credential(self):
5453class DSSConnection (object ):
5554 """
5655 A connection on the DSS instance.
56+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.get_connection` instead.
5757 """
5858 def __init__ (self , client , name ):
59- """Do not call this directly, use :meth:`dataikuapi.DSSClient.get_connection`"""
6059 self .client = client
6160 self .name = name
6261
@@ -151,10 +150,9 @@ def sync_datasets_acls(self):
151150class DSSUser (object ):
152151 """
153152 A handle for a user on the DSS instance.
154- Do not create this directly, use :meth:`dataikuapi.DSSClient.get_user`
153+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.get_user` instead.
155154 """
156155 def __init__ (self , client , login ):
157- """Do not call this directly, use :meth:`dataikuapi.DSSClient.get_user`"""
158156 self .client = client
159157 self .login = login
160158
@@ -243,7 +241,7 @@ def get_client_as(self):
243241class DSSOwnUser (object ):
244242 """
245243 A handle to interact with your own user
246- Do not create this directly, use :meth:`dataikuapi.DSSClient.get_own_user`
244+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.get_own_user` instead.
247245 """
248246 def __init__ (self , client ):
249247 self .client = client
@@ -259,9 +257,11 @@ def get_settings(self):
259257
260258
261259class DSSUserSettingsBase (object ):
262- """Settings for a DSS user"""
260+ """
261+ Settings for a DSS user.
262+ Do not create this object directly, use :meth:`DSSUser.get_settings` or :meth:`DSSOwnUser.get_settings` instead.
263+ """
263264 def __init__ (self , settings ):
264- """Do not call this directly, use :meth:`DSSUser.get_settings` or :meth:`DSSOwnUser.get_settings` """
265265 self .settings = settings
266266
267267 def get_raw (self ):
@@ -333,10 +333,11 @@ def remove_plugin_credential(self, plugin_id, param_set_id, preset_id, param_nam
333333
334334
335335class DSSUserSettings (DSSUserSettingsBase ):
336- """Settings for a DSS user"""
337-
336+ """
337+ Settings for a DSS user.
338+ Do not create this object directly, use :meth:`DSSUser.get_settings` instead.
339+ """
338340 def __init__ (self , client , login , settings ):
339- """Do not call this directly, use :meth:`DSSUser.get_settings`"""
340341 super (DSSUserSettings , self ).__init__ (settings )
341342 self .client = client
342343 self .login = login
@@ -368,10 +369,11 @@ def save(self):
368369
369370
370371class DSSOwnUserSettings (DSSUserSettingsBase ):
371- """Settings for the current DSS user"""
372-
372+ """
373+ Settings for the current DSS user.
374+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.get_own_user` instead.
375+ """
373376 def __init__ (self , client , settings ):
374- """Do not call this directly, use :meth:`dataikuapi.DSSClient.get_own_user`"""
375377 super (DSSOwnUserSettings , self ).__init__ (settings )
376378 self .client = client
377379
@@ -383,9 +385,8 @@ def save(self):
383385class DSSUserActivity (object ):
384386 """
385387 Activity for a DSS user.
386- Do not call this directly, use :meth:`DSSUser.get_activity` or :meth:`DSSClient.list_users_activity`
388+ Do not create this object directly, use :meth:`DSSUser.get_activity` or :meth:`DSSClient.list_users_activity` instead.
387389 """
388-
389390 def __init__ (self , client , login , activity ):
390391 self .client = client
391392 self .login = login
@@ -444,10 +445,9 @@ def last_session_activity(self):
444445class DSSGroup (object ):
445446 """
446447 A group on the DSS instance.
447- Do not create this directly, use :meth:`dataikuapi.DSSClient.get_group`
448+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.get_group` instead.
448449 """
449450 def __init__ (self , client , name ):
450- """Do not call this directly, use :meth:`dataikuapi.DSSClient.get_group`"""
451451 self .client = client
452452 self .name = name
453453
@@ -490,10 +490,9 @@ def set_definition(self, definition):
490490class DSSGeneralSettings (object ):
491491 """
492492 The general settings of the DSS instance.
493- Do not create this directly, use :meth:`dataikuapi.DSSClient.get_general_settings`
493+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.get_general_settings` instead.
494494 """
495495 def __init__ (self , client ):
496- """Do not call this directly, use :meth:`dataikuapi.DSSClient.get_general_settings`"""
497496 self .client = client
498497 self .settings = self .client ._perform_json ("GET" , "/admin/general-settings" )
499498
@@ -616,6 +615,7 @@ def push_container_exec_base_images(self):
616615 raise Exception ('Container exec base image push failed : %s' % (json .dumps (resp .get ('messages' , {}).get ('messages' , {}))))
617616 return resp
618617
618+
619619class DSSUserImpersonationRule (object ):
620620 """
621621 Helper to build user-level rule items for the impersonation settings
@@ -678,6 +678,7 @@ def user_regexp(self, regexp, unix_user, hadoop_user=None):
678678 self .raw ['targetHadoop' ] = hadoop_user
679679 return self
680680
681+
681682class DSSGroupImpersonationRule (object ):
682683 """
683684 Helper to build group-level rule items for the impersonation settings
@@ -722,10 +723,11 @@ def group_regexp(self, regexp, unix_user, hadoop_user=None):
722723 self .raw ['targetHadoop' ] = hadoop_user
723724 return self
724725
726+
725727class DSSCodeEnv (object ):
726728 """
727729 A code env on the DSS instance.
728- Do not create this directly, use :meth:`dataikuapi.DSSClient.get_code_env`
730+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.get_code_env` instead.
729731 """
730732 def __init__ (self , client , env_lang , env_name ):
731733 self .client = client
@@ -925,7 +927,7 @@ def get_log(self, log_name):
925927class DSSCodeEnvSettings (object ):
926928 """
927929 Base settings class for a DSS code env.
928- Do not instantiate this class directly, use :meth:`DSSCodeEnv.get_settings`
930+ Do not create this object directly, use :meth:`DSSCodeEnv.get_settings` instead.
929931
930932 Use :meth:`save` to save your changes
931933 """
@@ -950,6 +952,7 @@ def save(self):
950952 self .codeenv .client ._perform_json (
951953 "PUT" , "/admin/code-envs/%s/%s" % (self .env_lang , self .env_name ), body = self .settings )
952954
955+
953956class DSSCodeEnvPackageListBearer (object ):
954957 def get_required_packages (self , as_list = False ):
955958 """
@@ -1027,27 +1030,24 @@ def set_built_spark_kubernetes_confs(self, *configs, **kwargs):
10271030class DSSDesignCodeEnvSettings (DSSCodeEnvSettings , DSSCodeEnvPackageListBearer , DSSCodeEnvContainerConfsBearer ):
10281031 """
10291032 Base settings class for a DSS code env on a design node.
1030- Do not instantiate this class directly, use :meth:`DSSCodeEnv.get_settings`
1033+ Do not create this object directly, use :meth:`DSSCodeEnv.get_settings` instead.
10311034
10321035 Use :meth:`save` to save your changes
10331036 """
1034-
10351037 def __init__ (self , codeenv , settings ):
10361038 super (DSSDesignCodeEnvSettings , self ).__init__ (codeenv , settings )
10371039
10381040
10391041class DSSAutomationCodeEnvSettings (DSSCodeEnvSettings , DSSCodeEnvContainerConfsBearer ):
10401042 """
10411043 Base settings class for a DSS code env on an automation node.
1042- Do not instantiate this class directly, use :meth:`DSSCodeEnv.get_settings`
1044+ Do not create this object directly, use :meth:`DSSCodeEnv.get_settings` instead.
10431045
10441046 Use :meth:`save` to save your changes
10451047 """
1046-
10471048 def __init__ (self , codeenv , settings ):
10481049 super (DSSAutomationCodeEnvSettings , self ).__init__ (codeenv , settings )
10491050
1050-
10511051 def get_version (self , version_id = None ):
10521052 """
10531053 Get a specific code env version (for versioned envs) or the single
@@ -1077,11 +1077,10 @@ def get_version(self, version_id=None):
10771077class DSSAutomationCodeEnvVersionSettings (DSSCodeEnvPackageListBearer ):
10781078 """
10791079 Base settings class for a DSS code env version on an automation node.
1080- Do not instantiate this class directly, use :meth:`DSSAutomationCodeEnvSettings.get_version`
1080+ Do not create this object directly, use :meth:`DSSAutomationCodeEnvSettings.get_version` instead.
10811081
10821082 Use :meth:`save` on the :class:`DSSAutomationCodeEnvSettings` to save your changes
10831083 """
1084-
10851084 def __init__ (self , codeenv_settings , version_settings ):
10861085 self .codeenv_settings = codeenv_settings
10871086 self .settings = version_settings
@@ -1140,8 +1139,8 @@ def set_definition(self, definition):
11401139
11411140class DSSPersonalApiKey (object ):
11421141 """
1143- A personal API key on the DSS instance
1144- Do not call that directly, use :meth:`dataikuapi.DSSClient.get_personal_api_key`
1142+ A personal API key on the DSS instance.
1143+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.get_personal_api_key` instead.
11451144 """
11461145 def __init__ (self , client , id_ ):
11471146 self .client = client
@@ -1171,8 +1170,12 @@ def delete(self):
11711170 return self .client ._perform_empty (
11721171 "DELETE" , "/personal-api-keys/%s" % self .id_ )
11731172
1174- class DSSPersonalApiKeyListItem (DSSTaggableObjectListItem ):
1175- """An item in a list of datasets. Do not instantiate this class, :meth:`dataikuapi.DSSClient.list_personal_api_keys` or :meth:`dataikuapi.DSSClient.list_all_personal_api_keys`"""
1173+
1174+ class DSSPersonalApiKeyListItem (dict ):
1175+ """
1176+ An item in a list of personal API key.
1177+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.list_personal_api_keys` or :meth:`dataikuapi.DSSClient.list_all_personal_api_keys` instead.
1178+ """
11761179 def __init__ (self , client , data ):
11771180 super (DSSPersonalApiKeyListItem , self ).__init__ (data )
11781181 self .client = client
@@ -1184,31 +1187,39 @@ def to_personal_api_key(self):
11841187 @property
11851188 def id (self ):
11861189 return self ._data ["id" ]
1190+
11871191 @property
11881192 def user (self ):
11891193 return self ._data ["user" ]
1194+
11901195 @property
11911196 def key (self ):
11921197 return self ._data ["key" ]
1198+
11931199 @property
11941200 def label (self ):
11951201 return self ._data ["label" ]
1202+
11961203 @property
11971204 def description (self ):
11981205 return self ._data ["description" ]
1206+
11991207 @property
12001208 def created_on (self ):
1201- return self ._data ["createdOn" ]
1209+ timestamp = self ._data ["createdOn" ]
1210+ return datetime .datetime .fromtimestamp (timestamp / 1000 ) if timestamp > 0 else None
1211+
12021212 @property
12031213 def created_by (self ):
12041214 return self ._data ["createdBy" ]
1205-
1215+
1216+
12061217class DSSCluster (object ):
12071218 """
1208- A handle to interact with a cluster on the DSS instance
1219+ A handle to interact with a cluster on the DSS instance.
1220+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.get_cluster` instead.
12091221 """
12101222 def __init__ (self , client , cluster_id ):
1211- """Do not call that directly, use :meth:`dataikuapi.DSSClient.get_cluster`"""
12121223 self .client = client
12131224 self .cluster_id = cluster_id
12141225
@@ -1302,10 +1313,10 @@ def stop(self, terminate=True):
13021313
13031314class DSSClusterSettings (object ):
13041315 """
1305- The settings of a cluster
1316+ The settings of a cluster.
1317+ Do not create this object directly, use :meth:`DSSCluster.get_settings` instead.
13061318 """
13071319 def __init__ (self , client , cluster_id , settings ):
1308- """Do not call directly, use :meth:`DSSCluster.get_settings`"""
13091320 self .client = client
13101321 self .cluster_id = cluster_id
13111322 self .settings = settings
@@ -1335,12 +1346,13 @@ def save(self):
13351346 return self .client ._perform_json (
13361347 "PUT" , "/admin/clusters/%s" % (self .cluster_id ), body = self .settings )
13371348
1349+
13381350class DSSClusterStatus (object ):
13391351 """
1340- The status of a cluster
1352+ The status of a cluster.
1353+ Do not create this object directly, use :meth:`DSSCluster.get_Status` instead.
13411354 """
13421355 def __init__ (self , client , cluster_id , status ):
1343- """Do not call directly, use :meth:`DSSCluster.get_Status`"""
13441356 self .client = client
13451357 self .cluster_id = cluster_id
13461358 self .status = status
@@ -1356,9 +1368,8 @@ class DSSInstanceVariables(dict):
13561368 """
13571369 Dict containing the instance variables. The variables can be modified directly in the dict and persisted using its :meth:`save` method.
13581370
1359- Do not create this directly, use :meth:`dataikuapi.DSSClient.get_global_variables`
1371+ Do not create this object directly, use :meth:`dataikuapi.DSSClient.get_global_variables` instead.
13601372 """
1361-
13621373 def __init__ (self , client , variables ):
13631374 super (dict , self ).__init__ ()
13641375 self .update (variables )
@@ -1376,7 +1387,7 @@ def save(self):
13761387class DSSGlobalUsageSummary (object ):
13771388 """
13781389 The summary of the usage of the DSS instance.
1379- Do not create this directly, use :meth:`dataikuapi.dss.DSSClient.get_global_usage_summary`
1390+ Do not create this object directly, use :meth:`dataikuapi.dss.DSSClient.get_global_usage_summary` instead.
13801391 """
13811392 def __init__ (self , data ):
13821393 self .data = data
0 commit comments