Class KnativeEnvironment

java.lang.Object
org.apache.camel.component.knative.spi.KnativeEnvironment

@Configurer public class KnativeEnvironment extends Object
  • Constructor Details

    • KnativeEnvironment

      public KnativeEnvironment()
    • KnativeEnvironment

      public KnativeEnvironment(Collection<KnativeResource> resources)
  • Method Details

    • getResources

      public List<KnativeResource> getResources()
    • setResources

      public void setResources(List<KnativeResource> resources)
    • stream

      public Stream<KnativeResource> stream()
    • lookup

      public Stream<KnativeResource> lookup(Knative.Type type, String name)
    • mandatoryLoadFromSerializedString

      public static KnativeEnvironment mandatoryLoadFromSerializedString(String configuration) throws IOException
      Construct an instance o a KnativeEnvironment from a json serialized string.
       
       {
           "resources": [
               {
                    "type": "channel|endpoint|event",
                    "name": "",
                    "url": "",
                    "path": "",
                    "eventType": "",
                    "objectKind": "",
                    "objectApiVersion": "",
                    "endpointKind": "source|sink",
                    "filters": {
                        "header": "value"
                    },
                    "ceOverrides": {
                        "ce-type": "something"
                    }
               },
           ]
       }
       
       
      Parameters:
      configuration - the serialized representation of the Knative environment
      Returns:
      an instance of KnativeEnvironment
      Throws:
      IOException - if an error occur while parsing the file
    • mandatoryLoadFromProperties

      public static KnativeEnvironment mandatoryLoadFromProperties(org.apache.camel.CamelContext context, Map<String,Object> properties)
      Construct an instance o a KnativeEnvironment from a properties.
       
       resources[0].name = ...
       resources[0].type = channel|endpoint|event
       resources[0].endpointKind = source|sink
       resources[0].url = ...
       
       
      Parameters:
      context - the CamelContext
      properties - the properties from which to construct the KnativeEnvironment
      Returns:
      an instance of KnativeEnvironment
      Throws:
      IOException - if an error occur while parsing the file
    • mandatoryLoadFromResource

      public static KnativeEnvironment mandatoryLoadFromResource(org.apache.camel.CamelContext context, String path) throws IOException
      Construct an instance o a KnativeEnvironment from a json file.
       
       {
           "resources": [
               {
                    "type": "channel|endpoint|event",
                    "name": "",
                    "url": "",
                    "path": "",
                    "eventType": "",
                    "objectKind": "",
                    "objectApiVersion": "",
                    "endpointKind": "source|sink",
                    "filters": {
                        "header": "value"
                    },
                    "ceOverrides": {
                        "ce-type": "something"
                    }
               },
           ]
       }
       
       
      Parameters:
      context - the CamelContext
      path - URI of the resource
      Returns:
      an instance of KnativeEnvironment
      Throws:
      IOException - if an error occur while parsing the file
    • on

      public static KnativeEnvironment on(KnativeResource... definitions)
    • serviceBuilder

      public static KnativeEnvironment.KnativeServiceBuilder serviceBuilder(Knative.Type type, String name)