grove.connectors.torq package

Torq connectors for Grove.

Submodules

grove.connectors.torq.activity_logs module

Torq activity log connector for Grove.

class grove.connectors.torq.activity_logs.Connector(config: ConnectorConfig, context: Dict[str, str])[source]

Bases: BaseConnector

LOG_ORDER = 'REVERSE_CHRONOLOGICAL'
NAME = 'torq_activity_logs'
POINTER_PATH = 'event.timestamp'
collect()[source]

Collects all activity logs from the Torq API.

This will first check whether there are any pointers cached to indicate previous collections. If not, a 7 day look-back of data will be collected.

grove.connectors.torq.api module

Torq API client.

class grove.connectors.torq.api.Client(base_url: str | None = 'https://api.torq.io/public', identity: str | None = None, key: str | None = None, bearer_token: str | None = None, retry: bool | None = True)[source]

Bases: object

get_activity_logs(start_time: str | None = None, cursor: str | None = None) AuditLogEntries[source]

Fetches a list of activity logs from Torq which match the provided filters.

Parameters:
  • start_time – The required date and time of the earliest log entry. Start times are in RFC 3339 format, for example, 2022-03-09T08:40:18.490771179Z.

  • to_date – The required date and time in UTC of the latest log entry.

  • cursor – The cursor to use when paging.

Returns:

AuditLogEntries object containing a pagination cursor, and log entries.

get_audit_logs(start_time: str | None = None, cursor: str | None = None) AuditLogEntries[source]

Fetches a list of audit logs from Torq which match the provided filters.

Parameters:
  • start_time – The required date and time of the earliest log entry. Start times are in RFC 3339 format, for example, 2022-03-09T08:40:18.490771179Z.

  • to_date – The required date and time in UTC of the latest log entry.

  • cursor – The cursor to use when paging.

Returns:

AuditLogEntries object containing a pagination cursor, and log entries.

get_logs(endpoint: str, result_field: str, start_time: str | None = None, limit: int | None = 100, cursor: str | None = None) AuditLogEntries[source]

Fetches a list of logs from Torq which match the provided filters.

Parameters:
  • start_time – The required date and time of the earliest log entry. Start times are in RFC3339 format, for example, 2022-03-09T08:40:18.490771179Z.

  • result_field – The key name for the list of logs in the returned json.

  • to_date – The required date and time in UTC of the latest log entry.

  • limit – The maximum number of items to include in a single response.

  • cursor – The cursor to use when paging.

Returns:

AuditLogEntries object containing a pagination cursor, and log entries.

refresh_bearer_token()[source]

Use Basic Auth to get Bearer Token

Returns:

If the request is successful, the bearer token is returned to the Client class header.

grove.connectors.torq.audit_logs module

Torq audit log connector for Grove.

class grove.connectors.torq.audit_logs.Connector(config: ConnectorConfig, context: Dict[str, str])[source]

Bases: BaseConnector

LOG_ORDER = 'REVERSE_CHRONOLOGICAL'
NAME = 'torq_audit_logs'
POINTER_PATH = 'timestamp'
collect()[source]

Collects all audit logs from the Torq API.

This will first check whether there are any pointers cached to indicate previous collections. If not, a 7 day look-back of data will be collected.