AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Google scheduler api8/6/2023 ![]() access_secret_version ( name ) payload = response. secret_version_path ( project_id, secret_id, version_id ) response = self. _key_path ) def access_secret_version ( self, project_id, secret_id, version_id ): name = self. _key_location_file + '/key_location.json', 'r' ) as json_file : self. dirname ( _file_ ), 'key' )) with open ( self. WARNING: Do not output the secret in a production environment, or expose this outside your machine.įrom google.cloud import secretmanager_v1beta1 as secretmanager import os import json class getKey : def _init_ ( self ): self. To call it locally, the script below can be used. Once created your secret will have a Resource ID in the form of: Then either upload from a file or paste the token directly into the box. Click Create Secret and call it a suitable name. Secret Manager can be found under the Security tab. ![]() With Secret Manager, you can upload your token safely, and call it when required Here, we use Google’s Secret Manager, which is currently in Beta testing. Keep the token key safe for now, as we need it to call the API.Īs the token is a gateway to GitHub, by-passing your password, it is important to keep it safe and not expose it directly in a function. Testing Locally GitHub Personal Access Tokenįor this to work you need to create a GitHub Personal Access Token ⧉ that has permissions to call the GitHub API. Also, Cloud Functions is a little picky, don’t stress, it took me over 20 versions to get my function running properly. ![]() Both are similar, except the GitHub API credentials are called slightly differently. Then I will show you how to deploy it on GCP. This data then feeds into a Dash application that Campus colleagues can use.īelow, I will initially show you how to do this locally. Here, I will show you how we do use Google Cloud Platform’s Cloud Functions, Cloud Scheduler, and Secret Manager to do this automatically, every week. In a previous post I discussed how the Campus uses the information we put on GitHub to create Key Performance Indicators ⧉.
0 Comments
Read More
Leave a Reply. |