mirror of
https://github.com/rclone/rclone
synced 2024-11-23 00:06:55 +01:00
drive: add --drive-impersonate for service accounts #1491
This commit is contained in:
parent
04a0a7406b
commit
8a25ca786c
@ -63,6 +63,7 @@ var (
|
||||
driveExtensions = flags.StringP("drive-formats", "", defaultExtensions, "Comma separated list of preferred formats for downloading Google docs.")
|
||||
driveUseCreatedDate = flags.BoolP("drive-use-created-date", "", false, "Use created date instead of modified date.")
|
||||
driveListChunk = flags.Int64P("drive-list-chunk", "", 1000, "Size of listing chunk 100-1000. 0 to disable.")
|
||||
driveImpersonate = flags.StringP("drive-impersonate", "", "", "Impersonate this user when using a service account.")
|
||||
// chunkSize is the size of the chunks created during a resumable upload and should be a power of two.
|
||||
// 1<<18 is the minimum size supported by the Google uploader, and there is no maximum.
|
||||
chunkSize = fs.SizeSuffix(8 * 1024 * 1024)
|
||||
@ -455,6 +456,9 @@ func getServiceAccountClient(keyJsonfilePath string) (*http.Client, error) {
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error processing credentials")
|
||||
}
|
||||
if *driveImpersonate != "" {
|
||||
conf.Subject = *driveImpersonate
|
||||
}
|
||||
ctxWithSpecialClient := oauthutil.Context(fshttp.NewClient(fs.Config))
|
||||
return oauth2.NewClient(ctxWithSpecialClient, conf.TokenSource(ctxWithSpecialClient)), nil
|
||||
}
|
||||
|
@ -343,6 +343,10 @@ Here are the possible extensions with their corresponding mime types.
|
||||
| xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | Microsoft Office Spreadsheet |
|
||||
| zip | application/zip | A ZIP file of HTML, Images CSS |
|
||||
|
||||
#### --drive-impersonate user ####
|
||||
|
||||
When using a service account, this instructs rclone to impersonate the user passed in.
|
||||
|
||||
#### --drive-list-chunk int ####
|
||||
|
||||
Size of listing chunk 100-1000. 0 to disable. (default 1000)
|
||||
|
Loading…
Reference in New Issue
Block a user