Google Drive
Since Camel 2.14
Both producer and consumer are supported
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 consist of a clientId
, clientSecret
, and a refreshToken
. A handy resource for generating a long-lived refreshToken
is the OAuth playground.
In the case of a service account, credentials consist of a JSON-file (serviceAccountKey). You can also use delegation domain-wide authority (delegate) and one, several, or all possible Drive API (V2) Auth Scopes.
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>
<!-- use the same version as your Camel core version -->
<version>x.x.x</version>
</dependency>
URI Format
The GoogleDrive Component uses the following URI format:
google-drive://endpoint-prefix/endpoint?[options]
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties
,*.yaml
files, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The Google Drive component supports 13 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
Google drive application name. Example would be camel-google-drive/1.0. | String | ||
Client ID of the drive application. | String | ||
To use the shared configuration. | GoogleDriveConfiguration | ||
Delegate for wide-domain service account. | 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. | List | ||
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | |
To use the GoogleCalendarClientFactory as factory for creating the client. Will by default use BatchGoogleDriveClientFactory. | GoogleDriveClientFactory | ||
OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | String | ||
Client secret of the drive application. | String | ||
OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | String | ||
Service account key in json format to authenticate an application as a service account. Accept base64 adding the prefix base64:. | String |
Endpoint Options
The Google Drive endpoint is configured using URI syntax:
google-drive:apiName/methodName
With the following path and query parameters:
Path Parameters (2 parameters)
Name | Description | Default | Type |
---|---|---|---|
Required What kind of operation to perform. Enum values:
| GoogleDriveApiName | ||
Required What sub operation to use for the selected operation. Enum values:
| String |
Query Parameters (30 parameters)
Name | Description | Default | Type |
---|---|---|---|
Google drive application name. Example would be camel-google-drive/1.0. | String | ||
To use the GoogleCalendarClientFactory as factory for creating the client. Will by default use BatchGoogleDriveClientFactory. | GoogleDriveClientFactory | ||
Client ID of the drive application. | String | ||
Delegate for wide-domain service account. | String | ||
Sets the name of a parameter to be passed in the exchange In Body. | 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. | List | ||
If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. | PollingConsumerPollStrategy | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | int | ||
The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | int | ||
To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured. | int | ||
Milliseconds before the next poll. | 500 | long | |
If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages. | false | boolean | |
Milliseconds before the first poll starts. | 1000 | long | |
Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever. | 0 | long | |
The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that. Enum values:
| TRACE | LoggingLevel | |
Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool. | ScheduledExecutorService | ||
To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler. | none | Object | |
To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler. | Map | ||
Whether the scheduler should be auto started. | true | boolean | |
Time unit for initialDelay and delay options. Enum values:
| MILLISECONDS | TimeUnit | |
Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean | |
OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | String | ||
Client secret of the drive application. | String | ||
OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | String | ||
Service account key in json format to authenticate an application as a service account. Accept base64 adding the prefix base64:. | String |
API Parameters (9 APIs)
The Google Drive endpoint is an API-based component and has additional parameters based on which API name and API method is used. The API name and API method is located in the endpoint URI as the apiName/methodName
path parameters:
google-drive:apiName/methodName
There are 9 API names as listed in the table below:
API Name | Type | Description |
---|---|---|
Both | The changes collection of methods | |
Both | The channels collection of methods | |
Both | The comments collection of methods | |
Both | The drives collection of methods | |
Both | The files collection of methods | |
Both | The permissions collection of methods | |
Both | The replies collection of methods | |
Both | The revisions collection of methods | |
Both | The teamdrives collection of methods |
Each API is documented in the following sections to come.
API: drive-changes
Both producer and consumer are supported
The drive-changes API is defined in the syntax as follows:
google-drive:drive-changes/methodName?[parameters]
The 2 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
Method | Alias | Description |
---|---|---|
Lists the changes for a user or shared drive | ||
Subscribes to changes for a user |
Method list
Signatures:
-
com.google.api.services.drive.Drive.Changes.List list(String pageToken);
The google-drive/list API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
pageToken | The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method. | String |
Method watch
Signatures:
-
com.google.api.services.drive.Drive.Changes.Watch watch(String pageToken, com.google.api.services.drive.model.Channel content);
The google-drive/watch API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
contentChannel | The com.google.api.services.drive.model.Channel | Channel |
pageToken | The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method. | String |
In addition to the parameters above, the google-drive API can also use any of the Query Parameters (30 parameters).
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter
. The inBody
parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere
would override a CamelGoogleDrive.myParameterNameHere
header.
API: drive-channels
Both producer and consumer are supported
The drive-channels API is defined in the syntax as follows:
google-drive:drive-channels/methodName?[parameters]
The 1 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
Method | Alias | Description |
---|---|---|
Stops watching resources through this channel |
Method stop
Signatures:
-
com.google.api.services.drive.Drive.Channels.Stop stop(com.google.api.services.drive.model.Channel content);
The google-drive/stop API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
contentChannel | The com.google.api.services.drive.model.Channel | Channel |
In addition to the parameters above, the google-drive API can also use any of the Query Parameters (30 parameters).
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter
. The inBody
parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere
would override a CamelGoogleDrive.myParameterNameHere
header.
API: drive-comments
Both producer and consumer are supported
The drive-comments API is defined in the syntax as follows:
google-drive:drive-comments/methodName?[parameters]
The 5 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
Method | Alias | Description |
---|---|---|
Creates a comment on a file | ||
Deletes a comment | ||
Gets a comment by ID | ||
Lists a file’s comments | ||
Updates a comment with patch semantics |
Method create
Signatures:
-
com.google.api.services.drive.Drive.Comments.Create create(String fileId, com.google.api.services.drive.model.Comment content);
The google-drive/create API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
content | The com.google.api.services.drive.model.Comment | Comment |
fileId | The ID of the file | String |
Method delete
Signatures:
-
com.google.api.services.drive.Drive.Comments.Delete delete(String fileId, String commentId);
The google-drive/delete API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
commentId | The ID of the comment | String |
fileId | The ID of the file | String |
Method get
Signatures:
-
com.google.api.services.drive.Drive.Comments.Get get(String fileId, String commentId);
The google-drive/get API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
commentId | The ID of the comment | String |
fileId | The ID of the file | String |
Method list
Signatures:
-
com.google.api.services.drive.Drive.Comments.List list(String fileId);
The google-drive/list API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file | String |
Method update
Signatures:
-
com.google.api.services.drive.Drive.Comments.Update update(String fileId, String commentId, com.google.api.services.drive.model.Comment content);
The google-drive/update API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
commentId | The ID of the comment | String |
content | The com.google.api.services.drive.model.Comment | Comment |
fileId | The ID of the file | String |
In addition to the parameters above, the google-drive API can also use any of the Query Parameters (30 parameters).
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter
. The inBody
parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere
would override a CamelGoogleDrive.myParameterNameHere
header.
API: drive-drives
Both producer and consumer are supported
The drive-drives API is defined in the syntax as follows:
google-drive:drive-drives/methodName?[parameters]
The 6 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
Method | Alias | Description |
---|---|---|
Creates a shared drive | ||
Permanently deletes a shared drive for which the user is an organizer | ||
Gets a shared drive’s metadata by ID | ||
Hides a shared drive from the default view | ||
Restores a shared drive to the default view | ||
Updates the metadate for a shared drive |
Method create
Signatures:
-
com.google.api.services.drive.Drive.Drives.Create create(String requestId, com.google.api.services.drive.model.Drive content);
The google-drive/create API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
content | The com.google.api.services.drive.model.Drive | Drive |
requestId | Required. An ID, such as a random UUID, which uniquely identifies this user’s request for idempotent creation of a shared drive. A repeated request by the same user and with the same request ID will avoid creating duplicates by attempting to create the same shared drive. If the shared drive already exists a 409 error will be returned. | String |
Method delete
Signatures:
-
com.google.api.services.drive.Drive.Drives.Delete delete(String driveId);
The google-drive/delete API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
driveId | The ID of the shared drive | String |
Method get
Signatures:
-
com.google.api.services.drive.Drive.Drives.Get get(String driveId);
The google-drive/get API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
driveId | The ID of the shared drive | String |
Method hide
Signatures:
-
com.google.api.services.drive.Drive.Drives.Hide hide(String driveId);
The google-drive/hide API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
driveId | The ID of the shared drive | String |
Method unhide
Signatures:
-
com.google.api.services.drive.Drive.Drives.Unhide unhide(String driveId);
The google-drive/unhide API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
driveId | The ID of the shared drive | String |
Method update
Signatures:
-
com.google.api.services.drive.Drive.Drives.Update update(String driveId, com.google.api.services.drive.model.Drive content);
The google-drive/update API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
content | The com.google.api.services.drive.model.Drive | Drive |
driveId | The ID of the shared drive | String |
In addition to the parameters above, the google-drive API can also use any of the Query Parameters (30 parameters).
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter
. The inBody
parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere
would override a CamelGoogleDrive.myParameterNameHere
header.
API: drive-files
Both producer and consumer are supported
The drive-files API is defined in the syntax as follows:
google-drive:drive-files/methodName?[parameters]
The 9 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
Method | Alias | Description |
---|---|---|
Creates a copy of a file and applies any requested updates with patch semantics | ||
Creates a new file | ||
Permanently deletes a file owned by the user without moving it to the trash | ||
Exports a Google Workspace document to the requested MIME type and returns exported byte content | ||
Gets a file’s metadata or content by ID | ||
Lists the labels on a file | ||
Modifies the set of labels applied to a file | ||
Updates a file’s metadata and/or content | ||
Subscribes to changes to a file |
Method copy
Signatures:
-
com.google.api.services.drive.Drive.Files.Copy copy(String fileId, com.google.api.services.drive.model.File content);
The google-drive/copy API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
file | The com.google.api.services.drive.model.File | File |
fileId | The ID of the file | String |
Method create
Signatures:
-
com.google.api.services.drive.Drive.Files.Create create(com.google.api.services.drive.model.File content);
-
com.google.api.services.drive.Drive.Files.Create create(com.google.api.services.drive.model.File content, com.google.api.client.http.AbstractInputStreamContent mediaContent);
The google-drive/create API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
content | The com.google.api.services.drive.model.File media metadata or null if none | File |
mediaContent | The media HTTP content | AbstractInputStreamContent |
Method delete
Signatures:
-
com.google.api.services.drive.Drive.Files.Delete delete(String fileId);
The google-drive/delete API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file | String |
Method export
Signatures:
-
com.google.api.services.drive.Drive.Files.Export export(String fileId, String mimeType);
The google-drive/export API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file | String |
mimeType | Required. The MIME type of the format requested for this export. | String |
Method get
Signatures:
-
com.google.api.services.drive.Drive.Files.Get get(String fileId);
The google-drive/get API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file | String |
Method listLabels
Signatures:
-
com.google.api.services.drive.Drive.Files.ListLabels listLabels(String fileId);
The google-drive/listLabels API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID for the file | String |
Method modifyLabels
Signatures:
-
com.google.api.services.drive.Drive.Files.ModifyLabels modifyLabels(String fileId, com.google.api.services.drive.model.ModifyLabelsRequest content);
The google-drive/modifyLabels API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file to which the labels belong | String |
modifyLabelsRequest | The com.google.api.services.drive.model.ModifyLabelsRequest | ModifyLabelsRequest |
Method update
Signatures:
-
com.google.api.services.drive.Drive.Files.Update update(String fileId, com.google.api.services.drive.model.File content);
-
com.google.api.services.drive.Drive.Files.Update update(String fileId, com.google.api.services.drive.model.File content, com.google.api.client.http.AbstractInputStreamContent mediaContent);
The google-drive/update API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
file | The com.google.api.services.drive.model.File media metadata or null if none | File |
fileId | The ID of the file | String |
mediaContent | The media HTTP content | AbstractInputStreamContent |
Method watch
Signatures:
-
com.google.api.services.drive.Drive.Files.Watch watch(String fileId, com.google.api.services.drive.model.Channel content);
The google-drive/watch API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
channel | The com.google.api.services.drive.model.Channel | Channel |
fileId | The ID of the file | String |
In addition to the parameters above, the google-drive API can also use any of the Query Parameters (30 parameters).
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter
. The inBody
parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere
would override a CamelGoogleDrive.myParameterNameHere
header.
API: drive-permissions
Both producer and consumer are supported
The drive-permissions API is defined in the syntax as follows:
google-drive:drive-permissions/methodName?[parameters]
The 5 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
Method | Alias | Description |
---|---|---|
Creates a permission for a file or shared drive | ||
Deletes a permission | ||
Gets a permission by ID | ||
Lists a file’s or shared drive’s permissions | ||
Updates a permission with patch semantics |
Method create
Signatures:
-
com.google.api.services.drive.Drive.Permissions.Create create(String fileId, com.google.api.services.drive.model.Permission content);
The google-drive/create API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
content | The com.google.api.services.drive.model.Permission | Permission |
fileId | The ID of the file or shared drive | String |
Method delete
Signatures:
-
com.google.api.services.drive.Drive.Permissions.Delete delete(String fileId, String permissionId);
The google-drive/delete API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file or shared drive | String |
permissionId | The ID of the permission | String |
Method get
Signatures:
-
com.google.api.services.drive.Drive.Permissions.Get get(String fileId, String permissionId);
The google-drive/get API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file | String |
permissionId | The ID of the permission | String |
Method list
Signatures:
-
com.google.api.services.drive.Drive.Permissions.List list(String fileId);
The google-drive/list API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file or shared drive | String |
Method update
Signatures:
-
com.google.api.services.drive.Drive.Permissions.Update update(String fileId, String permissionId, com.google.api.services.drive.model.Permission content);
The google-drive/update API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
content | The com.google.api.services.drive.model.Permission | Permission |
fileId | The ID of the file or shared drive | String |
permissionId | The ID of the permission | String |
In addition to the parameters above, the google-drive API can also use any of the Query Parameters (30 parameters).
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter
. The inBody
parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere
would override a CamelGoogleDrive.myParameterNameHere
header.
API: drive-replies
Both producer and consumer are supported
The drive-replies API is defined in the syntax as follows:
google-drive:drive-replies/methodName?[parameters]
The 5 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
Method | Alias | Description |
---|---|---|
Creates a reply to a comment | ||
Deletes a reply | ||
Gets a reply by ID | ||
Lists a comment’s replies | ||
Updates a reply with patch semantics |
Method create
Signatures:
-
com.google.api.services.drive.Drive.Replies.Create create(String fileId, String commentId, com.google.api.services.drive.model.Reply content);
The google-drive/create API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
commentId | The ID of the comment | String |
content | The com.google.api.services.drive.model.Reply | Reply |
fileId | The ID of the file | String |
Method delete
Signatures:
-
com.google.api.services.drive.Drive.Replies.Delete delete(String fileId, String commentId, String replyId);
The google-drive/delete API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
commentId | The ID of the comment | String |
fileId | The ID of the file | String |
replyId | The ID of the reply | String |
Method get
Signatures:
-
com.google.api.services.drive.Drive.Replies.Get get(String fileId, String commentId, String replyId);
The google-drive/get API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
commentId | The ID of the comment | String |
fileId | The ID of the file | String |
replyId | The ID of the reply | String |
Method list
Signatures:
-
com.google.api.services.drive.Drive.Replies.List list(String fileId, String commentId);
The google-drive/list API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
commentId | The ID of the comment | String |
fileId | The ID of the file | String |
Method update
Signatures:
-
com.google.api.services.drive.Drive.Replies.Update update(String fileId, String commentId, String replyId, com.google.api.services.drive.model.Reply content);
The google-drive/update API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
commentId | The ID of the comment | String |
content | The com.google.api.services.drive.model.Reply | Reply |
fileId | The ID of the file | String |
replyId | The ID of the reply | String |
In addition to the parameters above, the google-drive API can also use any of the Query Parameters (30 parameters).
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter
. The inBody
parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere
would override a CamelGoogleDrive.myParameterNameHere
header.
API: drive-revisions
Both producer and consumer are supported
The drive-revisions API is defined in the syntax as follows:
google-drive:drive-revisions/methodName?[parameters]
The 4 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
Method | Alias | Description |
---|---|---|
Permanently deletes a file version | ||
Gets a revision’s metadata or content by ID | ||
Lists a file’s revisions | ||
Updates a revision with patch semantics |
Method delete
Signatures:
-
com.google.api.services.drive.Drive.Revisions.Delete delete(String fileId, String revisionId);
The google-drive/delete API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file | String |
revisionId | The ID of the revision | String |
Method get
Signatures:
-
com.google.api.services.drive.Drive.Revisions.Get get(String fileId, String revisionId);
The google-drive/get API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file | String |
revisionId | The ID of the revision | String |
Method list
Signatures:
-
com.google.api.services.drive.Drive.Revisions.List list(String fileId);
The google-drive/list API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
fileId | The ID of the file | String |
Method update
Signatures:
-
com.google.api.services.drive.Drive.Revisions.Update update(String fileId, String revisionId, com.google.api.services.drive.model.Revision content);
The google-drive/update API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
content | The com.google.api.services.drive.model.Revision | Revision |
fileId | The ID of the file | String |
revisionId | The ID of the revision | String |
In addition to the parameters above, the google-drive API can also use any of the Query Parameters (30 parameters).
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter
. The inBody
parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere
would override a CamelGoogleDrive.myParameterNameHere
header.
API: drive-teamdrives
Both producer and consumer are supported
The drive-teamdrives API is defined in the syntax as follows:
google-drive:drive-teamdrives/methodName?[parameters]
The 4 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
Method | Alias | Description |
---|---|---|
Deprecated: Use drives | ||
Deprecated: Use drives | ||
Deprecated: Use drives | ||
Deprecated: Use drives |
Method create
Signatures:
-
com.google.api.services.drive.Drive.Teamdrives.Create create(String requestId, com.google.api.services.drive.model.TeamDrive content);
The google-drive/create API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
content | The com.google.api.services.drive.model.TeamDrive | TeamDrive |
requestId | Required. An ID, such as a random UUID, which uniquely identifies this user’s request for idempotent creation of a Team Drive. A repeated request by the same user and with the same request ID will avoid creating duplicates by attempting to create the same Team Drive. If the Team Drive already exists a 409 error will be returned. | String |
Method delete
Signatures:
-
com.google.api.services.drive.Drive.Teamdrives.Delete delete(String teamDriveId);
The google-drive/delete API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
teamDriveId | The ID of the Team Drive | String |
Method get
Signatures:
-
com.google.api.services.drive.Drive.Teamdrives.Get get(String teamDriveId);
The google-drive/get API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
teamDriveId | The ID of the Team Drive | String |
Method update
Signatures:
-
com.google.api.services.drive.Drive.Teamdrives.Update update(String teamDriveId, com.google.api.services.drive.model.TeamDrive content);
The google-drive/update API method has the parameters listed in the table below:
Parameter | Description | Type |
---|---|---|
content | The com.google.api.services.drive.model.TeamDrive | TeamDrive |
teamDriveId | The ID of the Team Drive | String |
In addition to the parameters above, the google-drive API can also use any of the Query Parameters (30 parameters).
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleDrive.parameter
. The inBody
parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere
would override a CamelGoogleDrive.myParameterNameHere
header.
More Information
For more information on the endpoints and options see API documentation at: https://developers.google.com/drive/v2/reference/
Spring Boot Auto-Configuration
When using google-drive with Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-google-drive-starter</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
The component supports 14 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
OAuth 2 access token. This typically expires after an hour so refreshToken is recommended for long term usage. | String | ||
Google drive application name. Example would be camel-google-drive/1.0. | String | ||
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean | |
To use the GoogleCalendarClientFactory as factory for creating the client. Will by default use BatchGoogleDriveClientFactory. The option is a org.apache.camel.component.google.drive.GoogleDriveClientFactory type. | GoogleDriveClientFactory | ||
Client ID of the drive application. | String | ||
Client secret of the drive application. | String | ||
To use the shared configuration. The option is a org.apache.camel.component.google.drive.GoogleDriveConfiguration type. | GoogleDriveConfiguration | ||
Delegate for wide-domain service account. | String | ||
Whether to enable auto configuration of the google-drive component. This is enabled by default. | Boolean | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean | |
OAuth 2 refresh token. Using this, the Google Calendar component can obtain a new accessToken whenever the current one expires - a necessity if the application is long-lived. | 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. | List | ||
Service account key in json format to authenticate an application as a service account. Accept base64 adding the prefix base64:. | String |