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

Dropbox sink kamelet #88

Merged
merged 3 commits into from
Mar 24, 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
4 changes: 4 additions & 0 deletions docs/modules/ROOT/assets/images/kamelets/dropbox-sink.svg
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 @@ -5,6 +5,7 @@
* xref:ROOT:aws-sqs-sink.adoc[image:kamelets/aws-sqs-sink.svg[] AWS SQS Sink]
* xref:ROOT:aws-sqs-source.adoc[image:kamelets/aws-sqs-source.svg[] AWS SQS Source]
* xref:ROOT:bitcoin-source.adoc[image:kamelets/bitcoin-source.svg[] Bitcoin Source]
* xref:ROOT:dropbox-sink.adoc[image:kamelets/dropbox-sink.svg[] Dropbox Sink]
* xref:ROOT:dropbox-source.adoc[image:kamelets/dropbox-source.svg[] Dropbox Source]
* xref:ROOT:earthquake-source.adoc[image:kamelets/earthquake-source.svg[] Earthquake Source]
* xref:ROOT:file-watch-source.adoc[image:kamelets/file-watch-source.svg[] File Watch Source]
Expand Down
71 changes: 71 additions & 0 deletions docs/modules/ROOT/pages/dropbox-sink.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/dropbox-sink.svg[] Dropbox Sink

*Provided by: "Apache Software Foundation"*

Upload Files to Dropbox.

The Kamelet expects the following headers to be set:

- `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.

== Configuration Options

The following table summarizes the configuration options available for the `dropbox-sink` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *accessToken {empty}* *| Dropbox Access Token| The access Token to use to access Dropbox| string| |
| *clientIdentifier {empty}* *| The client identifier| Dropbox App client Identifier| string| |
| *remotePath {empty}* *| Remote path| Original file or folder to work with| string| |
| *uploadMode {empty}* *| Upload Mode| Which mode to upload. in case of add the new file will be renamed if a file with the same name already exists on dropbox. in case of force if a file with the same name already exists on dropbox, this will be overwritten. The value can be one of add, force.| string| `"add"`|
|===

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

== Usage

This section summarizes how the `dropbox-sink` can be used in various contexts.

=== Knative Sink

The `dropbox-sink` Kamelet can be used as Knative sink by binding it to a Knative object.

.dropbox-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: dropbox-sink-binding
spec:
source:
ref:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: dropbox-sink
properties:
accessToken: "The Dropbox Access Token"
clientIdentifier: "The The client identifier"
remotePath: "The Remote path"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `dropbox-sink-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the sink using the following command:

[source,shell]
----
kubectl apply -f dropbox-sink-binding.yaml
----
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
69 changes: 69 additions & 0 deletions dropbox-sink.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: dropbox-sink
annotations:
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjQzcHgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDQzIDQwIiB2ZXJzaW9uPSIxLjEiIGhlaWdodD0iNDBweCI+CiA8cGF0aCBkPSJtMTIuNSAwbC0xMi41IDguMSA4LjcgNyAxMi41LTcuOC04LjctNy4zem0tMTIuNSAyMS45bDEyLjUgOC4yIDguNy03LjMtMTIuNS03LjctOC43IDYuOHptMjEuMiAwLjlsOC44IDcuMyAxMi40LTguMS04LjYtNi45LTEyLjYgNy43em0yMS4yLTE0LjdsLTEyLjQtOC4xLTguOCA3LjMgMTIuNiA3LjggOC42LTd6bS0yMS4xIDE2LjNsLTguOCA3LjMtMy43LTIuNXYyLjhsMTIuNSA3LjUgMTIuNS03LjV2LTIuOGwtMy44IDIuNS04LjctNy4zeiIgZmlsbD0iIzAwN0VFNSIvPgo8L3N2Zz4K"
camel.apache.org/provider: "Apache Software Foundation"
labels:
camel.apache.org/kamelet.type: "sink"
spec:
definition:
title: "Dropbox Sink"
description: |-
Upload Files to Dropbox.

The Kamelet expects the following headers to be set:

- `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:
- accessToken
- clientIdentifier
- remotePath
- uploadMode
properties:
accessToken:
title: Dropbox Access Token
description: The access Token to use to access Dropbox
type: string
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
clientIdentifier:
title: The client identifier
description: Dropbox App client Identifier
type: string
remotePath:
title: Remote path
description: Original file or folder to work with
type: string
uploadMode:
title: Upload Mode
description: Which mode to upload. in case of add the new file will be renamed if a file with the same name already exists on dropbox. in case of force if a file with the same name already exists on dropbox, this will be overwritten. The value can be one of add, force.
type: string
default: add
flow:
from:
uri: "kamelet:source"
steps:
- choice:
when:
- simple: "${header[file]}"
steps:
- set-header:
name: CamelDropboxPutFileName
simple: "${header[file]}"
- simple: "${header[ce-file]}"
steps:
- set-header:
name: CamelDropboxPutFileName
simple: "${header[ce-file]}"
- to:
uri: 'dropbox:put'
parameters:
accessToken: '{{accessToken}}'
remotePath: '{{remotePath}}'
clientIdentifier: '{{clientIdentifier}}'
uploadMode: '{{uploadMode}}'