Skip to content

Commit 8c867d4

Browse files
authored
Add a method for obtaining the connected domain (#133)
* Add a method for obtaining the connected domain
1 parent 8fba266 commit 8c867d4

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

cterasdk/core/directoryservice.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def connect(self, domain, username, password, directory=DirectoryServiceType.Mic
5959
param.accessControlRules = None
6060
param.idMapping = None
6161
param.fetchMode = fetch
62+
param.ipAddresses = None
6263

6364
if domain_controllers:
6465
param.ipAddresses = Object()
@@ -167,6 +168,19 @@ def _configure_access_control(self, acl, default=None):
167168

168169
return response
169170

171+
def get_connected_domain(self):
172+
"""
173+
Get the connected domain information. Returns `None` if the Portal tenant is not connected to a domain
174+
175+
:return str: The connected domain
176+
"""
177+
domain = None
178+
try:
179+
domain = self._portal.get('/directoryConnector/domain')
180+
except CTERAException:
181+
pass
182+
return domain
183+
170184
def domains(self):
171185
"""
172186
Get domains

docs/source/user_guides/Portal/GlobalAdmin.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,21 @@ Directory Services
714714
)
715715
admin.directoryservice.connect('demo.local', 'svc_account', 'P@ssw0rd1', mapping=mapping, domain_controllers=portal_types.DomainControllers('172.54.3.52'), acl=[rw_admin, ro_admin])
716716
717+
.. automethod:: cterasdk.core.directoryservice.DirectoryService.domains
718+
:noindex:
719+
720+
.. code-block:: python
721+
722+
print(admin.directoryservice.domains())
723+
724+
725+
.. automethod:: cterasdk.core.directoryservice.DirectoryService.get_connected_domain
726+
:noindex:
727+
728+
.. code-block:: python
729+
730+
print(admin.directoryservice.get_connected_domain())
731+
717732
.. automethod:: cterasdk.core.directoryservice.DirectoryService.get_advanced_mapping
718733
:noindex:
719734

0 commit comments

Comments
 (0)