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 1f23c91d171821321e14ac26a0b22afae93828d9 Author: Alexander Haslam <[email protected]> AuthorDate: Sun Jan 30 23:12:02 2022 -0800 add base oracle sink & source --- kamelets/oracle-database-sink.kamelet.yaml | 114 +++++++++++++++++++++++++++ kamelets/oracle-database-source.kamelet.yaml | 111 ++++++++++++++++++++++++++ 2 files changed, 225 insertions(+) diff --git a/kamelets/oracle-database-sink.kamelet.yaml b/kamelets/oracle-database-sink.kamelet.yaml new file mode 100644 index 0000000..0135320 --- /dev/null +++ b/kamelets/oracle-database-sink.kamelet.yaml @@ -0,0 +1,114 @@ +# --------------------------------------------------------------------------- +# 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: oracle-database-sink + 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,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+UG9zdGdyZVNRTCBpY29uPC90aXRsZT48cGF0aCBkPSJNMTcuMTI4IDBhMTAuMTM0IDEwLjEzNCAwIDAgMC0yLjc1NS40MDNsLS4wNjMuMDJBMTAuOTIyIDEwLjkyMiAwIDAgMCAxMi42LjI1OEMxMS40MjIuMjM4IDEwLjQxLjUyNCA5LjU5NCAxIDguNzkuNzIxIDcuMTIyLjI0IDUuMzY0LjMzNiA0LjE0LjQwMyAyLjgwNC43NzUgMS44MTQgMS44Mi44MjcgMi44NjUuMzA1IDQuNDgyLjQxNSA2LjY4MmMuMDMuNjA3LjIwMyAxLjU5Ny [...] + camel.apache.org/provider: "Apache Software Foundation" + camel.apache.org/kamelet.group: "SQL" + labels: + camel.apache.org/kamelet.type: "sink" +spec: + definition: + title: "Oracle Database Sink" + description: |- + Send data to a Oracle Database. + + This Kamelet expects a JSON as body. The mapping between the JSON fields and parameters is done by key, so if you have the following query: + + 'INSERT INTO accounts (username,city) VALUES (:#username,:#city)' + + The Kamelet needs to receive as input something like: + + '{ "username":"oscerd", "city":"Rome"}' + required: + - serverName + - username + - password + - query + - databaseName + type: object + properties: + serverName: + title: Server Name + description: Server Name for the data source + type: string + example: localhost + serverPort: + title: Server Port + description: Server Port for the data source + type: string + default: 5432 + username: + title: Username + description: The username to use for accessing a secured Oracle Database + type: string + x-descriptors: + - urn:camel:group:credentials + password: + title: Password + description: The password to use for accessing a secured Oracle Database + type: string + format: password + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password + - urn:camel:group:credentials + query: + title: Query + description: The Query to execute against the Oracle Database + type: string + example: 'INSERT INTO accounts (username,city) VALUES (:#username,:#city)' + databaseName: + title: Database Name + description: The Database Name we are pointing + type: string + types: + in: + mediaType: application/json + dependencies: + - "camel:jackson" + - "camel:kamelet" + - "camel:sql" + - "mvn:com.oracle.database.jdbc:ojdbc11:21.4.0.0.1" + - "mvn:org.apache.commons:commons-dbcp2:2.9.0" + template: + beans: + - name: dsBean + type: "#class:org.apache.commons.dbcp2.BasicDataSource" + property: + - key: username + value: '{{username}}' + - key: password + value: '{{password}}' + - key: url + value: 'jdbc:oracle:thin://{{serverName}}:{{serverPort}}/{{databaseName}}' + - key: driverClassName + value: 'oracle.jdbc.driver.OracleDriver' + from: + uri: "kamelet:source" + steps: + - unmarshal: + json: + library: Jackson + - to: + uri: "sql:{{query}}" + parameters: + dataSource: "#bean:{{dsBean}}" diff --git a/kamelets/oracle-database-source.kamelet.yaml b/kamelets/oracle-database-source.kamelet.yaml new file mode 100644 index 0000000..01aa662 --- /dev/null +++ b/kamelets/oracle-database-source.kamelet.yaml @@ -0,0 +1,111 @@ +# --------------------------------------------------------------------------- +# 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: oracle-database-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,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+UG9zdGdyZVNRTCBpY29uPC90aXRsZT48cGF0aCBkPSJNMTcuMTI4IDBhMTAuMTM0IDEwLjEzNCAwIDAgMC0yLjc1NS40MDNsLS4wNjMuMDJBMTAuOTIyIDEwLjkyMiAwIDAgMCAxMi42LjI1OEMxMS40MjIuMjM4IDEwLjQxLjUyNCA5LjU5NCAxIDguNzkuNzIxIDcuMTIyLjI0IDUuMzY0LjMzNiA0LjE0LjQwMyAyLjgwNC43NzUgMS44MTQgMS44Mi44MjcgMi44NjUuMzA1IDQuNDgyLjQxNSA2LjY4MmMuMDMuNjA3LjIwMyAxLjU5Ny [...] + camel.apache.org/provider: "Apache Software Foundation" + camel.apache.org/kamelet.group: "SQL" + labels: + camel.apache.org/kamelet.type: "source" +spec: + definition: + title: "Oracle Database Source" + description: |- + Query data from a Oracle Database. + required: + - serverName + - username + - password + - query + - databaseName + type: object + properties: + serverName: + title: Server Name + description: Server Name for the data source + type: string + example: localhost + serverPort: + title: Server Port + description: Server Port for the data source + type: string + default: 5432 + username: + title: Username + description: The username to use for accessing a secured Oracle Database + type: string + x-descriptors: + - urn:camel:group:credentials + password: + title: Password + description: The password to use for accessing a secured Oracle Database + type: string + format: password + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:password + - urn:camel:group:credentials + query: + title: Query + description: The Query to execute against the Oracle Database + type: string + example: 'INSERT INTO accounts (username,city) VALUES (:#username,:#city)' + databaseName: + title: Database Name + description: The Database Name we are pointing + type: string + consumedQuery: + title: Consumed Query + description: A query to run on a tuple consumed + type: string + example: 'DELETE FROM accounts where user_id = :#user_id' + types: + out: + mediaType: application/json + dependencies: + - "camel:jackson" + - "camel:kamelet" + - "camel:sql" + - "mvn:com.oracle.database.jdbc:ojdbc11:21.4.0.0.1" + - "mvn:org.apache.commons:commons-dbcp2:2.9.0" + template: + beans: + - name: dsBean + type: "#class:org.apache.commons.dbcp2.BasicDataSource" + property: + - key: username + value: '{{username}}' + - key: password + value: '{{password}}' + - key: url + value: 'jdbc:oracle:thin://{{serverName}}:{{serverPort}}/{{databaseName}}' + - key: driverClassName + value: 'oracle.jdbc.driver.OracleDriver' + from: + uri: "sql:{{query}}" + parameters: + dataSource: "#bean:{{dsBean}}" + onConsume: "{{?consumedQuery}}" + steps: + - marshal: + json: + library: Jackson + - to: "kamelet:sink"
