---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: couchdb
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: couchdb
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: couchdb
        spec:
          containers:
          - image: funktion/connector-couchdb:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: couchdb
      syntax: couchdb:protocol:hostname:port/database
      title: CouchDB
      description: The couchdb component is used for integrate with CouchDB databases.
      label: database,nosql
      deprecated: false
      async: false
      javaType: org.apache.camel.component.couchdb.CouchDbComponent
      groupId: org.apache.camel
      artifactId: camel-couchdb
      version: 2.18.3
    componentProperties: {}
    properties:
      protocol:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        enum:
        - http
        - https
        deprecated: false
        secret: false
        description: The protocol to use for communicating with the database.
        order: 0
      hostname:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Hostname of the running couchdb instance
        order: 1
      port:
        kind: path
        group: common
        type: integer
        javaType: int
        deprecated: false
        secret: false
        defaultValue: "5984"
        description: Port number for the running couchdb instance
        order: 2
      database:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Name of the database to use
        order: 3
      createDatabase:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Creates the database if it does not already exist
        order: 4
      deletes:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: true
        description: Document deletes are published as events
        order: 5
      heartbeat:
        kind: parameter
        group: common
        type: integer
        javaType: long
        deprecated: false
        secret: false
        defaultValue: "30000"
        description: How often to send an empty message to keep socket alive in millis
        order: 6
      password:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Password for authenticated databases
        order: 7
      style:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        enum:
        - all_docs
        - main_only
        deprecated: false
        secret: false
        defaultValue: main_only
        description: Specifies how many revisions are returned in the changes array. The default main_only will only return the current winning revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts.)
        order: 8
      updates:
        kind: parameter
        group: common
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: true
        description: Document inserts/updates are published as events
        order: 9
      username:
        kind: parameter
        group: common
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Username in case of authenticated databases
        order: 10
      bridgeErrorHandler:
        kind: parameter
        group: consumer
        label: consumer
        type: boolean
        javaType: boolean
        optionalPrefix: consumer.
        deprecated: false
        secret: false
        defaultValue: false
        description: Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
        order: 11
      exceptionHandler:
        kind: parameter
        group: consumer (advanced)
        label: consumer,advanced
        type: object
        javaType: org.apache.camel.spi.ExceptionHandler
        optionalPrefix: consumer.
        deprecated: false
        secret: false
        description: To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
        order: 12
      exchangePattern:
        kind: parameter
        group: consumer (advanced)
        label: consumer,advanced
        type: string
        javaType: org.apache.camel.ExchangePattern
        enum:
        - InOnly
        - RobustInOnly
        - InOut
        - InOptionalOut
        - OutOnly
        - RobustOutOnly
        - OutIn
        - OutOptionalIn
        deprecated: false
        secret: false
        description: Sets the exchange pattern when the consumer creates an exchange.
        order: 13
      synchronous:
        kind: parameter
        group: advanced
        label: advanced
        type: boolean
        javaType: boolean
        deprecated: false
        secret: false
        defaultValue: false
        description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
        order: 14
  documentation.adoc: "[[CouchDB-CamelCouchDBcomponent]]\nCamel CouchDB component\n\
    ~~~~~~~~~~~~~~~~~~~~~~~\n\n*Available as of Camel 2.11*\n\nThe *couchdb:* component\
    \ allows you to treat\nhttp://couchdb.apache.org/[CouchDB] instances as a producer\
    \ or consumer\nof messages. Using the lightweight LightCouch API, this camel component\n\
    has the following features:\n\n* As a consumer, monitors couch changesets for\
    \ inserts, updates and\ndeletes and publishes these as messages into camel routes.\n\
    * As a producer, can save, update and from Camel 2.18 delete (by using CouchDbMethod\
    \ with DELETE value) \ndocuments into couch.\n* Can support as many endpoints\
    \ as required, eg for multiple databases\nacross multiple instances.\n* Ability\
    \ to have events trigger for only deletes, only inserts/updates\nor all (default).\n\
    * Headers set for sequenceId, document revision, document id, and HTTP\nmethod\
    \ type.\n\nMaven users will need to add the following dependency to their `pom.xml`\n\
    for this component:\n\n[source,xml]\n------------------------------------------------------------\n\
    <dependency>\n    <groupId>org.apache.camel</groupId>\n    <artifactId>camel-couchdb</artifactId>\n\
    \    <version>x.x.x</version>\n    <!-- use the same version as your Camel core\
    \ version -->\n</dependency>\n------------------------------------------------------------\n\
    \n[[CouchDB-URIformat]]\nURI format\n^^^^^^^^^^\n\n[source,java]\n-------------------------------------------------\n\
    couchdb:http://hostname[:port]/database?[options]\n-------------------------------------------------\n\
    \nWhere *hostname* is the hostname of the running couchdb instance. Port\nis optional\
    \ and if not specified then defaults to 5984.\n\n[[CouchDB-Options]]\nOptions\n\
    ^^^^^^^\n\n// component options: START\nThe CouchDB component has no options.\n\
    // component options: END\n\n// endpoint options: START\nThe CouchDB component\
    \ supports 15 endpoint options which are listed below:\n\n{% raw %}\n[width=\"\
    100%\",cols=\"2,1,1m,1m,5\",options=\"header\"]\n|=======================================================================\n\
    | Name | Group | Default | Java Type | Description\n| protocol | common |  | String\
    \ | *Required* The protocol to use for communicating with the database.\n| hostname\
    \ | common |  | String | *Required* Hostname of the running couchdb instance\n\
    | port | common | 5984 | int | Port number for the running couchdb instance\n\
    | database | common |  | String | *Required* Name of the database to use\n| createDatabase\
    \ | common | false | boolean | Creates the database if it does not already exist\n\
    | deletes | common | true | boolean | Document deletes are published as events\n\
    | heartbeat | common | 30000 | long | How often to send an empty message to keep\
    \ socket alive in millis\n| password | common |  | String | Password for authenticated\
    \ databases\n| style | common | main_only | String | Specifies how many revisions\
    \ are returned in the changes array. The default main_only will only return the\
    \ current winning revision; all_docs will return all leaf revisions (including\
    \ conflicts and deleted former conflicts.)\n| updates | common | true | boolean\
    \ | Document inserts/updates are published as events\n| username | common |  |\
    \ String | Username in case of authenticated databases\n| bridgeErrorHandler |\
    \ consumer | false | boolean | Allows for bridging the consumer to the Camel routing\
    \ Error Handler which mean any exceptions occurred while the consumer is trying\
    \ to pickup incoming messages or the likes will now be processed as a message\
    \ and handled by the routing Error Handler. By default the consumer will use the\
    \ org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged\
    \ at WARN/ERROR level and ignored.\n| exceptionHandler | consumer (advanced) |\
    \  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice\
    \ if the option bridgeErrorHandler is enabled then this options is not in use.\
    \ By default the consumer will deal with exceptions that will be logged at WARN/ERROR\
    \ level and ignored.\n| exchangePattern | consumer (advanced) |  | ExchangePattern\
    \ | Sets the exchange pattern when the consumer creates an exchange.\n| synchronous\
    \ | advanced | false | boolean | Sets whether synchronous processing should be\
    \ strictly used or Camel is allowed to use asynchronous processing (if supported).\n\
    |=======================================================================\n{% endraw\
    \ %}\n// endpoint options: END\n\n[[CouchDB-Headers]]\nHeaders\n^^^^^^^\n\nThe\
    \ following headers are set on exchanges during message transport.\n\n[width=\"\
    100%\",cols=\"20%,80%\",options=\"header\",]\n|=======================================================================\n\
    |Property |Value\n\n|`CouchDbDatabase` |the database the message came from\n\n\
    |`CouchDbSeq` |the couchdb changeset sequence number of the update / delete message\n\
    \n|`CouchDbId` |the couchdb document id\n\n|`CouchDbRev` |the couchdb document\
    \ revision\n\n|`CouchDbMethod` |the method (delete / update)\n|=======================================================================\n\
    \nHeaders are set by the consumer once the message is received. The\nproducer\
    \ will also set the headers for downstream processors once the\ninsert/update\
    \ has taken place. Any headers set prior to the producer are\nignored. That means\
    \ for example, if you set CouchDbId as a header, it\nwill not be used as the id\
    \ for insertion, the id of the document will\nstill be used.\n\n[[CouchDB-MessageBody]]\n\
    Message Body\n^^^^^^^^^^^^\n\nThe component will use the message body as the document\
    \ to be inserted.\nIf the body is an instance of String, then it will be marshalled\
    \ into a\nGSON object before insert. This means that the string must be valid\
    \ JSON\nor the insert / update will fail. If the body is an instance of a\ncom.google.gson.JsonElement\
    \ then it will be inserted as is. Otherwise\nthe producer will throw an exception\
    \ of unsupported body type.\n\n[[CouchDB-Samples]]\nSamples\n^^^^^^^\n\nFor example\
    \ if you wish to consume all inserts, updates and deletes from\na CouchDB instance\
    \ running locally, on port 9999 then you could use the\nfollowing:\n\n[source,java]\n\
    -------------------------------------------------------------\nfrom(\"couchdb:http://localhost:9999\"\
    ).process(someProcessor);\n-------------------------------------------------------------\n\
    \nIf you were only interested in deletes, then you could use the following\n\n\
    [source,java]\n---------------------------------------------------------------------------\n\
    from(\"couchdb:http://localhost:9999?updates=false\").process(someProcessor);\n\
    ---------------------------------------------------------------------------\n\n\
    If you wanted to insert a message as a document, then the body of the\nexchange\
    \ is used\n\n[source,java]\n----------------------------------------------------------------------------------------\n\
    from(\"someProducingEndpoint\").process(someProcessor).to(\"couchdb:http://localhost:9999\"\
    )\n----------------------------------------------------------------------------------------\n"
