You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2020/09/17 09:09:57 UTC

[camel-k] 02/21: kamelets: adding event types

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

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 7d3663ac0cf71f15eba2602c87a2613c5d54239e
Author: Nicola Ferraro <ni...@gmail.com>
AuthorDate: Tue Jun 23 11:46:38 2020 +0200

    kamelets: adding event types
---
 examples/kamelets/timer.kamelet.yaml     | 24 ++++++++++++++++++++++++
 pkg/apis/camel/v1alpha1/kamelet_types.go | 12 ++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/examples/kamelets/timer.kamelet.yaml b/examples/kamelets/timer.kamelet.yaml
new file mode 100644
index 0000000..9a2ec5d
--- /dev/null
+++ b/examples/kamelets/timer.kamelet.yaml
@@ -0,0 +1,24 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+  name: timer
+spec:
+  displayName: "Timer"
+  description: "Produces produces periodic events with a custom payload"
+  parameters:
+    - name: message
+      description: The message to generate
+      schema:
+        type: string
+  produces:
+    type: text.types.camel.apache.org
+    schema:
+      content:
+        type: string
+  flow:
+    from:
+      uri: timer:tick
+      steps:
+        - set-body:
+            constant: "Hello [here there'll be the message] !!!"
+        - to: "log:info"
diff --git a/pkg/apis/camel/v1alpha1/kamelet_types.go b/pkg/apis/camel/v1alpha1/kamelet_types.go
index ed99b66..190a71d 100644
--- a/pkg/apis/camel/v1alpha1/kamelet_types.go
+++ b/pkg/apis/camel/v1alpha1/kamelet_types.go
@@ -14,9 +14,21 @@ type KameletSpec struct {
 	Authorization AuthorizationSpec   `json:"authorization,omitempty"`
 	Sources       *camelv1.SourceSpec `json:"sources,omitempty"`
 	Flow          *camelv1.Flow       `json:"flow,omitempty"`
+	Consumes      *EventType          `json:"consumes,omitempty"`
+	Produces      *EventType          `json:"produces,omitempty"`
 	Dependencies  []string            `json:"dependencies,omitempty"`
 }
 
+type EventType struct {
+	Type   string      `json:"type,omitempty"`
+	Schema *DataSchema `json:"schema,omitempty"`
+}
+
+type DataSchema struct {
+	Ref     *corev1.ObjectReference `json:"ref,omitempty"`
+	Content *openapi.Schema         `json:"schema,omitempty"`
+}
+
 type KameletInfo struct {
 	DisplayName string      `json:"displayName,omitempty"`
 	Description string      `json:"description,omitempty"`