Google Cloud Storage
The Carbon Connect enabledIntegrations
value for Google Cloud Storage is GOOGLE_CLOUD_STORAGE
.
Authorization Type
Carbon uses OAuth 2.0 to connect to Google Cloud Storages buckets.
Authorization Flow
Log into your Google Drive account to provide access to your Google Cloud Storage buckets. Once you’ve successfully authenticated your account, you can select files and folders directly.
Via Carbon Connect: Optionally you can input the credentials directly via the Carbon Connect component.
Configuration
Custom OAuth Credentials
- Go to
APIs and Services
>Enabled APIs and Services
in your Google Cloud console, then click on the button titledENABLE APIS AND SERVICES
and enableCloud Resource Manager API
(cloudresourcemanager.googleapis.com). - Then create an
OAuth Client ID
in theCredentials section
underCloud Resource Manager API
. SelectWeb Application
as the Application type and give it an identifiable name for your reference.
- Add https://api.carbon.ai as the
Authorized JS origin
and https://api.carbon.ai/integrations/gcs as anAuthorized redirect URI
. You can also opt to use a custom CNAME record pointing to https://api.carbon.ai for theAuthorized JS Origin
andAuthorized redirect URI
. However, for theAuthorized redirect URI
the domain paths must still be/integrations/google
.
- Save the credentials. Download the credentials.json file once you save the OAuth Client ID data and share the file with Carbon.
- Configure your consent screen in the OAuth Consent Screen. Provide your App name, support email address, and brand logo. Add carbon.ai (or your custom CNAME) to
Authorized domain
.
-
Click on
Add or Remove Scopes
button to add the following scopes:auth/userinfo.profile
,auth/userinfo.email
,auth/devstorage.read_only
. -
If you wish to add test users, you can do so. These users will not see the “App is unverified” notification. Other users will see this alert.
-
Click
Publish App
to make this app available to your end-users.
Synchronization
You can synchronize buckets, folders, and files GCS using the following steps:
Sync a User’s GCS Account
- Use the
/integrations/items/sync
endpoint to synchronize a user’s GCS account.
List All Items from a User’s GCS Account
- Retrieve a list of all items (buckets and files) from a user’s GCS account by utilizing the
/integrations/items/list
endpoint.
Specify Specific Files to Sync
- Employ the
/integrations/files/sync
endpoint to specify and synchronize specific files.
You can also use the resync_file
API endpoint to programmatically resync specific GCS files. To delete GCS files from Carbon, you can use the delete_file
endpoint directly.
To sync GCS files on a 24-hour schedule (more frequent schedules available upon request), you can use the /update_users
endpoint. This endpoint allows organizations to customize syncing settings according to their requirements, with the option to enable syncing for all data sources using the string ‘ALL’. It’s important to note that each request supports up to 100 customer IDs.
Here’s an example illustrating how to automatically enable syncing for updated GCS content for specified users: