diff --git a/addons/strimzi/duck/client/internalclientset/fake/register.go b/addons/strimzi/duck/client/internalclientset/fake/register.go index b03a9f8056..04aa548214 100644 --- a/addons/strimzi/duck/client/internalclientset/fake/register.go +++ b/addons/strimzi/duck/client/internalclientset/fake/register.go @@ -38,14 +38,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/addons/strimzi/duck/client/internalclientset/scheme/register.go b/addons/strimzi/duck/client/internalclientset/scheme/register.go index bb376affd8..7c58dd36c4 100644 --- a/addons/strimzi/duck/client/internalclientset/scheme/register.go +++ b/addons/strimzi/duck/client/internalclientset/scheme/register.go @@ -38,14 +38,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/config/crd/bases/camel.apache.org_kameletbindings.yaml b/config/crd/bases/camel.apache.org_kameletbindings.yaml index abad45fdbd..f04594d9ac 100644 --- a/config/crd/bases/camel.apache.org_kameletbindings.yaml +++ b/config/crd/bases/camel.apache.org_kameletbindings.yaml @@ -7687,6 +7687,21 @@ spec: description: Sink is the destination of the integration defined by this binding properties: + dataTypes: + additionalProperties: + description: DataTypeReference references to the specification + of a data type by its scheme and format name + properties: + format: + description: the data type format name + type: string + scheme: + description: the data type component scheme + type: string + type: object + description: DataTypes defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + type: object properties: description: Properties are a key value representation of endpoint properties @@ -7731,8 +7746,8 @@ spec: type: object types: additionalProperties: - description: EventTypeSpec represents a specification for an - event type + description: 'EventTypeSpec represents a specification for an + event type Deprecated: In favor of using DataTypeSpec' properties: mediaType: description: media type as expected for HTTP media types @@ -7895,8 +7910,9 @@ spec: type: string type: object type: object - description: Types defines the schema of the data produced/consumed - by the endpoint + description: 'Types defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + Deprecated: In favor of using DataTypes' type: object uri: description: URI can be used to specify the (Camel) endpoint explicitly @@ -7906,6 +7922,21 @@ spec: description: Source is the starting point of the integration defined by this binding properties: + dataTypes: + additionalProperties: + description: DataTypeReference references to the specification + of a data type by its scheme and format name + properties: + format: + description: the data type format name + type: string + scheme: + description: the data type component scheme + type: string + type: object + description: DataTypes defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + type: object properties: description: Properties are a key value representation of endpoint properties @@ -7950,8 +7981,8 @@ spec: type: object types: additionalProperties: - description: EventTypeSpec represents a specification for an - event type + description: 'EventTypeSpec represents a specification for an + event type Deprecated: In favor of using DataTypeSpec' properties: mediaType: description: media type as expected for HTTP media types @@ -8114,8 +8145,9 @@ spec: type: string type: object type: object - description: Types defines the schema of the data produced/consumed - by the endpoint + description: 'Types defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + Deprecated: In favor of using DataTypes' type: object uri: description: URI can be used to specify the (Camel) endpoint explicitly @@ -8128,6 +8160,21 @@ spec: description: Endpoint represents a source/sink external entity (could be any Kubernetes resource or Camel URI) properties: + dataTypes: + additionalProperties: + description: DataTypeReference references to the specification + of a data type by its scheme and format name + properties: + format: + description: the data type format name + type: string + scheme: + description: the data type component scheme + type: string + type: object + description: DataTypes defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + type: object properties: description: Properties are a key value representation of endpoint properties @@ -8173,8 +8220,8 @@ spec: type: object types: additionalProperties: - description: EventTypeSpec represents a specification for - an event type + description: 'EventTypeSpec represents a specification for + an event type Deprecated: In favor of using DataTypeSpec' properties: mediaType: description: media type as expected for HTTP media types @@ -8339,8 +8386,9 @@ spec: type: string type: object type: object - description: Types defines the schema of the data produced/consumed - by the endpoint + description: 'Types defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + Deprecated: In favor of using DataTypes' type: object uri: description: URI can be used to specify the (Camel) endpoint diff --git a/config/crd/bases/camel.apache.org_kamelets.yaml b/config/crd/bases/camel.apache.org_kamelets.yaml index 20b9230b4e..558c29c6ab 100644 --- a/config/crd/bases/camel.apache.org_kamelets.yaml +++ b/config/crd/bases/camel.apache.org_kamelets.yaml @@ -63,6 +63,237 @@ spec: spec: description: the desired specification properties: + dataTypes: + additionalProperties: + description: DataTypesSpec represents the specification for a set + of data types + properties: + default: + description: the default data type for this Kamelet + type: string + headers: + additionalProperties: + description: HeaderSpec represents the specification for a + header used in the Kamelet + properties: + default: + type: string + description: + type: string + required: + type: boolean + title: + type: string + type: + type: string + type: object + description: one to many header specifications + type: object + types: + additionalProperties: + description: DataTypeSpec represents the specification for + a data type + properties: + dependencies: + description: the list of Camel or Maven dependencies required + by the data type + items: + type: string + type: array + description: + description: optional description + type: string + format: + description: the data type format name + type: string + headers: + additionalProperties: + description: HeaderSpec represents the specification + for a header used in the Kamelet + properties: + default: + type: string + description: + type: string + required: + type: boolean + title: + type: string + type: + type: string + type: object + description: one to many header specifications + type: object + mediaType: + description: media type as expected for HTTP media types + (ie, application/json) + type: string + schema: + description: the expected schema for the data type + properties: + $schema: + description: JSONSchemaURL represents a schema url. + type: string + description: + type: string + example: + description: 'JSON represents any valid JSON value. + These types are supported: bool, int64, float64, + string, []interface{}, map[string]interface{} and + nil.' + x-kubernetes-preserve-unknown-fields: true + externalDocs: + description: ExternalDocumentation allows referencing + an external resource for extended documentation. + properties: + description: + type: string + url: + type: string + type: object + id: + type: string + properties: + additionalProperties: + properties: + default: + description: default is a default value for + undefined object fields. + x-kubernetes-preserve-unknown-fields: true + description: + type: string + enum: + items: + description: 'JSON represents any valid JSON + value. These types are supported: bool, + int64, float64, string, []interface{}, map[string]interface{} + and nil.' + x-kubernetes-preserve-unknown-fields: true + type: array + example: + description: 'JSON represents any valid JSON + value. These types are supported: bool, int64, + float64, string, []interface{}, map[string]interface{} + and nil.' + x-kubernetes-preserve-unknown-fields: true + exclusiveMaximum: + type: boolean + exclusiveMinimum: + type: boolean + format: + description: "format is an OpenAPI v3 format + string. Unknown formats are ignored. The following + formats are validated: \n - bsonobjectid: + a bson object ID, i.e. a 24 characters hex + string - uri: an URI as parsed by Golang net/url.ParseRequestURI + - email: an email address as parsed by Golang + net/mail.ParseAddress - hostname: a valid + representation for an Internet host name, + as defined by RFC 1034, section 3.1 [RFC1034]. + - ipv4: an IPv4 IP as parsed by Golang net.ParseIP + - ipv6: an IPv6 IP as parsed by Golang net.ParseIP + - cidr: a CIDR as parsed by Golang net.ParseCIDR + - mac: a MAC address as parsed by Golang net.ParseMAC + - uuid: an UUID that allows uppercase defined + by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$ + - uuid3: an UUID3 that allows uppercase defined + by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$ + - uuid4: an UUID4 that allows uppercase defined + by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ + - uuid5: an UUID5 that allows uppercase defined + by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ + - isbn: an ISBN10 or ISBN13 number string + like \"0321751043\" or \"978-0321751041\" + - isbn10: an ISBN10 number string like \"0321751043\" + - isbn13: an ISBN13 number string like \"978-0321751041\" + - creditcard: a credit card number defined + by the regex ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\\\d{3})\\\\d{11})$ + with any non digit characters mixed in - ssn: + a U.S. social security number following the + regex ^\\\\d{3}[- ]?\\\\d{2}[- ]?\\\\d{4}$ + - hexcolor: an hexadecimal color code like + \"#FFFFFF\" following the regex ^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ + - rgbcolor: an RGB color code like rgb like + \"rgb(255,255,255)\" - byte: base64 encoded + binary data - password: any kind of string + - date: a date string like \"2006-01-02\" + as defined by full-date in RFC3339 - duration: + a duration string like \"22 ns\" as parsed + by Golang time.ParseDuration or compatible + with Scala duration format - datetime: a date + time string like \"2014-12-15T19:30:20.000Z\" + as defined by date-time in RFC3339." + type: string + id: + type: string + maxItems: + format: int64 + type: integer + maxLength: + format: int64 + type: integer + maxProperties: + format: int64 + type: integer + maximum: + description: A Number represents a JSON number + literal. + type: string + minItems: + format: int64 + type: integer + minLength: + format: int64 + type: integer + minProperties: + format: int64 + type: integer + minimum: + description: A Number represents a JSON number + literal. + type: string + multipleOf: + description: A Number represents a JSON number + literal. + type: string + nullable: + type: boolean + pattern: + type: string + title: + type: string + type: + type: string + uniqueItems: + type: boolean + x-descriptors: + description: XDescriptors is a list of extended + properties that trigger a custom behavior + in external systems + items: + type: string + type: array + type: object + type: object + required: + items: + type: string + type: array + title: + type: string + type: + type: string + type: object + scheme: + description: the data type component scheme + type: string + type: object + description: one to many data type specifications + type: object + type: object + description: data specification types for the events consumed/produced + by the Kamelet + type: object definition: description: defines the formal configuration of the Kamelet properties: @@ -275,8 +506,8 @@ spec: x-kubernetes-preserve-unknown-fields: true types: additionalProperties: - description: EventTypeSpec represents a specification for an event - type + description: 'EventTypeSpec represents a specification for an event + type Deprecated: In favor of using DataTypeSpec' properties: mediaType: description: media type as expected for HTTP media types (ie, @@ -432,8 +663,8 @@ spec: type: string type: object type: object - description: data specification types for the events consumed/produced - by the Kamelet + description: 'data specification types for the events consumed/produced + by the Kamelet Deprecated: In favor of using DataTypes' type: object type: object status: diff --git a/docs/modules/ROOT/pages/kamelets/kamelets-dev.adoc b/docs/modules/ROOT/pages/kamelets/kamelets-dev.adoc index 917d6c2409..6f675e55f9 100644 --- a/docs/modules/ROOT/pages/kamelets/kamelets-dev.adoc +++ b/docs/modules/ROOT/pages/kamelets/kamelets-dev.adoc @@ -72,9 +72,12 @@ spec: title: Message description: The message to generate type: string - types: + dataTypes: out: - mediaType: text/plain + default: text + types: + text: + mediaType: text/plain template: from: uri: timer:tick @@ -250,9 +253,12 @@ spec: format: password x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - types: # <2> + dataTypes: # <2> out: - mediaType: application/json + default: json + types: + json: + mediaType: application/json template: # <3> from: uri: "twitter-search:{{keywords}}" @@ -267,7 +273,7 @@ spec: - to: "kamelet:sink" ---- <1> An icon with an appropriate license, better using svg+base64 URL encoding. You can encode icons using services like https://dopiaza.org/tools/datauri/index.php[this one] -<2> The types section indicates that the Kamelet is going to produce JSON data. This part of the Kamelet spec is likely to change in the future but is not fundamental for the Kamelet mechanics to work +<2> The dataTypes section indicates that the Kamelet is going to produce JSON data as a default. The Kamelet is able to define multiple data types for in/out/error. The user will then be able to choose on of the data types in a KameletBinding when referencing the Kamelet. <3> The previous YAML flow The Kamelet can be shared on the Catalog and or created on a Kubernetes cluster to let users use it. @@ -799,9 +805,12 @@ spec: description: The amount of minutes to look ahead when starting the integration afresh type: integer default: 120 - types: # <3> + dataTypes: # <3> out: - mediaType: application/json + default: json + types: + json: + mediaType: application/json dependencies: # <4> - camel-quarkus:caffeine - camel-quarkus:http @@ -858,7 +867,7 @@ spec: ---- <1> Add an icon with an appropriate license, better using svg+base64 URL encoding. You can encode icons using services like https://dopiaza.org/tools/datauri/index.php[this one] <2> This marks the Kamelet as dependant on Quarkus since we're specifying explicit dependencies on Quarkus artifacts in the `spec` -> `dependencies` section -<3> The types section indicates that the Kamelet is going to produce JSON data. This part of the Kamelet spec will be subject of revision but is not fundamental for the Kamelet mechanics to work +<3> The types section indicates that the Kamelet is going to produce JSON data by default. The Kamelet is able to define multiple data types for in/out/error. The user will then be able to choose on of the data types in a KameletBinding when referencing the Kamelet. <4> Dependencies that we previously specified in the modeline options should be expressed now in the Kamelet spec The Kamelet is now ready to be used! @@ -1131,9 +1140,12 @@ spec: title: Chat ID description: The Chat ID where messages should be sent by default type: string - types: # <2> + dataTypes: # <2> out: - mediaType: application/json + default: json + types: + json: + mediaType: application/json template: # <3> from: uri: "kamelet:source" diff --git a/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc b/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc index 9fad548062..7fd5fc19b3 100644 --- a/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc +++ b/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc @@ -69,10 +69,13 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:password - types: # <5> + dataTypes: # <5> out: - mediaType: text/plain - # schema: + default: text + types: + text: + mediaType: text/plain + # schema: template: # <6> from: uri: telegram:bots @@ -92,7 +95,7 @@ spec: <2> Annotations such as icon provide additional display features to the Kamelet <3> Labels allow users to query Kamelets e.g. by kind ("source" vs. "sink") <4> Description of the Kamelets and parameters in JSON-schema specification format -<5> The media type of the output (can include a schema) +<5> The data type that the Kamelet produces. Data type specifications contain the media type of the output and also may include a schema. <6> The route template defining the behavior of the Kamelet At a high level (more details are provided later), a Kamelet resource describes: @@ -543,15 +546,19 @@ specification of a Kamelet includes also information about type of data that it # ... spec: # ... - types: + dataTypes: out: # <1> - mediaType: application/json - schema: # <2> - properties: - # ... + default: json + types: + json: # <2> + mediaType: application/json + schema: # <3> + properties: + # ... ---- <1> Defines the type of the `output` -<2> JSON-schema definition of the output +<2> Name of the data type +<2> Optional JSON-schema definition of the output Data shape can be indicated for the following channels: @@ -565,11 +572,31 @@ Data shapes contain the following information: |=== |name |Description |Type |Example +|`scheme` +|A specific component scheme that is used to identify the data shape +|`string` +|E.g. `aws2-s3` + +|`format` +|The data shape name used to identify and reference the data type in a KameletBinding when choosing from multiple data type options. +|`string` +|E.g. `json` + |`mediaType` |The media type of the data |`string` |E.g. `application/json` +|`headers` +|Optional map of message headers that get set with the data shape where the map keys represent the header name and the value defines the header type information. +|`map` +| + +|`dependencies` +|Optional list of additional dependencies that are required for this data type (e.g. Json marshal/unmarshal libraries) +|`list` +|E.g. `mvn:org.jackson:jackson-databind` + |`schema` |An optional JSON-schema definition for the data |`object` diff --git a/docs/modules/ROOT/partials/apis/kamelets-crds.adoc b/docs/modules/ROOT/partials/apis/kamelets-crds.adoc index c9daa48e7d..4e32bece5c 100644 --- a/docs/modules/ROOT/partials/apis/kamelets-crds.adoc +++ b/docs/modules/ROOT/partials/apis/kamelets-crds.adoc @@ -109,6 +109,141 @@ BeanProperties represent an unstructured object properties to be set on a bean +|=== + +[#_camel_apache_org_v1alpha1_DataTypeReference] +=== DataTypeReference + +*Appears on:* + +* <<#_camel_apache_org_v1alpha1_Endpoint, Endpoint>> + +DataTypeReference references to the specification of a data type by its scheme and format name + +[cols="2,2a",options="header"] +|=== +|Field +|Description + +|`scheme` + +string +| + + +the data type component scheme + +|`format` + +string +| + + +the data type format name + + +|=== + +[#_camel_apache_org_v1alpha1_DataTypeSpec] +=== DataTypeSpec + +*Appears on:* + +* <<#_camel_apache_org_v1alpha1_DataTypesSpec, DataTypesSpec>> + +DataTypeSpec represents the specification for a data type + +[cols="2,2a",options="header"] +|=== +|Field +|Description + +|`scheme` + +string +| + + +the data type component scheme + +|`format` + +string +| + + +the data type format name + +|`description` + +string +| + + +optional description + +|`mediaType` + +string +| + + +media type as expected for HTTP media types (ie, application/json) + +|`dependencies` + +[]string +| + + +the list of Camel or Maven dependencies required by the data type + +|`headers` + +*xref:#_camel_apache_org_v1alpha1_HeaderSpec[map[string\]github.com/apache/camel-k/pkg/apis/camel/v1alpha1.HeaderSpec]* +| + + +one to many header specifications + +|`schema` + +*xref:#_camel_apache_org_v1alpha1_JSONSchemaProps[JSONSchemaProps]* +| + + +the expected schema for the data type + + +|=== + +[#_camel_apache_org_v1alpha1_DataTypesSpec] +=== DataTypesSpec + +*Appears on:* + +* <<#_camel_apache_org_v1alpha1_KameletSpec, KameletSpec>> + +DataTypesSpec represents the specification for a set of data types + +[cols="2,2a",options="header"] +|=== +|Field +|Description + +|`default` + +string +| + + +the default data type for this Kamelet + +|`types` + +*xref:#_camel_apache_org_v1alpha1_DataTypeSpec[map[string\]github.com/apache/camel-k/pkg/apis/camel/v1alpha1.DataTypeSpec]* +| + + +one to many data type specifications + +|`headers` + +*xref:#_camel_apache_org_v1alpha1_HeaderSpec[map[string\]github.com/apache/camel-k/pkg/apis/camel/v1alpha1.HeaderSpec]* +| + + +one to many header specifications + + |=== [#_camel_apache_org_v1alpha1_Endpoint] @@ -148,11 +283,19 @@ URI can be used to specify the (Camel) endpoint explicitly Properties are a key value representation of endpoint properties |`types` + -*xref:#_camel_apache_org_v1alpha1_EventTypeSpec[map[github.com/apache/camel-k/pkg/apis/camel/v1alpha1.EventSlot\]github.com/apache/camel-k/pkg/apis/camel/v1alpha1.EventTypeSpec]* +*xref:#_camel_apache_org_v1alpha1_EventTypeSpec[map[github.com/apache/camel-k/pkg/apis/camel/v1alpha1.TypeSlot\]github.com/apache/camel-k/pkg/apis/camel/v1alpha1.EventTypeSpec]* | -Types defines the schema of the data produced/consumed by the endpoint +Types defines the data type of the data produced/consumed by the endpoint and references a given data type specification. +Deprecated: In favor of using DataTypes + +|`dataTypes` + +*xref:#_camel_apache_org_v1alpha1_DataTypeReference[map[github.com/apache/camel-k/pkg/apis/camel/v1alpha1.TypeSlot\]github.com/apache/camel-k/pkg/apis/camel/v1alpha1.DataTypeReference]* +| + + +DataTypes defines the data type of the data produced/consumed by the endpoint and references a given data type specification. |=== @@ -322,12 +465,6 @@ ErrorHandlerSpec represents an unstructured object for an error handler ErrorHandlerType a type of error handler (ie, sink) -[#_camel_apache_org_v1alpha1_EventSlot] -=== EventSlot(`string` alias) - -EventSlot represent a kind of data (ie, input, output, ...) - - [#_camel_apache_org_v1alpha1_EventTypeSpec] === EventTypeSpec @@ -337,6 +474,7 @@ EventSlot represent a kind of data (ie, input, output, ...) * <<#_camel_apache_org_v1alpha1_KameletSpec, KameletSpec>> EventTypeSpec represents a specification for an event type +Deprecated: In favor of using DataTypeSpec [cols="2,2a",options="header"] |=== @@ -389,6 +527,59 @@ string +|=== + +[#_camel_apache_org_v1alpha1_HeaderSpec] +=== HeaderSpec + +*Appears on:* + +* <<#_camel_apache_org_v1alpha1_DataTypeSpec, DataTypeSpec>> +* <<#_camel_apache_org_v1alpha1_DataTypesSpec, DataTypesSpec>> + +HeaderSpec represents the specification for a header used in the Kamelet + +[cols="2,2a",options="header"] +|=== +|Field +|Description + +|`type` + +string +| + + + + +|`title` + +string +| + + + + +|`description` + +string +| + + + + +|`required` + +bool +| + + + + +|`default` + +string +| + + + + + |=== [#_camel_apache_org_v1alpha1_JSON] @@ -632,6 +823,7 @@ XDescriptors is a list of extended properties that trigger a custom behavior in *Appears on:* +* <<#_camel_apache_org_v1alpha1_DataTypeSpec, DataTypeSpec>> * <<#_camel_apache_org_v1alpha1_EventTypeSpec, EventTypeSpec>> * <<#_camel_apache_org_v1alpha1_KameletSpec, KameletSpec>> @@ -1068,7 +1260,15 @@ sources in any Camel DSL supported the main source in YAML DSL |`types` + -*xref:#_camel_apache_org_v1alpha1_EventTypeSpec[map[github.com/apache/camel-k/pkg/apis/camel/v1alpha1.EventSlot\]github.com/apache/camel-k/pkg/apis/camel/v1alpha1.EventTypeSpec]* +*xref:#_camel_apache_org_v1alpha1_EventTypeSpec[map[github.com/apache/camel-k/pkg/apis/camel/v1alpha1.TypeSlot\]github.com/apache/camel-k/pkg/apis/camel/v1alpha1.EventTypeSpec]* +| + + +data specification types for the events consumed/produced by the Kamelet +Deprecated: In favor of using DataTypes + +|`dataTypes` + +*xref:#_camel_apache_org_v1alpha1_DataTypesSpec[map[github.com/apache/camel-k/pkg/apis/camel/v1alpha1.TypeSlot\]github.com/apache/camel-k/pkg/apis/camel/v1alpha1.DataTypesSpec]* | @@ -1168,4 +1368,9 @@ Template is an unstructured object representing a Kamelet template in YAML/JSON an unstructured raw message -|=== \ No newline at end of file +|=== + +[#_camel_apache_org_v1alpha1_TypeSlot] +=== TypeSlot(`string` alias) + +TypeSlot represent a kind of data (ie, input, output, ...) diff --git a/e2e/yaks/common/kamelet-binding-broker/logger-sink.kamelet.yaml b/e2e/yaks/common/kamelet-binding-broker/logger-sink.kamelet.yaml index 9ffc8376b5..f9b58feddd 100644 --- a/e2e/yaks/common/kamelet-binding-broker/logger-sink.kamelet.yaml +++ b/e2e/yaks/common/kamelet-binding-broker/logger-sink.kamelet.yaml @@ -31,11 +31,15 @@ spec: description: The prefix to prepend to the logged message type: string default: "message: " - types: + dataTypes: in: - mediaType: text/plain + types: + text: + mediaType: text/plain out: - mediaType: text/plain + types: + text: + mediaType: text/plain template: from: uri: "kamelet:source" diff --git a/e2e/yaks/common/kamelet-binding-broker/timer-source.kamelet.yaml b/e2e/yaks/common/kamelet-binding-broker/timer-source.kamelet.yaml index 268ca01fc0..df684a1408 100644 --- a/e2e/yaks/common/kamelet-binding-broker/timer-source.kamelet.yaml +++ b/e2e/yaks/common/kamelet-binding-broker/timer-source.kamelet.yaml @@ -37,12 +37,14 @@ spec: title: Message description: The message to generate type: string - types: + dataTypes: out: - mediaType: application/json - schema: - id: text.camel.apache.org - type: string + types: + json: + mediaType: application/json + schema: + id: text.camel.apache.org + type: string template: from: uri: timer:tick diff --git a/e2e/yaks/common/kamelet-binding-http/timer-source.kamelet.yaml b/e2e/yaks/common/kamelet-binding-http/timer-source.kamelet.yaml index 268ca01fc0..df684a1408 100644 --- a/e2e/yaks/common/kamelet-binding-http/timer-source.kamelet.yaml +++ b/e2e/yaks/common/kamelet-binding-http/timer-source.kamelet.yaml @@ -37,12 +37,14 @@ spec: title: Message description: The message to generate type: string - types: + dataTypes: out: - mediaType: application/json - schema: - id: text.camel.apache.org - type: string + types: + json: + mediaType: application/json + schema: + id: text.camel.apache.org + type: string template: from: uri: timer:tick diff --git a/e2e/yaks/common/kamelet-binding/logger-sink.kamelet.yaml b/e2e/yaks/common/kamelet-binding/logger-sink.kamelet.yaml index 9ffc8376b5..f9b58feddd 100644 --- a/e2e/yaks/common/kamelet-binding/logger-sink.kamelet.yaml +++ b/e2e/yaks/common/kamelet-binding/logger-sink.kamelet.yaml @@ -31,11 +31,15 @@ spec: description: The prefix to prepend to the logged message type: string default: "message: " - types: + dataTypes: in: - mediaType: text/plain + types: + text: + mediaType: text/plain out: - mediaType: text/plain + types: + text: + mediaType: text/plain template: from: uri: "kamelet:source" diff --git a/e2e/yaks/common/kamelet-binding/timer-source.kamelet.yaml b/e2e/yaks/common/kamelet-binding/timer-source.kamelet.yaml index 268ca01fc0..df684a1408 100644 --- a/e2e/yaks/common/kamelet-binding/timer-source.kamelet.yaml +++ b/e2e/yaks/common/kamelet-binding/timer-source.kamelet.yaml @@ -37,12 +37,14 @@ spec: title: Message description: The message to generate type: string - types: + dataTypes: out: - mediaType: application/json - schema: - id: text.camel.apache.org - type: string + types: + json: + mediaType: application/json + schema: + id: text.camel.apache.org + type: string template: from: uri: timer:tick diff --git a/e2e/yaks/common/kamelet-steps/prefix-action.kamelet.yaml b/e2e/yaks/common/kamelet-steps/prefix-action.kamelet.yaml index 9c0cdbfc32..f1dc779afa 100644 --- a/e2e/yaks/common/kamelet-steps/prefix-action.kamelet.yaml +++ b/e2e/yaks/common/kamelet-steps/prefix-action.kamelet.yaml @@ -32,11 +32,15 @@ spec: title: Prefix description: The prefix to add type: string - types: + dataTypes: in: - mediaType: text/plain + types: + text: + mediaType: text/plain out: - mediaType: text/plain + types: + text: + mediaType: text/plain template: from: uri: "kamelet:source" diff --git a/e2e/yaks/common/kamelet-steps/timer-source.kamelet.yaml b/e2e/yaks/common/kamelet-steps/timer-source.kamelet.yaml index 268ca01fc0..df684a1408 100644 --- a/e2e/yaks/common/kamelet-steps/timer-source.kamelet.yaml +++ b/e2e/yaks/common/kamelet-steps/timer-source.kamelet.yaml @@ -37,12 +37,14 @@ spec: title: Message description: The message to generate type: string - types: + dataTypes: out: - mediaType: application/json - schema: - id: text.camel.apache.org - type: string + types: + json: + mediaType: application/json + schema: + id: text.camel.apache.org + type: string template: from: uri: timer:tick diff --git a/e2e/yaks/common/kamelet/echo-sink.kamelet.yaml b/e2e/yaks/common/kamelet/echo-sink.kamelet.yaml index ec70cb4084..ad49170b73 100644 --- a/e2e/yaks/common/kamelet/echo-sink.kamelet.yaml +++ b/e2e/yaks/common/kamelet/echo-sink.kamelet.yaml @@ -31,11 +31,17 @@ spec: description: The prefix to prepend to the incoming event type: string default: "echo: " - types: + dataTypes: in: - mediaType: text/plain + default: text + types: + text: + mediaType: text/plain out: - mediaType: text/plain + default: text + types: + text: + mediaType: text/plain template: from: uri: "kamelet:source" diff --git a/e2e/yaks/common/kamelet/timer-source.kamelet.yaml b/e2e/yaks/common/kamelet/timer-source.kamelet.yaml index 268ca01fc0..df684a1408 100644 --- a/e2e/yaks/common/kamelet/timer-source.kamelet.yaml +++ b/e2e/yaks/common/kamelet/timer-source.kamelet.yaml @@ -37,12 +37,14 @@ spec: title: Message description: The message to generate type: string - types: + dataTypes: out: - mediaType: application/json - schema: - id: text.camel.apache.org - type: string + types: + json: + mediaType: application/json + schema: + id: text.camel.apache.org + type: string template: from: uri: timer:tick diff --git a/helm/camel-k/crds/crd-kamelet-binding.yaml b/helm/camel-k/crds/crd-kamelet-binding.yaml index abad45fdbd..f04594d9ac 100644 --- a/helm/camel-k/crds/crd-kamelet-binding.yaml +++ b/helm/camel-k/crds/crd-kamelet-binding.yaml @@ -7687,6 +7687,21 @@ spec: description: Sink is the destination of the integration defined by this binding properties: + dataTypes: + additionalProperties: + description: DataTypeReference references to the specification + of a data type by its scheme and format name + properties: + format: + description: the data type format name + type: string + scheme: + description: the data type component scheme + type: string + type: object + description: DataTypes defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + type: object properties: description: Properties are a key value representation of endpoint properties @@ -7731,8 +7746,8 @@ spec: type: object types: additionalProperties: - description: EventTypeSpec represents a specification for an - event type + description: 'EventTypeSpec represents a specification for an + event type Deprecated: In favor of using DataTypeSpec' properties: mediaType: description: media type as expected for HTTP media types @@ -7895,8 +7910,9 @@ spec: type: string type: object type: object - description: Types defines the schema of the data produced/consumed - by the endpoint + description: 'Types defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + Deprecated: In favor of using DataTypes' type: object uri: description: URI can be used to specify the (Camel) endpoint explicitly @@ -7906,6 +7922,21 @@ spec: description: Source is the starting point of the integration defined by this binding properties: + dataTypes: + additionalProperties: + description: DataTypeReference references to the specification + of a data type by its scheme and format name + properties: + format: + description: the data type format name + type: string + scheme: + description: the data type component scheme + type: string + type: object + description: DataTypes defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + type: object properties: description: Properties are a key value representation of endpoint properties @@ -7950,8 +7981,8 @@ spec: type: object types: additionalProperties: - description: EventTypeSpec represents a specification for an - event type + description: 'EventTypeSpec represents a specification for an + event type Deprecated: In favor of using DataTypeSpec' properties: mediaType: description: media type as expected for HTTP media types @@ -8114,8 +8145,9 @@ spec: type: string type: object type: object - description: Types defines the schema of the data produced/consumed - by the endpoint + description: 'Types defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + Deprecated: In favor of using DataTypes' type: object uri: description: URI can be used to specify the (Camel) endpoint explicitly @@ -8128,6 +8160,21 @@ spec: description: Endpoint represents a source/sink external entity (could be any Kubernetes resource or Camel URI) properties: + dataTypes: + additionalProperties: + description: DataTypeReference references to the specification + of a data type by its scheme and format name + properties: + format: + description: the data type format name + type: string + scheme: + description: the data type component scheme + type: string + type: object + description: DataTypes defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + type: object properties: description: Properties are a key value representation of endpoint properties @@ -8173,8 +8220,8 @@ spec: type: object types: additionalProperties: - description: EventTypeSpec represents a specification for - an event type + description: 'EventTypeSpec represents a specification for + an event type Deprecated: In favor of using DataTypeSpec' properties: mediaType: description: media type as expected for HTTP media types @@ -8339,8 +8386,9 @@ spec: type: string type: object type: object - description: Types defines the schema of the data produced/consumed - by the endpoint + description: 'Types defines the data type of the data produced/consumed + by the endpoint and references a given data type specification. + Deprecated: In favor of using DataTypes' type: object uri: description: URI can be used to specify the (Camel) endpoint diff --git a/helm/camel-k/crds/crd-kamelet.yaml b/helm/camel-k/crds/crd-kamelet.yaml index 20b9230b4e..558c29c6ab 100644 --- a/helm/camel-k/crds/crd-kamelet.yaml +++ b/helm/camel-k/crds/crd-kamelet.yaml @@ -63,6 +63,237 @@ spec: spec: description: the desired specification properties: + dataTypes: + additionalProperties: + description: DataTypesSpec represents the specification for a set + of data types + properties: + default: + description: the default data type for this Kamelet + type: string + headers: + additionalProperties: + description: HeaderSpec represents the specification for a + header used in the Kamelet + properties: + default: + type: string + description: + type: string + required: + type: boolean + title: + type: string + type: + type: string + type: object + description: one to many header specifications + type: object + types: + additionalProperties: + description: DataTypeSpec represents the specification for + a data type + properties: + dependencies: + description: the list of Camel or Maven dependencies required + by the data type + items: + type: string + type: array + description: + description: optional description + type: string + format: + description: the data type format name + type: string + headers: + additionalProperties: + description: HeaderSpec represents the specification + for a header used in the Kamelet + properties: + default: + type: string + description: + type: string + required: + type: boolean + title: + type: string + type: + type: string + type: object + description: one to many header specifications + type: object + mediaType: + description: media type as expected for HTTP media types + (ie, application/json) + type: string + schema: + description: the expected schema for the data type + properties: + $schema: + description: JSONSchemaURL represents a schema url. + type: string + description: + type: string + example: + description: 'JSON represents any valid JSON value. + These types are supported: bool, int64, float64, + string, []interface{}, map[string]interface{} and + nil.' + x-kubernetes-preserve-unknown-fields: true + externalDocs: + description: ExternalDocumentation allows referencing + an external resource for extended documentation. + properties: + description: + type: string + url: + type: string + type: object + id: + type: string + properties: + additionalProperties: + properties: + default: + description: default is a default value for + undefined object fields. + x-kubernetes-preserve-unknown-fields: true + description: + type: string + enum: + items: + description: 'JSON represents any valid JSON + value. These types are supported: bool, + int64, float64, string, []interface{}, map[string]interface{} + and nil.' + x-kubernetes-preserve-unknown-fields: true + type: array + example: + description: 'JSON represents any valid JSON + value. These types are supported: bool, int64, + float64, string, []interface{}, map[string]interface{} + and nil.' + x-kubernetes-preserve-unknown-fields: true + exclusiveMaximum: + type: boolean + exclusiveMinimum: + type: boolean + format: + description: "format is an OpenAPI v3 format + string. Unknown formats are ignored. The following + formats are validated: \n - bsonobjectid: + a bson object ID, i.e. a 24 characters hex + string - uri: an URI as parsed by Golang net/url.ParseRequestURI + - email: an email address as parsed by Golang + net/mail.ParseAddress - hostname: a valid + representation for an Internet host name, + as defined by RFC 1034, section 3.1 [RFC1034]. + - ipv4: an IPv4 IP as parsed by Golang net.ParseIP + - ipv6: an IPv6 IP as parsed by Golang net.ParseIP + - cidr: a CIDR as parsed by Golang net.ParseCIDR + - mac: a MAC address as parsed by Golang net.ParseMAC + - uuid: an UUID that allows uppercase defined + by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$ + - uuid3: an UUID3 that allows uppercase defined + by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$ + - uuid4: an UUID4 that allows uppercase defined + by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ + - uuid5: an UUID5 that allows uppercase defined + by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ + - isbn: an ISBN10 or ISBN13 number string + like \"0321751043\" or \"978-0321751041\" + - isbn10: an ISBN10 number string like \"0321751043\" + - isbn13: an ISBN13 number string like \"978-0321751041\" + - creditcard: a credit card number defined + by the regex ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\\\d{3})\\\\d{11})$ + with any non digit characters mixed in - ssn: + a U.S. social security number following the + regex ^\\\\d{3}[- ]?\\\\d{2}[- ]?\\\\d{4}$ + - hexcolor: an hexadecimal color code like + \"#FFFFFF\" following the regex ^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ + - rgbcolor: an RGB color code like rgb like + \"rgb(255,255,255)\" - byte: base64 encoded + binary data - password: any kind of string + - date: a date string like \"2006-01-02\" + as defined by full-date in RFC3339 - duration: + a duration string like \"22 ns\" as parsed + by Golang time.ParseDuration or compatible + with Scala duration format - datetime: a date + time string like \"2014-12-15T19:30:20.000Z\" + as defined by date-time in RFC3339." + type: string + id: + type: string + maxItems: + format: int64 + type: integer + maxLength: + format: int64 + type: integer + maxProperties: + format: int64 + type: integer + maximum: + description: A Number represents a JSON number + literal. + type: string + minItems: + format: int64 + type: integer + minLength: + format: int64 + type: integer + minProperties: + format: int64 + type: integer + minimum: + description: A Number represents a JSON number + literal. + type: string + multipleOf: + description: A Number represents a JSON number + literal. + type: string + nullable: + type: boolean + pattern: + type: string + title: + type: string + type: + type: string + uniqueItems: + type: boolean + x-descriptors: + description: XDescriptors is a list of extended + properties that trigger a custom behavior + in external systems + items: + type: string + type: array + type: object + type: object + required: + items: + type: string + type: array + title: + type: string + type: + type: string + type: object + scheme: + description: the data type component scheme + type: string + type: object + description: one to many data type specifications + type: object + type: object + description: data specification types for the events consumed/produced + by the Kamelet + type: object definition: description: defines the formal configuration of the Kamelet properties: @@ -275,8 +506,8 @@ spec: x-kubernetes-preserve-unknown-fields: true types: additionalProperties: - description: EventTypeSpec represents a specification for an event - type + description: 'EventTypeSpec represents a specification for an event + type Deprecated: In favor of using DataTypeSpec' properties: mediaType: description: media type as expected for HTTP media types (ie, @@ -432,8 +663,8 @@ spec: type: string type: object type: object - description: data specification types for the events consumed/produced - by the Kamelet + description: 'data specification types for the events consumed/produced + by the Kamelet Deprecated: In favor of using DataTypes' type: object type: object status: diff --git a/pkg/apis/camel/v1alpha1/kamelet_binding_types.go b/pkg/apis/camel/v1alpha1/kamelet_binding_types.go index c2d86c5429..fe59a8791e 100644 --- a/pkg/apis/camel/v1alpha1/kamelet_binding_types.go +++ b/pkg/apis/camel/v1alpha1/kamelet_binding_types.go @@ -71,8 +71,11 @@ type Endpoint struct { URI *string `json:"uri,omitempty"` // Properties are a key value representation of endpoint properties Properties *EndpointProperties `json:"properties,omitempty"` - // Types defines the schema of the data produced/consumed by the endpoint - Types map[EventSlot]EventTypeSpec `json:"types,omitempty"` + // Types defines the data type of the data produced/consumed by the endpoint and references a given data type specification. + // Deprecated: In favor of using DataTypes + Types map[TypeSlot]EventTypeSpec `json:"types,omitempty"` + // DataTypes defines the data type of the data produced/consumed by the endpoint and references a given data type specification. + DataTypes map[TypeSlot]DataTypeReference `json:"dataTypes,omitempty"` } // EndpointType represents the type (ie, source or sink) diff --git a/pkg/apis/camel/v1alpha1/kamelet_types.go b/pkg/apis/camel/v1alpha1/kamelet_types.go index fe4f3adb2c..3a7f4ec48f 100644 --- a/pkg/apis/camel/v1alpha1/kamelet_types.go +++ b/pkg/apis/camel/v1alpha1/kamelet_types.go @@ -77,7 +77,10 @@ type KameletSpec struct { // the main source in YAML DSL Template *Template `json:"template,omitempty"` // data specification types for the events consumed/produced by the Kamelet - Types map[EventSlot]EventTypeSpec `json:"types,omitempty"` + // Deprecated: In favor of using DataTypes + Types map[TypeSlot]EventTypeSpec `json:"types,omitempty"` + // data specification types for the events consumed/produced by the Kamelet + DataTypes map[TypeSlot]DataTypesSpec `json:"dataTypes,omitempty"` // Camel dependencies needed by the Kamelet Dependencies []string `json:"dependencies,omitempty"` } @@ -88,19 +91,20 @@ type Template struct { RawMessage `json:",inline"` } -// EventSlot represent a kind of data (ie, input, output, ...) -type EventSlot string +// TypeSlot represent a kind of data (ie, input, output, ...) +type TypeSlot string const ( - // EventSlotIn is used for the input events - EventSlotIn EventSlot = "in" - // EventSlotOut is used for the output events - EventSlotOut EventSlot = "out" - // EventSlotError is used for the error events - EventSlotError EventSlot = "error" + // TypeSlotIn is used for the input events + TypeSlotIn TypeSlot = "in" + // TypeSlotOut is used for the output events + TypeSlotOut TypeSlot = "out" + // TypeSlotError is used for the error events + TypeSlotError TypeSlot = "error" ) // EventTypeSpec represents a specification for an event type +// Deprecated: In favor of using DataTypeSpec type EventTypeSpec struct { // media type as expected for HTTP media types (ie, application/json) MediaType string `json:"mediaType,omitempty"` @@ -108,6 +112,51 @@ type EventTypeSpec struct { Schema *JSONSchemaProps `json:"schema,omitempty"` } +// DataTypesSpec represents the specification for a set of data types +type DataTypesSpec struct { + // the default data type for this Kamelet + Default string `json:"default,omitempty"` + // one to many data type specifications + Types map[string]DataTypeSpec `json:"types,omitempty"` + // one to many header specifications + Headers map[string]HeaderSpec `json:"headers,omitempty"` +} + +// DataTypeSpec represents the specification for a data type +type DataTypeSpec struct { + // the data type component scheme + Scheme string `json:"scheme,omitempty"` + // the data type format name + Format string `json:"format,omitempty"` + // optional description + Description string `json:"description,omitempty"` + // media type as expected for HTTP media types (ie, application/json) + MediaType string `json:"mediaType,omitempty"` + // the list of Camel or Maven dependencies required by the data type + Dependencies []string `json:"dependencies,omitempty"` + // one to many header specifications + Headers map[string]HeaderSpec `json:"headers,omitempty"` + // the expected schema for the data type + Schema *JSONSchemaProps `json:"schema,omitempty"` +} + +// DataTypeReference references to the specification of a data type by its scheme and format name +type DataTypeReference struct { + // the data type component scheme + Scheme string `json:"scheme,omitempty"` + // the data type format name + Format string `json:"format,omitempty"` +} + +// HeaderSpec represents the specification for a header used in the Kamelet +type HeaderSpec struct { + Type string `json:"type,omitempty"` + Title string `json:"title,omitempty"` + Description string `json:"description,omitempty"` + Required bool `json:"required,omitempty"` + Default string `json:"default,omitempty"` +} + // KameletStatus defines the observed state of Kamelet type KameletStatus struct { // ObservedGeneration is the most recent generation observed for this Kamelet. diff --git a/pkg/apis/camel/v1alpha1/kamelet_types_support.go b/pkg/apis/camel/v1alpha1/kamelet_types_support.go index 52635f28eb..20c91c2997 100644 --- a/pkg/apis/camel/v1alpha1/kamelet_types_support.go +++ b/pkg/apis/camel/v1alpha1/kamelet_types_support.go @@ -159,10 +159,10 @@ func (k *Kamelet) SortedDefinitionPropertiesKeys() []string { } // SortedTypesKeys returns the sorted keys of the Kamelet spec types -func (k *Kamelet) SortedTypesKeys() []EventSlot { - types := k.Spec.Types +func (k *Kamelet) SortedTypesKeys() []TypeSlot { + types := k.Spec.DataTypes if len(types) == 0 { - return []EventSlot{} + return []TypeSlot{} } strs := make([]string, len(types)) i := 0 @@ -171,9 +171,9 @@ func (k *Kamelet) SortedTypesKeys() []EventSlot { i++ } sort.Strings(strs) - res := make([]EventSlot, len(types)) + res := make([]TypeSlot, len(types)) for i, s := range strs { - res[i] = EventSlot(s) + res[i] = TypeSlot(s) } return res } diff --git a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go index 880d57311d..cee9e7a0f1 100644 --- a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go @@ -32,6 +32,82 @@ func (in *BeanProperties) DeepCopy() *BeanProperties { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataTypeReference) DeepCopyInto(out *DataTypeReference) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataTypeReference. +func (in *DataTypeReference) DeepCopy() *DataTypeReference { + if in == nil { + return nil + } + out := new(DataTypeReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataTypeSpec) DeepCopyInto(out *DataTypeSpec) { + *out = *in + if in.Dependencies != nil { + in, out := &in.Dependencies, &out.Dependencies + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make(map[string]HeaderSpec, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Schema != nil { + in, out := &in.Schema, &out.Schema + *out = new(JSONSchemaProps) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataTypeSpec. +func (in *DataTypeSpec) DeepCopy() *DataTypeSpec { + if in == nil { + return nil + } + out := new(DataTypeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataTypesSpec) DeepCopyInto(out *DataTypesSpec) { + *out = *in + if in.Types != nil { + in, out := &in.Types, &out.Types + *out = make(map[string]DataTypeSpec, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make(map[string]HeaderSpec, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataTypesSpec. +func (in *DataTypesSpec) DeepCopy() *DataTypesSpec { + if in == nil { + return nil + } + out := new(DataTypesSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Endpoint) DeepCopyInto(out *Endpoint) { *out = *in @@ -52,11 +128,18 @@ func (in *Endpoint) DeepCopyInto(out *Endpoint) { } if in.Types != nil { in, out := &in.Types, &out.Types - *out = make(map[EventSlot]EventTypeSpec, len(*in)) + *out = make(map[TypeSlot]EventTypeSpec, len(*in)) for key, val := range *in { (*out)[key] = *val.DeepCopy() } } + if in.DataTypes != nil { + in, out := &in.DataTypes, &out.DataTypes + *out = make(map[TypeSlot]DataTypeReference, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. @@ -222,6 +305,21 @@ func (in *ExternalDocumentation) DeepCopy() *ExternalDocumentation { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HeaderSpec) DeepCopyInto(out *HeaderSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HeaderSpec. +func (in *HeaderSpec) DeepCopy() *HeaderSpec { + if in == nil { + return nil + } + out := new(HeaderSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *JSON) DeepCopyInto(out *JSON) { *out = *in @@ -623,7 +721,14 @@ func (in *KameletSpec) DeepCopyInto(out *KameletSpec) { } if in.Types != nil { in, out := &in.Types, &out.Types - *out = make(map[EventSlot]EventTypeSpec, len(*in)) + *out = make(map[TypeSlot]EventTypeSpec, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.DataTypes != nil { + in, out := &in.DataTypes, &out.DataTypes + *out = make(map[TypeSlot]DataTypesSpec, len(*in)) for key, val := range *in { (*out)[key] = *val.DeepCopy() } diff --git a/pkg/client/camel/applyconfiguration/camel/v1alpha1/datatypereference.go b/pkg/client/camel/applyconfiguration/camel/v1alpha1/datatypereference.go new file mode 100644 index 0000000000..382f649806 --- /dev/null +++ b/pkg/client/camel/applyconfiguration/camel/v1alpha1/datatypereference.go @@ -0,0 +1,49 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// DataTypeReferenceApplyConfiguration represents an declarative configuration of the DataTypeReference type for use +// with apply. +type DataTypeReferenceApplyConfiguration struct { + Scheme *string `json:"scheme,omitempty"` + Format *string `json:"format,omitempty"` +} + +// DataTypeReferenceApplyConfiguration constructs an declarative configuration of the DataTypeReference type for use with +// apply. +func DataTypeReference() *DataTypeReferenceApplyConfiguration { + return &DataTypeReferenceApplyConfiguration{} +} + +// WithScheme sets the Scheme field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scheme field is set to the value of the last call. +func (b *DataTypeReferenceApplyConfiguration) WithScheme(value string) *DataTypeReferenceApplyConfiguration { + b.Scheme = &value + return b +} + +// WithFormat sets the Format field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Format field is set to the value of the last call. +func (b *DataTypeReferenceApplyConfiguration) WithFormat(value string) *DataTypeReferenceApplyConfiguration { + b.Format = &value + return b +} diff --git a/pkg/client/camel/applyconfiguration/camel/v1alpha1/datatypespec.go b/pkg/client/camel/applyconfiguration/camel/v1alpha1/datatypespec.go new file mode 100644 index 0000000000..f375c32d13 --- /dev/null +++ b/pkg/client/camel/applyconfiguration/camel/v1alpha1/datatypespec.go @@ -0,0 +1,102 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// DataTypeSpecApplyConfiguration represents an declarative configuration of the DataTypeSpec type for use +// with apply. +type DataTypeSpecApplyConfiguration struct { + Scheme *string `json:"scheme,omitempty"` + Format *string `json:"format,omitempty"` + Description *string `json:"description,omitempty"` + MediaType *string `json:"mediaType,omitempty"` + Dependencies []string `json:"dependencies,omitempty"` + Headers map[string]HeaderSpecApplyConfiguration `json:"headers,omitempty"` + Schema *JSONSchemaPropsApplyConfiguration `json:"schema,omitempty"` +} + +// DataTypeSpecApplyConfiguration constructs an declarative configuration of the DataTypeSpec type for use with +// apply. +func DataTypeSpec() *DataTypeSpecApplyConfiguration { + return &DataTypeSpecApplyConfiguration{} +} + +// WithScheme sets the Scheme field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scheme field is set to the value of the last call. +func (b *DataTypeSpecApplyConfiguration) WithScheme(value string) *DataTypeSpecApplyConfiguration { + b.Scheme = &value + return b +} + +// WithFormat sets the Format field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Format field is set to the value of the last call. +func (b *DataTypeSpecApplyConfiguration) WithFormat(value string) *DataTypeSpecApplyConfiguration { + b.Format = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *DataTypeSpecApplyConfiguration) WithDescription(value string) *DataTypeSpecApplyConfiguration { + b.Description = &value + return b +} + +// WithMediaType sets the MediaType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MediaType field is set to the value of the last call. +func (b *DataTypeSpecApplyConfiguration) WithMediaType(value string) *DataTypeSpecApplyConfiguration { + b.MediaType = &value + return b +} + +// WithDependencies adds the given value to the Dependencies field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Dependencies field. +func (b *DataTypeSpecApplyConfiguration) WithDependencies(values ...string) *DataTypeSpecApplyConfiguration { + for i := range values { + b.Dependencies = append(b.Dependencies, values[i]) + } + return b +} + +// WithHeaders puts the entries into the Headers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Headers field, +// overwriting an existing map entries in Headers field with the same key. +func (b *DataTypeSpecApplyConfiguration) WithHeaders(entries map[string]HeaderSpecApplyConfiguration) *DataTypeSpecApplyConfiguration { + if b.Headers == nil && len(entries) > 0 { + b.Headers = make(map[string]HeaderSpecApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.Headers[k] = v + } + return b +} + +// WithSchema sets the Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Schema field is set to the value of the last call. +func (b *DataTypeSpecApplyConfiguration) WithSchema(value *JSONSchemaPropsApplyConfiguration) *DataTypeSpecApplyConfiguration { + b.Schema = value + return b +} diff --git a/pkg/client/camel/applyconfiguration/camel/v1alpha1/datatypesspec.go b/pkg/client/camel/applyconfiguration/camel/v1alpha1/datatypesspec.go new file mode 100644 index 0000000000..9c5730c1f0 --- /dev/null +++ b/pkg/client/camel/applyconfiguration/camel/v1alpha1/datatypesspec.go @@ -0,0 +1,70 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// DataTypesSpecApplyConfiguration represents an declarative configuration of the DataTypesSpec type for use +// with apply. +type DataTypesSpecApplyConfiguration struct { + Default *string `json:"default,omitempty"` + Types map[string]DataTypeSpecApplyConfiguration `json:"types,omitempty"` + Headers map[string]HeaderSpecApplyConfiguration `json:"headers,omitempty"` +} + +// DataTypesSpecApplyConfiguration constructs an declarative configuration of the DataTypesSpec type for use with +// apply. +func DataTypesSpec() *DataTypesSpecApplyConfiguration { + return &DataTypesSpecApplyConfiguration{} +} + +// WithDefault sets the Default field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Default field is set to the value of the last call. +func (b *DataTypesSpecApplyConfiguration) WithDefault(value string) *DataTypesSpecApplyConfiguration { + b.Default = &value + return b +} + +// WithTypes puts the entries into the Types field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Types field, +// overwriting an existing map entries in Types field with the same key. +func (b *DataTypesSpecApplyConfiguration) WithTypes(entries map[string]DataTypeSpecApplyConfiguration) *DataTypesSpecApplyConfiguration { + if b.Types == nil && len(entries) > 0 { + b.Types = make(map[string]DataTypeSpecApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.Types[k] = v + } + return b +} + +// WithHeaders puts the entries into the Headers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Headers field, +// overwriting an existing map entries in Headers field with the same key. +func (b *DataTypesSpecApplyConfiguration) WithHeaders(entries map[string]HeaderSpecApplyConfiguration) *DataTypesSpecApplyConfiguration { + if b.Headers == nil && len(entries) > 0 { + b.Headers = make(map[string]HeaderSpecApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.Headers[k] = v + } + return b +} diff --git a/pkg/client/camel/applyconfiguration/camel/v1alpha1/endpoint.go b/pkg/client/camel/applyconfiguration/camel/v1alpha1/endpoint.go index d3a5f070e5..fe962b4ea2 100644 --- a/pkg/client/camel/applyconfiguration/camel/v1alpha1/endpoint.go +++ b/pkg/client/camel/applyconfiguration/camel/v1alpha1/endpoint.go @@ -27,10 +27,11 @@ import ( // EndpointApplyConfiguration represents an declarative configuration of the Endpoint type for use // with apply. type EndpointApplyConfiguration struct { - Ref *v1.ObjectReference `json:"ref,omitempty"` - URI *string `json:"uri,omitempty"` - Properties *EndpointPropertiesApplyConfiguration `json:"properties,omitempty"` - Types map[camelv1alpha1.EventSlot]EventTypeSpecApplyConfiguration `json:"types,omitempty"` + Ref *v1.ObjectReference `json:"ref,omitempty"` + URI *string `json:"uri,omitempty"` + Properties *EndpointPropertiesApplyConfiguration `json:"properties,omitempty"` + Types map[camelv1alpha1.TypeSlot]EventTypeSpecApplyConfiguration `json:"types,omitempty"` + DataTypes map[camelv1alpha1.TypeSlot]DataTypeReferenceApplyConfiguration `json:"dataTypes,omitempty"` } // EndpointApplyConfiguration constructs an declarative configuration of the Endpoint type for use with @@ -67,12 +68,26 @@ func (b *EndpointApplyConfiguration) WithProperties(value *EndpointPropertiesApp // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Types field, // overwriting an existing map entries in Types field with the same key. -func (b *EndpointApplyConfiguration) WithTypes(entries map[camelv1alpha1.EventSlot]EventTypeSpecApplyConfiguration) *EndpointApplyConfiguration { +func (b *EndpointApplyConfiguration) WithTypes(entries map[camelv1alpha1.TypeSlot]EventTypeSpecApplyConfiguration) *EndpointApplyConfiguration { if b.Types == nil && len(entries) > 0 { - b.Types = make(map[camelv1alpha1.EventSlot]EventTypeSpecApplyConfiguration, len(entries)) + b.Types = make(map[camelv1alpha1.TypeSlot]EventTypeSpecApplyConfiguration, len(entries)) } for k, v := range entries { b.Types[k] = v } return b } + +// WithDataTypes puts the entries into the DataTypes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the DataTypes field, +// overwriting an existing map entries in DataTypes field with the same key. +func (b *EndpointApplyConfiguration) WithDataTypes(entries map[camelv1alpha1.TypeSlot]DataTypeReferenceApplyConfiguration) *EndpointApplyConfiguration { + if b.DataTypes == nil && len(entries) > 0 { + b.DataTypes = make(map[camelv1alpha1.TypeSlot]DataTypeReferenceApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.DataTypes[k] = v + } + return b +} diff --git a/pkg/client/camel/applyconfiguration/camel/v1alpha1/headerspec.go b/pkg/client/camel/applyconfiguration/camel/v1alpha1/headerspec.go new file mode 100644 index 0000000000..45cbf17c0c --- /dev/null +++ b/pkg/client/camel/applyconfiguration/camel/v1alpha1/headerspec.go @@ -0,0 +1,76 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// HeaderSpecApplyConfiguration represents an declarative configuration of the HeaderSpec type for use +// with apply. +type HeaderSpecApplyConfiguration struct { + Type *string `json:"type,omitempty"` + Title *string `json:"title,omitempty"` + Description *string `json:"description,omitempty"` + Required *bool `json:"required,omitempty"` + Default *string `json:"default,omitempty"` +} + +// HeaderSpecApplyConfiguration constructs an declarative configuration of the HeaderSpec type for use with +// apply. +func HeaderSpec() *HeaderSpecApplyConfiguration { + return &HeaderSpecApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *HeaderSpecApplyConfiguration) WithType(value string) *HeaderSpecApplyConfiguration { + b.Type = &value + return b +} + +// WithTitle sets the Title field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Title field is set to the value of the last call. +func (b *HeaderSpecApplyConfiguration) WithTitle(value string) *HeaderSpecApplyConfiguration { + b.Title = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *HeaderSpecApplyConfiguration) WithDescription(value string) *HeaderSpecApplyConfiguration { + b.Description = &value + return b +} + +// WithRequired sets the Required field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Required field is set to the value of the last call. +func (b *HeaderSpecApplyConfiguration) WithRequired(value bool) *HeaderSpecApplyConfiguration { + b.Required = &value + return b +} + +// WithDefault sets the Default field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Default field is set to the value of the last call. +func (b *HeaderSpecApplyConfiguration) WithDefault(value string) *HeaderSpecApplyConfiguration { + b.Default = &value + return b +} diff --git a/pkg/client/camel/applyconfiguration/camel/v1alpha1/kameletspec.go b/pkg/client/camel/applyconfiguration/camel/v1alpha1/kameletspec.go index dee47d6606..8daa2ae017 100644 --- a/pkg/client/camel/applyconfiguration/camel/v1alpha1/kameletspec.go +++ b/pkg/client/camel/applyconfiguration/camel/v1alpha1/kameletspec.go @@ -27,11 +27,12 @@ import ( // KameletSpecApplyConfiguration represents an declarative configuration of the KameletSpec type for use // with apply. type KameletSpecApplyConfiguration struct { - Definition *JSONSchemaPropsApplyConfiguration `json:"definition,omitempty"` - Sources []v1.SourceSpecApplyConfiguration `json:"sources,omitempty"` - Template *TemplateApplyConfiguration `json:"template,omitempty"` - Types map[camelv1alpha1.EventSlot]EventTypeSpecApplyConfiguration `json:"types,omitempty"` - Dependencies []string `json:"dependencies,omitempty"` + Definition *JSONSchemaPropsApplyConfiguration `json:"definition,omitempty"` + Sources []v1.SourceSpecApplyConfiguration `json:"sources,omitempty"` + Template *TemplateApplyConfiguration `json:"template,omitempty"` + Types map[camelv1alpha1.TypeSlot]EventTypeSpecApplyConfiguration `json:"types,omitempty"` + DataTypes map[camelv1alpha1.TypeSlot]DataTypesSpecApplyConfiguration `json:"dataTypes,omitempty"` + Dependencies []string `json:"dependencies,omitempty"` } // KameletSpecApplyConfiguration constructs an declarative configuration of the KameletSpec type for use with @@ -73,9 +74,9 @@ func (b *KameletSpecApplyConfiguration) WithTemplate(value *TemplateApplyConfigu // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Types field, // overwriting an existing map entries in Types field with the same key. -func (b *KameletSpecApplyConfiguration) WithTypes(entries map[camelv1alpha1.EventSlot]EventTypeSpecApplyConfiguration) *KameletSpecApplyConfiguration { +func (b *KameletSpecApplyConfiguration) WithTypes(entries map[camelv1alpha1.TypeSlot]EventTypeSpecApplyConfiguration) *KameletSpecApplyConfiguration { if b.Types == nil && len(entries) > 0 { - b.Types = make(map[camelv1alpha1.EventSlot]EventTypeSpecApplyConfiguration, len(entries)) + b.Types = make(map[camelv1alpha1.TypeSlot]EventTypeSpecApplyConfiguration, len(entries)) } for k, v := range entries { b.Types[k] = v @@ -83,6 +84,20 @@ func (b *KameletSpecApplyConfiguration) WithTypes(entries map[camelv1alpha1.Even return b } +// WithDataTypes puts the entries into the DataTypes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the DataTypes field, +// overwriting an existing map entries in DataTypes field with the same key. +func (b *KameletSpecApplyConfiguration) WithDataTypes(entries map[camelv1alpha1.TypeSlot]DataTypesSpecApplyConfiguration) *KameletSpecApplyConfiguration { + if b.DataTypes == nil && len(entries) > 0 { + b.DataTypes = make(map[camelv1alpha1.TypeSlot]DataTypesSpecApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.DataTypes[k] = v + } + return b +} + // WithDependencies adds the given value to the Dependencies field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Dependencies field. diff --git a/pkg/client/camel/applyconfiguration/utils.go b/pkg/client/camel/applyconfiguration/utils.go index aa365d31b5..67be27bd8f 100644 --- a/pkg/client/camel/applyconfiguration/utils.go +++ b/pkg/client/camel/applyconfiguration/utils.go @@ -158,6 +158,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &camelv1.ValueSourceApplyConfiguration{} // Group=camel.apache.org, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithKind("DataTypeReference"): + return &camelv1alpha1.DataTypeReferenceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("DataTypeSpec"): + return &camelv1alpha1.DataTypeSpecApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("DataTypesSpec"): + return &camelv1alpha1.DataTypesSpecApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("Endpoint"): return &camelv1alpha1.EndpointApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("EndpointProperties"): @@ -168,6 +174,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &camelv1alpha1.EventTypeSpecApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("ExternalDocumentation"): return &camelv1alpha1.ExternalDocumentationApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("HeaderSpec"): + return &camelv1alpha1.HeaderSpecApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("JSON"): return &camelv1alpha1.JSONApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("JSONSchemaProp"): diff --git a/pkg/cmd/describe_kamelet.go b/pkg/cmd/describe_kamelet.go index 30a37d3914..d308b13b89 100644 --- a/pkg/cmd/describe_kamelet.go +++ b/pkg/cmd/describe_kamelet.go @@ -132,12 +132,17 @@ func (command *describeKameletCommandOptions) describeKamelet(cmd *cobra.Command } // Types - if len(kamelet.Spec.Types) > 0 { + if len(kamelet.Spec.DataTypes) > 0 { w.Writef(0, "Types:\n") for _, k := range kamelet.SortedTypesKeys() { - t := kamelet.Spec.Types[k] + t := kamelet.Spec.DataTypes[k] w.Writef(1, "%s:\n", k) - w.Writef(2, "Media Type: %s\n", t.MediaType) + w.Writef(2, "Default:\t%s\n", t.Default) + w.Writef(2, "Types:\t\n") + w.Writef(3, "Format\tScheme\tMediaType\tDescription\n") + for _, dt := range t.Types { + w.Writef(3, "%s\t%s\t%s\t%s", dt.Format, dt.Scheme, dt.MediaType, dt.Description) + } } } diff --git a/pkg/install/testdata/timer-source.kamelet.yaml b/pkg/install/testdata/timer-source.kamelet.yaml index 64759fa347..829a3a5750 100644 --- a/pkg/install/testdata/timer-source.kamelet.yaml +++ b/pkg/install/testdata/timer-source.kamelet.yaml @@ -40,9 +40,12 @@ spec: description: The message to generate type: string example: "hello world" - types: + dataTypes: out: - mediaType: text/plain + default: text + types: + text: + mediaType: text/plain template: from: uri: timer:tick diff --git a/resources/templates/kamelet.tmpl b/resources/templates/kamelet.tmpl index 1a2c8e9f6b..0a9e441811 100644 --- a/resources/templates/kamelet.tmpl +++ b/resources/templates/kamelet.tmpl @@ -20,9 +20,12 @@ spec: title: Message description: The message to generate type: string - types: + dataTypes: out: - mediaType: text/plain + default: text + types: + text: + mediaType: text/plain template: from: uri: timer:tick