---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    funktion.fabric8.io/kind: Connector
  name: jclouds
data:
  deployment.yml: |
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        funktion.fabric8.io/kind: Subscription
        connector: jclouds
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            funktion.fabric8.io/kind: Subscription
            connector: jclouds
        spec:
          containers:
          - image: funktion/connector-jclouds:${project.version}
            name: connector
  schema.yml: |
    ---
    component:
      kind: component
      scheme: jclouds
      syntax: jclouds:command:providerId
      title: JClouds
      description: For interacting with cloud compute & blobstore service via jclouds.
      label: api,cloud
      deprecated: false
      async: false
      javaType: org.apache.camel.component.jclouds.JcloudsComponent
      groupId: org.apache.camel
      artifactId: camel-jclouds
      version: 2.18.3
    componentProperties:
      blobStores:
        kind: property
        type: array
        javaType: java.util.List<org.jclouds.blobstore.BlobStore>
        deprecated: false
        secret: false
        description: To use the given BlobStore which must be configured when using blobstore.
        order: 0
      computeServices:
        kind: property
        type: array
        javaType: java.util.List<org.jclouds.compute.ComputeService>
        deprecated: false
        secret: false
        description: To use the given ComputeService which must be configured when use compute.
        order: 1
    properties:
      command:
        kind: path
        group: common
        required: true
        type: string
        javaType: org.apache.camel.component.jclouds.JcloudsCommand
        enum:
        - blobstore
        - compute
        deprecated: false
        secret: false
        description: What command to execute such as blobstore or compute.
        order: 0
      providerId:
        kind: path
        group: common
        required: true
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The name of the cloud provider that provides the target service (e.g. aws-s3 or aws_ec2).
        order: 1
      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: 2
      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: 3
      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: 4
      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: 5
      blobName:
        kind: parameter
        group: blobstore
        label: producer,blobstore
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The name of the blob.
        order: 6
      container:
        kind: parameter
        group: blobstore
        label: blobstore
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The name of the blob container.
        order: 7
      directory:
        kind: parameter
        group: blobstore
        label: consumer,blobstore
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: An optional directory name to use
        order: 8
      group:
        kind: parameter
        group: compute
        label: producer,compute
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The group that will be assigned to the newly created node. Values depend on the actual cloud provider.
        order: 9
      hardwareId:
        kind: parameter
        group: compute
        label: producer,compute
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The hardware that will be used for creating a node. Values depend on the actual cloud provider.
        order: 10
      imageId:
        kind: parameter
        group: compute
        label: producer,compute
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The imageId that will be used for creating a node. Values depend on the actual cloud provider.
        order: 11
      locationId:
        kind: parameter
        group: compute
        label: producer,compute
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The location that will be used for creating a node. Values depend on the actual cloud provider.
        order: 12
      nodeId:
        kind: parameter
        group: compute
        label: producer,compute
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The id of the node that will run the script or destroyed.
        order: 13
      nodeState:
        kind: parameter
        group: compute
        label: producer,compute
        type: string
        javaType: java.lang.String
        enum:
        - PENDING
        - TERMINATED
        - SUSPENDED
        - RUNNING
        - ERROR
        - UNRECOGNIZED
        deprecated: false
        secret: false
        description: To filter by node status to only select running nodes etc.
        order: 14
      operation:
        kind: parameter
        group: compute
        label: producer,compute
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: Specifies the type of operation that will be performed to the blobstore.
        order: 15
      user:
        kind: parameter
        group: compute
        label: producer,compute
        type: string
        javaType: java.lang.String
        deprecated: false
        secret: false
        description: The user on the target node that will run the script.
        order: 16
  documentation.adoc: "[[jclouds-JcloudsComponent]]\nJclouds Component\n~~~~~~~~~~~~~~~~~\n\
    \n*Available as of Camel 2.9*\n\nThis component allows interaction with cloud\
    \ provider key-value engines\n(blobstores) and compute services. The component\
    \ uses\nhttp://code.google.com/p/jclouds[jclouds] which is +\n a library that\
    \ provides abstractions for blobstores and compute\nservices.\n\n*ComputeService*\
    \ simplifies the task of managing machines in the cloud.\nFor example, you can\
    \ use ComputeService to start 5 machines and install\nyour software on them. +\n\
    \ *BlobStore* simplifies dealing with key-value providers such as Amazon\nS3.\
    \ For example, BlobStore can give you a simple Map view of a\ncontainer.\n\nThe\
    \ camel jclouds component allows you to use both abstractions, as it\nspecifes\
    \ two types of endpoint the JcloudsBlobStoreEndpoint and the\nJcloudsComputeEndpoint.\
    \ You can have both producers and consumers on a\nblobstore endpoint but you can\
    \ only have producers on compute endpoints.\n\nMaven users will need to add the\
    \ following dependency to their `pom.xml`\nfor this component:\n\n[source,xml]\n\
    ------------------------------------------------------------\n<dependency>\n \
    \   <groupId>org.apache.camel</groupId>\n    <artifactId>camel-jclouds</artifactId>\n\
    \    <version>x.x.x</version>\n    <!-- use the same version as your Camel core\
    \ version -->\n</dependency>\n------------------------------------------------------------\n\
    \n[[jclouds-Configuringthecomponent]]\nConfiguring the component\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\
    \nThe camel jclouds component will make use of multiple jclouds blobstores\nand\
    \ compute services as long as they are passed to the component during\ninitialization.\
    \ The component accepts a list blobstores and compute\nservices. Here is how it\
    \ can be configured.\n\n[source,xml]\n----------------------------------------------------------------------------------------------------------------\n\
    \    <bean id=\"jclouds\" class=\"org.apache.camel.component.jclouds.JcloudsComponent\"\
    >\n        <property name=\"computeServices\">\n            <list>\n         \
    \       <ref bean=\"computeService\"/>\n            </list>\n        </property>\n\
    \        <property name=\"blobStores\">\n            <list>\n                <ref\
    \ bean=\"blobStore\"/>\n            </list>\n        </property>\n    </bean>\n\
    \n    <!-- Creating a blobstore from spring / blueprint xml -->\n    <bean id=\"\
    blobStoreContextFactory\" class=\"org.jclouds.blobstore.BlobStoreContextFactory\"\
    />\n\n    <bean id=\"blobStoreContext\" factory-bean=\"blobStoreContextFactory\"\
    \ factory-method=\"createContext\">\n        <constructor-arg name=\"provider\"\
    \ value=\"PROVIDER_NAME\"/>\n        <constructor-arg name=\"identity\"  value=\"\
    IDENTITY\"/>\n        <constructor-arg name=\"credential\" value=\"CREDENTIAL\"\
    />\n    </bean>\n\n    <bean id=\"blobStore\" factory-bean=\"blobStoreContext\"\
    \ factory-method=\"getBlobStore\"/>\n\n    <!-- Creating a compute service from\
    \ spring / blueprint xml -->\n    <bean id=\"computeServiceContextFactory\" class=\"\
    org.jclouds.compute.ComputeServiceContextFactory\"/>\n\n    <bean id=\"computeServiceContext\"\
    \ factory-bean=\"computeServiceContextFactory\" factory-method=\"createContext\"\
    >\n        <constructor-arg name=\"provider\" value=\"PROVIDER_NAME\"/>\n    \
    \    <constructor-arg name=\"identity\"  value=\"IDENTITY\"/>\n        <constructor-arg\
    \ name=\"credential\" value=\"CREDENTIAL\"/>\n    </bean>\n\n    <bean id=\"computeService\"\
    \ factory-bean=\"computeServiceContext\" factory-method=\"getComputeService\"\
    />\n----------------------------------------------------------------------------------------------------------------\n\
    \nAs you can see the component is capable of handling multiple blobstores\nand\
    \ compute services. The actual implementation that will be used by\neach endpoint\
    \ is specified by passing the provider inside the URI.\n\n[[jclouds-Options]]\n\
    Jclouds Options\n^^^^^^^^^^^^^^^\n\n[source,java]\n-----------------------------------------\n\
    jclouds:blobstore:[provider id][?options]\njclouds:compute:[provider id][?options]\n\
    -----------------------------------------\n\nThe *provider id* is the name of\
    \ the cloud provider that provides the\ntarget service (_e.g. aws-s3 or aws_ec2_).\n\
    \nYou can append query options to the URI in the following format,\n`?option=value&option=value&...`\n\
    \n[[jclouds-BlobstoreURIOptions]]\nBlobstore URI Options\n^^^^^^^^^^^^^^^^^^^^^\n\
    \n\n\n\n// component options: START\nThe JClouds component supports 2 options\
    \ which are listed below.\n\n\n\n{% raw %}\n[width=\"100%\",cols=\"2,1m,7\",options=\"\
    header\"]\n|=======================================================================\n\
    | Name | Java Type | Description\n| blobStores | List | To use the given BlobStore\
    \ which must be configured when using blobstore.\n| computeServices | List | To\
    \ use the given ComputeService which must be configured when use compute.\n|=======================================================================\n\
    {% endraw %}\n// component options: END\n\n\n\n\n\n\n// endpoint options: START\n\
    The JClouds component supports 17 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| command | common |  | JcloudsCommand\
    \ | *Required* What command to execute such as blobstore or compute.\n| providerId\
    \ | common |  | String | *Required* The name of the cloud provider that provides\
    \ the target service (e.g. aws-s3 or aws_ec2).\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| blobName | blobstore |  | String | The name of\
    \ the blob.\n| container | blobstore |  | String | The name of the blob container.\n\
    | directory | blobstore |  | String | An optional directory name to use\n| group\
    \ | compute |  | String | The group that will be assigned to the newly created\
    \ node. Values depend on the actual cloud provider.\n| hardwareId | compute |\
    \  | String | The hardware that will be used for creating a node. Values depend\
    \ on the actual cloud provider.\n| imageId | compute |  | String | The imageId\
    \ that will be used for creating a node. Values depend on the actual cloud provider.\n\
    | locationId | compute |  | String | The location that will be used for creating\
    \ a node. Values depend on the actual cloud provider.\n| nodeId | compute |  |\
    \ String | The id of the node that will run the script or destroyed.\n| nodeState\
    \ | compute |  | String | To filter by node status to only select running nodes\
    \ etc.\n| operation | compute |  | String | Specifies the type of operation that\
    \ will be performed to the blobstore.\n| user | compute |  | String | The user\
    \ on the target node that will run the script.\n|=======================================================================\n\
    {% endraw %}\n// endpoint options: END\n\n\n\nYou can have as many of these options\
    \ as you like.\n\n[source,java]\n------------------------------------------------------------------------------------------\n\
    jclouds:blobstore:aws-s3?operation=CamelJcloudsGet&container=mycontainer&blobName=someblob\n\
    ------------------------------------------------------------------------------------------\n\
    \nFor producer endpoint you can override all of the above URI options by\npassing\
    \ the appropriate headers to the message.\n\n[[jclouds-MessageHeadersforblobstore]]\n\
    Message Headers for blobstore\n+++++++++++++++++++++++++++++\n\n[width=\"100%\"\
    ,cols=\"10%,90%\",options=\"header\",]\n|=======================================================================\n\
    |Header |Description\n\n|`CamelJcloudsOperation` |The operation to be performed\
    \ on the blob. The valid options are\n* PUT\n* GET\n\n|`CamelJcloudsContainer`\
    \ |The name of the blob container.\n\n|`CamelJcloudsBlobName` |The name of the\
    \ blob.\n|=======================================================================\n\
    \n[[jclouds-BlobstoreUsageSamples]]\nBlobstore Usage Samples\n^^^^^^^^^^^^^^^^^^^^^^^\n\
    \n[[jclouds-Example1:Puttingtotheblob]]\nExample 1: Putting to the blob\n++++++++++++++++++++++++++++++\n\
    \nThis example will show you how you can store any message inside a blob\nusing\
    \ the jclouds component.\n\n[source,java]\n------------------------------------\n\
    from(\"direct:start\")\n    .to(\"jclouds:blobstore:aws-s3\" +\n        \"?operation=PUT\"\
    \ +\n        \"&container=mycontainer\" +\n        \"&blobName=myblob\");\n------------------------------------\n\
    \nIn the above example you can override any of the URI parameters with\nheaders\
    \ on the message. \nHere is how the above example would look like using xml to\
    \ define our\nroute.\n\n[source,xml]\n--------------------------------------------------------------------------------------------\n\
    <route>\n    <from uri=\"direct:start\"/>\n    <to uri=\"jclouds:blobstore:aws-s3?operation=PUT&container=mycontainer&blobName=myblob\"\
    />\n</route>\n--------------------------------------------------------------------------------------------\n\
    \n[[jclouds-Example2:GettingReadingfromablob]]\nExample 2: Getting/Reading from\
    \ a blob\n++++++++++++++++++++++++++++++++++++++\n\nThis example will show you\
    \ how you can read the contnet of a blob using\nthe jclouds component.\n\n[source,java]\n\
    ------------------------------------\nfrom(\"direct:start\")\n    .to(\"jclouds:blobstore:aws-s3\"\
    \ +\n        \"?operation=GET\" +\n        \"&container=mycontainer\" +\n    \
    \    \"&blobName=myblob\");\n------------------------------------\n\nIn the above\
    \ example you can override any of the URI parameters with\nheaders on the message.\
    \ \n Here is how the above example would look like using xml to define our\nroute.\n\
    \n[source,xml]\n--------------------------------------------------------------------------------------------\n\
    <route>\n    <from uri=\"direct:start\"/>\n    <to uri=\"jclouds:blobstore:aws-s3?operation=PUT&container=mycontainer&blobName=myblob\"\
    />\n</route>\n--------------------------------------------------------------------------------------------\n\
    \n[[jclouds-Example3:Consumingablob]]\nExample 3: Consuming a blob\n+++++++++++++++++++++++++++\n\
    \nThis example will consume all blob that are under the specified\ncontainer.\
    \ The generated exchange will contain the payload of the blob\nas body.\n\n[source,java]\n\
    -------------------------------------\n    from(\"jclouds:blobstore:aws-s3\" +\n\
    \        \"?container=mycontainer\")\n        .to(\"direct:next\");\n-------------------------------------\n\
    \nYou can achieve the same goal by using xml, as you can see below.\n\n[source,xml]\n\
    ----------------------------------------------------------------------------------------------\n\
    <route>\n    <from uri=\"jclouds:blobstore:aws-s3?operation=GET&container=mycontainer&blobName=myblob\"\
    />\n    <to uri=\"direct:next\"/>\n</route>\n----------------------------------------------------------------------------------------------\n\
    \n\n\n[source,java]\n-------------------------------------------------------------------------------------------------------------\n\
    jclouds:compute:aws-ec2?operation=CamelJcloudsCreateNode&imageId=AMI_XXXXX&locationId=eu-west-1&group=mygroup\n\
    -------------------------------------------------------------------------------------------------------------\n\
    \n[[jclouds-ComputeUsageSamples]]\nCompute Usage Samples\n^^^^^^^^^^^^^^^^^^^^^\n\
    \nBelow are some examples that demonstrate the use of jclouds compute\nproducer\
    \ in java dsl and spring/blueprint xml.\n\n[[jclouds-Example1:Listingtheavailableimages.]]\n\
    Example 1: Listing the available images.\n++++++++++++++++++++++++++++++++++++++++\n\
    \n[source,java]\n--------------------------------------------\n    from(\"jclouds:compute:aws-ec2\"\
    \ +\n        \"&operation=CamelJCloudsListImages\")\n        .to(\"direct:next\"\
    );\n--------------------------------------------\n\nThis will create a message\
    \ that will contain the list of images inside\nits body. You can also do the same\
    \ using xml.\n\n[source,xml]\n--------------------------------------------------------------------------\n\
    <route>\n    <from uri=\"jclouds:compute:aws-ec2?operation=CamelJCloudsListImages\"\
    />\n    <to uri=\"direct:next\"/>\n</route>\n--------------------------------------------------------------------------\n\
    \n[[jclouds-Example2:Createanewnode.]]\nExample 2: Create a new node.\n+++++++++++++++++++++++++++++\n\
    \n[source,java]\n---------------------------------------------\n    from(\"direct:start\"\
    ).\n    to(\"jclouds:compute:aws-ec2\" +\n        \"?operation=CamelJcloudsCreateNode\"\
    \ +\n        \"&imageId=AMI_XXXXX\" +\n        \"&locationId=XXXXX\" +\n     \
    \   \"&group=myGroup\");\n---------------------------------------------\n\nThis\
    \ will create a new node on the cloud provider. The out message in\nthis case\
    \ will be a set of metadata that contains information about the\nnewly created\
    \ node (e.g. the ip, hostname etc). Here is the same using\nspring xml.\n\n[source,xml]\n\
    -------------------------------------------------------------------------------------------------------------------------\n\
    <route>\n    <from uri=\"direct:start\"/>\n    <to uri=\"jclouds:compute:aws-ec2?operation=CamelJcloudsCreateNode&imageId=AMI_XXXXX&locationId=XXXXX&group=myGroup\"\
    />\n</route>\n-------------------------------------------------------------------------------------------------------------------------\n\
    \n[[jclouds-Example3:Runashellscriptonrunningnode.]]\nExample 3: Run a shell script\
    \ on running node.\n++++++++++++++++++++++++++++++++++++++++++++++\n\n[source,java]\n\
    --------------------------------------------\n    from(\"direct:start\").\n  \
    \  to(\"jclouds:compute:aws-ec2\" +\n        \"?operation=CamelJcloudsRunScript\"\
    \ +\n        \"?nodeId=10\" +\n        \"&user=ubuntu\");\n--------------------------------------------\n\
    \nThe sample above will retrieve the body of the in message, which is\nexpected\
    \ to contain the shell script to be executed. Once the script is\nretrieved, it\
    \ will be sent to the node for execution under the specified\nuser (_in order\
    \ case ubuntu_). The target node is specified using its\nnodeId. The nodeId can\
    \ be retrieved either upon the creation of the\nnode, it will be part of the resulting\
    \ metadata or by a executing a\nLIST_NODES operation.\n\n*Note* This will require\
    \ that the compute service that will be passed to\nthe component, to be initialized\
    \ with the appropriate jclouds ssh\ncapable module (_e.g. jsch or sshj_).\n\n\
    Here is the same using spring xml.\n\n[source,xml]\n----------------------------------------------------------------------------------------------\n\
    <route>\n    <from uri=\"direct:start\"/>\n    <to uri=\"jclouds:compute:aws-ec2?operation=CamelJcloudsListNodes&?nodeId=10&user=ubuntu\"\
    />\n</route>\n----------------------------------------------------------------------------------------------\n\
    \n[[jclouds-Seealso]]\nSee also\n++++++++\n\nIf you want to find out more about\
    \ jclouds here is list of interesting\nresources \n\nhttp://jclouds.incubator.apache.org/documentation/userguide/blobstore-guide/[Jclouds\n\
    Blobstore wiki] \n\nhttp://jclouds.incubator.apache.org/documentation/userguide/compute/[Jclouds\n\
    Compute wiki]\n"
