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/05/11 12:13:00 UTC
[camel-kamelets] 01/08: Add Azure CosmosDB Sink Kamelet
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch cosmosdb-sink
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
commit 9fed9f1e2fa39c703ccf2e448b9bdf80e5f477fb
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu May 11 14:05:20 2023 +0200
Add Azure CosmosDB Sink Kamelet
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
kamelets/azure-cosmosdb-sink.kamelet.yaml | 105 ++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
diff --git a/kamelets/azure-cosmosdb-sink.kamelet.yaml b/kamelets/azure-cosmosdb-sink.kamelet.yaml
new file mode 100644
index 00000000..1f892638
--- /dev/null
+++ b/kamelets/azure-cosmosdb-sink.kamelet.yaml
@@ -0,0 +1,105 @@
+# ---------------------------------------------------------------------------
+# 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: azure-cosmosdb-sink
+ annotations:
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/catalog.version: "4.0.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxOCI+PGRlZnM+PHJhZGlhbEdyYWRpZW50IGlkPSJhIiBjeD0iLTEwNS4wMDYiIGN5PSItMTAuNDA5IiByPSI1Ljk1NCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxLjAzNiAwIDAgMS4wMjcgMTE3LjczOSAxOS42NDQpIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agb2Zmc2V0PSIuMTgzIiBzdG9wLWNvbG9yPSIjNWVhMGVmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjMDA3OGQ0Ii8+PC9yYWRpYWxHcmFkaWVudD48Y2xpcFBhdG [...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "Azure CosmosDB"
+ camel.apache.org/kamelet.namespace: "Azure"
+ labels:
+ camel.apache.org/kamelet.type: "sinks"
+spec:
+ definition:
+ title: "Azure CosmosDB Sink"
+ description: |-
+ Send Data to an Azure CosmosDB instance
+ required:
+ - databaseName
+ - containerName
+ - accountKey
+ - databaseEndpoint
+ type: object
+ properties:
+ databaseName:
+ title: Database Name
+ description: The Azure Cosmos database name.
+ type: string
+ containerName:
+ title: Container Name
+ description: The Azure Cosmos container name.
+ type: string
+ accountKey:
+ title: Account Key
+ description: The Azure Cosmos account Key.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:alm:descriptor:com.tectonic.ui:password
+ - urn:camel:group:credentials
+ databaseEndpoint:
+ title: Database Endpoint
+ description: Sets the Azure Cosmos database endpoint the component will connect to.
+ type: string
+ itemPartitionKey:
+ title: Item Partition Key
+ description: Represents a partition key value in the Azure Cosmos DB database service. A partition key identifies the partition where the item is stored in.
+ type: string
+ types:
+ in:
+ mediaType: application/json
+ dependencies:
+ - "camel:azure-cosmosdb"
+ - "camel:kamelet"
+ - "camel:jackson"
+ template:
+ from:
+ uri: "kamelet:source"
+ steps:
+ - choice:
+ precondition: true
+ when:
+ - simple: '${propertiesExist:!itemPartitionKey}'
+ steps:
+ - choice:
+ when:
+ - simple: "${header[itemPartitionKey]}"
+ steps:
+ - set-header:
+ name: CamelAzureCosmosDbItemPartitionKey
+ simple: "${header[itemPartitionKey]}"
+ - simple: "${header[ce-itemPartitionKey]}"
+ steps:
+ - set-header:
+ name: CamelAzureCosmosDbItemPartitionKey
+ simple: "${header[ce-itemPartitionKey]}"
+ - unmarshal:
+ json:
+ library: Jackson
+ - to:
+ uri: "azure-cosmosdb:{{databaseName}}/{{containerName}}"
+ parameters:
+ accountKey: "{{accountKey}}"
+ databaseEndpoint: "{{databaseEndpoint}}"
+ itemPartitionKey: "{{?itemPartitionKey}}"
+ operation: createItem
+