feat: Add table googleworkspace_activity_report Closes (#88)#89
feat: Add table googleworkspace_activity_report Closes (#88)#89
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new Steampipe table to query Google Workspace Admin Reports activity logs via the Reports API.
- Introduce
googleworkspace_admin_reports_activitytable definition and list logic - Add
ReportsServiceinservice.gowith the required Admin Reports scope - Register the new table in
plugin.goand update documentation
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| googleworkspace/table_googleworkspace_admin_reports_activity.go | New table definition, list function, and transform for events |
| googleworkspace/service.go | Added ReportsService and Admin Reports API scope |
| googleworkspace/plugin.go | Registered the new googleworkspace_admin_reports_activity table |
| docs/tables/googleworkspace_admin_reports_activity.md | Documentation for querying the new table |
| docs/index.md | Added Admin SDK API and scope to setup instructions |
Comments suppressed due to low confidence (2)
docs/tables/googleworkspace_admin_reports_activity.md:20
- The docs list optional quals but omit
customer_id, which is supported in the code. Please addcustomer_idto the optional qualifiers section.
- `actor_email`
googleworkspace/service.go:121
- [nitpick] Indentation uses spaces here instead of tabs, leading to inconsistent formatting. Align with the rest of the file using tabs.
serviceCacheKey := "googleworkspace.reports"
googleworkspace/table_googleworkspace_admin_reports_activity.go
Outdated
Show resolved
Hide resolved
googleworkspace/table_googleworkspace_admin_reports_activity.go
Outdated
Show resolved
Hide resolved
|
@ParthaI notes on table naming:
|
| | APIs | 1. Go to the [Google API Console](https://console.cloud.google.com/apis/dashboard). <br/> 2. Select the project that contains your credentials. <br/> 3. Click `Enable APIs and Services`. <br/> 4. Enable: `Google Calendar API`, `Google Drive API`, `Gmail API`, `Google People API`. | ||
| | Credentials | 1. To use **domain-wide delegation**, generate your [service account and credentials](https://developers.google.com/admin-sdk/directory/v1/guides/delegation#create_the_service_account_and_credentials) and [delegate domain-wide authority to your service account](https://developers.google.com/admin-sdk/directory/v1/guides/delegation#delegate_domain-wide_authority_to_your_service_account). Enter the following OAuth 2.0 scopes for the services that the service account can access:<br />`https://www.googleapis.com/auth/calendar.readonly`,<br />`https://www.googleapis.com/auth/contacts.readonly`,<br />`https://www.googleapis.com/auth/contacts.other.readonly`,<br />`https://www.googleapis.com/auth/directory.readonly`,<br />`https://www.googleapis.com/auth/drive.readonly`,<br />`https://www.googleapis.com/auth/gmail.readonly`<br />2. To use **OAuth client**, configure your [credentials](#authenticate-using-oauth-client). | | ||
| | APIs | 1. Go to the [Google API Console](https://console.cloud.google.com/apis/dashboard). <br/> 2. Select the project that contains your credentials. <br/> 3. Click `Enable APIs and Services`. <br/> 4. Enable: `Google Calendar API`, `Google Drive API`, `Gmail API`, `Google People API`, `Google Admin SDK API`. | ||
| | Credentials | 1. To use **domain-wide delegation**, generate your [service account and credentials](https://developers.google.com/admin-sdk/directory/v1/guides/delegation#create_the_service_account_and_credentials) and [delegate domain-wide authority to your service account](https://developers.google.com/admin-sdk/directory/v1/guides/delegation#delegate_domain-wide_authority_to_your_service_account). Enter the following OAuth 2.0 scopes for the services that the service account can access:<br />`https://www.googleapis.com/auth/admin.reports.audit.readonly`<br />`https://www.googleapis.com/auth/calendar.readonly`,<br />`https://www.googleapis.com/auth/contacts.readonly`,<br />`https://www.googleapis.com/auth/contacts.other.readonly`,<br />`https://www.googleapis.com/auth/directory.readonly`,<br />`https://www.googleapis.com/auth/drive.readonly`,<br />`https://www.googleapis.com/auth/gmail.readonly`<br />2. To use **OAuth client**, configure your [credentials](#authenticate-using-oauth-client). | |
There was a problem hiding this comment.
Are the admin permissions required for other tables? Should we add it specifically to the doc page of the googleworkspace_activity_report table?
There was a problem hiding this comment.
The index.md file serves as general documentation for the entire plugin, rather than for a specific table. Therefore, it makes sense to list all the required scopes there to provide a complete overview. That said, we’ve also included a note about the required scope in the specific table documentation for googleworkspace_activity_report to ensure clarity for users reviewing that page.
Example query results
Results