Skip to content

Commit dc825b5

Browse files
committed
Merge branch 'release/5.0' into tasks/dss50-add-create-infra
2 parents faed7a1 + 63fb21b commit dc825b5

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

dataikuapi/dss/admin.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,27 @@ class DSSConnection(object):
88
def __init__(self, client, name):
99
self.client = client
1010
self.name = name
11+
12+
########################################################
13+
# Location info
14+
########################################################
15+
16+
def get_location_info(self):
17+
"""
18+
Gets information about this connection.
19+
20+
Note: this call requires either an admin API key or
21+
a personal API key that corresponds to a user who
22+
belongs to a group who has the rights to read connection
23+
details
24+
25+
:returns: a dict containing connection information
26+
"""
27+
return self.client._perform_json(
28+
"GET", "/connections/%s/info" % self.name)
1129

1230
########################################################
13-
# User deletion
31+
# Connection deletion
1432
########################################################
1533

1634
def delete(self):

dataikuapi/dssclient.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,49 @@ def catalog_index_connections(self, connection_names=[], all_connections=False,
706706
"indexingMode": indexing_mode
707707
})
708708

709+
710+
########################################################
711+
# Auth
712+
########################################################
713+
714+
def get_auth_info(self, with_secrets=False):
715+
"""
716+
Returns various information about the user currently authenticated using
717+
this instance of the API client.
718+
719+
This method returns a dict that may contain the following keys (may also contain others):
720+
721+
* authIdentifier: login for a user, id for an API key
722+
* groups: list of group names (if context is an user)
723+
* secrets: list of dicts containing user secrets (if context is an user)
724+
725+
:param: with_secrets boolean: Return user secrets
726+
:returns: a dict
727+
:rtype: dict
728+
"""
729+
return self._perform_json("GET", "/auth/info", params={"withSecrets": with_secrets})
730+
731+
def get_auth_info_from_browser_headers(self, headers_dict, with_secrets=False):
732+
"""
733+
Returns various information about the DSS user authenticated by the dictionary of
734+
HTTP headers provided in headers_dict.
735+
736+
This is generally only used in webapp backends
737+
738+
This method returns a dict that may contain the following keys (may also contain others):
739+
740+
* authIdentifier: login for a user, id for an API key
741+
* groups: list of group names (if context is an user)
742+
* secrets: list of dicts containing user secrets (if context is an user)
743+
744+
:param: headers_dict dict: Dictionary of HTTP headers
745+
:param: with_secrets boolean: Return user secrets
746+
:returns: a dict
747+
:rtype: dict
748+
"""
749+
return self._perform_json("POST", "/auth/info-from-browser-headers",
750+
params={"withSecrets": with_secrets}, body=headers_dict)
751+
709752
########################################################
710753
# Internal Request handling
711754
########################################################
@@ -769,6 +812,7 @@ def get_object_discussions(self, project_key, object_type, object_id):
769812
"""
770813
return DSSObjectDiscussions(self, project_key, object_type, object_id)
771814

815+
772816
class TemporaryImportHandle(object):
773817
def __init__(self, client, import_id):
774818
self.client = client

0 commit comments

Comments
 (0)