検索

このコンテンツは選択した言語では利用できません。

Chapter 52. GoogleDrive

download PDF

GoogleDrive Component

Available as of Camel 2.14
The Google Drive component provides access to the Google Drive file storage service via the Google Drive Web APIs.
Google Drive uses the OAuth 2.0 protocol for authenticating a Google account and authorizing access to user data. Before you can use this component, you will need to create an account and generate OAuth credentials. Credentials comprise of a clientId, clientSecret, and a refreshToken. A handy resource for generating a long-lived refreshToken is the OAuth playground.
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-google-drive</artifactId>
        <version>2.14-SNAPSHOT</version>
</dependency>

URI Format

The GoogleDrive Component uses the following URI format:
google-drive://endpoint-prefix/endpoint?[options]
Endpoint prefix can be one of:
  • drive-about
  • drive-apps
  • drive-changes
  • drive-channels
  • drive-children
  • drive-comments
  • drive-files
  • drive-parents
  • drive-permissions
  • drive-properties
  • drive-realtime
  • drive-replies
  • drive-revisions

GoogleDriveComponent

The GoogleDrive Component can be configured with the options below. These options can be provided using the component's bean property configuration of type org.apache.camel.component.google.drive.GoogleDriveConfiguration.
Option Type Description
accessToken String OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage.
applicationName String Google drive application name. Example would be camel-google-drive/1.0.
clientId String Client ID of the drive application
clientSecret String Client secret of the drive application
refreshToken
String
OAuth 2 refresh token. Using this, the Google Drive component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived.
scopes List<String> Specifies the level of permissions you want a drive application to have to a user account. See https://developers.google.com/drive/web/scopes for more info.

Producer Endpoints

Producer endpoints can use endpoint prefixes followed by endpoint names and associated options described next. A shorthand alias can be used for some endpoints. The endpoint URI MUST contain a prefix.
Endpoint options that are not mandatory are denoted by []. When there are no mandatory options for an endpoint, one of the set of [] options MUST be provided. Producer endpoints can also use a special option inBody that in turn should contain the name of the endpoint option whose value will be contained in the Camel Exchange In message.
Any of the endpoint options can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.<option>. Note that the inBody option overrides message header, i.e. the endpoint option inBody=option would override a CamelGoogleDrive.option header.
For more information on the endpoints and options see API documentation at: https://developers.google.com/drive/v2/reference/

1. Endpoint Prefix drive-about

The following endpoints can be invoked with the prefix drive-about as follows:
google-drive://drive-about/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
get com.google.api.services.drive.model.About

URI Options for drive-about

Name Type

2. Endpoint Prefix drive-apps

The following endpoints can be invoked with the prefix drive-apps as follows:
google-drive://drive-apps/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
get appId com.google.api.services.drive.model.App
list com.google.api.services.drive.model.AppList

URI Options for drive-apps

Name Type
appId String

3. Endpoint Prefix drive-changes

The following endpoints can be invoked with the prefix drive-changes as follows:
        google-drive://drive-changes/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
get changeId com.google.api.services.drive.model.Change
list com.google.api.services.drive.model.ChangeList
watch contentChannel com.google.api.services.drive.model.Channel

URI Options for drive-changes

Name Type
changeId String
contentChannel com.google.api.services.drive.model.Channel

4. Endpoint Prefix drive-channels

The following endpoints can be invoked with the prefix drive-channels as follows:
google-drive://drive-channels/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
stop contentChannel

URI Options for drive-channels

Name Type
contentChannel com.google.api.services.drive.model.Channel

5. Endpoint Prefix drive-children

The following endpoints can be invoked with the prefix drive-children as follows:
google-drive://drive-children/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
delete childId, folderId
get childId, folderId com.google.api.services.drive.model.ChildReference
insert content, folderId com.google.api.services.drive.model.ChildReference
list folderId com.google.api.services.drive.model.ChildList

URI Options for drive-children

Name Type
childId String
content com.google.api.services.drive.model.ChildReference
folderId String

6. Endpoint Prefix drive-comments

The following endpoints can be invoked with the prefix drive-comments as follows:
google-drive://drive-comments/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
delete commentId, fileId
get commentId, fileId com.google.api.services.drive.model.Comment
insert content, fileId com.google.api.services.drive.model.Comment
list fileId com.google.api.services.drive.model.CommentList
patch commentId, content, fileId com.google.api.services.drive.model.Comment
update commentId, content, fileId com.google.api.services.drive.model.Comment

URI Options for drive-comments

Name Type
commentId String
content com.google.api.services.drive.model.Comment
fileId String

7. Endpoint Prefix drive-files

The following endpoints can be invoked with the prefix drive-files as follows:
google-drive://drive-files/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
copy content, fileId com.google.api.services.drive.model.File
delete fileId
get fileId com.google.api.services.drive.model.File
insert [mediaContent], content com.google.api.services.drive.model.File
list com.google.api.services.drive.model.FileList
patch content, fileId com.google.api.services.drive.model.File
touch fileId com.google.api.services.drive.model.File
trash fileId com.google.api.services.drive.model.File
untrash fileId com.google.api.services.drive.model.File
update [mediaContent], content, fileId com.google.api.services.drive.model.File
watch contentChannel, fileId com.google.api.services.drive.model.Channel

URI Options for drive-files

Name Type
content com.google.api.services.drive.model.File
contentChannel com.google.api.services.drive.model.Channel
fileId String
mediaContent com.google.api.client.http.AbstractInputStreamContent

8. Endpoint Prefix drive-parents

The following endpoints can be invoked with the prefix drive-parents as follows:
google-drive://drive-parents/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
delete fileId, parentId
get fileId, parentId com.google.api.services.drive.model.ParentReference
insert content, fileId com.google.api.services.drive.model.ParentReference
list fileId com.google.api.services.drive.model.ParentList

URI Options for drive-parents

Name Type
content com.google.api.services.drive.model.ParentReference
fileId String
parentId String

9. Endpoint Prefix drive-permissions

The following endpoints can be invoked with the prefix drive-permissions as follows:
google-drive://drive-permissions/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
delete fileId, permissionId
get fileId, permissionId com.google.api.services.drive.model.Permission
getIdForEmail email com.google.api.services.drive.model.PermissionId
insert content, fileId com.google.api.services.drive.model.Permission
list fileId com.google.api.services.drive.model.PermissionList
patch content, fileId, permissionId com.google.api.services.drive.model.Permission
update content, fileId, permissionId com.google.api.services.drive.model.Permission

URI Options for drive-permissions

Name Type
content com.google.api.services.drive.model.Permission
email String
fileId String
permissionId String

10. Endpoint Prefix drive-properties

The following endpoints can be invoked with the prefix drive-properties as follows:
google-drive://drive-properties/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
delete fileId, propertyKey
get fileId, propertyKey com.google.api.services.drive.model.Property
insert content, fileId com.google.api.services.drive.model.Property
list fileId com.google.api.services.drive.model.PropertyList
patch content, fileId, propertyKey com.google.api.services.drive.model.Property
update content, fileId, propertyKey com.google.api.services.drive.model.Property

URI Options for drive-properties

Name Type
content com.google.api.services.drive.model.Property
fileId String
propertyKey String

11. Endpoint Prefix drive-realtime

The following endpoints can be invoked with the prefix drive-realtime as follows:
google-drive://drive-realtime/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
get fileId
update [mediaContent], fileId

URI Options for drive-realtime

Name Type
fileId String
mediaContent com.google.api.client.http.AbstractInputStreamContent

12. Endpoint Prefix drive-replies

The following endpoints can be invoked with the prefix drive-replies as follows:
google-drive://drive-replies/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
delete commentId, fileId, replyId
get commentId, fileId, replyId com.google.api.services.drive.model.CommentReply
insert commentId, content, fileId com.google.api.services.drive.model.CommentReply
list commentId, fileId com.google.api.services.drive.model.CommentReplyList
patch commentId, content, fileId, replyId com.google.api.services.drive.model.CommentReply
update commentId, content, fileId, replyId com.google.api.services.drive.model.CommentReply

URI Options for drive-replies

Name Type
commentId String
content com.google.api.services.drive.model.CommentReply
fileId String
replyId String

13. Endpoint Prefix drive-revisions

The following endpoints can be invoked with the prefix drive-revisions as follows:
google-drive://drive-revisions/endpoint?[options]
Endpoint Shorthand Alias Options Result Body Type
delete fileId, revisionId
get fileId, revisionId com.google.api.services.drive.model.Revision
list fileId com.google.api.services.drive.model.RevisionList
patch content, fileId, revisionId com.google.api.services.drive.model.Revision
update content, fileId, revisionId com.google.api.services.drive.model.Revision

URI Options for drive-revisions

Name Type
content com.google.api.services.drive.model.Revision
fileId String
revisionId String

Consumer Endpoints

Any of the producer endpoints can be used as a consumer endpoint. Consumer endpoints can use Scheduled Poll Consumer Options with a consumer. prefix to schedule endpoint invocation. Consumer endpoints that return an array or collection will generate one exchange per element, and their routes will be executed once for each exchange.

Message Headers

Any URI option can be provided in a message header for producer endpoints with a CamelGoogleDrive. prefix.

Message Body

All result message bodies utilize objects provided by the underlying APIs used by the GoogleDriveComponent. Producer endpoints can specify the option name for incoming message body in the inBody endpoint URI parameter. For endpoints that return an array or collection, a consumer endpoint will map every element to distinct messages.
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.