Objects

class Objects(api)

Bases: FeatureBase

clear(obj, attributes)

Clears attributes from an object.

Parameters
  • obj (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the object.

  • attributes (Union[dict, List[str]]) –

    Two types are supported:

    • list of attribute names to be cleared entirely.

    • dict whose keys are attribute names and whose values are the values to be cleared from the attribute. If the attribute is left empty it is cleared.

exists(object_dn=None)
Parameters

object_dn (str) – The Distinguished Name (DN) of the object.

Returns

True if object_dn exist, else False.

Return type

bool

find_policy(obj, class_name, attribute_name)

Find the folder that defines the policy attribute of the class_name on a given object.

Parameters
Returns

A tuple of

  • A Distinguished Name (DN) of the folder implementing the policy.

  • A list of attribute values.

  • True if the policy value is locked, else False.

Return type

Tuple[str, List[str], bool]

get(object_dn=None, object_guid=None, raise_error_if_not_exists=True)

One of object_dn or object_guid is required.

Parameters
  • object_dn (str) – Distinguished Name (DN) of the object.

  • object_guid (str) – GUID of the object.

  • raise_error_if_not_exists (bool) – If True raise an exception if the object doesn’t exist.

Returns

Config Object of the object.

read(obj, attribute_name, include_policy_values=False, timeout=10)
Parameters
  • obj (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the object.

  • attribute_name (str) – The attribute name.

  • include_policy_values (bool) – If True, the effective value(s) are returned. Otherwise only values explicitly assigned to the object are returned.

  • timeout (int) – Read timeout in seconds.

Returns

An AttributeValue object with these properties

  • values (List[str]) - List of attribute values.

  • locked (bool) - True if the value is locked by policy.

read_all(obj)
Parameters

obj (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the object.

Returns

List of NameValues where the

  • name is the attribute name.

  • values is the list of attribute values.

rename(obj, new_object_dn)

Note

This method can be used to rename objects and move their location.

Parameters
update(obj, attributes)

Updates attributes on an object. If the attribute is locked TPP will simply ignore the request.

Parameters
wait_for(obj, attribute_name, attribute_value, include_policy_values=False, timeout=10)

Waits for the attribute_name to have the attribute_value on the object within the timeout period. A TimeoutError is raised if the attribute_name does not have the attribute_value.

Parameters
  • obj (Union[config.Object, str]) – Config Object or Distinguished Name (DN) of the object.

  • attribute_name (str) – The name of the attribute.

  • attribute_value (str) – The expected value to the attribute_name.

  • include_policy_values (bool) – If True, the effective value(s) are returned. Otherwise only values explicitly assigned to the object are returned.

  • timeout (int) – Timeout period in seconds.

Returns

An AttributeValue object with these properties

  • values (List[str]) - List of attribute values.

  • locked (bool) - True if the value is locked by policy.

write(obj, attributes)

Writes new attributes on an object. If the attribute is locked TPP will simply ignore the request.

Parameters