| /* |
| 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. |
| */ |
| |
| package knative |
| |
| // CamelEnvironment is the top level configuration object expected by the Camel Knative component |
| type CamelEnvironment struct { |
| Services []CamelServiceDefinition `json:"services"` |
| } |
| |
| // NewCamelEnvironment creates a new env |
| func NewCamelEnvironment() CamelEnvironment { |
| return CamelEnvironment{ |
| Services: make([]CamelServiceDefinition, 0), |
| } |
| } |
| |
| // CamelServiceDefinition defines the parameters to connect to Knative service. It's also used for exposed services |
| type CamelServiceDefinition struct { |
| ServiceType CamelServiceType `json:"type"` |
| Name string `json:"name"` |
| Host string `json:"host,omitempty"` |
| Port *int `json:"port,omitempty"` |
| Metadata map[string]string `json:"metadata,omitempty"` |
| } |
| |
| // CamelEndpointKind -- |
| type CamelEndpointKind string |
| |
| const ( |
| // CamelEndpointKindSource is a service that can be used to consume events |
| CamelEndpointKindSource CamelEndpointKind = "source" |
| // CamelEndpointKindSink is a service that can be used to send events to |
| CamelEndpointKindSink CamelEndpointKind = "sink" |
| ) |
| |
| // CamelServiceType -- |
| type CamelServiceType string |
| |
| const ( |
| // CamelServiceTypeEndpoint is a callable endpoint |
| CamelServiceTypeEndpoint CamelServiceType = "endpoint" |
| // CamelServiceTypeChannel is a callable endpoint that will be also associated to a subscription |
| CamelServiceTypeChannel CamelServiceType = "channel" |
| // CamelServiceTypeEvent is used when the target service is the Knative broker |
| CamelServiceTypeEvent CamelServiceType = "event" |
| ) |
| |
| // Meta Options |
| const ( |
| CamelMetaServicePath = "service.path" |
| CamelMetaServiceID = "service.id" |
| CamelMetaServiceName = "service.name" |
| CamelMetaServiceHost = "service.host" |
| CamelMetaServicePort = "service.port" |
| CamelMetaServiceZone = "service.zone" |
| |
| CamelMetaKnativeKind = "knative.kind" |
| CamelMetaKnativeAPIVersion = "knative.apiVersion" |
| |
| CamelMetaEndpointKind = "camel.endpoint.kind" |
| |
| CamelMetaFilterPrefix = "filter." |
| ) |