Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kamelets from developer guide #55

Merged
merged 2 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ on:

env:
CAMEL_K_VERSION: 1.3.1
YAKS_VERSION: 0.2.0
YAKS_VERSION: 0.3.0

jobs:
test:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/assets/images/kamelets/telegram-sink.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* xref:ROOT:aws-s3-source.adoc[image:kamelets/aws-s3-source.svg[] AWS S3 Source]
* xref:ROOT:aws-sqs-source.adoc[image:kamelets/aws-sqs-source.svg[] AWS SQS Source]
* xref:ROOT:bitcoin-source.adoc[image:kamelets/bitcoin-source.svg[] Bitcoin Source]
* xref:ROOT:earthquake-source.adoc[image:kamelets/earthquake-source.svg[] Earthquake Source]
* xref:ROOT:ftp-source.adoc[image:kamelets/ftp-source.svg[] FTP Source]
* xref:ROOT:ftps-source.adoc[image:kamelets/ftps-source.svg[] FTPS Source]
* xref:ROOT:google-calendar-stream-source.adoc[image:kamelets/google-calendar-stream-source.svg[] Google Calendar Stream Source]
Expand All @@ -19,7 +20,9 @@
* xref:ROOT:salesforce-source.adoc[image:kamelets/salesforce-source.svg[] Salesforce Source]
* xref:ROOT:sftp-source.adoc[image:kamelets/sftp-source.svg[] SFTP Source]
* xref:ROOT:slack-source.adoc[image:kamelets/slack-source.svg[] Slack Source]
* xref:ROOT:telegram-sink.adoc[image:kamelets/telegram-sink.svg[] Telegram Sink]
* xref:ROOT:telegram-source.adoc[image:kamelets/telegram-source.svg[] Telegram Source]
* xref:ROOT:timer-source.adoc[image:kamelets/timer-source.svg[] Timer Source]
* xref:ROOT:twitter-search-source.adoc[image:kamelets/twitter-search-source.svg[] Twitter Search Source]
* xref:ROOT:webhook-source.adoc[image:kamelets/webhook-source.svg[] Webhook Source]
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
59 changes: 59 additions & 0 deletions docs/modules/ROOT/pages/earthquake-source.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/earthquake-source.svg[] Earthquake Source

*Provided by: "Apache Software Foundation"*

Get data about current earthquake events happening in the world using the USGS API

== Configuration Options

The following table summarizes the configuration options available for the `earthquake-source` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| lookAhead| Look-ahead minutes| The amount of minutes to look ahead when starting the integration afresh| integer| `120`|
| period| Period between polls| The interval between fetches to the earthquake API in milliseconds| integer| `60000`|
|===

NOTE: Fields marked with ({empty}*) are mandatory.

== Usage

This section summarizes how the `earthquake-source` can be used in various contexts.

=== Knative Source

The `earthquake-source` Kamelet can be used as Knative source by binding it to a Knative object.

.earthquake-source-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: earthquake-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: earthquake-source
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 `earthquake-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 earthquake-source-binding.yaml
----
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
74 changes: 74 additions & 0 deletions docs/modules/ROOT/pages/telegram-sink.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/telegram-sink.svg[] Telegram Sink

*Provided by: "Apache Software Foundation"*

Send a message to a Telegram chat using your Telegram bot as sender.

To create a bot, contact the @botfather account using the Telegram app.

This sink supports the following message types:

- Standard text messages
- PNG images (`Content-Type` must be set to `image/png`)
- JPEG images (`Content-Type` must be set to `image/jpeg`)

This following message headers are also supported:

- `text` / `ce-text`: when sending an image, the image caption
- `chat-id` / `ce-chat-id`: to override the default chat where messages are sent to

== Configuration Options

The following table summarizes the configuration options available for the `telegram-sink` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *authorizationToken {empty}* *| Token| The token to access your bot on Telegram. You you can obtain it from the Telegram @botfather.| string| |
| chatId| Chat ID| The Chat ID where messages should be sent by default| string| |
|===

NOTE: Fields marked with ({empty}*) are mandatory.

== Usage

This section summarizes how the `telegram-sink` can be used in various contexts.

=== Knative Sink

The `telegram-sink` Kamelet can be used as Knative sink by binding it to a Knative object.

.telegram-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: telegram-sink-binding
spec:
source:
ref:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: telegram-sink
properties:
authorizationToken: "The Token"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `telegram-sink-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the sink using the following command:

[source,shell]
----
kubectl apply -f telegram-sink-binding.yaml
----
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
71 changes: 71 additions & 0 deletions docs/modules/ROOT/pages/twitter-search-source.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/twitter-search-source.svg[] Twitter Search Source

*Provided by: "Apache Software Foundation"*

Allows to get all tweets on particular keywords from Twitter.

It requires tokens that can be obtained by creating an application
in the Twitter developer portal: https://developer.twitter.com/.

== Configuration Options

The following table summarizes the configuration options available for the `twitter-search-source` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *accessToken {empty}* *| Access Token| The Access Token from the Twitter application in the developer portal| string| |
| *accessTokenSecret {empty}* *| Access Token Secret| The Access Token Secret from the Twitter application in the developer portal| string| |
| *apiKey {empty}* *| API Key| The API Key from the Twitter application in the developer portal| string| |
| *apiKeySecret {empty}* *| API Key Secret| The API Key Secret from the Twitter application in the developer portal| string| |
| *keywords {empty}* *| Keywords| The keywords to use in the Twitter search (Supports Twitter standard operators)| string| | `"Apache Camel"`
|===

NOTE: Fields marked with ({empty}*) are mandatory.

== Usage

This section summarizes how the `twitter-search-source` can be used in various contexts.

=== Knative Source

The `twitter-search-source` Kamelet can be used as Knative source by binding it to a Knative object.

.twitter-search-source-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: twitter-search-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: twitter-search-source
properties:
accessToken: "The Access Token"
accessTokenSecret: "The Access Token Secret"
apiKey: "The API Key"
apiKeySecret: "The API Key Secret"
keywords: "Apache Camel"
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 `twitter-search-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 twitter-search-source-binding.yaml
----
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
82 changes: 82 additions & 0 deletions earthquake-source.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: earthquake-source
annotations:
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzEwMHB4JyB3aWR0aD0nMTAwcHgnICBmaWxsPSIjMDAwMDAwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTAwLjAwMyA3OS45OTciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDEwMC4wMDMgNzkuOTk3IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNODEuNjUzLDQyLjk0Yy0xLjM4NywwLTIuNjY2LDAuNzY3LTMuMzE1LDEuOTkyTDcyLjk0Miw1NS4xbC02LjY0OS0xOS40NzljLTAuNTA4LTEuNDcyLTEuODY1LTIuNDgtMy40MjMtMi41MzQgIGMtMS42MDItMC4wNDYtMi45ODMsMC44NTktMy41ODksMi4yOTJsLTQuNTYxLDEwLjgzNGwtNy4yLTQzLjEyOGMtMC4zMy0xLjgxMi0yLjAyOS0zLjE4OC0zLjc3LTMuMDc5ICBjLTEuODQzLDAuMDQyLTMuMzg0LDEuMjUyLTMuNjM1LDMuMDc5bC02LjM1Nyw1MC4wNTJsLTUuMTU2LTI2Ljg2NGMtMC4zMDMtMS41ODktMS41OTQtMi44MDMtMy4yMDEtMy4wMSAgYy0xLjU3Ny0wLjIxLTMuMTYyLDAuNjM1LTMuODYyLDIuMDk3bC04LjQzNSwxNy41OEgwdjcuNDk3aDE1LjQ2NmMxLjQ0MywwLDIuNzU2LTAuODI1LDMuMzgxLTIuMTI5bDQuNTM2LTkuNDVsNy4zMTIsMzguMDk4ICBjMC4zMzksMS43NzEsMS44ODcsMy4wNDEsMy42ODIsMy4wNDFjMC4wMzIsMCwwLjA2NiwwLDAuMSwwYzEuODM2LTAuMDQ5LDMuMzY3LTEuNDIxLDMuNjE2LTMuMjQxbDYuMjU5LTQ5LjE4Mmw1LjI0NywzMi4zODUgIGMwLjI5NSwxLjYzMSwxLjYzMSwyLjg3NiwzLjI3NiwzLjA1N2MxLjY3LDAuMTYxLDMuMjIzLTAuNzQyLDMuODY3LTIuMjc1bDUuNjM1LTEzLjM3NGw2LjI3LDE4LjM1OSAgYzAuNDgzLDEuNDExLDEuNzYzLDIuNDA3LDMuMjUxLDIuNTI0YzEuNDk0LDAuMDgzLDIuOTEtMC42NTksMy42MTMtMS45ODJsOC4zOTgtMTUuODNoMTYuMDk0VjQyLjk0SDgxLjY1M3oiPjwvcGF0aD48L3N2Zz4="
camel.apache.org/provider: "Apache Software Foundation"
labels:
camel.apache.org/kamelet.type: "source"
camel.apache.org/kamelet.verified: "true"
spec:
definition:
title: Earthquake Source
description: |-
Get data about current earthquake events happening in the world using the USGS API
properties:
period:
title: Period between polls
description: The interval between fetches to the earthquake API in milliseconds
type: integer
default: 60000
lookAhead:
title: Look-ahead minutes
description: The amount of minutes to look ahead when starting the integration afresh
type: integer
default: 120
types:
out:
mediaType: application/json
dependencies:
- camel-quarkus:caffeine
- camel-quarkus:http
flow:
from:
uri: "timer:earthquake"
parameters:
period: "{{period}}"
steps:
- set-header:
name: CamelCaffeineAction
constant: GET
- tod: "caffeine-cache:cache-${routeId}?key=lastUpdate"
- choice:
when:
- simple: "${header.CamelCaffeineActionHasResult}"
steps:
- set-property:
name: lastUpdate
simple: "${body}"
otherwise:
steps:
- set-property:
name: lastUpdate
simple: "${date-with-timezone:now-{{lookAhead}}m:UTC:yyyy-MM-dd'T'HH:mm:ss.SSS}"
- set-header:
name: CamelHttpMethod
constant: GET
- tod: "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&updatedafter=${exchangeProperty.lastUpdate}&orderby=time-asc"
- unmarshal:
json: {}
- set-property:
name: generated
simple: "${body[metadata][generated]}"
- set-property:
name: lastUpdate
simple: "${date-with-timezone:exchangeProperty.generated:UTC:yyyy-MM-dd'T'HH:mm:ss.SSS}"
- claim-check:
operation: Push
- set-body:
exchange-property: lastUpdate
- set-header:
name: CamelCaffeineAction
constant: PUT
- tod: "caffeine-cache:cache-${routeId}?key=lastUpdate"
- claim-check:
operation: Pop
- split:
jsonpath: "$.features[*]"
steps:
- marshal:
json: {}
- to: "kamelet:sink"
Loading