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 2023/08/24 15:24:42 UTC

[camel-kamelets] branch opensearch-index-3.x created (now 465f73ac)

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

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


      at 465f73ac Added Opensearch Sink Kamelet

This branch includes the following new commits:

     new 465f73ac Added Opensearch Sink Kamelet

The 1 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.



[camel-kamelets] 01/01: Added Opensearch Sink Kamelet

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

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

commit 465f73ac46e4197a7dd652d66305ba044eb49e98
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Aug 24 17:20:25 2023 +0200

    Added Opensearch Sink Kamelet
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 docs/modules/ROOT/nav.adoc                         |   2 +-
 kamelets/opensearch-index-sink.kamelet.yaml        | 147 +++++++++++++++++++++
 .../kamelets/opensearch-index-sink.kamelet.yaml    | 147 +++++++++++++++++++++
 3 files changed, 295 insertions(+), 1 deletion(-)

diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index fa256dbe..eb89569a 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -122,7 +122,6 @@
 * xref:json-schema-validator-action.adoc[]
 * xref:json-serialize-action.adoc[]
 * xref:jsonata-action.adoc[]
-* xref:kafka-aggregate-source.adoc[]
 * xref:kafka-manual-commit-action.adoc[]
 * xref:kafka-not-secured-sink.adoc[]
 * xref:kafka-not-secured-source.adoc[]
@@ -163,6 +162,7 @@
 * xref:ogcapi-features-action.adoc[]
 * xref:openai-classification-action.adoc[]
 * xref:openai-completion-action.adoc[]
+* xref:opensearch-index-sink.adoc[]
 * xref:oracle-database-sink.adoc[]
 * xref:oracle-database-source.adoc[]
 * xref:pdf-action.adoc[]
diff --git a/kamelets/opensearch-index-sink.kamelet.yaml b/kamelets/opensearch-index-sink.kamelet.yaml
new file mode 100644
index 00000000..ed5a5c90
--- /dev/null
+++ b/kamelets/opensearch-index-sink.kamelet.yaml
@@ -0,0 +1,147 @@
+# ---------------------------------------------------------------------------
+# 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: opensearch-index-sink
+  labels:
+    camel.apache.org/kamelet.type: "sink"
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "3.21.0-SNAPSHOT"
+    camel.apache.org/kamelet.group: "OpenSearch"
+    camel.apache.org/kamelet.namespace: "Search"
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAzNzIgNzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+Cjx0aXRsZT5PcGVuU2VhcmNoIGxvZ288L3RpdGxlPgo8ZGVzYz5TZWFyY2ggZW5naW5lIHNvZnR3YXJlIGZvcmsgb2YgRWxhc3RpY3NlYXJjaDwvZGVzYz4KIDxwYXRoIGQ9Im02MS43Mzc0IDI2LjVjLTEuMjQ5NiAwLTIuMjYyNiAxLjAxMy0yLjI2MjYgMi4yNjI2IDAgMTguNjE4OC0xNS4wOTM0IDMzLjcxMjItMzMuNzEyMiAzMy43MTIyLTEuMjQ5NiAwLTIuMjYyNi [...]
+spec:
+  definition:
+    title: "OpenSearch Index Sink"
+    description: |-
+      Stores JSON-formatted data into Opensearch.
+
+      The input data must be formatted in JSON according to the requirements of the index. 
+
+      If you specify the `certificate` property, you must base64 encode it before you pass it as a parameter.
+      
+      In the header, you can set the following properties:
+
+      - `indexId` / `ce-indexid`: The index ID for OpenSearch.
+      
+      - `indexName` / `ce-indexname`: The index name for OpenSearch.
+      
+      If you do not set a property in the header, the Kamelet uses the exchange ID for the index setting.
+    required:
+      - clusterName
+      - hostAddresses
+    type: object
+    properties:
+      user:
+        title: Username
+        description: The username to connect to OpenSearch.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      password:
+        title: Password
+        description: The password to connect to OpenSearch.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:alm:descriptor:com.tectonic.ui:password
+        - urn:camel:group:credentials
+      enableSSL:
+        title: Enable SSL
+        description: Specifies to connect by using SSL.
+        type: boolean
+        default: false
+        x-descriptors:
+          - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+      hostAddresses:
+        title: Host Addresses
+        description: A comma-separated list of remote transport addresses in `ip:port format`.
+        type: string
+        example: quickstart-es-http:9200
+      clusterName:
+        title: OpenSearch Cluster Name
+        description: The name of the OpenSearch cluster.
+        type: string
+        example: quickstart
+      indexName:
+        title: Index in OpenSearch
+        description: The name of the OpenSearch index.
+        type: string
+        example: data
+      certificate:
+        title: Certificate 
+        description: The Certificate for accessing the OpenSearch cluster. You must encode this value in base64.
+        type: string
+  types:
+    out:
+      mediaType: text/plain
+    in:
+      mediaType: application/json
+  dependencies:
+    - "camel:core"
+    - "camel:jackson"
+    - "camel:kamelet"
+    - "camel:opensearch"
+    - "camel:gson"
+    - "camel:bean"
+  template:
+    beans:
+      - name: local-opensearch
+        type: "#class:org.apache.camel.component.opensearch.OpensearchComponent"
+        properties:
+            user: "{{?user}}"
+            password: "{{?password}}"
+    from:
+      uri: kamelet:source
+      steps:
+      - choice:
+          when:
+          - simple: "${header[indexId]}"
+            steps:
+            - set-header:
+                name: "indexId"
+                simple: "${header[indexId]}"
+          - simple: "${header[ce-indexid]}"
+            steps:
+            - set-header:
+                name: "indexId"
+                simple: "${header[ce-indexid]}"
+      - choice:
+          when:
+          - simple: "${header[indexName]}"
+            steps:
+            - set-header:
+                name: "indexName"
+                simple: "${header[indexName]}"
+          - simple: "${header[ce-indexname]}"
+            steps:
+            - set-header:
+                name: "indexName"
+                simple: "${header[ce-indexname]}"
+      - unmarshal:
+          json: {}
+      - to:
+          uri: "{{local-opensearch}}:{{clusterName}}"
+          parameters:
+            operation: "INDEX"
+            hostAddresses: "{{hostAddresses}}"
+            enableSSL: "{{enableSSL}}"
+            indexName: "{{?indexName}}"
+            certificatePath: "base64:{{?certificate}}"
diff --git a/library/camel-kamelets/src/main/resources/kamelets/opensearch-index-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/opensearch-index-sink.kamelet.yaml
new file mode 100644
index 00000000..ed5a5c90
--- /dev/null
+++ b/library/camel-kamelets/src/main/resources/kamelets/opensearch-index-sink.kamelet.yaml
@@ -0,0 +1,147 @@
+# ---------------------------------------------------------------------------
+# 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: opensearch-index-sink
+  labels:
+    camel.apache.org/kamelet.type: "sink"
+  annotations:
+    camel.apache.org/kamelet.support.level: "Stable"
+    camel.apache.org/catalog.version: "3.21.0-SNAPSHOT"
+    camel.apache.org/kamelet.group: "OpenSearch"
+    camel.apache.org/kamelet.namespace: "Search"
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAzNzIgNzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+Cjx0aXRsZT5PcGVuU2VhcmNoIGxvZ288L3RpdGxlPgo8ZGVzYz5TZWFyY2ggZW5naW5lIHNvZnR3YXJlIGZvcmsgb2YgRWxhc3RpY3NlYXJjaDwvZGVzYz4KIDxwYXRoIGQ9Im02MS43Mzc0IDI2LjVjLTEuMjQ5NiAwLTIuMjYyNiAxLjAxMy0yLjI2MjYgMi4yNjI2IDAgMTguNjE4OC0xNS4wOTM0IDMzLjcxMjItMzMuNzEyMiAzMy43MTIyLTEuMjQ5NiAwLTIuMjYyNi [...]
+spec:
+  definition:
+    title: "OpenSearch Index Sink"
+    description: |-
+      Stores JSON-formatted data into Opensearch.
+
+      The input data must be formatted in JSON according to the requirements of the index. 
+
+      If you specify the `certificate` property, you must base64 encode it before you pass it as a parameter.
+      
+      In the header, you can set the following properties:
+
+      - `indexId` / `ce-indexid`: The index ID for OpenSearch.
+      
+      - `indexName` / `ce-indexname`: The index name for OpenSearch.
+      
+      If you do not set a property in the header, the Kamelet uses the exchange ID for the index setting.
+    required:
+      - clusterName
+      - hostAddresses
+    type: object
+    properties:
+      user:
+        title: Username
+        description: The username to connect to OpenSearch.
+        type: string
+        x-descriptors:
+        - urn:camel:group:credentials
+      password:
+        title: Password
+        description: The password to connect to OpenSearch.
+        type: string
+        format: password
+        x-descriptors:
+        - urn:alm:descriptor:com.tectonic.ui:password
+        - urn:camel:group:credentials
+      enableSSL:
+        title: Enable SSL
+        description: Specifies to connect by using SSL.
+        type: boolean
+        default: false
+        x-descriptors:
+          - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+      hostAddresses:
+        title: Host Addresses
+        description: A comma-separated list of remote transport addresses in `ip:port format`.
+        type: string
+        example: quickstart-es-http:9200
+      clusterName:
+        title: OpenSearch Cluster Name
+        description: The name of the OpenSearch cluster.
+        type: string
+        example: quickstart
+      indexName:
+        title: Index in OpenSearch
+        description: The name of the OpenSearch index.
+        type: string
+        example: data
+      certificate:
+        title: Certificate 
+        description: The Certificate for accessing the OpenSearch cluster. You must encode this value in base64.
+        type: string
+  types:
+    out:
+      mediaType: text/plain
+    in:
+      mediaType: application/json
+  dependencies:
+    - "camel:core"
+    - "camel:jackson"
+    - "camel:kamelet"
+    - "camel:opensearch"
+    - "camel:gson"
+    - "camel:bean"
+  template:
+    beans:
+      - name: local-opensearch
+        type: "#class:org.apache.camel.component.opensearch.OpensearchComponent"
+        properties:
+            user: "{{?user}}"
+            password: "{{?password}}"
+    from:
+      uri: kamelet:source
+      steps:
+      - choice:
+          when:
+          - simple: "${header[indexId]}"
+            steps:
+            - set-header:
+                name: "indexId"
+                simple: "${header[indexId]}"
+          - simple: "${header[ce-indexid]}"
+            steps:
+            - set-header:
+                name: "indexId"
+                simple: "${header[ce-indexid]}"
+      - choice:
+          when:
+          - simple: "${header[indexName]}"
+            steps:
+            - set-header:
+                name: "indexName"
+                simple: "${header[indexName]}"
+          - simple: "${header[ce-indexname]}"
+            steps:
+            - set-header:
+                name: "indexName"
+                simple: "${header[ce-indexname]}"
+      - unmarshal:
+          json: {}
+      - to:
+          uri: "{{local-opensearch}}:{{clusterName}}"
+          parameters:
+            operation: "INDEX"
+            hostAddresses: "{{hostAddresses}}"
+            enableSSL: "{{enableSSL}}"
+            indexName: "{{?indexName}}"
+            certificatePath: "base64:{{?certificate}}"