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

Json-Patch Action Kamelet #649

Merged
merged 5 commits into from
Dec 21, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
59 changes: 59 additions & 0 deletions docs/modules/ROOT/assets/images/kamelets/json-patch-action.svg
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 @@ -81,6 +81,7 @@
* xref:ROOT:jms-apache-artemis-source.adoc[image:kamelets/jms-apache-artemis-source.svg[] JMS - Apache Artemis Kamelet Source]
* xref:ROOT:jolt-transformation-action.adoc[image:kamelets/jolt-transformation-action.svg[] Jolt Transformation Action]
* xref:ROOT:json-deserialize-action.adoc[image:kamelets/json-deserialize-action.svg[] Json Deserialize Action]
* xref:ROOT:json-patch-action.adoc[image:kamelets/json-patch-action.svg[] Json Patch Action]
* xref:ROOT:json-schema-validator-action.adoc[image:kamelets/json-schema-validator-action.svg[] Json Schema Validator Action]
* xref:ROOT:json-serialize-action.adoc[image:kamelets/json-serialize-action.svg[] Json Serialize Action]
* xref:ROOT:jsonata-action.adoc[image:kamelets/jsonata-action.svg[] Jsonata Action]
Expand Down
162 changes: 162 additions & 0 deletions docs/modules/ROOT/pages/json-patch-action.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT

= image:kamelets/json-patch-action.svg[] Json Patch Action

*Provided by: "Apache Software Foundation"*

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

Apply a Json Patch Transformation.

The template 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 `json-patch-action` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *template {empty}* *| Template| The json patch transformation| binary| |
|===

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


== Dependencies

At runtime, the `json-patch-action` Kamelet relies upon the presence of the following dependencies:

- camel:json-patch
- camel:kamelet

== Usage

This section describes how you can use the `json-patch-action`.

=== Knative Action

You can use the `json-patch-action` Kamelet as an intermediate step in a Knative binding.

.json-patch-action-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: json-patch-action-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: timer-source
properties:
message: "Hello"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: json-patch-action
properties:
template: "The Template"
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 `json-patch-action-binding.yaml` file to your local drive, and then edit it as needed for your configuration.

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

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

Configure and run the action by using the following command:

[source,shell]
----
kamel bind timer-source?message=Hello --step json-patch-action -p "step-0.template=The Template" channel:mychannel
----

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

=== Kafka Action

You can use the `json-patch-action` Kamelet as an intermediate step in a Kafka binding.

.json-patch-action-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: json-patch-action-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: timer-source
properties:
message: "Hello"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: json-patch-action
properties:
template: "The Template"
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 `json-patch-action-binding.yaml` file to your local drive, and then edit it as needed for your configuration.

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

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

Configure and run the action by using the following command:

[source,shell]
----
kamel bind timer-source?message=Hello --step json-patch-action -p "step-0.template=The Template" 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/json-patch-action.kamelet.yaml

// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
54 changes: 54 additions & 0 deletions kamelets/json-patch-action.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# ---------------------------------------------------------------------------
# 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: json-patch-action
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,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYW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C04LC0yMyAtMTUsLTIxIC01MSwtNjYuNSAtMzYsLTQ1LjUgLTU0LC03MC41IDI2LC01MCA0MSwtOTggbCAxODMsLTI4IHEgMTMsLTIgMjEsLTEyLjUgOCwtMTAuNSA4LC0yMy41IHoiCiAgICAgICBpZD0icGF0aDMwMjkiCiAgICAgICBpbmtzY2FwZTpjb25uZWN0b3ItY3VydmF0dXJlPSIwIgogICAgICAgc3R5bGU9ImZpbGw6Y3VycmVudENvbG9yIiAvPgogIDwvZz4KPC9zdmc+Cg=="
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Actions"
labels:
camel.apache.org/kamelet.type: "action"
spec:
definition:
title: "Json Patch Action"
description: |-
Apply a Json Patch Transformation.

The template property needs to be encoded in base64, so when you pass it as parameter, don't forget to encode it.
required:
- template
type: object
properties:
template:
title: Template
description: The json patch transformation
type: binary
dependencies:
- "camel:json-patch"
- "camel:kamelet"
flow:
from:
uri: "kamelet:source"
steps:
- to:
uri: "json-patch:"
parameters:
resourceUri: "base64:{{template}}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# ---------------------------------------------------------------------------
# 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: json-patch-action
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,PD94bWwgdmVyc2lvbj0iMS4wI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NjUsLTE3MCA3LC04IDcsLTIyIDAsLTEyIC04LC0yMyAtMTUsLTIxIC01MSwtNjYuNSAtMzYsLTQ1LjUgLTU0LC03MC41IDI2LC01MCA0MSwtOTggbCAxODMsLTI4IHEgMTMsLTIgMjEsLTEyLjUgOCwtMTAuNSA4LC0yMy41IHoiCiAgICAgICBpZD0icGF0aDMwMjkiCiAgICAgICBpbmtzY2FwZTpjb25uZWN0b3ItY3VydmF0dXJlPSIwIgogICAgICAgc3R5bGU9ImZpbGw6Y3VycmVudENvbG9yIiAvPgogIDwvZz4KPC9zdmc+Cg=="
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "Actions"
labels:
camel.apache.org/kamelet.type: "action"
spec:
definition:
title: "Json Patch Action"
description: |-
Apply a Json Patch Transformation.

The template property needs to be encoded in base64, so when you pass it as parameter, don't forget to encode it.
required:
- template
type: object
properties:
template:
title: Template
description: The json patch transformation
type: binary
dependencies:
- "camel:json-patch"
- "camel:kamelet"
flow:
from:
uri: "kamelet:source"
steps:
- to:
uri: "json-patch:"
parameters:
resourceUri: "base64:{{template}}"
24 changes: 24 additions & 0 deletions templates/bindings/camel-k/json-patch-action-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: json-patch-action-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: timer-source
properties:
message: "Hello"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: json-patch-action
properties:
template: "The Template"
sink:
ref:
kind: KafkaTopic
apiVersion: kafka.strimzi.io/v1beta1
name: my-topic
13 changes: 13 additions & 0 deletions templates/bindings/core/json-patch-action-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 1000
message: "{ \"foo\": \"John\"}"
steps:
- to:
uri: "kamelet:json-patch-action"
parameters:
template: "The Template"
- to:
uri: "log:info"