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.

OptionTypeDescription
accessTokenStringOAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage.
applicationNameStringGoogle drive application name. Example would be "camel-google-drive/1.0"
clientIdStringClient ID of the drive application
clientSecretStringClient 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.
scopesList<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]
    
EndpointShorthand AliasOptionsResult Body Type
get  com.google.api.services.drive.model.About

URI Options for drive-about


NameType

2. Endpoint Prefix drive-apps


The following endpoints can be invoked with the prefix drive-apps as follows:

        google-drive://drive-apps/endpoint?[options]
    
EndpointShorthand AliasOptionsResult Body Type
get appIdcom.google.api.services.drive.model.App
list  com.google.api.services.drive.model.AppList

URI Options for drive-apps


NameType
appIdString

3. Endpoint Prefix drive-changes


The following endpoints can be invoked with the prefix drive-changes as follows:

        google-drive://drive-changes/endpoint?[options]
    
EndpointShorthand AliasOptionsResult Body Type
get changeIdcom.google.api.services.drive.model.Change
list  com.google.api.services.drive.model.ChangeList
watch contentChannelcom.google.api.services.drive.model.Channel

 

URI Options for drive-changes


NameType
changeIdString
contentChannelcom.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]
    
EndpointShorthand AliasOptionsResult Body Type
stop contentChannel 

URI Options for drive-channels


NameType
contentChannelcom.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]
    
EndpointShorthand AliasOptionsResult Body Type
delete childId, folderId 
get childId, folderIdcom.google.api.services.drive.model.ChildReference
insert content, folderIdcom.google.api.services.drive.model.ChildReference
list folderIdcom.google.api.services.drive.model.ChildList

URI Options for drive-children


NameType
childIdString
contentcom.google.api.services.drive.model.ChildReference
folderIdString

6. Endpoint Prefix drive-comments


The following endpoints can be invoked with the prefix drive-comments as follows:

        google-drive://drive-comments/endpoint?[options]
    
EndpointShorthand AliasOptionsResult Body Type
delete commentId, fileId 
get commentId, fileIdcom.google.api.services.drive.model.Comment
insert content, fileIdcom.google.api.services.drive.model.Comment
list fileIdcom.google.api.services.drive.model.CommentList
patch commentId, content, fileIdcom.google.api.services.drive.model.Comment
update commentId, content, fileIdcom.google.api.services.drive.model.Comment

URI Options for drive-comments


NameType
commentIdString
contentcom.google.api.services.drive.model.Comment
fileIdString

7. Endpoint Prefix drive-files


The following endpoints can be invoked with the prefix drive-files as follows:

        google-drive://drive-files/endpoint?[options]
    
EndpointShorthand AliasOptionsResult Body Type
copy content, fileIdcom.google.api.services.drive.model.File
delete fileId 
emptyTrash   
get fileIdcom.google.api.services.drive.model.File
insert [mediaContent], contentcom.google.api.services.drive.model.File
list  com.google.api.services.drive.model.FileList
patch content, fileIdcom.google.api.services.drive.model.File
touch fileIdcom.google.api.services.drive.model.File
trash fileIdcom.google.api.services.drive.model.File
untrash fileIdcom.google.api.services.drive.model.File
update [mediaContent], content, fileIdcom.google.api.services.drive.model.File
watch contentChannel, fileIdcom.google.api.services.drive.model.Channel

URI Options for drive-files


NameType
contentcom.google.api.services.drive.model.File
contentChannelcom.google.api.services.drive.model.Channel
fileIdString
mediaContentcom.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]
    
EndpointShorthand AliasOptionsResult Body Type
delete fileId, parentId 
get fileId, parentIdcom.google.api.services.drive.model.ParentReference
insert content, fileIdcom.google.api.services.drive.model.ParentReference
list fileIdcom.google.api.services.drive.model.ParentList

URI Options for drive-parents


NameType
contentcom.google.api.services.drive.model.ParentReference
fileIdString
parentIdString

9. Endpoint Prefix drive-permissions


The following endpoints can be invoked with the prefix drive-permissions as follows:

        google-drive://drive-permissions/endpoint?[options]
    
EndpointShorthand AliasOptionsResult Body Type
delete fileId, permissionId 
get fileId, permissionIdcom.google.api.services.drive.model.Permission
getIdForEmail emailcom.google.api.services.drive.model.PermissionId
insert content, fileIdcom.google.api.services.drive.model.Permission
list fileIdcom.google.api.services.drive.model.PermissionList
patch content, fileId, permissionIdcom.google.api.services.drive.model.Permission
update content, fileId, permissionIdcom.google.api.services.drive.model.Permission

URI Options for drive-permissions


NameType
contentcom.google.api.services.drive.model.Permission
emailString
fileIdString
permissionIdString

10. Endpoint Prefix drive-properties


The following endpoints can be invoked with the prefix drive-properties as follows:

        google-drive://drive-properties/endpoint?[options]
    
EndpointShorthand AliasOptionsResult Body Type
delete fileId, propertyKey 
get fileId, propertyKeycom.google.api.services.drive.model.Property
insert content, fileIdcom.google.api.services.drive.model.Property
list fileIdcom.google.api.services.drive.model.PropertyList
patch content, fileId, propertyKeycom.google.api.services.drive.model.Property
update content, fileId, propertyKeycom.google.api.services.drive.model.Property

URI Options for drive-properties


NameType
contentcom.google.api.services.drive.model.Property
fileIdString
propertyKeyString

11. Endpoint Prefix drive-realtime


The following endpoints can be invoked with the prefix drive-realtime as follows:

        google-drive://drive-realtime/endpoint?[options]
    
EndpointShorthand AliasOptionsResult Body Type
get fileId 
update [mediaContent], fileId 

URI Options for drive-realtime


NameType
fileIdString
mediaContentcom.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]
    
EndpointShorthand AliasOptionsResult Body Type
delete commentId, fileId, replyId 
get commentId, fileId, replyIdcom.google.api.services.drive.model.CommentReply
insert commentId, content, fileIdcom.google.api.services.drive.model.CommentReply
list commentId, fileIdcom.google.api.services.drive.model.CommentReplyList
patch commentId, content, fileId, replyIdcom.google.api.services.drive.model.CommentReply
update commentId, content, fileId, replyIdcom.google.api.services.drive.model.CommentReply

URI Options for drive-replies


NameType
commentIdString
contentcom.google.api.services.drive.model.CommentReply
fileIdString
replyIdString

13. Endpoint Prefix drive-revisions


The following endpoints can be invoked with the prefix drive-revisions as follows:

        google-drive://drive-revisions/endpoint?[options]
    
EndpointShorthand AliasOptionsResult Body Type
delete fileId, revisionId 
get fileId, revisionIdcom.google.api.services.drive.model.Revision
list fileIdcom.google.api.services.drive.model.RevisionList
patch content, fileId, revisionIdcom.google.api.services.drive.model.Revision
update content, fileId, revisionIdcom.google.api.services.drive.model.Revision

URI Options for drive-revisions


NameType
contentcom.google.api.services.drive.model.Revision
fileIdString
revisionIdString

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.     

  • No labels

0 Comments