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:04 UTC
[camel-kamelets] 01/02: Add wttr.in Source Kamelet
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"