GSuite Admin API Exporter
Project description
GSuite Exporter
This package handles exporting data from the GSuite Admin APIs to a destination.
The following GSuite Admin APIs are currently supported:
reports_v1
- Reports APIadmin
- Admin activity reportsdrive
- Google Drive activity reportslogin
- Login activity reportsmobile
- Mobile activity reportstoken
- Authorization Token activity reports
The following destinations are currently supported:
Requirements
- A GSuite Admin account
- A service account with:
- GSuite domain-wide delegation enabled.
- The IAM role
roles/iam.tokenCreator
granted to the service account on the project it was created in.
- On the service account's project:
- Enable the
Identity and Access Management (IAM) API
.
- Enable the
- On the destination project:
- Enable the
Admin Reports API
.
- Enable the
Collectors
To collect data from the Admin SDK APIs, you need to grant extra permissions to your service account:
- Go to your Admin Console and login with your GSuite administrator account
- Navigate to
Security > Advanced Settings > Manage API client access
- Grant the following scopes (comma-separated) to your service account's
client_id
:
Exporters
Stackdriver Logging
To use the Stackdriver Logging exporter, you need to grant extra IAM roles to your service account:
roles/logging.viewer
on the destination projectroles/logging.logWriter
on the destination project
Installation
pip install gsuite-exporter
Usage
The GSuite Exporter can be used either using the command-line interface or as a Python library.
Using the CLI
An example sync from the Admin Reports API to Stackdriver Logging for the 'login' application looks like:
gsuite-exporter
--credentials-path='/path/to/service/account/credentials.json'
--admin-user='<your_gsuite_admin>@<your_domain>'
--api='report_v1'
--applications='login drive token'
--project-id='<logging_project>'
--exporter='stackdriver_exporter.StackdriverExporter'
The credentials_path
variable is optional and you can use Application Default Credentials instead.
Using as a library
An example sync from the Admin Reports API to Stackdriver Logging looks like:
from gsuite_exporter.cli import sync_all
sync_all(
credentials_path=/path/to/service/account/credentials.json,
admin_user='<user>@<domain>',
api='reports_v1',
applications=['login', 'drive', 'token'],
project_id='<project-id>',
exporter_class='stackdriver_exporter.StackdriverExporter'
)
More examples are available using the library functions under the examples/ directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gsuite_exporter-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7196b232675308c17a083006627f0320c2504d120a75c70b14b0f47f0d11afe |
|
MD5 | cd0815f48fcc573c7ef3d27a95b151ea |
|
BLAKE2b-256 | 90eb4ce3e1d22796882b5e7e298f0119a4df3c683b8b7234875649be02b054cc |