Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couchbase Sink Kamelet: Initial version #566

Merged
merged 12 commits into from
Nov 10, 2021
81 changes: 81 additions & 0 deletions couchbase-sink.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: couchbase-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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNjguMzQzIDY4LjM0MyIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2U9IiMwMDAiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHVzZSB4bGluazpocmVmPSIjQSIgeD0iMi4xNzEiIHk9IjIuMTcxIi8+PHN5bWJvbCBpZD0iQSIgb3ZlcmZsb3c9InZpc2libGUiPjxwYXRoIGQ9Ik0zMi4wMDIgMEMxNC4zMzEuMDAyLjAwNSAxNC4zMjYgMCAzMS45OThjLjAwNSAxNy42NyAxNC4zMjggMzEuOTkzIDMxLjk5OCAzMS45OTggMTcuNjctLjAwNSAzMS45OTMtMTQuMzI4IDMxLjk5OC0zMS45OThDNjMuOTkxIDE0LjMzIDQ5LjY3LjAwNyAzMi4wMDIgMHptMjEuNjA2IDM3LjYwOWMwIDEuOTMzLTEuMTEyIDMuNjI2LTMuMjg4IDQuMDEzLTMuNzcuNjc4LTExLjcgMS4wNjQtMTguMzE4IDEuMDY0cy0xNC41NDgtLjQzNC0xOC4zMTgtMS4wNjRjLTEuOTY0LS4yOTQtMy4zODUtMi4wMjktMy4yODgtNC4wMTNWMjUuMTM2YzAtMS45MzMgMS40OTgtMy43MjIgMy4yODgtNC4wMTMgMS4xMTItLjE5NSAzLjcyMi0uNDM0IDUuNzU0LS40MzQuNzczIDAgMS40MDMuNTgyIDEuNDAzIDEuNDk4djguNzUxbDExLjIxMy0uMjQzIDExLjIxMy4yNDN2LTguNzAzYzAtLjg2OS42My0xLjQ5OCAxLjQwMy0xLjQ5OCAyLjAyOCAwIDQuNjQ3LjE5NiA1Ljc1NC40MzQgMS44MzcuMjkxIDMuMjg4IDIuMDg1IDMuMjg4IDQuMDEzbC0uMDk2IDEyLjQ3M3oiIHN0cm9rZT0ibm9uZSIgZmlsbD0iI2VkMjIyNiIgZmlsbC1ydWxlPSJub256ZXJvIi8+PC9zeW1ib2w+PC9zdmc+"
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Couchbase"
labels:
camel.apache.org/kamelet.type: "sink"
spec:
definition:
title: "Couchbase Sink"
description: |-
Send documents to Couchbase.
required:
- protocol
- couchbaseHostname
- bucket
type: object
properties:
protocol:
title: Protocol
description: The protocol to use
type: string
couchbaseHostname:
title: Hostname
description: The hostname to use
type: string
couchbasePort:
title: Port
description: The port to use
type: int
default: 8091
bucket:
title: Bucket
description: The bucket to use
type: string
username:
title: Username
description: Username to connect to Couchbase.
type: string
x-descriptors:
- urn:camel:group:credentials
password:
title: Password
description: Password to connect to Couchbase.
type: string
format: password
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
- urn:camel:group:credentials
startingId:
title: Starting Id
description: The starting id
type: long
default: 1
autoStartId:
title: Auto Start Id
description: Auto Start Id or not
type: boolean
default: true
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:checkbox
dependencies:
- "camel:couchbase"
- "camel:kamelet"
flow:
from:
uri: "kamelet:source"
steps:
- to:
uri: "couchbase:{{protocol}}://{{couchbaseHostname}}:{{couchbasePort}}"
parameters:
bucket: "{{bucket}}"
autoStartIdForInserts: "{{autoStartId}}"
startingIdForInsertsFrom: "{{startingId}}"
username: "{{username}}"
password: "{{password}}"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* xref:ROOT:cassandra-source.adoc[image:kamelets/cassandra-source.svg[] Cassandra Source]
* xref:ROOT:chuck-norris-source.adoc[image:kamelets/chuck-norris-source.svg[] Chuck Norris Source]
* xref:ROOT:chunk-template-action.adoc[image:kamelets/chunk-template-action.svg[] Chunk Template Action]
* xref:ROOT:couchbase-sink.adoc[image:kamelets/couchbase-sink.svg[] Couchbase Sink]
* xref:ROOT:cron-source.adoc[image:kamelets/cron-source.svg[] Cron Source]
* xref:ROOT:dns-dig-action.adoc[image:kamelets/dns-dig-action.svg[] DNS DIG Action]
* xref:ROOT:dns-ip-action.adoc[image:kamelets/dns-ip-action.svg[] DNS IP Action]
Expand Down
157 changes: 157 additions & 0 deletions docs/modules/ROOT/pages/couchbase-sink.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT

= image:kamelets/couchbase-sink.svg[] Couchbase Sink

*Provided by: "Apache Software Foundation"*

*Support Level for this Kamelet is: "Preview"*

Send documents to Couchbase.

== Configuration Options

The following table summarizes the configuration options available for the `couchbase-sink` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *bucket {empty}* *| Bucket| The bucket to use| string| |
| *couchbaseHostname {empty}* *| Hostname| The hostname to use| string| |
| *protocol {empty}* *| Protocol| The protocol to use| string| |
| autoStartId| Auto Start Id| Auto Start Id or not| boolean| `true`|
| couchbasePort| Port| The port to use| int| `8091`|
| password| Password| Password to connect to Couchbase.| string| |
| startingId| Starting Id| The starting id| long| `1`|
| username| Username| Username to connect to Couchbase.| string| |
|===

NOTE: Fields marked with an asterisk ({empty}*) are mandatory.


== Dependencies

At runtime, the `couchbase-sink Kamelet relies upon the presence of the following dependencies:

- camel:couchbase
- camel:kamelet

== Usage

This section describes how you can use the `couchbase-sink`.

=== Knative Sink

You can use the `couchbase-sink` Kamelet as a Knative sink by binding it to a Knative object.

.couchbase-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: couchbase-sink-binding
spec:
source:
ref:
kind: Channel
apiVersion: messaging.knative.dev/v1
name: mychannel
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: couchbase-sink
properties:
bucket: "The Bucket"
couchbaseHostname: "The Hostname"
protocol: "The Protocol"

----

==== *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 `couchbase-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration.

. Run the sink by using the following command:
+
[source,shell]
----
kubectl apply -f couchbase-sink-binding.yaml
----

==== *Procedure for using the Kamel CLI*

Configure and run the sink by using the following command:

[source,shell]
----
kamel bind channel:mychannel couchbase-sink -p "sink.bucket=The Bucket" -p "sink.couchbaseHostname=The Hostname" -p "sink.protocol=The Protocol"
----

This command creates the KameletBinding in the current namespace on the cluster.

=== Kafka Sink

You can use the `couchbase-sink` Kamelet as a Kafka sink by binding it to a Kafka topic.

.couchbase-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: couchbase-sink-binding
spec:
source:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: couchbase-sink
properties:
bucket: "The Bucket"
couchbaseHostname: "The Hostname"
protocol: "The Protocol"

----

==== *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 `couchbase-sink-binding.yaml` file to your local drive, and then edit it as needed for your configuration.

. Run the sink by using the following command:
+
[source,shell]
----
kubectl apply -f couchbase-sink-binding.yaml
----

==== *Procedure for using the Kamel CLI*

Configure and run the sink by using the following command:

[source,shell]
----
kamel bind kafka.strimzi.io/v1beta1:KafkaTopic:my-topic couchbase-sink -p "sink.bucket=The Bucket" -p "sink.couchbaseHostname=The Hostname" -p "sink.protocol=The Protocol"
----

This command creates the KameletBinding in the current namespace on the cluster.

== Kamelet source file

https://github.com/apache/camel-kamelets/blob/main/couchbase-sink.kamelet.yaml

// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: couchbase-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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNjguMzQzIDY4LjM0MyIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2U9IiMwMDAiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHVzZSB4bGluazpocmVmPSIjQSIgeD0iMi4xNzEiIHk9IjIuMTcxIi8+PHN5bWJvbCBpZD0iQSIgb3ZlcmZsb3c9InZpc2libGUiPjxwYXRoIGQ9Ik0zMi4wMDIgMEMxNC4zMzEuMDAyLjAwNSAxNC4zMjYgMCAzMS45OThjLjAwNSAxNy42NyAxNC4zMjggMzEuOTkzIDMxLjk5OCAzMS45OTggMTcuNjctLjAwNSAzMS45OTMtMTQuMzI4IDMxLjk5OC0zMS45OThDNjMuOTkxIDE0LjMzIDQ5LjY3LjAwNyAzMi4wMDIgMHptMjEuNjA2IDM3LjYwOWMwIDEuOTMzLTEuMTEyIDMuNjI2LTMuMjg4IDQuMDEzLTMuNzcuNjc4LTExLjcgMS4wNjQtMTguMzE4IDEuMDY0cy0xNC41NDgtLjQzNC0xOC4zMTgtMS4wNjRjLTEuOTY0LS4yOTQtMy4zODUtMi4wMjktMy4yODgtNC4wMTNWMjUuMTM2YzAtMS45MzMgMS40OTgtMy43MjIgMy4yODgtNC4wMTMgMS4xMTItLjE5NSAzLjcyMi0uNDM0IDUuNzU0LS40MzQuNzczIDAgMS40MDMuNTgyIDEuNDAzIDEuNDk4djguNzUxbDExLjIxMy0uMjQzIDExLjIxMy4yNDN2LTguNzAzYzAtLjg2OS42My0xLjQ5OCAxLjQwMy0xLjQ5OCAyLjAyOCAwIDQuNjQ3LjE5NiA1Ljc1NC40MzQgMS44MzcuMjkxIDMuMjg4IDIuMDg1IDMuMjg4IDQuMDEzbC0uMDk2IDEyLjQ3M3oiIHN0cm9rZT0ibm9uZSIgZmlsbD0iI2VkMjIyNiIgZmlsbC1ydWxlPSJub256ZXJvIi8+PC9zeW1ib2w+PC9zdmc+"
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Couchbase"
labels:
camel.apache.org/kamelet.type: "sink"
spec:
definition:
title: "Couchbase Sink"
description: |-
Send documents to Couchbase.
required:
- protocol
- couchbaseHostname
- bucket
type: object
properties:
protocol:
title: Protocol
description: The protocol to use
type: string
couchbaseHostname:
title: Hostname
description: The hostname to use
type: string
couchbasePort:
title: Port
description: The port to use
type: int
default: 8091
bucket:
title: Bucket
description: The bucket to use
type: string
username:
title: Username
description: Username to connect to Couchbase.
type: string
x-descriptors:
- urn:camel:group:credentials
password:
title: Password
description: Password to connect to Couchbase.
type: string
format: password
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
- urn:camel:group:credentials
startingId:
title: Starting Id
description: The starting id
type: long
default: 1
autoStartId:
title: Auto Start Id
description: Auto Start Id or not
type: boolean
default: true
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:checkbox
dependencies:
- "camel:couchbase"
- "camel:kamelet"
flow:
from:
uri: "kamelet:source"
steps:
- to:
uri: "couchbase:{{protocol}}://{{couchbaseHostname}}:{{couchbasePort}}"
parameters:
bucket: "{{bucket}}"
autoStartIdForInserts: "{{autoStartId}}"
startingIdForInsertsFrom: "{{startingId}}"
username: "{{username}}"
password: "{{password}}"
20 changes: 20 additions & 0 deletions templates/bindings/camel-k/couchbase-sink-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: couchbase-sink-binding
spec:
source:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: couchbase-sink
properties:
bucket: "The Bucket"
couchbaseHostname: "The Hostname"
protocol: "The Protocol"

14 changes: 14 additions & 0 deletions templates/bindings/core/couchbase-sink-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 1000
message: "Hello Camel JBang"
steps:
- to:
uri: "kamelet:couchbase-sink"
parameters:
bucket: "The Bucket"
couchbaseHostname: "The Hostname"
protocol: "The Protocol"