Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anderseknert/opa-google-calendar
Example integration of OPA using Google Calendar as a datasource
https://github.com/anderseknert/opa-google-calendar
Last synced: 20 days ago
JSON representation
Example integration of OPA using Google Calendar as a datasource
- Host: GitHub
- URL: https://github.com/anderseknert/opa-google-calendar
- Owner: anderseknert
- License: apache-2.0
- Created: 2021-09-16T08:33:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-09T13:30:37.000Z (over 3 years ago)
- Last Synced: 2025-01-19T22:43:50.476Z (25 days ago)
- Language: Open Policy Agent
- Size: 17.6 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-opa - Google Calendar - Integrating OPA with the Google Calendar API (Datasource Integrations / Blogs and Articles)
README
# OPA Google Calendar Integration
Companion code for the [Styra blog](https://blog.styra.com/blog/the-power-of-data-calendar-based-policy-enforcement) on integrating OPA with the Google Calendar API as a datasource.
## Extract events from Google Calendar
* Create a GCP service account. You do not need to change any defaults.
* In your service account settings, click "Keys" and "New key". Download the credentials file.
* Export the service account email as an env variable: `export [email protected]`
* Export the private key as an env variable: `export SIGNING_KEY=$(cat credentials.json | jq -r .private_key)`
* In Google Calendar, click the calendar you want to use and choose "Settings and sharing".
* From the menu to the left, click "Share with specific people". Add the service account e-mail address.
* From the menu to the left, click "Integrate calendar". Copy the Calendar ID value.
* Export the calendar ID: `export CALENDAR_ID=`
* Extract events and save to file: `opa eval --format raw --data events.rego data.google.calendar > calendar.json`## Resources
* [Google Calendar v3 API reference](https://developers.google.com/calendar/api/v3/reference)
* [Event Resource Description](https://developers.google.com/calendar/api/v3/reference/events)
* [Temporal OPA](https://github.com/mhausenblas/temporal-opa)