udm_rest_client package¶
Submodules¶
udm_rest_client.base module¶
Base classes for (simplified) UDM modules and objects.
-
class
udm_rest_client.base.
BaseModule
(name: str, connection: Any, api_version: int)[source]¶ Bases:
object
Base class for UDM module classes. UDM modules are basically UDM object factories.
Usage:
Get module using:
user_mod = UDM().get('users/user')
Create fresh, not yet saved BaseObject:
new_user = user_mod.new()
Load an existing object:
group = group_mod.get('cn=test,cn=groups,dc=example,dc=com') group = group_mod.get_by_id('Domain Users')
Search and load existing objects:
dc_slaves = dc_slave_mod.search(filter_s='cn=s10*') campus_groups = group_mod.search(base='ou=campus,dc=example,dc=com')
Load existing object(s) without
open()
‘ing them:user_mod.meta.auto_open = False user = user_mod.get(dn) user.props.groups == []
-
get
(dn: str) → udm_rest_client.base.BaseObject[source]¶ Load UDM object from LDAP.
Parameters: dn (str) – DN of the object to load.
Returns: an existing
BaseObject
instance.Return type: Raises: - univention.udm.exceptions.NoObject – if no object is found at dn
- univention.udm.exceptions.WrongObjectType – if the object found at dn is not of type
self.name
-
meta
= BaseModuleMetadata(supported_api_versions=(), suitable_for=[], used_api_version=None)¶
-
new
(superordinate: Union[str, udm_rest_client.base.BaseObject] = None) → udm_rest_client.base.BaseObject[source]¶ Create a new, unsaved
BaseObject
object.Parameters: superordinate (str or GenericObject) – DN or UDM object this one references as its superordinate (required by some modules) Returns: a new, unsaved BaseObject object Return type: BaseObject
-
search
(filter_s: str = '', base: str = '', scope: str = 'sub') → Iterator[udm_rest_client.base.BaseObject][source]¶ Get all UDM objects from LDAP that match the given filter.
Parameters: - filter_s (str) – LDAP filter (only object selector like uid=foo required, objectClasses will be set by the UDM module)
- base (str) – LDAP search base.
- scope (str) – LDAP search scope, e.g. base or sub or one.
Returns: iterator of
BaseObject
objectsReturn type: Iterator(BaseObject)
-
class
udm_rest_client.base.
BaseModuleMeta
[source]¶ Bases:
type
This is not a subclass of
univention.udm.plugins.Plugin
, like in the originalunivention.udm.base.ModuleMeta
, because we don’t need to load module specific code in the client.-
udm_meta_class
¶ alias of
BaseModuleMetadata
-
-
class
udm_rest_client.base.
BaseModuleMetadata
(meta: BaseModule.Meta)[source]¶ Bases:
object
Base class for UDM module meta data.
-
auto_open
= True¶ Whether UDM objects should be
open()
‘ed.
-
auto_reload
= True¶ Whether UDM objects should be
reload()
‘ed after saving.
-
identifying_property
¶ UDM property of which the mapped LDAP attribute is used as first component in a DN, e.g. username (LDAP attribute uid) or name (LDAP attribute cn).
-
instance
(udm_module: udm_rest_client.base.BaseModule, api_version: int) → udm_rest_client.base.BaseModuleMetadata[source]¶
-
lookup_filter
(filter_s: str = None) → str[source]¶ Filter the UDM module uses to find its corresponding LDAP objects.
This can be used in two ways:
get the filter to find all objects:
myfilter_s = obj.meta.lookup_filter()
get the filter to find a subset of the corresponding LDAP objects (filter_s will be combined with & to the filter for all objects):
`myfilter = obj.meta.lookup_filter('(|(givenName=A*)(givenName=B*))')`
Parameters: filter_s (str) – optional LDAP filter expression Returns: an LDAP filter string Return type: str
-
mapping
¶ UDM properties to LDAP attributes mapping and vice versa.
Returns: a namedtuple containing two mappings: a) from UDM property to LDAP attribute and b) from LDAP attribute to UDM property Return type: LdapMapping
-
-
class
udm_rest_client.base.
BaseObject
[source]¶ Bases:
object
Base class for UDM object classes.
Usage:
Creation of instances is always done through
BaseModule.new()
,BaseModule.get()
orBaseModule.search()
.Modify an object:
user.props.firstname = 'Peter' user.props.lastname = 'Pan' user.save()
Move an object:
user.position = 'cn=users,ou=Company,dc=example,dc=com' user.save()
Delete an object:
obj.delete()
After saving a
BaseObject
, it isreload()
‘ed automatically because UDM hooks and listener modules often add, modify or remove properties when saving to LDAP. As this involves LDAP, it can be disabled if the object is not used afterwards and performance is an issue:user_mod.meta.auto_reload = False
-
reload
() → udm_rest_client.base.BaseObject[source]¶ Refresh object from LDAP.
Returns: self Return type: BaseObject
-
save
() → udm_rest_client.base.BaseObject[source]¶ Save object to LDAP.
Returns: self Return type: BaseObject Raises: univention.udm.exceptions.MoveError – when a move operation fails
-
udm_prop_class
¶ alias of
BaseObjectProperties
udm_rest_client.base_http module¶
Base classes for (simplified) UDM modules and objects using the UDM REST API (instead of the low level Python UDM API).
-
class
udm_rest_client.base_http.
DnPropertyEncoder
(property_name: str, dn: str, session: udm_rest_client.base_http.Session, udm_module_name: str = None)[source]¶ Bases:
object
Given a DN, return a string object with the DN and an additional member
obj
.obj
is a property that, when accessed, will return the UDM object the DN refers to. The property has to be await ‘ed.
-
class
udm_rest_client.base_http.
Session
(username: str, password: str, url: str, max_client_tasks: int = 10, request_id: str = None, request_id_header: str = 'X-Request-ID', language: str = None, **kwargs)[source]¶ Bases:
object
-
call_openapi
(udm_module_name: str, operation: str, dn: str = None, api_model_obj: Union[ApiModel, Dict[str, Any]] = None, language: str = None, **kwargs) → Tuple[Union[ApiModel, List[ApiModel]], int, Dict[str, str]][source]¶
-
session
¶
-
-
class
udm_rest_client.base_http.
UdmModule
(name: str, session: udm_rest_client.base_http.Session)[source]¶ Bases:
udm_rest_client.base.BaseModule
Base class for UDM_HTTP module classes. UDM modules are basically UDM object factories.
Usage:
Get module using:
user_mod = UDM().get('users/user')
1 Create fresh, not yet saved UdmObject:
new_user = user_mod.new()
2 Load an existing object:
group = group_mod.get('cn=test,cn=groups,dc=example,dc=com') group = group_mod.get_by_id('Domain Users')
3 Search and load existing objects:
dc_slaves = dc_slave_mod.search(filter_s='cn=s10*') campus_groups = group_mod.search(base='ou=campus,dc=example,dc=com')
Load existing object(s) without open() ‘ing them:
user_mod.meta.auto_open = False user = user_mod.get(dn) user.props.groups == []
-
get
(dn: str, language: str = None) → udm_rest_client.base_http.UdmObject[source]¶ Load UDM object from LDAP.
Parameters: - dn (str) – DN of the object to load
- language (str) – Language used in the “Accept-Language” header for this request (optional)
Returns: an existing
udm_rest_client.BaseHttpObject
objectReturn type: Raises: - udm_rest_client.NoObject – if no object is found at dn
- udm_rest_client.WrongObjectType – if the object found at dn is not of type
self.name
-
meta
= UdmModuleMetadata(supported_api_versions=[0, 1, 2], suitable_for=['*/*'], used_api_version=None)¶
-
new
(superordinate: str = None, language: str = None) → udm_rest_client.base_http.UdmObject[source]¶ Create a new, unsaved BaseHttpObject object.
Parameters: - superordinate (str or GenericObject) – DN or UDM object this one references as its superordinate (required by some modules)
- language (str) – Language used in the “Accept-Language” header for this request (optional)
Returns: a new, unsaved
udm_rest_client.UdmObject
objectReturn type:
-
search
(filter_s: str = '', base: str = '', scope: str = 'sub', language: str = None) → AsyncIterator[udm_rest_client.base_http.UdmObject][source]¶ Get all UDM objects from LDAP that match the given filter.
Parameters: - filter_s (str) – LDAP filter (only object selector like uid=foo required, objectClasses will be set by the UDM module)
- base (str) – base dn for search
- scope (str) – one of base, one, sub or children
- language (str) – Language used in the “Accept-Language” header for this request (optional)
Returns: iterator of
UdmObject
objectsReturn type: Iterator(udm_rest_client.UdmObject)
-
class
udm_rest_client.base_http.
UdmModuleMeta
[source]¶ Bases:
udm_rest_client.base.BaseModuleMeta
-
udm_meta_class
¶ alias of
UdmModuleMetadata
-
-
class
udm_rest_client.base_http.
UdmModuleMetadata
(meta: BaseModule.Meta)[source]¶ Bases:
udm_rest_client.base.BaseModuleMetadata
Base class for module meta data. Nothing here in the REST client
-
identifying_property
¶ UDM Property of which the mapped LDAP attribute is used as first component in a DN, e.g. username (LDAP attribute uid) or name (LDAP attribute cn).
-
lookup_filter
(filter_s: str = None) → str[source]¶ Filter the UDM module uses to find its corresponding LDAP objects.
This can be used in two ways:
- get the filter to find all objects:
- myfilter_s = obj.meta.lookup_filter()
- get the filter to find a subset of the corresponding LDAP objects
- (filter_s will be combined with & to the filter for all objects): myfilter = obj.meta.lookup_filter(‘(|(givenName=A*)(givenName=B*))’)
Parameters: filter_s (str) – optional LDAP filter expression Returns: an LDAP filter string Return type: str
-
mapping
¶ UDM properties to LDAP attributes mapping and vice versa.
Returns: a namedtuple containing two mappings: a) from UDM property to LDAP attribute and b) from LDAP attribute to UDM property Return type: LdapMapping
-
-
class
udm_rest_client.base_http.
UdmObject
[source]¶ Bases:
udm_rest_client.base.BaseObject
Base class for UDM_HTTP object classes.
Usage:
Creation of instances
udm_rest_client.UdmObject
is always done through aBaseHttpModul
instances py:meth:new(), py:meth:get() or py:meth:search() methods.Modify an object:
user.props.firstname = 'Peter' user.props.lastname = 'Pan' user.save()
Move an object:
user.position = 'cn=users,ou=Company,dc=example,dc=com' user.save()
Delete an object:
obj.delete()
After saving a
udm_rest_client.UdmObject
, it isreload()
‘ed automatically because UDM hooks and listener modules often add, modify or remove properties when saving to LDAP. As this involves LDAP, it can be disabled if the object is not used afterwards and performance is an issue:user_mod.meta.auto_reload = False
-
delete
(language=None) → None[source]¶ Remove the object from the LDAP database.
Parameters: language (str) – Language used in the “Accept-Language” header for this request (optional) Returns: None
-
reload
(language: str = None) → udm_rest_client.base_http.UdmObject[source]¶ Refresh object from LDAP.
Parameters: language (str) – Language used in the “Accept-Language” header for this request (optional) Returns: self Return type: udm_rest_client.UdmObject
-
save
(language: str = None) → udm_rest_client.base_http.UdmObject[source]¶ Save object to LDAP (via UDM REST API).
Parameters: language (str) – Language used in the “Accept-Language” header for this request (optional) Returns: self Return type: udm_rest_client.UdmObject Raises: ApiException – when the operation fails
-
udm_prop_class
¶ alias of
UdmObjectProperties
-
class
udm_rest_client.base_http.
UdmObjectProperties
(udm_obj: udm_rest_client.base.BaseObject)[source]¶ Bases:
udm_rest_client.base.BaseObjectProperties
Container for UDM properties.
udm_rest_client.exceptions module¶
-
exception
udm_rest_client.exceptions.
APICommunicationError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when something goes wrong communicating.
-
exception
udm_rest_client.exceptions.
ConfigurationError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶
-
exception
udm_rest_client.exceptions.
CreateError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when an error occurred when creating an object.
-
exception
udm_rest_client.exceptions.
DeletedError
(msg: str = None, dn: str = None, module_name: str = None)[source]¶
-
exception
udm_rest_client.exceptions.
MethodNotSupportedError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised if the API client does not support a method.
-
exception
udm_rest_client.exceptions.
ModifyError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised if an error occurred when modifying an object.
-
exception
udm_rest_client.exceptions.
MoveError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised if an error occurred when moving an object.
-
exception
udm_rest_client.exceptions.
MultipleObjects
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when more than one UDM object was found when there should be at most one.
-
exception
udm_rest_client.exceptions.
NoObject
(msg: str = None, dn: str = None, module_name: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when a UDM object could not be found at a DN.
-
exception
udm_rest_client.exceptions.
NotYetSavedError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when a client tries to delete or reload a UDM object that is not yet saved.
-
msg
= 'Object has not been created/loaded yet.'¶
-
-
exception
udm_rest_client.exceptions.
UdmError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
Exception
Base class of Exceptions raised by (simplified) UDM modules.
-
msg
= ''¶
-
-
exception
udm_rest_client.exceptions.
UnknownModuleType
(msg: str = None, dn: str = None, module_name: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when an LDAP object has no or empty attribute univentionObjectType.
udm_rest_client.udm module¶
UDM REST API Client library
Python library to interact with the Univention UDM REST API, implementing the interface of the simple Python UDM API [1].
The API consists of UDM modules and UDM object. UDM modules are factories for UDM objects. UDM objects manipulate LDAP objects on the UCS server.
Usage:
async with UDM("myuser", "s3cr3t", "https://FQ.DN/univention/udm/") as udm:
user_mod = udm.get('users/user')
obj = user_mod.get(dn)
obj.props.firstname = 'foo' # modify property
obj.position = 'cn=users,cn=example,dc=com' # move LDAP object
obj.save() # apply changes and reload object from LDAP
obj = user_mod.get(dn)
obj.delete() # delete object
async for obj in udm.get('users/user').search('uid=a*'):
print(obj.props.firstname, obj.props.lastname)
[1] https://docs.software-univention.de/developer-reference-4.4.html#udm:rest_api
-
class
udm_rest_client.udm.
UDM
(username: str, password: str, url: str, max_client_tasks: int = 10, request_id: str = None, request_id_header: str = 'X-Request-ID', language: str = None, **kwargs)[source]¶ Bases:
object
Factory for creating
udm_rest_client.UdmModule
objects:from udm_rest_client import UDM async def func(): async with UDM("myuser", "s3cr3t", "https://FQ.DN/univention/udm/") as udm: group_mod = udm.get('groups/group') obj = await group_mod.get(dn) # obj is of type udm_rest_client.base_http.UdmObject
HTTP(S) sessions will be closed upon existing the asynchronous context manager. It is recommended to make as many operations as possible in the same session.
-
api_version
¶ Here only for backwards compatibility.
-
get
(name: str) → udm_rest_client.base_http.UdmModule[source]¶ Context manager of type
udm_rest_client.UdmModule
to work with UDM objects of type name (e.g. users/user). Exiting the context manager automatically closes theaiohttp.ClientSession
. Usage example:async with udm.get("users/user") as user_mod: user_obj = await user_mod.get($DN)
Parameters: name (str) – UDM module name (e.g. users/user) Returns: instance of udm_rest_client.UdmModule
Return type: udm_rest_client.UdmModule
-
modules_list
(language: str = None) → Sequence[str][source]¶ Get the list of UDM modules the server knows.
Parameters: language (str) – Language used in the “Accept-Language” header for this request (optional) Returns: list of UDM module names Return type: list(str)
-
obj_by_dn
(dn: str, language: str = None) → udm_rest_client.base_http.UdmObject[source]¶ Load a UDM object without knowing the UDM module type.
Parameters: dn (str) – DN of the object to load
Returns: udm_rest_client.UdmObject
instanceReturn type: Raises: - univention.udm.exceptions.NoObject – if no object is found at dn
- univention.udm.exceptions.ImportError – if the Python module for the specific UDM module type could not be loaded
-
set_language
(language: str) → None[source]¶ Set the language used in the “Accept-Language” header for each request in the current session.
Parameters: language (str) – Language used in the “Accept-Language” header Returns: None
-
unknown_modules
(language: str = None) → Sequence[str][source]¶ Get the list of UDM modules the server knows, but this client doesn’t.
Unknown UDM modules cannot be used with this client library. When the list is non-empty, the package openapi-client-udm must be rebuilt to use them.
Parameters: language (str) – Language used in the “Accept-Language” header for this request (optional) Returns: list of UDM modules known by the server but not this client Return type: list(str)
-
version
(api_version: int) → udm_rest_client.udm.UDM[source]¶ This is not about versions of the UDM REST API. This is here only to provide better drop-in functionality when using this lib instead of the UDM Python API on a UCS system. It is not required to use this method.
Parameters: api_version (int) – ignored Returns: self Return type: udm_rest_client.UDM
-
Module contents¶
Top-level package for Python UDM REST Client.
-
class
udm_rest_client.
UDM
(username: str, password: str, url: str, max_client_tasks: int = 10, request_id: str = None, request_id_header: str = 'X-Request-ID', language: str = None, **kwargs)[source]¶ Bases:
object
Factory for creating
udm_rest_client.UdmModule
objects:from udm_rest_client import UDM async def func(): async with UDM("myuser", "s3cr3t", "https://FQ.DN/univention/udm/") as udm: group_mod = udm.get('groups/group') obj = await group_mod.get(dn) # obj is of type udm_rest_client.base_http.UdmObject
HTTP(S) sessions will be closed upon existing the asynchronous context manager. It is recommended to make as many operations as possible in the same session.
-
api_version
¶ Here only for backwards compatibility.
-
get
(name: str) → udm_rest_client.base_http.UdmModule[source]¶ Context manager of type
udm_rest_client.UdmModule
to work with UDM objects of type name (e.g. users/user). Exiting the context manager automatically closes theaiohttp.ClientSession
. Usage example:async with udm.get("users/user") as user_mod: user_obj = await user_mod.get($DN)
Parameters: name (str) – UDM module name (e.g. users/user) Returns: instance of udm_rest_client.UdmModule
Return type: udm_rest_client.UdmModule
-
modules_list
(language: str = None) → Sequence[str][source]¶ Get the list of UDM modules the server knows.
Parameters: language (str) – Language used in the “Accept-Language” header for this request (optional) Returns: list of UDM module names Return type: list(str)
-
obj_by_dn
(dn: str, language: str = None) → udm_rest_client.base_http.UdmObject[source]¶ Load a UDM object without knowing the UDM module type.
Parameters: dn (str) – DN of the object to load
Returns: udm_rest_client.UdmObject
instanceReturn type: Raises: - univention.udm.exceptions.NoObject – if no object is found at dn
- univention.udm.exceptions.ImportError – if the Python module for the specific UDM module type could not be loaded
-
set_language
(language: str) → None[source]¶ Set the language used in the “Accept-Language” header for each request in the current session.
Parameters: language (str) – Language used in the “Accept-Language” header Returns: None
-
unknown_modules
(language: str = None) → Sequence[str][source]¶ Get the list of UDM modules the server knows, but this client doesn’t.
Unknown UDM modules cannot be used with this client library. When the list is non-empty, the package openapi-client-udm must be rebuilt to use them.
Parameters: language (str) – Language used in the “Accept-Language” header for this request (optional) Returns: list of UDM modules known by the server but not this client Return type: list(str)
-
version
(api_version: int) → udm_rest_client.udm.UDM[source]¶ This is not about versions of the UDM REST API. This is here only to provide better drop-in functionality when using this lib instead of the UDM Python API on a UCS system. It is not required to use this method.
Parameters: api_version (int) – ignored Returns: self Return type: udm_rest_client.UDM
-
-
class
udm_rest_client.
UdmModule
(name: str, session: udm_rest_client.base_http.Session)[source]¶ Bases:
udm_rest_client.base.BaseModule
Base class for UDM_HTTP module classes. UDM modules are basically UDM object factories.
Usage:
Get module using:
user_mod = UDM().get('users/user')
1 Create fresh, not yet saved UdmObject:
new_user = user_mod.new()
2 Load an existing object:
group = group_mod.get('cn=test,cn=groups,dc=example,dc=com') group = group_mod.get_by_id('Domain Users')
3 Search and load existing objects:
dc_slaves = dc_slave_mod.search(filter_s='cn=s10*') campus_groups = group_mod.search(base='ou=campus,dc=example,dc=com')
Load existing object(s) without open() ‘ing them:
user_mod.meta.auto_open = False user = user_mod.get(dn) user.props.groups == []
-
get
(dn: str, language: str = None) → udm_rest_client.base_http.UdmObject[source]¶ Load UDM object from LDAP.
Parameters: - dn (str) – DN of the object to load
- language (str) – Language used in the “Accept-Language” header for this request (optional)
Returns: an existing
udm_rest_client.BaseHttpObject
objectReturn type: Raises: - udm_rest_client.NoObject – if no object is found at dn
- udm_rest_client.WrongObjectType – if the object found at dn is not of type
self.name
-
meta
= UdmModuleMetadata(supported_api_versions=[0, 1, 2], suitable_for=['*/*'], used_api_version=None)¶
-
new
(superordinate: str = None, language: str = None) → udm_rest_client.base_http.UdmObject[source]¶ Create a new, unsaved BaseHttpObject object.
Parameters: - superordinate (str or GenericObject) – DN or UDM object this one references as its superordinate (required by some modules)
- language (str) – Language used in the “Accept-Language” header for this request (optional)
Returns: a new, unsaved
udm_rest_client.UdmObject
objectReturn type:
-
search
(filter_s: str = '', base: str = '', scope: str = 'sub', language: str = None) → AsyncIterator[udm_rest_client.base_http.UdmObject][source]¶ Get all UDM objects from LDAP that match the given filter.
Parameters: - filter_s (str) – LDAP filter (only object selector like uid=foo required, objectClasses will be set by the UDM module)
- base (str) – base dn for search
- scope (str) – one of base, one, sub or children
- language (str) – Language used in the “Accept-Language” header for this request (optional)
Returns: iterator of
UdmObject
objectsReturn type: Iterator(udm_rest_client.UdmObject)
-
class
udm_rest_client.
UdmObject
[source]¶ Bases:
udm_rest_client.base.BaseObject
Base class for UDM_HTTP object classes.
Usage:
Creation of instances
udm_rest_client.UdmObject
is always done through aBaseHttpModul
instances py:meth:new(), py:meth:get() or py:meth:search() methods.Modify an object:
user.props.firstname = 'Peter' user.props.lastname = 'Pan' user.save()
Move an object:
user.position = 'cn=users,ou=Company,dc=example,dc=com' user.save()
Delete an object:
obj.delete()
After saving a
udm_rest_client.UdmObject
, it isreload()
‘ed automatically because UDM hooks and listener modules often add, modify or remove properties when saving to LDAP. As this involves LDAP, it can be disabled if the object is not used afterwards and performance is an issue:user_mod.meta.auto_reload = False
-
delete
(language=None) → None[source]¶ Remove the object from the LDAP database.
Parameters: language (str) – Language used in the “Accept-Language” header for this request (optional) Returns: None
-
reload
(language: str = None) → udm_rest_client.base_http.UdmObject[source]¶ Refresh object from LDAP.
Parameters: language (str) – Language used in the “Accept-Language” header for this request (optional) Returns: self Return type: udm_rest_client.UdmObject
-
save
(language: str = None) → udm_rest_client.base_http.UdmObject[source]¶ Save object to LDAP (via UDM REST API).
Parameters: language (str) – Language used in the “Accept-Language” header for this request (optional) Returns: self Return type: udm_rest_client.UdmObject Raises: ApiException – when the operation fails
-
udm_prop_class
¶ alias of
UdmObjectProperties
-
exception
udm_rest_client.
ConfigurationError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶
-
exception
udm_rest_client.
CreateError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when an error occurred when creating an object.
-
exception
udm_rest_client.
DeletedError
(msg: str = None, dn: str = None, module_name: str = None)[source]¶
-
exception
udm_rest_client.
NotYetSavedError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when a client tries to delete or reload a UDM object that is not yet saved.
-
msg
= 'Object has not been created/loaded yet.'¶
-
-
exception
udm_rest_client.
ModifyError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised if an error occurred when modifying an object.
-
exception
udm_rest_client.
MoveError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised if an error occurred when moving an object.
-
exception
udm_rest_client.
MultipleObjects
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when more than one UDM object was found when there should be at most one.
-
exception
udm_rest_client.
NoObject
(msg: str = None, dn: str = None, module_name: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when a UDM object could not be found at a DN.
-
exception
udm_rest_client.
UdmError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
Exception
Base class of Exceptions raised by (simplified) UDM modules.
-
msg
= ''¶
-
-
exception
udm_rest_client.
UnknownModuleType
(msg: str = None, dn: str = None, module_name: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when an LDAP object has no or empty attribute univentionObjectType.
-
exception
udm_rest_client.
APICommunicationError
(msg: str = None, dn: str = None, module_name: str = None, error: dict = None, status: int = None, reason: str = None)[source]¶ Bases:
udm_rest_client.exceptions.UdmError
Raised when something goes wrong communicating.