diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ec469ee74..fcf210d54 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -37,7 +37,7 @@ on: env: CAMEL_K_VERSION: 1.3.1 - YAKS_VERSION: 0.2.0 + YAKS_VERSION: 0.3.0 jobs: test: diff --git a/docs/modules/ROOT/assets/images/kamelets/earthquake-source.svg b/docs/modules/ROOT/assets/images/kamelets/earthquake-source.svg new file mode 100644 index 000000000..db8c041d2 --- /dev/null +++ b/docs/modules/ROOT/assets/images/kamelets/earthquake-source.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/modules/ROOT/assets/images/kamelets/telegram-sink.svg b/docs/modules/ROOT/assets/images/kamelets/telegram-sink.svg new file mode 100644 index 000000000..080818fa9 --- /dev/null +++ b/docs/modules/ROOT/assets/images/kamelets/telegram-sink.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/modules/ROOT/assets/images/kamelets/twitter-search-source.svg b/docs/modules/ROOT/assets/images/kamelets/twitter-search-source.svg new file mode 100644 index 000000000..c0364cc15 --- /dev/null +++ b/docs/modules/ROOT/assets/images/kamelets/twitter-search-source.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index bec52232a..ffef22feb 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -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] @@ -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 diff --git a/docs/modules/ROOT/pages/earthquake-source.adoc b/docs/modules/ROOT/pages/earthquake-source.adoc new file mode 100644 index 000000000..b66467387 --- /dev/null +++ b/docs/modules/ROOT/pages/earthquake-source.adoc @@ -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 diff --git a/docs/modules/ROOT/pages/telegram-sink.adoc b/docs/modules/ROOT/pages/telegram-sink.adoc new file mode 100644 index 000000000..f1e552dd0 --- /dev/null +++ b/docs/modules/ROOT/pages/telegram-sink.adoc @@ -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 diff --git a/docs/modules/ROOT/pages/twitter-search-source.adoc b/docs/modules/ROOT/pages/twitter-search-source.adoc new file mode 100644 index 000000000..d5a39190e --- /dev/null +++ b/docs/modules/ROOT/pages/twitter-search-source.adoc @@ -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 diff --git a/earthquake-source.kamelet.yaml b/earthquake-source.kamelet.yaml new file mode 100755 index 000000000..a82554bf5 --- /dev/null +++ b/earthquake-source.kamelet.yaml @@ -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,PHN2ZyBoZWlnaHQ9JzEwMHB4JyB3aWR0aD0nMTAwcHgnICBmaWxsPSIjMDAwMDAwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTAwLjAwMyA3OS45OTciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDEwMC4wMDMgNzkuOTk3IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBkPSJNODEuNjUzLDQyLj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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" diff --git a/telegram-sink.kamelet.yaml b/telegram-sink.kamelet.yaml new file mode 100755 index 000000000..71b87c144 --- /dev/null +++ b/telegram-sink.kamelet.yaml @@ -0,0 +1,99 @@ +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet +metadata: + name: telegram-sink + annotations: + camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0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My00My4zMjVjMy4yNDItMS45NjYgNi4yMTgtLjkxIDMuNzc2IDEuMjU4Ii8+PC9zdmc+" + camel.apache.org/provider: "Apache Software Foundation" + labels: + camel.apache.org/kamelet.type: "sink" + camel.apache.org/kamelet.group: "Telegram" +spec: + definition: + title: "Telegram Sink" + description: |- + 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 + required: + - authorizationToken + properties: + authorizationToken: + title: Token + description: The token to access your bot on Telegram. You you can obtain it from the Telegram @botfather. + type: string + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password + chatId: + title: Chat ID + description: The Chat ID where messages should be sent by default + type: string + types: + out: + mediaType: application/json + flow: + from: + uri: "kamelet:source" + steps: + - choice: + when: + - simple: "${header[Content-Type]} == 'image/png'" + steps: + - convert-body-to: + type: "byte[]" + - set-header: + name: CamelTelegramMediaType + constant: PHOTO_PNG + - simple: "${header[Content-Type]} == 'image/jpeg'" + steps: + - convert-body-to: + type: "byte[]" + - set-header: + name: CamelTelegramMediaType + constant: PHOTO_JPG + otherwise: + steps: + - convert-body-to: + type: "java.lang.String" + - choice: + when: + - simple: "${header[text]}" + steps: + - set-header: + name: CamelTelegramMediaTitleCaption + simple: "${header[text]}" + - simple: "${header[ce-text]}" + steps: + - set-header: + name: CamelTelegramMediaTitleCaption + simple: "${header[ce-text]}" + - choice: + when: + - simple: "${header[chat-id]}" + steps: + - set-header: + name: CamelTelegramChatId + simple: "${header[chat-id]}" + - simple: "${header[ce-chat-id]}" + steps: + - set-header: + name: CamelTelegramChatId + simple: "${header[ce-chat-id]}" + - to: + uri: "telegram:bots" + parameters: + authorizationToken: "{{authorizationToken}}" + chatId: "{{chatId}}" + - marshal: + json: {} diff --git a/telegram-source.kamelet.yaml b/telegram-source.kamelet.yaml index 3193e8a2d..c60015f77 100644 --- a/telegram-source.kamelet.yaml +++ b/telegram-source.kamelet.yaml @@ -7,6 +7,7 @@ metadata: camel.apache.org/provider: "Apache Software Foundation" labels: camel.apache.org/kamelet.type: "source" + camel.apache.org/kamelet.group: "Telegram" spec: definition: title: "Telegram Source" diff --git a/test/earthquake-source/earthquake-source.feature b/test/earthquake-source/earthquake-source.feature new file mode 100644 index 000000000..e18a2cf14 --- /dev/null +++ b/test/earthquake-source/earthquake-source.feature @@ -0,0 +1,21 @@ +Feature: Kamelet earthquake-source works + + Background: + Given Disable auto removal of Kamelet resources + Given Disable auto removal of Kubernetes resources + Given Camel-K resource polling configuration + | maxAttempts | 60 | + | delayBetweenAttempts | 3000 | + + Scenario: Bind Kamelet to service + Given create Kubernetes service test-service with target port 8080 + And bind Kamelet earthquake-source to uri http://test-service.${YAKS_NAMESPACE}.svc.cluster.local/test + When create KameletBinding earthquake-source-uri + Then KameletBinding earthquake-source-uri should be available + + Scenario: Verify binding + Given HTTP server "test-service" + And HTTP server timeout is 120000 ms + Then expect HTTP request header: Content-Type="application/json;charset=UTF-8" + And receive POST /test + And delete KameletBinding earthquake-source-uri diff --git a/test/earthquake-source/yaks-config.yaml b/test/earthquake-source/yaks-config.yaml new file mode 100644 index 000000000..efeddebc6 --- /dev/null +++ b/test/earthquake-source/yaks-config.yaml @@ -0,0 +1,27 @@ +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +config: + namespace: + temporary: true +pre: +- name: installation + run: | + # Install required Kamelets (these steps may be done globally in future versions) + + kamel install -n $YAKS_NAMESPACE + kubectl apply -f ../../earthquake-source.kamelet.yaml -n $YAKS_NAMESPACE diff --git a/twitter-search.kamelet.yaml b/twitter-search.kamelet.yaml new file mode 100755 index 000000000..a43b74a73 --- /dev/null +++ b/twitter-search.kamelet.yaml @@ -0,0 +1,75 @@ +# camel-k: language=kamelet + +apiVersion: camel.apache.org/v1alpha1 +kind: Kamelet +metadata: + name: twitter-search-source + annotations: + camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjI1NnB4IiBoZWlnaHQ9IjIwOXB4IiB2aWV3Qm94PSIwIDAgMjU2IDIwOSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCI+CiAgICA8Zz4KICAgICAgICA8cGF0aCBkPSJNMjU2LDI1LjQ1MDAyNTkgQzI0Ni41ODA4NDEsMjkuNjI3MjY3MiAyMzYuNDU4NDUxLDMyLjQ1MDQ4NjggMjI1LjgzNDE1NiwzMy43MjAyMzMzIEMyMzYuNjc4NTAzLDI3LjIxOTgwNTMgMjQ1LjAwNTgzLDE2LjkyNjk5MjkgMjQ4LjkyNzQzNyw0LjY2MzA3Njg1IEMyMzguNzc5NzY1LDEwLjY4MTI2MzMgMjI3LjUzOTMyNSwxNS4wNTIzMzc2IDIxNS41NzU5OSwxNy40MDgyOTggQzIwNS45OTQ4MzUsNy4yMDA2OTcxIDE5Mi4zNDUwNiwwLjgyMiAxNzcuMjM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AxMi41Mjg5MTQ3LDE4Ni4wMDQ2MDQgQzguMjg5ODcxNjEsMTg2LjAwNDYwNCA0LjEwODg4NDc0LDE4NS43NTY0NiAwLDE4NS4yNzE0MDkgQzIzLjI0MzEwMzMsMjAwLjE3MzEzOSA1MC44NTA3MjYxLDIwOC44Njc1MzIgODAuNTEwOTE4NSwyMDguODY3NTMyIEMxNzcuMTE2NTI5LDIwOC44Njc1MzIgMjI5Ljk0Mzk3NywxMjguODM2OTgyIDIyOS45NDM5NzcsNTkuNDMyNjAwMiBDMjI5Ljk0Mzk3Nyw1Ny4xNTUyOTY4IDIyOS44OTM0MTIsNTQuODkwMTY2NCAyMjkuNzkyMjgyLDUyLjYzODE0NTQgQzI0MC4wNTMyNTcsNDUuMjMzMTYzNSAyNDguOTU4MzM4LDM1Ljk4MjU1NDUgMjU2LDI1LjQ1MDAyNTkiIGZpbGw9IiM1NWFjZWUiPjwvcGF0aD4KICAgIDwvZz4KPC9zdmc+" + camel.apache.org/provider: "Apache Software Foundation" + labels: + camel.apache.org/kamelet.type: "source" + camel.apache.org/kamelet.group: "Twitter" +spec: + definition: + title: "Twitter Search Source" + description: |- + 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/. + required: + - keywords + - apiKey + - apiKeySecret + - accessToken + - accessTokenSecret + properties: + keywords: + title: Keywords + description: The keywords to use in the Twitter search (Supports Twitter standard operators) + type: string + example: "Apache Camel" + apiKey: + title: API Key + description: The API Key from the Twitter application in the developer portal + type: string + format: password + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password + apiKeySecret: + title: API Key Secret + description: The API Key Secret from the Twitter application in the developer portal + type: string + format: password + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password + accessToken: + title: Access Token + description: The Access Token from the Twitter application in the developer portal + type: string + format: password + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password + accessTokenSecret: + title: Access Token Secret + description: The Access Token Secret from the Twitter application in the developer portal + type: string + format: password + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password + types: + out: + mediaType: application/json + flow: + from: + uri: "twitter-search:{{keywords}}" + parameters: + accessToken: "{{accessToken}}" + accessTokenSecret: "{{accessTokenSecret}}" + consumerKey: "{{apiKey}}" + consumerSecret: "{{apiKeySecret}}" + steps: + - marshal: + json: {} + - to: "kamelet:sink"