unityapiclient.client module¶
Client for the Unity IDM APIs.
The client provides methods for interacting with the Administration API of a Unity IDM server.
Client instantiation requires specifying the server’s base URL and optionally, the deployment path of the endpoint and API version (currently there is only one).
-
class
unityapiclient.client.
UnityApiClient
(server_base_url, **kwargs)[source]¶ -
get_entity
(entity_id)[source]¶ Returns information about the identified entity, including its status and all identities.
- @param entity_id: numeric identifier of the entity whose status
- and identities to retrieve.
Example response:
{ "id" : 3, "state" : "valid", "identities" : [ { "typeId" : "userName", "value" : "tested", "target" : null, "realm" : null, "local" : true, "entityId" : 3, "comparableValue" : "tested" }, { "typeId" : "persistent", "value" : "129ffe63-63b9-4467-ae24-6bc889327b0d", "target" : null, "realm" : null, "local" : true, "entityId" : 3, "comparableValue" : "129ffe63-63b9-4467-ae24-6bc889327b0d" } ], "credentialInfo" : { "credentialRequirementId" : "cr-pass", "credentialsState" : { "credential1" : { "state" : "notSet", "extraInformation" : "" } } } }
-
get_entity_attrs
(entity_id, group_path=None, effective=True)[source]¶ Returns all attributes of the identified entity.
If
group_path
is not supplied, then the method returns the attributes in all groups the entity is member of.- @param entity_id: numeric identifier of the entity whose attributes to
- retrieve.
- @param group_path: (optional) path to the group associated with the
- attributes to retrieve.
- @param effective: (optional) whether to retrieve only directly defined
- or effective attributes (by default True).
Example response:
[ { "values" : [ "/9j/4AAQSk .... KKKKACiiigD//2Q==" ], "direct" : true, "name" : "jpegA", "groupPath" : "/example", "visibility" : "full", "syntax" : "jpegImage" }, { "values" : [ "value" ], "direct" : true, "name" : "stringA", "groupPath" : "/example", "visibility" : "full", "syntax" : "string" } ]
-
get_entity_groups
(entity_id)[source]¶ Returns all groups of the identified entity.
- @param entity_id: numeric identifier of the entity whose groups to
- retrieve.
Example response:
["/example/sub","/example","/"]
-
get_group
(group_path=None)[source]¶ Returns all members and subgroups of the specified group.
If
group_path
is not supplied, then the method returns all root-level groups and members.- @param group_path: (optional) path to group whose subgroups
- and members to retrieve.
Example response:
{ "subGroups" : [ ], "members" : [ 3 ] }
-
remove_entity_attr
(entity_id, attr_name)[source]¶ Removes the given attribute of the identified entity.
- @param entity_id: numeric identifier of the entity whose attribute
- to remove
@param attr_name: name of the attribute to remove
-
schedule_operation
(entity_id, operation, when=None, identity_type=None)[source]¶ Schedules an operation to be invoked at a given time on the identified entity. Allowed operations are: ‘REMOVE’ and ‘DISABLE’.
Important: This method requires a privileged user.
- @param entity_id: numeric identifier of the entity for which to
- schedule the operation.
- @param operation: operation to be scheduled. Allowed operations
- are: ‘REMOVE’ and ‘DISABLE’.
- @parm when: (optional) datetime when to invoke the operation
- (default is now). Naive datetime instances assume UTC time.
- @param identity_type: (optional) type of identity for which to
- schedule the operation.
-