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 2022/03/30 15:44:18 UTC

[camel-kamelets] 03/08: feature(salesforce): Delete sink accepts parameters on body Also, improved documentation on all salesforce sink

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

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

commit f0197f4d8f7f6908aebb034fd9e3111926103fb4
Author: Maria Arias de Reyna <ar...@redhat.com>
AuthorDate: Tue Mar 29 10:19:44 2022 +0200

    feature(salesforce): Delete sink accepts parameters on body
    Also, improved documentation on all salesforce sink
---
 kamelets/salesforce-create-sink.kamelet.yaml       |  4 +++-
 kamelets/salesforce-delete-sink.kamelet.yaml       | 26 +++++++++-------------
 kamelets/salesforce-update-sink.kamelet.yaml       |  6 ++++-
 .../direct-to-salesforce-delete-binding.yaml       |  4 +---
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/kamelets/salesforce-create-sink.kamelet.yaml b/kamelets/salesforce-create-sink.kamelet.yaml
index faa7826..309a1d6 100644
--- a/kamelets/salesforce-create-sink.kamelet.yaml
+++ b/kamelets/salesforce-create-sink.kamelet.yaml
@@ -29,7 +29,9 @@ metadata:
 spec:
   definition:
     title: "Salesforce Create Sink"
-    description: "Creates an object in  Salesforce."
+    description: |-
+        Creates an object in Salesforce. The body of the message must contain
+      the JSON of the salesforce object.
     required:
       - sObjectName
       - clientId
diff --git a/kamelets/salesforce-delete-sink.kamelet.yaml b/kamelets/salesforce-delete-sink.kamelet.yaml
index 528487b..42b3441 100644
--- a/kamelets/salesforce-delete-sink.kamelet.yaml
+++ b/kamelets/salesforce-delete-sink.kamelet.yaml
@@ -29,25 +29,16 @@ metadata:
 spec:
   definition:
     title: "Salesforce Delete Sink"
-    description: "Removes an object from Salesforce."
+    description: |-
+        Removes an object from Salesforce. The body received must be a json
+      containing two keys: sObjectId and sObjectName.
     required:
-      - sObjectId
-      - sObjectName
       - clientId
       - clientSecret
       - userName
       - password
     type: object
     properties:
-      sObjectName:
-        title: Object Name
-        description: Type of the object
-        type: string
-        example: Contact
-      sObjectId:
-        title: Object Id
-        description: Id of the object
-        type: string
       loginUrl:
         title: Login URL
         description: The Salesforce instance login URL
@@ -100,8 +91,13 @@ spec:
     from:
       uri: kamelet:source
       steps:
+        - set-header:
+            name: sObjectId
+            jsonpath: "$['sObjectId']"
+        - set-header:
+            name: sObjectName
+            jsonpath: "$['sObjectName']"
+        - setBody:
+            simple: "${null}"
         - to:
             uri: "{{local-delete-salesforce}}:deleteSObject"
-            parameters:
-              sObjectId: "{{sObjectId}}"
-              sObjectName: "{{sObjectName}}"
diff --git a/kamelets/salesforce-update-sink.kamelet.yaml b/kamelets/salesforce-update-sink.kamelet.yaml
index ca88aba..ad26cfd 100644
--- a/kamelets/salesforce-update-sink.kamelet.yaml
+++ b/kamelets/salesforce-update-sink.kamelet.yaml
@@ -29,7 +29,11 @@ metadata:
 spec:
   definition:
     title: "Salesforce Update Sink"
-    description: "Updates an object in  Salesforce."
+    description: |-
+        Updates an object in  Salesforce. The body received must contain a
+      JSON key-value pair for each property to update or a valid Salesforce
+      object. If using key-value pair, sObjectName and sObjectId must be
+      provided as parameters.
     required:
       - clientId
       - clientSecret
diff --git a/test/salesforce-sink/direct-to-salesforce-delete-binding.yaml b/test/salesforce-sink/direct-to-salesforce-delete-binding.yaml
index 7441a1c..62dc8a8 100644
--- a/test/salesforce-sink/direct-to-salesforce-delete-binding.yaml
+++ b/test/salesforce-sink/direct-to-salesforce-delete-binding.yaml
@@ -27,7 +27,7 @@ spec:
       name: timer-source
     properties:
       period: 60000
-      message: "Hello Salesforce!"
+      message: " { \"sObjectId\": \"${id}\", \"sObjectName\" : \"Contact\" }"
   sink:
     ref:
       apiVersion: camel.apache.org/v1alpha1
@@ -38,5 +38,3 @@ spec:
       clientSecret: "${client_secret}"
       userName: "${userName}"
       password: "${password}"
-      sObjectName: "Contact"
-      sObjectId: "${id}"