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

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

commit 9b0ad0252e8a6fd19649e5becbbebb05e99f710c
Author: nferraro <ni.ferr...@gmail.com>
AuthorDate: Mon Dec 24 09:07:13 2018 +0100

    Add flows to types
---
 pkg/apis/camel/v1alpha1/types.go         |  3 +++
 pkg/apis/camel/v1alpha1/types_support.go | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/pkg/apis/camel/v1alpha1/types.go b/pkg/apis/camel/v1alpha1/types.go
index ef4dcc0..9951e3f 100644
--- a/pkg/apis/camel/v1alpha1/types.go
+++ b/pkg/apis/camel/v1alpha1/types.go
@@ -363,6 +363,9 @@ type Flow struct {
        Steps []Step `json:"steps"`
 }
 
+// Flows are collections of Flow
+type Flows []Flow
+
 // Step --
 type Step struct {
        Kind string `json:"kind"`
diff --git a/pkg/apis/camel/v1alpha1/types_support.go 
b/pkg/apis/camel/v1alpha1/types_support.go
index 21df605..95a842f 100644
--- a/pkg/apis/camel/v1alpha1/types_support.go
+++ b/pkg/apis/camel/v1alpha1/types_support.go
@@ -19,6 +19,7 @@ package v1alpha1
 
 import (
        "fmt"
+       "gopkg.in/yaml.v2"
        "strings"
 
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -128,3 +129,12 @@ func TraitProfileByName(name string) TraitProfile {
        }
        return ""
 }
+
+// Serialize serializes a Flow
+func (flows Flows) Serialize() (string, error) {
+       res, err := yaml.Marshal(flows)
+       if err != nil {
+               return "", err
+       }
+       return string(res), nil
+}

Reply via email to