grove.connectors.gsuite package

Google GSuite connectors for Grove.

Submodules

grove.connectors.gsuite.activities module

Google GSuite Activities connector for Grove.

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

Bases: BaseConnector

LOG_ORDER = 'REVERSE_CHRONOLOGICAL'
NAME = 'gsuite_activities'
POINTER_PATH = 'id.time'
collect()[source]

Collects activities from the Google GSuite Reports API.

As the Google APIs use OAuth 2.0 2LO (‘two-legged OAuth’) which contains a number of fields inside of a JSON ‘service account file’ the key and identity are treated a little differently in this connector.

Rather than the key being a single authentication token, the key should contain the entire ‘service account file’ in JSON format - as generated by the Google API console.

The identity must be the name of a service account which has been granted domain wide delegation. Please see the following guides for more information:

Raises:

RequestFailedException – An HTTP request failed.

property delay

Defines the amount of time to delay collection of logs (in minutes).

This is used to allow time for logs to become ‘consistent’ before they are collected. Google backfill log entries based on their published lag guidelines. As a result of this, collection of events within this lag window may result in missed events.

As a result of these constraints, this value is configurable to allow operators to preference consistency over speed of delivery, and vice versa. For example, a delay of 20 would instruct Grove to only collect logs after they are at least 20 minutes old.

This defaults to 0 (no delay).

Returns:

The “delay” component of the connector configuration.

get_credentials()[source]

Generates and returns a credentials instance from the connector’s configured service account info. This is used for required to perform operations using the Google API client.

Returns:

A credentials instance built from configured service account info.

Raises:

ConfigurationException – There is an issue with the configuration for this connector.

get_http_transport()[source]

Creates an HTTP object for use by the Google API Client.

Returns:

An httplib2.Http object for use with the Google API client.

grove.connectors.gsuite.activities.as_rfc3339(date: datetime) str[source]

Formats an input date into RFC3339 format.

Parameters:

date – The input datetime object to convert to RFC3339 format.

Returns:

An RFC 3339 format date as a string.

grove.connectors.gsuite.alerts module

Google GSuite Alerts connector for Grove.

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

Bases: BaseConnector

LOG_ORDER = 'CHRONOLOGICAL'
NAME = 'gsuite_alerts'
POINTER_PATH = 'createTime'
collect()[source]

Collects all alerts from the Google GSuite Alerts API.

As the Google APIs use OAuth 2.0 2LO (‘two-legged OAuth’) which contains a number of fields inside of a JSON ‘service account file’ the key and identity are treated a little differently in this connector.

Rather than the key being a single authentication token, the key should contain the entire ‘service account file’ in JSON format - as generated by the Google API console.

The identity must be the name of a service account which has been granted domain wide delegation. Please see the following guides for more information:

Raises:

RequestFailedException – An HTTP request failed.

get_credentials()[source]

Generates and returns a credentials instance from the connector’s configured service account info. This is used for required to perform operations using the Google API client.

Returns:

A credentials instance built from configured service account info.

Raises:

ConfigurationException – There is an issue with the configuration for this connector.

get_http_transport()[source]

Creates an HTTP object for use by the Google API Client.

Returns:

An httplib2.Http object for use with the Google API client.