Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(services/gdrive): Support shared drives in Google Drive API integration #4591

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

keanji-x
Copy link

@keanji-x keanji-x commented May 10, 2024

close #4576

This PR introduces the capability to work with shared drives in our Google Drive API integration by handling the driveId parameter. This change enables users to specify a shared drive ID that will be used in API requests, allowing operations to be performed on shared drives.

Changes:

  • Added drive_id field to GdriveConfig to store the ID of the shared drive.
  • Implemented drive_id setter method in GdriveBuilder to allow the passing of the drive ID during configuration.
  • Modified GdriveCore to append the drive_id to the URL query parameters if present, also enabling support for all drives with supportsAllDrives=true.

Documentation Reference:
For more information on enabling shared drives, see the official Google documentation: Enabling Shared Drives

Impact:
This enhancement allows our application to interact not just with user-specific drives but also with shared drives, broadening our application's scope in collaborative environments.

@Xuanwo
Copy link
Member

Xuanwo commented May 10, 2024

Thanks a lot for sending this PR!

We don't have the environment to test this change. Would you like to perform the integration tests locally and post the results?

The docs can be found at: https://github.com/apache/opendal/tree/main/core/tests/behavior.

Our CI scripts are at

- name: Setup Test Core
uses: ./.github/services/${{ inputs.service }}/${{ inputs.setup }}
- name: Run Test Core
shell: bash
working-directory: core
run: cargo test behavior --features tests,${{ inputs.feature }}
env:
OPENDAL_TEST: ${{ inputs.service }}

@keanji-x
Copy link
Author

Thanks a lot for sending this PR!

We don't have the environment to test this change. Would you like to perform the integration tests locally and post the results?

The docs can be found at: https://github.com/apache/opendal/tree/main/core/tests/behavior.

Our CI scripts are at

- name: Setup Test Core
uses: ./.github/services/${{ inputs.service }}/${{ inputs.setup }}
- name: Run Test Core
shell: bash
working-directory: core
run: cargo test behavior --features tests,${{ inputs.feature }}
env:
OPENDAL_TEST: ${{ inputs.service }}

I apologize for the inconvenience, but unfortunately I also don't have access to a Google Shared Drive environment as it requires a business subscription. Is there any way you could provide some assistance or suggest an alternative solution?

@davidmathers
Copy link

I can run the tests, once I figure out how to do it correctly

I created the .env file and set the values for gdrive, but when I ran the test I got the "scheme is not enabled or supported" error

@Xuanwo
Copy link
Member

Xuanwo commented Jul 11, 2024

I created the .env file and set the values for gdrive, but when I ran the test I got the "scheme is not enabled or supported" error

Hi, please try OPENDAL_TEST=gdrive cargo test behavior --features tests,services-gdrive

@davidmathers
Copy link

That worked. But, the tests are running on "My Drive" and not on the shared drive

I did add a new variable to .env named OPENDAL_GDRIVE_DRIVE_ID with the id of a shared drive

@Xuanwo
Copy link
Member

Xuanwo commented Jul 11, 2024

I did add a new variable to .env named OPENDAL_GDRIVE_DRIVE_ID with the id of a shared drive

I got it. So it doesn't work if we only change the gdrive_list API. Do you have interest to continue the work?

@davidmathers
Copy link

  1. Previously, I was on the wrong branch when I ran the test
  2. Running on the correct branch: the test failed. Google returned this error message: The includeItemsFromAllDrives parameter must be set to true when driveId is specified or corpora contains drive or allDrives.
  3. I see now that it's only enabled on list, so that won't work. It would need to be enabled on all of the functions
  4. I'm not a rust programmer, but I may try to figure this out if I get some free time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable Gdrive shared drives
3 participants