For this exercise, we’re going to integrate FAS with Google Drive. This starts off with establishing a Google Workspace and then enabling APIs, creating a service account and setting the API scopes. Let’s take a look!
To index Google Drive with FAS, your organization needs to subscribe to a Google Workspace. For this exercise, I chose the starter package at $6 per user/month. I’m going for just the 14 day trial ultimately.
Log into the admin console for your Google Workspace. In my case, I created a workspace and associated my personal domain with interneatz.com, a domain I own. Pjohnson.fas@interneatz.com is my main account.
In Google admin, just to note, you associate your domain with your subscription:
The domain verification is done with a custom TXT DNS resource record that you add to your domains DNS records.
OK GREAT! Now we have a workspace associated with a domain. We can log in with the user and head to their Google Drive or create new users (keeping in mind each one is $6 user/month with this plan …).
If you can’t log into Google Drive with the account you created to establish the Google Workspace subscription, you’ll need to turn on the Drive and Docks App.
So, get on with it, go over to Google Drive and upload some files. I uploaded some random stuff to my Google Drive as seen here.
Now we need to head over to Google Cloud Platform and setup a project with the Google Drive API enabled that we can associate a service account with. https://console.cloud.google.com
Hit the drop down at the top to create a new Project. I already have one called “My First Project”, I’ll create a new one though.
I called this one, “My Second Project” and made sure the organization associated was the domain from my Workspace I created earlier.
When it completes, make sure you are now selected into the project you just created. Then on the left menu, go to “APIs & Services” > “Dashboard”. We need to enable the Google Drive API for this project first …
Click on the “+ ENABLE APIS AND SERVICES” button
Search for Google Drive and then click on it in the results.
Go on, click on the Enable button!
Once enabled, it should automatically redirect you to the API page. We want to get back to the project main page though and create a service account now. Head back to the project, “My Second Project” in my case …
We want to create a service account under “APIs & Services” > “Credentials”
Click on the “+ CREATE CREDENTIALS” button and select “Service account”
Give the Service account a useful name and click on “CREATE AND CONTINUE”
Click Done. We now have a Service Account established. Click on the Edit button for that service account.
We need to set the account for Domain-Wide Delegation. To do this, expand out the “SHOW DOMAIN-WIDE DELEGATION” dropdown and select the option to “Enable Google Workspace Domain-wide Delegation”
Press Save to commit the setting. We need need to generate a service account key and download it as JSON. Click on “KEYS” in the top menu of the service account.
Copy the Unique ID value and save it out to notepad. You'll need this later when setting your API scope.
Click on “ADD KEY” and select “Create new key”
Make sure the key type is select as JSON and click on CREATE.
It will automatically download the JSON. Your browser probably let you know, but if not, go into your downloads directory and you’ll have it there.
We now need to set the API scopes for this service account. This is done in the G Suite admin console. https://admin.google.com
In the admin console click on Security
Scroll down and click on API Controls
Then click on “MANAGE DOMAIN WIDE DELEGATION”
Click on Add New
Add the Client ID you took down earlier and then add the following two scopes to it.
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/admin.directory.user
Like the following:
Log into FAS and go to Connect > Repositories > Manage Repositories
Click on New Repository and provide it a name representing your Google Drive. Make sure to select the repository type of Google Drive and use the Cloud Cluster.
On the next screen, I chose to index metadata and content.
On the Credentials screen, provide the name you used for the Google API project as well as the user account you worked with and upload the JSON file that was generated when you created the service account key.
Go through the remainder of the new repository setup as needed to select your grammars, entities, scheduling, etc.
I chose not to enable scheduling as I only want to index this Google Drive one time.
Now, click on the update menu option for the new repository to have it initiate an index of the Google Drive and …. cross your fingers. 😊
You can hop over to the Agent Activity window to see whether it’s processing properly or not. The task status should start off with “Pending” and then you should see a tracker bar in the Task Status.
It’s alive!!
And it completed!
Let’s take a look at the Data Volume for this repository.
Heading over to the Analyze section of FAS, we can search and filter down to that Google Drive repository.
There you have it! Enjoy!