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

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


The following commit(s) were added to refs/heads/main by this push:
     new b1106331 Expose Kamelet data type information
b1106331 is described below

commit b11063312d365fc78b9d326b99b71d323f4ba464
Author: Christoph Deppisch <cdeppi...@redhat.com>
AuthorDate: Wed Sep 6 18:03:24 2023 +0200

    Expose Kamelet data type information
    
    - AWS DDB sink Kamelet input data type information
    - AWS S3 source output data type information
---
 .github/workflows/yaks-tests.yaml                  |  2 +-
 kamelets/aws-ddb-sink.kamelet.yaml                 | 46 ++++++++++++++++--
 kamelets/aws-s3-source.kamelet.yaml                | 55 ++++++++++++++++++++++
 .../converter/aws2/ddb/Ddb2JsonInputType.java      |  8 ++--
 .../resources/kamelets/aws-ddb-sink.kamelet.yaml   | 46 ++++++++++++++++--
 .../resources/kamelets/aws-s3-source.kamelet.yaml  | 55 ++++++++++++++++++++++
 6 files changed, 197 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/yaks-tests.yaml 
b/.github/workflows/yaks-tests.yaml
index 45a9c4c9..dd4a987e 100644
--- a/.github/workflows/yaks-tests.yaml
+++ b/.github/workflows/yaks-tests.yaml
@@ -42,7 +42,7 @@ concurrency:
 
 env:
   YAKS_VERSION: 0.16.0
-  YAKS_RUN_OPTIONS: "--timeout=15m --local -e YAKS_CAMELK_MAX_ATTEMPTS=10 -e 
YAKS_JBANG_CAMEL_VERSION=4.0.0 -e YAKS_JBANG_KAMELETS_VERSION=4.0.0-SNAPSHOT -e 
YAKS_JBANG_KAMELETS_LOCAL_DIR=../../../kamelets -e 
YAKS_KAMELET_API_VERSION=v1alpha1"
+  YAKS_RUN_OPTIONS: "--timeout=15m --local -e YAKS_CAMELK_MAX_ATTEMPTS=10 -e 
YAKS_JBANG_CAMEL_VERSION=4.0.0 -e YAKS_JBANG_KAMELETS_VERSION=4.1.0-SNAPSHOT -e 
YAKS_JBANG_KAMELETS_LOCAL_DIR=../../../kamelets -e 
YAKS_KAMELET_API_VERSION=v1alpha1"
 
 jobs:
   test:
diff --git a/kamelets/aws-ddb-sink.kamelet.yaml 
b/kamelets/aws-ddb-sink.kamelet.yaml
index f6e7bcd0..f778f1d2 100644
--- a/kamelets/aws-ddb-sink.kamelet.yaml
+++ b/kamelets/aws-ddb-sink.kamelet.yaml
@@ -44,10 +44,11 @@ spec:
       For DeleteItem operation the Json body defines only the primary key 
attributes that identify the item to delete.
       For UpdateItem operation the Json body defines both key attributes to 
identify the item to be updated and all item attributes tht get updated on the 
item.
       
-      The given Json body can use "key" and "item" as top level properties. 
Both define a Json object that will be mapped to respective attribute value maps
+      The given Json body can use "operation", "key" and "item" as top level 
properties that will be mapped to respective attribute value maps.
       {
-          "key": {},
-          "item": {}
+        "operation": "PutItem"
+        "key": {},
+        "item": {}
       }
     required:
       - table
@@ -104,9 +105,44 @@ spec:
         x-descriptors:
           - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
         default: false
-  types:
+  dataTypes:
     in:
-      mediaType: application/json
+      default: json
+      types:
+        json:
+          format: "aws2-ddb:application-json"
+          description: |-
+            Json representation of a DDB operation. The input type supports 
the operations: PutItem, UpdateItem, DeleteItem
+            
+            For PutItem operation the Json body defines all item attributes.
+            For DeleteItem operation the Json body defines only the primary 
key attributes that identify the item to delete.
+            For UpdateItem operation the Json body defines both key attributes 
to identify the item to be updated and all item attributes tht get updated on 
the item.
+  
+            The given Json body can use "operation", "key" and "item" as top 
level properties that will be mapped to respective attribute value maps.
+          headers:
+            CamelAwsDdbOperation:
+              title: Operation
+              description: The operation to perform. Overwrites the operation 
given in the Json body. One of PutItem, UpdateItem, DeleteItem.
+              default: PutItem
+              type: string
+            CamelAwsDdbReturnValues:
+              title: Return Values
+              description: Use this parameter if you want to get the attribute 
name-value pairs before or after they are modified. Possible values are NONE, 
ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW.
+              type: string
+          mediaType: application/json
+          schema:
+            type: object
+            required: [ "key" ]
+            properties:
+              operation:
+                type: string
+                description: The operator to perform. One of PutItem, 
UpdateItem, DeleteItem
+              key:
+                type: object
+                description: The primary key specifies the selection criteria 
for the query.
+              item:
+                type: object
+                description: Attribute value map specifies all attributes to 
change with the given operation.
   dependencies:
   - mvn:org.apache.camel.kamelets:camel-kamelets-utils:4.1.0-SNAPSHOT
   - "camel:core"
diff --git a/kamelets/aws-s3-source.kamelet.yaml 
b/kamelets/aws-s3-source.kamelet.yaml
index 82342503..c38cc990 100644
--- a/kamelets/aws-s3-source.kamelet.yaml
+++ b/kamelets/aws-s3-source.kamelet.yaml
@@ -101,6 +101,61 @@ spec:
         description: The number of milliseconds before the next poll of the 
selected bucket.
         type: integer
         default: 500
+  dataTypes:
+    out:
+      default: binary
+      headers:
+        CamelAwsS3BucketName:
+          title: S3 Bucket Name
+          description: The bucket name which has been used to retrieve objects
+          type: string
+        CamelAwsS3Key:
+          title: S3 Key
+          description: The key under which the retrieved object is stored
+          type: string
+        CamelAwsS3ContentType:
+          title: Content Type
+          description: The content type of the retrieved object.
+          default: application/octet-stream
+          type: string
+        CamelAwsS3ETag:
+          title: ETag Value
+          description: |-
+            The hex encoded 128-bit MD5 digest of the associated object 
according to RFC 1864. 
+            This data is used as an integrity check to verify that the data 
received by the caller is the same data that was sent by Amazon S3.
+          type: string
+      types:
+        binary:
+          format: "application-octet-stream"
+          description: Default binary representation of the S3 object 
retrieved from the bucket.
+          mediaType: application/octet-stream
+        cloudevents:
+          format: "aws2-s3:application-cloudevents"
+          description: |-
+            Output data type represents AWS S3 get object response as 
CloudEvent V1. The data type sets Camel specific CloudEvent headers on the 
exchange with
+            respective data from the S3 bucket and its derived object.
+          headers:
+            CamelCloudEventID:
+              title: CloudEvent ID
+              description: The Camel exchange id set as event id
+              type: string
+            CamelCloudEventType:
+              title: CloudEvent Type
+              description: The event type
+              default: "org.apache.camel.event.aws.s3.getObject"
+              type: string
+            CamelCloudEventSource:
+              title: CloudEvent Source
+              description: The event source. By default, the S3 bucket name 
with prefix "aws.s3.bucket.".
+              type: string
+            CamelCloudEventSubject:
+              title: CloudEvent Subject
+              description: The event subject. Usually the S3 key.
+              type: string
+            CamelCloudEventTime:
+              title: CloudEvent Time
+              description: The exchange creation timestamp as event time.
+              type: string
   dependencies:
     - "camel:core"
     - "camel:aws2-s3"
diff --git 
a/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/format/converter/aws2/ddb/Ddb2JsonInputType.java
 
b/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/format/converter/aws2/ddb/Ddb2JsonInputType.java
index b9b20f3f..d56b6f0e 100644
--- 
a/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/format/converter/aws2/ddb/Ddb2JsonInputType.java
+++ 
b/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/format/converter/aws2/ddb/Ddb2JsonInputType.java
@@ -59,8 +59,8 @@ import 
software.amazon.awssdk.services.dynamodb.model.ReturnValue;
  * For UpdateItem operation the Json body defines both key attributes to 
identify the item to be updated and all item
  * attributes tht get updated on the item.
  *
- * The given Json body can use "operation", "key" and "item" as top level 
properties. Both define a Json object that
- * will be mapped to respective attribute value maps:
+ * The given Json body can use "operation", "key" and "item" as top level 
properties that will be mapped to respective
+ * attribute value maps:
  *
  * <pre>
  * {@code
@@ -72,11 +72,11 @@ import 
software.amazon.awssdk.services.dynamodb.model.ReturnValue;
  * }
  * </pre>
  *
- * The converter will extract the objects and set respective attribute value 
maps as header entries. This is a
+ * The transformer will extract the objects and set respective attribute value 
maps as header entries. This is a
  * comfortable way to define different key and item attribute value maps e.g. 
on UpdateItem operation.
  *
  * In case key and item attribute value maps are identical you can omit the 
special top level properties completely. The
- * converter will map the whole Json body as is then and use it as source for 
the attribute value map.
+ * transformer will map the whole Json body as is then and use it as source 
for the attribute value map.
  */
 @DataTypeTransformer(name = "aws2-ddb:application-json")
 public class Ddb2JsonInputType extends Transformer {
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/aws-ddb-sink.kamelet.yaml 
b/library/camel-kamelets/src/main/resources/kamelets/aws-ddb-sink.kamelet.yaml
index f6e7bcd0..f778f1d2 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/aws-ddb-sink.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/aws-ddb-sink.kamelet.yaml
@@ -44,10 +44,11 @@ spec:
       For DeleteItem operation the Json body defines only the primary key 
attributes that identify the item to delete.
       For UpdateItem operation the Json body defines both key attributes to 
identify the item to be updated and all item attributes tht get updated on the 
item.
       
-      The given Json body can use "key" and "item" as top level properties. 
Both define a Json object that will be mapped to respective attribute value maps
+      The given Json body can use "operation", "key" and "item" as top level 
properties that will be mapped to respective attribute value maps.
       {
-          "key": {},
-          "item": {}
+        "operation": "PutItem"
+        "key": {},
+        "item": {}
       }
     required:
       - table
@@ -104,9 +105,44 @@ spec:
         x-descriptors:
           - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
         default: false
-  types:
+  dataTypes:
     in:
-      mediaType: application/json
+      default: json
+      types:
+        json:
+          format: "aws2-ddb:application-json"
+          description: |-
+            Json representation of a DDB operation. The input type supports 
the operations: PutItem, UpdateItem, DeleteItem
+            
+            For PutItem operation the Json body defines all item attributes.
+            For DeleteItem operation the Json body defines only the primary 
key attributes that identify the item to delete.
+            For UpdateItem operation the Json body defines both key attributes 
to identify the item to be updated and all item attributes tht get updated on 
the item.
+  
+            The given Json body can use "operation", "key" and "item" as top 
level properties that will be mapped to respective attribute value maps.
+          headers:
+            CamelAwsDdbOperation:
+              title: Operation
+              description: The operation to perform. Overwrites the operation 
given in the Json body. One of PutItem, UpdateItem, DeleteItem.
+              default: PutItem
+              type: string
+            CamelAwsDdbReturnValues:
+              title: Return Values
+              description: Use this parameter if you want to get the attribute 
name-value pairs before or after they are modified. Possible values are NONE, 
ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW.
+              type: string
+          mediaType: application/json
+          schema:
+            type: object
+            required: [ "key" ]
+            properties:
+              operation:
+                type: string
+                description: The operator to perform. One of PutItem, 
UpdateItem, DeleteItem
+              key:
+                type: object
+                description: The primary key specifies the selection criteria 
for the query.
+              item:
+                type: object
+                description: Attribute value map specifies all attributes to 
change with the given operation.
   dependencies:
   - mvn:org.apache.camel.kamelets:camel-kamelets-utils:4.1.0-SNAPSHOT
   - "camel:core"
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/aws-s3-source.kamelet.yaml 
b/library/camel-kamelets/src/main/resources/kamelets/aws-s3-source.kamelet.yaml
index 82342503..c38cc990 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/aws-s3-source.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/aws-s3-source.kamelet.yaml
@@ -101,6 +101,61 @@ spec:
         description: The number of milliseconds before the next poll of the 
selected bucket.
         type: integer
         default: 500
+  dataTypes:
+    out:
+      default: binary
+      headers:
+        CamelAwsS3BucketName:
+          title: S3 Bucket Name
+          description: The bucket name which has been used to retrieve objects
+          type: string
+        CamelAwsS3Key:
+          title: S3 Key
+          description: The key under which the retrieved object is stored
+          type: string
+        CamelAwsS3ContentType:
+          title: Content Type
+          description: The content type of the retrieved object.
+          default: application/octet-stream
+          type: string
+        CamelAwsS3ETag:
+          title: ETag Value
+          description: |-
+            The hex encoded 128-bit MD5 digest of the associated object 
according to RFC 1864. 
+            This data is used as an integrity check to verify that the data 
received by the caller is the same data that was sent by Amazon S3.
+          type: string
+      types:
+        binary:
+          format: "application-octet-stream"
+          description: Default binary representation of the S3 object 
retrieved from the bucket.
+          mediaType: application/octet-stream
+        cloudevents:
+          format: "aws2-s3:application-cloudevents"
+          description: |-
+            Output data type represents AWS S3 get object response as 
CloudEvent V1. The data type sets Camel specific CloudEvent headers on the 
exchange with
+            respective data from the S3 bucket and its derived object.
+          headers:
+            CamelCloudEventID:
+              title: CloudEvent ID
+              description: The Camel exchange id set as event id
+              type: string
+            CamelCloudEventType:
+              title: CloudEvent Type
+              description: The event type
+              default: "org.apache.camel.event.aws.s3.getObject"
+              type: string
+            CamelCloudEventSource:
+              title: CloudEvent Source
+              description: The event source. By default, the S3 bucket name 
with prefix "aws.s3.bucket.".
+              type: string
+            CamelCloudEventSubject:
+              title: CloudEvent Subject
+              description: The event subject. Usually the S3 key.
+              type: string
+            CamelCloudEventTime:
+              title: CloudEvent Time
+              description: The exchange creation timestamp as event time.
+              type: string
   dependencies:
     - "camel:core"
     - "camel:aws2-s3"

Reply via email to