You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/12/06 09:13:03 UTC

[camel-kamelets] branch main updated (bd1f2f6 -> 39bc34e)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git.


    from bd1f2f6  Regen for commit fb043d76f78d298d1e7b9f01f03ffeb8103c0bf8
     new 9789894  Add wttr.in Source Kamelet
     new 39bc34e  Generate doc for wttr.in Source Kamelet

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../ROOT/assets/images/kamelets/wttrin-source.svg  |  1 +
 docs/modules/ROOT/nav.adoc                         |  1 +
 .../{github-source.adoc => wttrin-source.adoc}     | 62 +++++++--------
 kamelets/wttrin-source.kamelet.yaml                | 87 ++++++++++++++++++++++
 ...ink-binding.yaml => wttrin-source-binding.yaml} | 12 +--
 ...rce-binding.yaml => wttrin-source-binding.yaml} |  2 +-
 6 files changed, 123 insertions(+), 42 deletions(-)
 create mode 100644 docs/modules/ROOT/assets/images/kamelets/wttrin-source.svg
 copy docs/modules/ROOT/pages/{github-source.adoc => wttrin-source.adoc} (56%)
 create mode 100755 kamelets/wttrin-source.kamelet.yaml
 copy templates/bindings/camel-k/{log-sink-binding.yaml => wttrin-source-binding.yaml} (81%)
 copy templates/bindings/core/{bitcoin-source-binding.yaml => wttrin-source-binding.yaml} (62%)

[camel-kamelets] 01/02: Add wttr.in Source Kamelet

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git

commit 978989461f20a3510791ea8cfd68048af35ad176
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Mon Dec 6 13:09:44 2021 +0900

    Add wttr.in Source Kamelet
---
 kamelets/wttrin-source.kamelet.yaml | 87 +++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/kamelets/wttrin-source.kamelet.yaml b/kamelets/wttrin-source.kamelet.yaml
new file mode 100755
index 0000000..0aa090c
--- /dev/null
+++ b/kamelets/wttrin-source.kamelet.yaml
@@ -0,0 +1,87 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: wttrin-source
+  annotations:
+    camel.apache.org/kamelet.support.level: "Preview"
+    camel.apache.org/catalog.version: "main-SNAPSHOT"
+    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyBhcmlhLWhpZGRlbj0idHJ1ZSIgZm9jdXNhYmxlPSJmYWxzZSIgZGF0YS1wcmVmaXg9ImZhcyIgZGF0YS1pY29uPSJjbG91ZC1zdW4iIGNsYXNzPSJzdmctaW5saW5lLS1mYSBmYS1jbG91ZC1zdW4iIHJvbGU9ImltZyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgNjQwIDUxMiI+PHBhdGggZmlsbD0iY3VycmVudENvbG9yIiBkPSJNOTYgMjA4YzAtNjEuODYgNTAuMTQtMTExLjEgMTExLjEtMTExLjFjNTIuNjUgMCA5Ni41IDM2LjQ1IDEwOC41IDg1LjQyQzMzNC43IDE3My4xIDM1NC43IDE2OCAzNzUuMSAxNjhjNC42MD [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "Weather"
+  labels:
+    camel.apache.org/kamelet.type: "source"
+spec:
+  definition:
+    title: wttr.in Source
+    description: |-
+      Get weather forecasts from the wttr.in weather forecast service
+    type: object
+    properties:
+      period:
+        title: Period
+        description: The interval between fetches to the wttr.in service in milliseconds
+        type: integer
+        default: 60000
+      wttrLocation:
+        title: Location
+        description: The location to get weather forecasts
+        type: string
+        example: '"paris", "~Eiffel+tower", "Москва", "muc", "@stackoverflow.com", "94107", "-78.46,106.79"'
+      wttrLanguage:
+        title: Language
+        description: The language to use for displaying weather forecasts
+        type: string
+        example: 'am ar af be bn ca da de el et fr fa hi hu ia id it lt mg nb nl oc pl pt-br ro ru ta tr th uk vi zh-cn zh-tw'
+      output:
+        title: Output Type
+        description: The type of output
+        type: string
+        example: 'current, weather, full'
+        default: current
+  types:
+    out:
+      mediaType: application/json
+  dependencies:
+    - "camel:http"
+    - "camel:jackson"
+    - "camel:jsonpath"
+    - "camel:kamelet"
+    - "camel:timer"
+  flow:
+    from:
+      uri: timer:wttr.in
+      parameters:
+        period: "{{period}}"
+      steps:
+        - to: "https://wttr.in/{{?wttrLocation}}?format=j1&lang={{?wttrLanguage}}"
+        - choice:
+            when:
+              - simple: "'{{output}}' == 'current'"
+                steps:
+                  - transform:
+                      jsonpath: "$.current_condition[0]"
+                  - marshal:
+                      json: {}
+              - simple: "'{{output}}' == 'weather'"
+                steps:
+                  - transform:
+                      jsonpath: "$.weather"
+                  - marshal:
+                      json: {}
+        - to: "kamelet:sink"

[camel-kamelets] 02/02: Generate doc for wttr.in Source Kamelet

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git

commit 39bc34e11100c99d18f818365ab584e8f1796d1a
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Mon Dec 6 13:10:29 2021 +0900

    Generate doc for wttr.in Source Kamelet
---
 .../ROOT/assets/images/kamelets/wttrin-source.svg  |   1 +
 docs/modules/ROOT/nav.adoc                         |   1 +
 docs/modules/ROOT/pages/wttrin-source.adoc         | 146 +++++++++++++++++++++
 .../bindings/camel-k/wttrin-source-binding.yaml    |  16 +++
 templates/bindings/core/wttrin-source-binding.yaml |   7 +
 5 files changed, 171 insertions(+)

diff --git a/docs/modules/ROOT/assets/images/kamelets/wttrin-source.svg b/docs/modules/ROOT/assets/images/kamelets/wttrin-source.svg
new file mode 100644
index 0000000..616c828
--- /dev/null
+++ b/docs/modules/ROOT/assets/images/kamelets/wttrin-source.svg
@@ -0,0 +1 @@
+<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="cloud-sun" class="svg-inline--fa fa-cloud-sun" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M96 208c0-61.86 50.14-111.1 111.1-111.1c52.65 0 96.5 36.45 108.5 85.42C334.7 173.1 354.7 168 375.1 168c4.607 0 9.152 .3809 13.68 .8203l24.13-34.76c5.145-7.414 .8965-17.67-7.984-19.27L317.2 98.78L301.2 10.21C299.6 1.325 289.4-2.919 281.9 2.226L208 53.54L134.1 2.225C126.6-2.92 1 [...]
\ No newline at end of file
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index c94f9f2..f5cac61 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -139,6 +139,7 @@
 * xref:ROOT:value-to-key-action.adoc[image:kamelets/value-to-key-action.svg[] Value to Key Action]
 * xref:ROOT:velocity-template-action.adoc[image:kamelets/velocity-template-action.svg[] Velocity Template Action]
 * xref:ROOT:webhook-source.adoc[image:kamelets/webhook-source.svg[] Webhook Source]
+* xref:ROOT:wttrin-source.adoc[image:kamelets/wttrin-source.svg[] wttr.in Source]
 * xref:ROOT:xj-identity-action.adoc[image:kamelets/xj-identity-action.svg[] XJ Identity Action]
 * xref:ROOT:xj-template-action.adoc[image:kamelets/xj-template-action.svg[] XJ Template Action]
 // THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
diff --git a/docs/modules/ROOT/pages/wttrin-source.adoc b/docs/modules/ROOT/pages/wttrin-source.adoc
new file mode 100644
index 0000000..af490c4
--- /dev/null
+++ b/docs/modules/ROOT/pages/wttrin-source.adoc
@@ -0,0 +1,146 @@
+// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
+
+= image:kamelets/wttrin-source.svg[] wttr.in Source
+
+*Provided by: "Apache Software Foundation"*
+
+*Support Level for this Kamelet is: "Preview"*
+
+Get weather forecasts from the wttr.in weather forecast service
+
+== Configuration Options
+
+The following table summarizes the configuration options available for the `wttrin-source` Kamelet:
+[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
+|===
+| Property| Name| Description| Type| Default| Example
+| language| Language| The language to use for displaying weather forecasts| string| | `"am ar af be bn ca da de el et fr fa hi hu ia id it lt mg nb nl oc pl pt-br ro ru ta tr th uk vi zh-cn zh-tw"`
+| output| Output Type| The type of output| string| `"current"`| `"current, weather, full"`
+| period| Period| The interval between fetches to the wttr.in service in milliseconds| integer| `60000`| 
+| wttrLocation| Location| The location to get weather forecasts| string| | `"\"paris\", \"~Eiffel+tower\", \"Москва\", \"muc\", \"@stackoverflow.com\", \"94107\", \"-78.46,106.79\""`
+|===
+
+NOTE: Fields marked with an asterisk ({empty}*) are mandatory.
+
+
+== Dependencies
+
+At runtime, the `wttrin-source` Kamelet relies upon the presence of the following dependencies:
+
+- camel:http
+- camel:jsonpath
+- camel:jackson 
+
+== Usage
+
+This section describes how you can use the `wttrin-source`.
+
+=== Knative Source
+
+You can use the `wttrin-source` Kamelet as a Knative source by binding it to a Knative object.
+
+.wttrin-source-binding.yaml
+[source,yaml]
+----
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: wttrin-source-binding
+spec:
+  source:
+    ref:
+      kind: Kamelet
+      apiVersion: camel.apache.org/v1alpha1
+      name: wttrin-source
+  sink:
+    ref:
+      kind: Channel
+      apiVersion: messaging.knative.dev/v1
+      name: mychannel
+  
+----
+
+==== *Prerequisite*
+
+You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster.
+
+==== *Procedure for using the cluster CLI*
+
+. Save the `wttrin-source-binding.yaml` file to your local drive, and then edit it as needed for your configuration.
+
+. Run the source by using the following command:
++
+[source,shell]
+----
+kubectl apply -f wttrin-source-binding.yaml
+----
+
+==== *Procedure for using the Kamel CLI*
+
+Configure and run the source by using the following command:
+
+[source,shell]
+----
+kamel bind wttrin-source channel:mychannel
+----
+
+This command creates the KameletBinding in the current namespace on the cluster.
+
+=== Kafka Source
+
+You can use the `wttrin-source` Kamelet as a Kafka source by binding it to a Kafka topic.
+
+.wttrin-source-binding.yaml
+[source,yaml]
+----
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: wttrin-source-binding
+spec:
+  source:
+    ref:
+      kind: Kamelet
+      apiVersion: camel.apache.org/v1alpha1
+      name: wttrin-source
+  sink:
+    ref:
+      kind: KafkaTopic
+      apiVersion: kafka.strimzi.io/v1beta1
+      name: my-topic
+  
+----
+
+==== *Prerequisites*
+
+* You've installed https://strimzi.io/[Strimzi].
+* You've created a topic named `my-topic` in the current namespace.
+* You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster.
+
+==== *Procedure for using the cluster CLI*
+
+. Save the `wttrin-source-binding.yaml` file to your local drive, and then edit it as needed for your configuration.
+
+. Run the source by using the following command:
++
+[source,shell]
+----
+kubectl apply -f wttrin-source-binding.yaml
+----
+
+==== *Procedure for using the Kamel CLI*
+
+Configure and run the source by using the following command:
+
+[source,shell]
+----
+kamel bind wttrin-source kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
+----
+
+This command creates the KameletBinding in the current namespace on the cluster.
+
+== Kamelet source file
+
+https://github.com/apache/camel-kamelets/blob/main/kamelets/wttrin-source.kamelet.yaml
+
+// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
diff --git a/templates/bindings/camel-k/wttrin-source-binding.yaml b/templates/bindings/camel-k/wttrin-source-binding.yaml
new file mode 100644
index 0000000..7bca533
--- /dev/null
+++ b/templates/bindings/camel-k/wttrin-source-binding.yaml
@@ -0,0 +1,16 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: KameletBinding
+metadata:
+  name: wttrin-source-binding
+spec:
+  source:
+    ref:
+      kind: Kamelet
+      apiVersion: camel.apache.org/v1alpha1
+      name: wttrin-source
+  sink:
+    ref:
+      kind: KafkaTopic
+      apiVersion: kafka.strimzi.io/v1beta1
+      name: my-topic
+  
\ No newline at end of file
diff --git a/templates/bindings/core/wttrin-source-binding.yaml b/templates/bindings/core/wttrin-source-binding.yaml
new file mode 100644
index 0000000..e19d395
--- /dev/null
+++ b/templates/bindings/core/wttrin-source-binding.yaml
@@ -0,0 +1,7 @@
+- route:
+    from:
+      uri: "kamelet:wttrin-source"
+    steps:
+      - to:
+          uri: "log:info"
+    
\ No newline at end of file