Fortinet black logo

Google Drive v1.0.0

1.0.0
Copy Link
Copy Doc ID c2d2373e-6ca4-11ed-96f0-fa163e15d75b:449

About the connector

Google drive connector helps list, add, remove, download, and upload files from Google Drive using your playbooks.

This document provides information about the Google Drive Connector, which facilitates automated interactions, with a Google Drive server using FortiSOAR™ playbooks. Add the Google Drive Connector as a step in FortiSOAR™ playbooks and perform automated operations with Google Drive.

Version information

Connector Version: 1.0.0

Authored By: Community

Certified: No

Accessing the Google Drive API

Your application needs to be both authenticated and authorized to access the Google Drive API. The REST APIs of Google Drive allow you to manage asynchronous service-to-service communication used in serverless and microservices architectures

The following configuration parameters are required to authenticate the Google Drive connector with the Google Drive API.

  • Client ID
  • Client Secret
  • Redirect URI

The following configuration parameter is required to authorize the Google Drive connector with the Google Drive API.

  • Authorization Code

You can get the authentication token to access the Google Drive APIs using the OAuth 2.0 method. For more information see, https://developers.google.com/identity/protocols/oauth2/web-server.

You can follow the steps below to secure the authentication and authorization codes used to access the Google Drive API:

  1. Ensure that you have created a PROJECT in Google Cloud Platform in the Web Application section so that you can get your CLIENT_ID, CLIENT_SECRET, and REDIRECT_URI, i.e., you must register your application with Google Drive. For more information see, https://developers.google.com/adwords/api/docs/guides/authentication#webapp.
  2. In the PROJECT, enable the Google Drive API in APIs and Services. For more information see, https://support.google.com/googleapi/answer/6158841?hl=en&ref_topic=7013279.
    Make a note of these authentication codes. In the Configurations tab of the connector, enter the authentication details in the following fields to authenticate the Google Drive connector with the Google Drive API.
    • In the Client ID field, enter the client ID
    • In the Client Secret field, enter the client secret
    • In the Redirect URL field, enter the redirect URI. By default, the redirect URI is set to https://localhost/myapp
      Now that you have the authentication codes, you can use them to generate the authorization code.
  3. Copy the following URL into a browser and replace the CLIENT_ID and REDIRECT_URI with the client ID and redirect URI that is generated at the time of registering the application:
    https://accounts.google.com/o/oauth2/v2/auth?scope=https://www.googleapis.com/auth/cloud-platform
    https://accounts.google.com/o/oauth2/v2/auth?scope=https://www.googleapis.com/auth/cloud-platform&access_type=offline&include_granted_scopes=true&response_type=code&state=state_parameter_passthrough_value&redirect_uri=REDIRECT_URI&client_id=CLIENT_ID
  4. Enter the link and you will be automatically redirected to a link with the following structure: REDIRECT_URI?state=STATE&code=AUTH_CODE&scope=SCOPE. Copy the AUTH_CODE (without the "code=" prefix), and in the Configurations tab of the connector, paste the AUTH_CODE in the Authorization Code field.

The process to access the Google Drive API is now complete. Google Drive API reference is available at: https://cloud.google.com/kms/docs/reference/rest.

Installing the connector

Use the Content Hub to install the connector. For the detailed procedure to install a connector, click here.

You can also use the following yum command as a root user to install connectors from an SSH session:
yum install cyops-connector-google-drive

Prerequisites to configuring the connector

  • You must have the URL of the Google Drive server to which you will connect and perform automated operations. You will also need the credentials to access the Google Drive API as specified in Configuration Parameters.
  • The FortiSOAR™ server should have outbound connectivity to port 443 on the Google Drive server.

Minimum Permissions Required

  • Not Applicable

Configuring the connector

For the procedure to configure a connector, click here

Configuration parameters

In FortiSOAR™, on the Connectors page, click the Google Drive connector row (if you are in the Grid view on the Connectors page) and in the Configurations tab enter the required configuration details:

Parameter Description
Server URL The service-based URL of the Google API server to which you will connect and perform the automated operations.
Client ID Unique ID of the Google Drive application that is used to create an authentication token required to access the API.
Client Secret Unique Client Secret of the Google application that is used to create an authentication token required to access the API. For information on how to get the secret key, see Using OAuth 2.0 for Web Server Applications.
Authorization Code The authorization code that you have acquired during the authorization step. For more information, see the Accessing the Google Drive API section.
Redirect URL The redirect_uri of your app, where you can send and receive the authentication responses. It must exactly match one of the redirect_uri you registered in the app registration portal.
Verify SSL Specifies whether the SSL certificate for the server is to be verified or not.
By default, this option is set to True.

Actions supported by the connector

The following automated operations can be included in playbooks and you can also use the annotations to access operations:

Function Description Annotation and Category
Get File List Gets a list of all the files in Google Drive based on the count of files you have specified. get_all_files
Investigation
Delete File Deletes a file from Google Drive based on the file ID you have specified. delete_file
Containment
Empty Trash Permanently deletes all of the user's files from the Trash folder. empty_trash
Containment
Upload File Uploads a file to Google Drive based on the attachment IRI you have specified. upload_file
Containment
Download File Downloads a file from Google Drive based on the file ID you have specified. It then creates a record in FortiSOAR's Attachments module. download_file
Containment

operation: Get File List

Input parameters

Parameter Description
Page Size Specify the number of files to display.

Output

The output contains the following populated JSON schema:
{
"kind": "",
"incompleteSearch": "",
"files": [
{
"kind": "",
"id": "",
"name": "",
"mimeType": ""
}
]
}

operation: Delete File

Input parameters

Parameter Description
File ID Specify the file ID of the file to delete from Google Drive. You can get the file ID from the Get File List operation. step.

Output

The output contains a non-dictionary value.

operation: Empty Trash

Input parameters

None.

Output

The output contains a non-dictionary value.

operation: Upload File

Input parameters

Parameter Description
Attachment IRI Specify the attachment IRI of the file to upload. The attachment IRI can be found in the Dynamic Values -> IRI Lookup.
New File Name Specify a name for the uploaded file. If left blank, it takes the filename associated with the specified attachment IRI.

Output

The output contains the following populated JSON schema:
{
"file_id": ""
}

operation: Download File

Input parameters

Parameter Description
File ID Specify the ID of the file to download from Google Drive. You can get the file ID from the Get File List operation.
Note: The file ID that you have specified for download must not have .folder appended in the mimeType.

Output

The output contains the following populated JSON schema:
{
"id": "",
"@id": "",
"file": {
"id": "",
"@id": "",
"size": "",
"uuid": "",
"@type": "",
"assignee": "",
"filename": "",
"metadata": [],
"mimeType": "",
"thumbnail": "",
"uploadDate": ""
},
"name": "",
"type": "",
"uuid": "",
"@type": "",
"tasks": [],
"alerts": [],
"assets": [],
"owners": [],
"people": [],
"@context": "",
"assignee": "",
"comments": [],
"warrooms": [],
"incidents": [],
"createDate": "",
"createUser": {
"id": "",
"@id": "",
"name": "",
"uuid": "",
"@type": "",
"avatar": "",
"userId": "",
"userType": "",
"createDate": "",
"createUser": "",
"modifyDate": "",
"modifyUser": ""
},
"indicators": [],
"modifyDate": "",
"modifyUser": {
"id": "",
"@id": "",
"name": "",
"uuid": "",
"@type": "",
"avatar": "",
"userId": "",
"userType": "",
"createDate": "",
"createUser": "",
"modifyDate": "",
"modifyUser": ""
},
"recordTags": [],
"userOwners": [],
"description": ""
}

Included playbooks

The Sample - Google Drive - 1.0.0 playbook collection comes bundled with the Google Drive connector. These playbooks contain steps using which you can perform all supported actions. You can see bundled playbooks in the Automation > Playbooks section in FortiSOAR™ after installing the Google Drive connector.

  • Delete File
  • Download File
  • Empty Trash
  • Get File List
  • Ingest Drive Files
  • Upload File

Note: If you are planning to use any of the sample playbooks in your environment, ensure that you clone those playbooks and move them to a different collection since the sample playbook collection gets deleted during connector upgrade and delete.

Previous
Next

About the connector

Google drive connector helps list, add, remove, download, and upload files from Google Drive using your playbooks.

This document provides information about the Google Drive Connector, which facilitates automated interactions, with a Google Drive server using FortiSOAR™ playbooks. Add the Google Drive Connector as a step in FortiSOAR™ playbooks and perform automated operations with Google Drive.

Version information

Connector Version: 1.0.0

Authored By: Community

Certified: No

Accessing the Google Drive API

Your application needs to be both authenticated and authorized to access the Google Drive API. The REST APIs of Google Drive allow you to manage asynchronous service-to-service communication used in serverless and microservices architectures

The following configuration parameters are required to authenticate the Google Drive connector with the Google Drive API.

The following configuration parameter is required to authorize the Google Drive connector with the Google Drive API.

You can get the authentication token to access the Google Drive APIs using the OAuth 2.0 method. For more information see, https://developers.google.com/identity/protocols/oauth2/web-server.

You can follow the steps below to secure the authentication and authorization codes used to access the Google Drive API:

  1. Ensure that you have created a PROJECT in Google Cloud Platform in the Web Application section so that you can get your CLIENT_ID, CLIENT_SECRET, and REDIRECT_URI, i.e., you must register your application with Google Drive. For more information see, https://developers.google.com/adwords/api/docs/guides/authentication#webapp.
  2. In the PROJECT, enable the Google Drive API in APIs and Services. For more information see, https://support.google.com/googleapi/answer/6158841?hl=en&ref_topic=7013279.
    Make a note of these authentication codes. In the Configurations tab of the connector, enter the authentication details in the following fields to authenticate the Google Drive connector with the Google Drive API.
    • In the Client ID field, enter the client ID
    • In the Client Secret field, enter the client secret
    • In the Redirect URL field, enter the redirect URI. By default, the redirect URI is set to https://localhost/myapp
      Now that you have the authentication codes, you can use them to generate the authorization code.
  3. Copy the following URL into a browser and replace the CLIENT_ID and REDIRECT_URI with the client ID and redirect URI that is generated at the time of registering the application:
    https://accounts.google.com/o/oauth2/v2/auth?scope=https://www.googleapis.com/auth/cloud-platform
    https://accounts.google.com/o/oauth2/v2/auth?scope=https://www.googleapis.com/auth/cloud-platform&access_type=offline&include_granted_scopes=true&response_type=code&state=state_parameter_passthrough_value&redirect_uri=REDIRECT_URI&client_id=CLIENT_ID
  4. Enter the link and you will be automatically redirected to a link with the following structure: REDIRECT_URI?state=STATE&code=AUTH_CODE&scope=SCOPE. Copy the AUTH_CODE (without the "code=" prefix), and in the Configurations tab of the connector, paste the AUTH_CODE in the Authorization Code field.

The process to access the Google Drive API is now complete. Google Drive API reference is available at: https://cloud.google.com/kms/docs/reference/rest.

Installing the connector

Use the Content Hub to install the connector. For the detailed procedure to install a connector, click here.

You can also use the following yum command as a root user to install connectors from an SSH session:
yum install cyops-connector-google-drive

Prerequisites to configuring the connector

Minimum Permissions Required

Configuring the connector

For the procedure to configure a connector, click here

Configuration parameters

In FortiSOAR™, on the Connectors page, click the Google Drive connector row (if you are in the Grid view on the Connectors page) and in the Configurations tab enter the required configuration details:

Parameter Description
Server URL The service-based URL of the Google API server to which you will connect and perform the automated operations.
Client ID Unique ID of the Google Drive application that is used to create an authentication token required to access the API.
Client Secret Unique Client Secret of the Google application that is used to create an authentication token required to access the API. For information on how to get the secret key, see Using OAuth 2.0 for Web Server Applications.
Authorization Code The authorization code that you have acquired during the authorization step. For more information, see the Accessing the Google Drive API section.
Redirect URL The redirect_uri of your app, where you can send and receive the authentication responses. It must exactly match one of the redirect_uri you registered in the app registration portal.
Verify SSL Specifies whether the SSL certificate for the server is to be verified or not.
By default, this option is set to True.

Actions supported by the connector

The following automated operations can be included in playbooks and you can also use the annotations to access operations:

Function Description Annotation and Category
Get File List Gets a list of all the files in Google Drive based on the count of files you have specified. get_all_files
Investigation
Delete File Deletes a file from Google Drive based on the file ID you have specified. delete_file
Containment
Empty Trash Permanently deletes all of the user's files from the Trash folder. empty_trash
Containment
Upload File Uploads a file to Google Drive based on the attachment IRI you have specified. upload_file
Containment
Download File Downloads a file from Google Drive based on the file ID you have specified. It then creates a record in FortiSOAR's Attachments module. download_file
Containment

operation: Get File List

Input parameters

Parameter Description
Page Size Specify the number of files to display.

Output

The output contains the following populated JSON schema:
{
"kind": "",
"incompleteSearch": "",
"files": [
{
"kind": "",
"id": "",
"name": "",
"mimeType": ""
}
]
}

operation: Delete File

Input parameters

Parameter Description
File ID Specify the file ID of the file to delete from Google Drive. You can get the file ID from the Get File List operation. step.

Output

The output contains a non-dictionary value.

operation: Empty Trash

Input parameters

None.

Output

The output contains a non-dictionary value.

operation: Upload File

Input parameters

Parameter Description
Attachment IRI Specify the attachment IRI of the file to upload. The attachment IRI can be found in the Dynamic Values -> IRI Lookup.
New File Name Specify a name for the uploaded file. If left blank, it takes the filename associated with the specified attachment IRI.

Output

The output contains the following populated JSON schema:
{
"file_id": ""
}

operation: Download File

Input parameters

Parameter Description
File ID Specify the ID of the file to download from Google Drive. You can get the file ID from the Get File List operation.
Note: The file ID that you have specified for download must not have .folder appended in the mimeType.

Output

The output contains the following populated JSON schema:
{
"id": "",
"@id": "",
"file": {
"id": "",
"@id": "",
"size": "",
"uuid": "",
"@type": "",
"assignee": "",
"filename": "",
"metadata": [],
"mimeType": "",
"thumbnail": "",
"uploadDate": ""
},
"name": "",
"type": "",
"uuid": "",
"@type": "",
"tasks": [],
"alerts": [],
"assets": [],
"owners": [],
"people": [],
"@context": "",
"assignee": "",
"comments": [],
"warrooms": [],
"incidents": [],
"createDate": "",
"createUser": {
"id": "",
"@id": "",
"name": "",
"uuid": "",
"@type": "",
"avatar": "",
"userId": "",
"userType": "",
"createDate": "",
"createUser": "",
"modifyDate": "",
"modifyUser": ""
},
"indicators": [],
"modifyDate": "",
"modifyUser": {
"id": "",
"@id": "",
"name": "",
"uuid": "",
"@type": "",
"avatar": "",
"userId": "",
"userType": "",
"createDate": "",
"createUser": "",
"modifyDate": "",
"modifyUser": ""
},
"recordTags": [],
"userOwners": [],
"description": ""
}

Included playbooks

The Sample - Google Drive - 1.0.0 playbook collection comes bundled with the Google Drive connector. These playbooks contain steps using which you can perform all supported actions. You can see bundled playbooks in the Automation > Playbooks section in FortiSOAR™ after installing the Google Drive connector.

Note: If you are planning to use any of the sample playbooks in your environment, ensure that you clone those playbooks and move them to a different collection since the sample playbook collection gets deleted during connector upgrade and delete.

Previous
Next