ResourceEdit

class activelogic.ResourceEdit

This is the resource that governs the resource management of an ActiveLogic system.

async ResourceEdit.list(cls)

Generic list function for all kind of data that belongs to this resource.

Parameters:

cls – Object type that determines what kind of data to get.

Returns:

A list of given dataclass type.

Raises:
  • ValueError – Invalid dataclass type.

  • PLDBNewDataCommitted – Conflict with new data committed by an other session.

The following data can be listed from this resource:

  • ResourceProperty: Lists current status of all resources.

>>> re.list(ResourceProperty)
[ResourceProperty(id=1, name='Rules & Object Configuration', locker='admin@192.168.1.1', status='Ready'), ...]
class activelogic.ResourceMode

Defines mode of a resource:

Variables:
  • LOCAL – Resource is local.

  • PROXY – Resource is proxied.

class activelogic.ResourceProperty

Object that represents properties of a resource

Parameters:
  • id (int) – The ID of the resource.

  • name (str) – Name of the resource.

  • locker (str) – Details about who locked the resource (‘admin@192.168.1.1’).

  • status (str) – The status of the resource.

  • proxyaddress (str) – The address of the proxy ActiveLogic system if the mode of the resource is set to proxy.

  • proxyuser (str) – The user of the proxy ActiveLogic system if the mode of the resource is set to proxy.

  • proxypassword (str) – The password of the proxy ActiveLogic system if the mode of the resource is set to proxy.

  • mode (ResourceMode) – Determines if the resource is local or proxied.

  • last_query (str) – The last query entry for the resource.

  • avg_query_time (int) – Avarage query time in ms.

  • queries (int) – Number of queries executed.

async ResourceEdit.force_unlock(resource)

Break the lock of a locked resource.

Parameters:

resource (Resource or int) – A resource class or resource ID.

Raises:
  • TypeError – Invalid resource.

  • TypeError – Invalid resource ID.

>>> re = conn.resource_edit()
>>> re.force_unlock(SysDiag)
>>> sd = conn.sysdiag()
async ResourceEdit.update_resource(resource, mode=None, proxyaddress=None, proxyuser=None, proxypassword=None)

Configure proxy of a resource.

Parameters:
  • resource (Resource or int) – A resource class or resource ID.

  • mode (ResourceMode) – Determines mode of the resource (LOCAL, PROXY).

  • proxyaddress (str) – The address of the proxy ActiveLogic system if the mode of the resource is set to PROXY.

  • proxyuser (str) – The user of the proxy ActiveLogic system if the mode of the resource is set to PROXY.

  • proxypassword (str) – The password of the proxy ActiveLogic system if the mode of the resource is set to PROXY.

Raises:
  • TypeError – Invalid resource.

  • TypeError – Invalid resource ID.

  • PLDBError – Proxy isn’t allowed on resource.

Resources can be updated either by passing the resource class:

>>> re = conn.resource_edit()
>>> re.update_resource(SysDiag, ResourceMode.PROXY, '127.0.1.2', 'admin', 'password')

or the resource ID:

>>> re = conn.resource_edit()
>>> re.update_resource(7, ResourceMode.PROXY, '127.0.1.2', 'admin', 'password')