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/16 13:14:24 UTC

[camel-kamelets] 01/05: Added Google Storage Sink Kamelet

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

acosentino pushed a commit to branch google-storage-sink
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git

commit 79fe26b5bc22d825ba4280f2d6aec04d65b2c550
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Dec 16 14:09:52 2021 +0100

    Added Google Storage Sink Kamelet
---
 kamelets/google-storage-sink.kamelet.yaml | 91 +++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/kamelets/google-storage-sink.kamelet.yaml b/kamelets/google-storage-sink.kamelet.yaml
new file mode 100644
index 0000000..12ef2ed
--- /dev/null
+++ b/kamelets/google-storage-sink.kamelet.yaml
@@ -0,0 +1,91 @@
+# ---------------------------------------------------------------------------
+# 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: google-storage-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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBoZWlnaHQ9IjgwMCIgd2lkdGg9IjEyMDAiIHZpZXdCb3g9Ii0xOS4yMDAxNSAtMjguNDgzIDE2Ni40MDEzIDE3MC44OTgiPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTcuMDM0KSI+PGxpbmVhckdyYWRpZW50IHkyPSIxMjAuNzg5IiB4Mj0iNjQiIHkxPSI3LjAzNCIgeDE9IjY0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgaWQ9ImEiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzQzODdmZCIvPj [...]
+    camel.apache.org/provider: "Apache Software Foundation"
+    camel.apache.org/kamelet.group: "Google Storage"
+  labels:
+    camel.apache.org/kamelet.type: "sink"
+spec:
+  definition:
+    title: "Google Storage Sink"
+    description: |-
+      Upload Objects to Google Storage.
+
+      The serviceAccountKey property needs to be encoded in base64, so when you pass it as parameter, don't forget to encode it.
+
+      - `file` / `ce-file`: as the file name to upload
+
+      If the header won't be set the exchange ID will be used as file name.
+    required:
+      - bucketNameOrArn
+      - serviceAccountKey
+    type: object
+    properties:
+      bucketNameOrArn:
+        title: Bucket Name Or ARN
+        description: The Bucket Name or Bucket ARN
+        type: string
+      serviceAccountKey:
+        title: Service Account Key
+        description: The Service account key that can be used as credentials for the Google Cloud Storage access.
+        type: binary
+        x-descriptors:
+        - urn:camel:group:credentials
+      autoCreateBucket:
+        title: Autocreate Bucket
+        description: Setting the autocreation of the Google Cloud Storage bucket bucketNameOrArn. 
+        type: boolean
+        x-descriptors:
+        - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+        default: false
+  dependencies:
+    - "camel:kamelet"
+    - "camel:google-storage"
+    - "camel:jackson"
+  flow:
+    from:
+      uri: "kamelet:source"
+      steps:
+      - choice:
+          when:
+          - simple: "${header[file]}"
+            steps:
+            - set-header:
+                name: CamelGoogleCloudStorageObjectName
+                simple: "${header[file]}"
+          - simple: "${header[ce-file]}"
+            steps:
+            - set-header:
+                name: CamelGoogleCloudStorageObjectName
+                simple: "${header[ce-file]}"
+          otherwise:
+            steps:
+            - set-header:
+                name: CamelGoogleCloudStorageObjectName
+                simple: "${exchangeId}"
+      - to:
+          uri: "google-storage://{{bucketNameOrArn}}"
+          parameters:
+            autoCreateBucket: "{{autoCreateBucket}}"
+            serviceAccountKey: "base64:{{serviceAccountKey}}"