Skip to content

Commit

Permalink
Expose Kamelet data type information
Browse files Browse the repository at this point in the history
- AWS DDB sink Kamelet input data type information
- AWS S3 source output data type information
  • Loading branch information
christophd committed Sep 6, 2023
1 parent 70b53d1 commit b110633
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/yaks-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
46 changes: 41 additions & 5 deletions kamelets/aws-ddb-sink.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
55 changes: 55 additions & 0 deletions kamelets/aws-s3-source.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
* 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
Expand All @@ -72,11 +72,11 @@
* }
* </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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b110633

Please sign in to comment.