blob: 1ee0d1ec7f8381221d1c0fc64b0fada715fd370b [file] [log] [blame]
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/google-mail-source.svg[] Google Mail Source
*Provided by: "Apache Software Foundation"*
*Support Level for this Kamelet is: "Preview"*
Receive data from Google Mail.
== Configuration Options
The following table summarizes the configuration options available for the `google-mail-source` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *accessToken {empty}* *| Access Token| OAuth 2 access token for google mail application. This typically expires after an hour so refreshToken is recommended for long term usage.| string| |
| *applicationName {empty}* *| Application name| Google Mail application name| string| |
| *clientId {empty}* *| Client ID| Client ID of the gmail application| string| |
| *clientSecret {empty}* *| Client Secret| Client Secret of the gmail application| string| |
| *index {empty}* *| Index| An index for the google mail endpoint| string| |
| *refreshToken {empty}* *| Refresh Token| OAuth 2 refresh token for google mail application. 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| |
| delay| Delay| Milliseconds before the next poll| integer| `500`|
| labels| Gmail Labels| Comma separated list of labels to take into account| string| | `"inbox"`
| markAsRead| Mark as Read| Mark the message as read once it has been consumed| boolean| `true`|
| query| Gmail Query| The query to execute on gmail box| string| `"is:unread"`| `"is:unread -category:(promotions OR social)"`
|===
NOTE: Fields marked with ({empty}*) are mandatory.
== Usage
This section summarizes how the `google-mail-source` can be used in various contexts.
=== Knative Source
The `google-mail-source` Kamelet can be used as Knative source by binding it to a Knative object.
.google-mail-source-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: google-mail-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: google-mail-source
properties:
accessToken: "The Access Token"
applicationName: "The Application name"
clientId: "The Client ID"
clientSecret: "The Client Secret"
index: "The Index"
refreshToken: "The Refresh Token"
sink:
ref:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel
----
Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.
Save the `google-mail-source-binding.yaml` file into your hard drive, then configure it according to your needs.
You can run the source using the following command:
[source,shell]
----
kubectl apply -f google-mail-source-binding.yaml
----
==== *Dependencies*
The Kamelet needs the following dependencies:
- camel:jackson
- camel:kamelet
- camel:google-mail
==== *Binding to Knative using the Kamel CLI:*
The procedure described above can be simplified into a single execution of the `kamel bind` command:
[source,shell]
----
kamel bind google-mail-source -p "source.accessToken=The Access Token" -p "source.applicationName=The Application name" -p "source.clientId=The Client ID" -p "source.clientSecret=The Client Secret" -p "source.index=The Index" -p "source.refreshToken=The Refresh Token" channel:mychannel
----
This will create the KameletBinding under the hood and apply it to the current namespace in the cluster.
=== Kafka Source
The `google-mail-source` Kamelet can be used as Kafka source by binding it to a Kafka topic.
.google-mail-source-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: google-mail-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: google-mail-source
properties:
accessToken: "The Access Token"
applicationName: "The Application name"
clientId: "The Client ID"
clientSecret: "The Client Secret"
index: "The Index"
refreshToken: "The Refresh Token"
sink:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic
----
Ensure that you've installed https://strimzi.io/[Strimzi] and created a topic named `my-topic` in the current namespace.
Make also sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.
Save the `google-mail-source-binding.yaml` file into your hard drive, then configure it according to your needs.
You can run the source using the following command:
[source,shell]
----
kubectl apply -f google-mail-source-binding.yaml
----
==== *Binding to Kafka using the Kamel CLI:*
The procedure described above can be simplified into a single execution of the `kamel bind` command:
[source,shell]
----
kamel bind google-mail-source -p "source.accessToken=The Access Token" -p "source.applicationName=The Application name" -p "source.clientId=The Client ID" -p "source.clientSecret=The Client Secret" -p "source.index=The Index" -p "source.refreshToken=The Refresh Token" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
----
This will create the KameletBinding under the hood and apply it to the current namespace in the cluster.
==== Kamelet source file
Have a look at the following link:
https://github.com/apache/camel-kamelets/blob/main/google-mail-source.kamelet.yaml
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT