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

Google Storage Source Kamelet #633

Merged
merged 8 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
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 @@ -59,6 +59,7 @@
* xref:ROOT:google-pubsub-sink.adoc[image:kamelets/google-pubsub-sink.svg[] Google Pubsub Sink]
* xref:ROOT:google-pubsub-source.adoc[image:kamelets/google-pubsub-source.svg[] Google Pubsub Source]
* xref:ROOT:google-sheets-source.adoc[image:kamelets/google-sheets-source.svg[] Google Sheets Source]
* xref:ROOT:google-storage-source.adoc[image:kamelets/google-storage-source.svg[] Google Storage Source]
* xref:ROOT:has-header-filter-action.adoc[image:kamelets/has-header-filter-action.svg[] Has Header Filter Action]
* xref:ROOT:header-matches-filter-action.adoc[image:kamelets/header-matches-filter-action.svg[] Header Matches Filter Action]
* xref:ROOT:hoist-field-action.adoc[image:kamelets/hoist-field-action.svg[] Hoist Field Action]
Expand Down
154 changes: 154 additions & 0 deletions docs/modules/ROOT/pages/google-storage-source.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT

= image:kamelets/google-storage-source.svg[] Google Storage Source

*Provided by: "Apache Software Foundation"*

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

Consume Objects from Google Storage.

The serviceAccountKey property needs to be encoded in base64, so when you pass it as parameter, don't forget to encode it.

== Configuration Options

The following table summarizes the configuration options available for the `google-storage-source` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *bucketNameOrArn {empty}* *| Bucket Name Or ARN| The Bucket Name or Bucket ARN| string| |
| *serviceAccountKey {empty}* *| Service Account Key| The Service account key that can be used as credentials for the Google Cloud Storage access.| binary| |
| autoCreateBucket| Autocreate Bucket| Setting the autocreation of the Google Cloud Storage bucket bucketNameOrArn.| boolean| `false`|
| deleteAfterRead| Auto-delete Objects| Delete objects after consuming them| boolean| `true`|
|===

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


== Dependencies

At runtime, the `google-storage-source` Kamelet relies upon the presence of the following dependencies:

- camel:kamelet
- camel:google-storage
- camel:jackson

== Usage

This section describes how you can use the `google-storage-source`.

=== Knative Source

You can use the `google-storage-source` Kamelet as a Knative source by binding it to a Knative object.

.google-storage-source-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: google-storage-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: google-storage-source
properties:
bucketNameOrArn: "The Bucket Name Or ARN"
serviceAccountKey: "The Service Account Key"
sink:
ref:
kind: Channel
apiVersion: messaging.knative.dev/v1
name: mychannel

----

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

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

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

Configure and run the source by using the following command:

[source,shell]
----
kamel bind google-storage-source -p "source.bucketNameOrArn=The Bucket Name Or ARN" -p "source.serviceAccountKey=The Service Account Key" channel:mychannel
----

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

=== Kafka Source

You can use the `google-storage-source` Kamelet as a Kafka source by binding it to a Kafka topic.

.google-storage-source-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: google-storage-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: google-storage-source
properties:
bucketNameOrArn: "The Bucket Name Or ARN"
serviceAccountKey: "The Service Account Key"
sink:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic

----

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

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

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

Configure and run the source by using the following command:

[source,shell]
----
kamel bind google-storage-source -p "source.bucketNameOrArn=The Bucket Name Or ARN" -p "source.serviceAccountKey=The Service Account Key" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic
----

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

== Kamelet source file

https://github.com/apache/camel-kamelets/blob/main/kamelets/google-storage-source.kamelet.yaml

// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
77 changes: 77 additions & 0 deletions kamelets/google-storage-source.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# ---------------------------------------------------------------------------
# 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-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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBoZWlnaHQ9IjgwMCIgd2lkdGg9IjEyMDAiIHZpZXdCb3g9Ii0xOS4yMDAxNSAtMjguNDgzIDE2Ni40MDEzIDE3MC44OTgiPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTcuMDM0KSI+PGxpbmVhckdyYWRpZW50IHkyPSIxMjAuNzg5IiB4Mj0iNjQiIHkxPSI3LjAzNCIgeDE9IjY0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgaWQ9ImEiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzQzODdmZCIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzQ2ODNlYSIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTI3Ljc5IDExNS4yMTdMMS41NCA2OS43NDlhMTEuNDk5IDExLjQ5OSAwIDAxMC0xMS40OTlsMjYuMjUtNDUuNDY3YTExLjUgMTEuNSAwIDAxOS45Ni01Ljc1aDUyLjVhMTEuNSAxMS41IDAgMDE5Ljk1OSA1Ljc1bDI2LjI1IDQ1LjQ2N2ExMS40OTkgMTEuNDk5IDAgMDEwIDExLjVsLTI2LjI1IDQ1LjQ2NmExMS41IDExLjUgMCAwMS05Ljk1OSA1Ljc1aC01Mi41YTExLjQ5OSAxMS40OTkgMCAwMS05Ljk2LTUuNzV6IiBmaWxsPSJ1cmwoI2EpIi8+PC9nPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTcuMDM0KSI+PGRlZnM+PHBhdGggZD0iTTI3Ljc5MSAxMTU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YuNDE1IDguNDkxbC00MS40MzYuMDAyYy0uNjY3IDAtMS4yMTIuNTQ2LTEuMjEyIDEuMjE0djguNTY1YzAgLjY2Ni41NDYgMS4yMTMgMS4yMTIgMS4yMTNIODQuN2MuNjY3IDAgMS4yMTMtLjU0NyAxLjIxMy0xLjIxM3YtOC41NjdjMC0uNjY2LS41NDUtMS4yMTQtMS4yMTItMS4yMTRtLTYuNDE2IDcuOTc2YTIuNDgzIDIuNDgzIDAgMDEtMi40NzctMi40OCAyLjQ3NSAyLjQ3NSAwIDAxMi40NzctMi40NzcgMi40OCAyLjQ4IDAgMTEwIDQuOTU2IiBmaWxsPSIjZmZmIi8+PC9zdmc+"
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Google Storage"
labels:
camel.apache.org/kamelet.type: "source"
spec:
definition:
title: "Google Storage Source"
description: |-
Consume Objects from Google Storage.

The serviceAccountKey property needs to be encoded in base64, so when you pass it as parameter, don't forget to encode it.
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
deleteAfterRead:
title: Auto-delete Objects
description: Delete objects after consuming them
type: boolean
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: true
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: "google-storage://{{bucketNameOrArn}}"
parameters:
autoCreateBucket: "{{autoCreateBucket}}"
serviceAccountKey: "base64:{{serviceAccountKey}}"
deleteAfterRead: "{{deleteAfterRead}}"
steps:
- to: kamelet:sink
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# ---------------------------------------------------------------------------
# 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-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,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBoZWlnaHQ9IjgwMCIgd2lkdGg9IjEyMDAiIHZpZXdCb3g9Ii0xOS4yMDAxNSAtMjguNDgzIDE2Ni40MDEzIDE3MC44OTgiPjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTcuMDM0KSI+PGxpbmVhckdyYWRpZW50IHkyPSIxMjAuNzg5IiB4Mj0iNjQiIHkxPSI3LjAzNCIgeDE9IjY0IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgaWQ9ImEiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzQzODdmZCIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iIzQ2ODNlYSIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTI3Ljc5IDExNS4yMTdMMS41NCA2OS43NDlhMTEuNDk5IDExLjQ5OSAwIDAxMC0xMS40OTlsMjYuMjUtN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yAwLTEuMjEyLjU0Ni0xLjIxMiAxLjIxNHY4LjU2NmMwIC42NjYuNTQ2IDEuMjEyIDEuMjEyIDEuMjEySDg0LjdjLjY2NyAwIDEuMjEzLS41NDYgMS4yMTMtMS4yMTJ2LTguNTY4YzAtLjY2Ni0uNTQ1LTEuMjEzLTEuMjEyLTEuMjEzbS02LjQxNiA3Ljk3NmEyLjQ4NCAyLjQ4NCAwIDAxLTIuNDc3LTIuNDggMi40NzUgMi40NzUgMCAwMTIuNDc3LTIuNDc3YzEuMzcgMCAyLjQ4IDEuMTAzIDIuNDggMi40NzdhMi40OCAyLjQ4IDAgMDEtMi40OCAyLjQ4bTYuNDE1IDguNDkxbC00MS40MzYuMDAyYy0uNjY3IDAtMS4yMTIuNTQ2LTEuMjEyIDEuMjE0djguNTY1YzAgLjY2Ni41NDYgMS4yMTMgMS4yMTIgMS4yMTNIODQuN2MuNjY3IDAgMS4yMTMtLjU0NyAxLjIxMy0xLjIxM3YtOC41NjdjMC0uNjY2LS41NDUtMS4yMTQtMS4yMTItMS4yMTRtLTYuNDE2IDcuOTc2YTIuNDgzIDIuNDgzIDAgMDEtMi40NzctMi40OCAyLjQ3NSAyLjQ3NSAwIDAxMi40NzctMi40NzcgMi40OCAyLjQ4IDAgMTEwIDQuOTU2IiBmaWxsPSIjZmZmIi8+PC9zdmc+"
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Google Storage"
labels:
camel.apache.org/kamelet.type: "source"
spec:
definition:
title: "Google Storage Source"
description: |-
Consume Objects from Google Storage.

The serviceAccountKey property needs to be encoded in base64, so when you pass it as parameter, don't forget to encode it.
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
deleteAfterRead:
title: Auto-delete Objects
description: Delete objects after consuming them
type: boolean
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: true
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: "google-storage://{{bucketNameOrArn}}"
parameters:
autoCreateBucket: "{{autoCreateBucket}}"
serviceAccountKey: "base64:{{serviceAccountKey}}"
deleteAfterRead: "{{deleteAfterRead}}"
steps:
- to: kamelet:sink
19 changes: 19 additions & 0 deletions templates/bindings/camel-k/google-storage-source-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: google-storage-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: google-storage-source
properties:
bucketNameOrArn: "The Bucket Name Or ARN"
serviceAccountKey: "The Service Account Key"
sink:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic

10 changes: 10 additions & 0 deletions templates/bindings/core/google-storage-source-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- route:
from:
uri: "kamelet:google-storage-source"
parameters:
bucketNameOrArn: "The Bucket Name Or ARN"
serviceAccountKey: "The Service Account Key"
steps:
- to:
uri: "log:info"