anchor.diff:  The AWS 2 Athena endpoint is configured using URI syntax:
   
   ----
  -aws2-athena:query
  +aws2-athena:label
   ----
   
   with the following path and query parameters:
  
positive.code: 
  
  
  Required S3 component options
  
  You have to provide the amazonS3Client in the
  Registry or your accessKey and secretKey to access
  the https://aws.amazon.com/s3[Amazon's S3].
  
  == Batch Consumer
  
  This component implements the Batch Consumer.
  
  This allows you for instance to know how many messages exists in this
  batch and for instance let the Aggregator
  aggregate this number of messages.
  
  == Usage
  
  === Message headers evaluated by the S3 producer
  
  [width="100%",cols="10%,10%,80%",options="header",]
  |=======================================================================
  |Header |Type |Description
  
  |`CamelAwsS3BucketName` |`String` |The bucket Name which this object will be stored or which will be used for the current operation
  
  |`CamelAwsS3BucketDestinationName` |`String` |The bucket Destination Name which will be used for the current operation
  
  |`CamelAwsS3ContentLength` |`Long` |The content length of this object.
  
  |`CamelAwsS3ContentType` |`String` |The content type of this object.
  
  |`CamelAwsS3ContentControl` |`String` |The content control of this object.
  
  |`CamelAwsS3ContentDisposition` |`String` |The content disposition of this object.
  
  |`CamelAwsS3ContentEncoding` |`String` |The content encoding of this object.
  
  |`CamelAwsS3ContentMD5` |`String` |The md5 checksum of this object.
  
  |`CamelAwsS3DestinationKey` |`String` |The Destination key which will be used for the current operation
  
  |`CamelAwsS3Key` |`String` |The key under which this object will be stored or which will be used for the current operation
  
  |`CamelAwsS3LastModified` |`java.util.Date` |The last modified timestamp of this object.
  
  |`CamelAwsS3Operation` |`String` |The operation to perform. Permitted values are copyObject, deleteObject, listBuckets, deleteBucket, downloadLink, listObjects
  
  |`CamelAwsS3StorageClass` |`String` |The storage class of this object.
  
  |`CamelAwsS3CannedAcl` |`String` |The canned acl that will be applied to the object. see
  `com.amazonaws.services.s3.model.CannedAccessControlList` for allowed
  values.
  
  |`CamelAwsS3Acl` |`com.amazonaws.services.s3.model.AccessControlList` |A well constructed Amazon S3 Access Control List object.
  see `com.amazonaws.services.s3.model.AccessControlList` for more details
  
  |`CamelAwsS3Headers` |`Map<String,String>` |Support to get or set custom objectMetadata headers.
  
  |`CamelAwsS3ServerSideEncryption` |String |Sets the server-side encryption algorithm when encrypting
  the object using AWS-managed keys. For example use AES256.
  
  |`CamelAwsS3VersionId` |`String` |The version Id of the object to be stored or returned from the current operation
  |=======================================================================
  
  === Message headers set by the S3 producer
  
  [width="100%",cols="10%,10%,80%",options="header",]
  |=======================================================================
  |Header |Type |Description
  |`CamelAwsS3ETag` |`String` |The ETag value for the newly uploaded object.
  
  |`CamelAwsS3VersionId` |`String` |The *optional* version ID of the newly uploaded object.
  
  |`CamelAwsS3DownloadLinkExpiration` | `String` | The expiration (millis) of URL download link. The link will be stored into *CamelAwsS3DownloadLink* response header.
  
  |=======================================================================
  
  === Message headers set by the S3 consumer
  
  [width="100%",cols="10%,10%,80%",options="header",]
  |=======================================================================
  |Header |Type |Description
  
  |`CamelAwsS3Key` |`String` |The key under which this object is stored.
  
  |`CamelAwsS3BucketName` |`String` |The name of the bucket in which this object is contained.
  
  |`CamelAwsS3ETag` |`String` |The hex encoded 128-bit MD5 digest of the associated object according to
  RFC 1864. This data is used as an integrity check to verify that the
  data received by the caller is the same data that was sent by Amazon S3.
  
  |`CamelAwsS3LastModified` |`Date` |The value of the Last-Modified header, indicating the date and time at
  which Amazon S3 last recorded a modification to the associated object.
  
  |`CamelAwsS3VersionId` |`String` |The version ID of the associated Amazon S3 object if available. Version
  IDs are only assigned to objects when an object is uploaded to an Amazon
  S3 bucket that has object versioning enabled.
  
  |`CamelAwsS3ContentType` |`String` |The Content-Type HTTP header, which indicates the type of content stored
  in the associated object. The value of this header is a standard MIME
  type.
  
  |`CamelAwsS3ContentMD5` |`String` |The base64 encoded 128-bit MD5 digest of the associated object (content
  - not including headers) according to RFC 1864. This data is used as a
  message integrity check to verify that the data received by Amazon S3 is
  the same data that the caller sent.
  
  |`CamelAwsS3ContentLength` |`Long` |The Content-Length HTTP header indicating the size of the associated
  object in bytes.
  
  |`CamelAwsS3ContentEncoding` |`String` |The *optional* Content-Encoding HTTP header specifying what content
  encodings have been applied to the object and what decoding mechanisms
  must be applied in order to obtain the media-type referenced by the
  Content-Type field.
  
  |`CamelAwsS3ContentDisposition` |`String` |The *optional* Content-Disposition HTTP header, which specifies
  presentational information such as the recommended filename for the
  object to be saved as.
  
  |`CamelAwsS3ContentControl` |`String` |The *optional* Cache-Control HTTP header which allows the user to
  specify caching behavior along the HTTP request/reply chain.
  
  |`CamelAwsS3ServerSideEncryption` |String |The server-side encryption algorithm when encrypting the
  object using AWS-managed keys.
  |=======================================================================
  
  === S3 Producer operations
  
  Camel-AWS s3 component provides the following operation on the producer side:
  
  - copyObject
  - deleteObject
  - listBuckets
  - deleteBucket
  - listObjects
  - getObject (this will return an S3Object instance)
  - getObjectRange (this will return an S3Object instance)
  
  === Advanced AmazonS3 configuration
  
  If your Camel Application is running behind a firewall or if you need to
  have more control over the `S3Client` instance configuration, you can
  create your own instance and refer to it in your Camel aws2-s3 component configuration:
  
  [source,java]
  --------------------------------------------------------------------------------
  from("aws2-s3://MyBucket?amazonS3Client=#client&delay=5000&maxMessagesPerPoll=5")
  .to("mock:result");
  --------------------------------------------------------------------------------
  
  === Use KMS with the S3 component
  
  To use AWS KMS to encrypt/decrypt data by using AWS infrastructure you can use the options introduced in 2.21.x like in the following example
  
  [source,java]
  --------------------------------------------------------------------------------
  from("file:tmp/test?fileName=test.txt")
       .setHeader(S3Constants.KEY, constant("testFile"))
       .to("aws2-s3://mybucket?amazonS3Client=#client&useAwsKMS=true&awsKMSKeyId=3f0637ad-296a-3dfe-a796-e60654fb128c");
  --------------------------------------------------------------------------------
  
  In this way you'll ask to S3, to use the KMS key 3f0637ad-296a-3dfe-a796-e60654fb128c, to encrypt the file test.txt. When you'll ask to download this file, the decryption will be done directly before the download.
  
  === Use "useIAMCredentials" with the s3 component
  
  To use AWS IAM credentials, you must first verify that the EC2 in which you are launching the Camel application on has an IAM role associated with it containing the appropriate policies attached to run effectively.
  Keep in mind that this feature should only be set to "true" on remote instances. To clarify even further, you must still use static credentials locally since IAM is an AWS specific component,
  but AWS environments should now be easier to manage. After this is implemented and understood, you can set the query parameter "useIAMCredentials" to "true" for AWS environments! To effectively toggle this
  on and off based on local and remote environments, you can consider enabling this query parameter with system environment variables. For example, your code could set the "useIAMCredentials" query parameter to "true",
  when the system environment variable called "isRemote" is set to true (there are many other ways to do this and this should act as a simple example). Although it doesn't take away the need for static credentials completely,
  using IAM credentials on AWS environments takes away the need to refresh on remote environments and adds a major security boost (IAM credentials are refreshed automatically every 6 hours and update when their
  policies are updated). This is the AWS recommended way to manage credentials and therefore should be used as often as possible.
  
  === S3 Producer Operation examples
  
  - CopyObject: this operation copy an object from one bucket to a different one
  
  [source,java]
  --------------------------------------------------------------------------------
    from("direct:start").process(new Processor() {
  
        @Override
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setHeader(S3Constants.BUCKET_DESTINATION_NAME, "camelDestinationBucket");
            exchange.getIn().setHeader(S3Constants.KEY, "camelKey");
            exchange.getIn().setHeader(S3Constants.DESTINATION_KEY, "camelDestinationKey");
        }
    })
    .to("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&operation=copyObject")
    .to("mock:result");
  --------------------------------------------------------------------------------
  
  This operation will copy the object with the name expressed in the header camelDestinationKey to the camelDestinationBucket bucket, from the bucket mycamelbucket.
  
  - DeleteObject: this operation deletes an object from a bucket
  
  [source,java]
  --------------------------------------------------------------------------------
    from("direct:start").process(new Processor() {
  
        @Override
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setHeader(S3Constants.KEY, "camelKey");
        }
    })
    .to("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&operation=deleteObject")
    .to("mock:result");
  --------------------------------------------------------------------------------
  
  This operation will delete the object camelKey from the bucket mycamelbucket.
  
  - ListBuckets: this operation list the buckets for this account in this region
  
  [source,java]
  --------------------------------------------------------------------------------
    from("direct:start")
    .to("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&operation=listBuckets")
    .to("mock:result");
  --------------------------------------------------------------------------------
  
  This operation will list the buckets for this account
  
  - DeleteBucket: this operation delete the bucket specified as URI parameter or header
  
  [source,java]
  --------------------------------------------------------------------------------
    from("direct:start")
    .to("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&operation=deleteBucket")
    .to("mock:result");
  --------------------------------------------------------------------------------
  
  This operation will delete the bucket mycamelbucket
  
  - DownloadLink: this operation create a download link for the file specified in the key header
  
  [source,java]
  --------------------------------------------------------------------------------
    from("direct:start").process(new Processor() {
  
        @Override
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setHeader(S3Constants.KEY, "camelKey");
        }
    })
    .to("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&operation=downloadLink")
    .to("mock:result");
  --------------------------------------------------------------------------------
  
  This operation will create a downloadLink for the file camelKey in the bucket mycamelbucket
  
  - ListObjects: this operation list object in a specific bucket
  
  [source,java]
  --------------------------------------------------------------------------------
    from("direct:start")
    .to("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&operation=listObjects")
    .to("mock:result");
  --------------------------------------------------------------------------------
  
  This operation will list the objects in the mycamelbucket bucket
  
  - GetObject: this operation get a single object in a specific bucket
  
  [source,java]
  --------------------------------------------------------------------------------
    from("direct:start").process(new Processor() {
  
        @Override
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setHeader(S3Constants.KEY, "camelKey");
        }
    })
    .to("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&operation=getObject")
    .to("mock:result");
  --------------------------------------------------------------------------------
  
  This operation will return an S3Object instance related to the camelKey object in mycamelbucket bucket.
  
  - GetObjectRange: this operation get a single object range in a specific bucket
  
  [source,java]
  --------------------------------------------------------------------------------
    from("direct:start").process(new Processor() {
  
        @Override
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setHeader(S3Constants.KEY, "camelKey");
            exchange.getIn().setHeader(S3Constants.RANGE_START, "0");
            exchange.getIn().setHeader(S3Constants.RANGE_END, "9");
        }
    })
    .to("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&operation=getObjectRange")
    .to("mock:result");
  --------------------------------------------------------------------------------
  
  This operation will return an S3Object instance related to the camelKey object in mycamelbucket bucket, containing a the bytes from 0 to 9.
  
  == Bucket Autocreation
  
  With the option `autoCreateBucket` users are able to avoid the autocreation of an S3 Bucket in case it doesn't exist. The default for this option is `true`.
  If set to false any operation on a not-existent bucket in AWS won't be successful and an error will be returned.
  
  == Automatic detection of AmazonS3 client in registry
  
  The component is capable of detecting the presence of an AmazonS3 bean into the registry.
  If it's the only instance of that type it will be used as client and you won't have to define it as uri parameter, like the example above.
  This may be really useful for smarter configuration of the endpoint.
  
  == Moving stuff between a bucket and another bucket
  
  Some users like to consume stuff from a bucket and move the content in a different one without using the copyObject feature of this component.
  If this is case for you, don't forget to remove the bucketName header from the incoming exchange of the consumer, otherwise the file will be always overwritten on the same
  original bucket.
  
  == MoveAfterRead consumer option
  
  In addition to deleteAfterRead it has been added another option, moveAfterRead. With this option enabled the consumed object will be moved to a target destinationBucket instead of being only deleted.
  This will require specifying the destinationBucket option. As example:
  
  [source,java]
  --------------------------------------------------------------------------------
    from("aws2-s3://mycamelbucket?amazonS3Client=#amazonS3Client&moveAfterRead=true&destinationBucket=myothercamelbucket")
    .to("mock:result");
  --------------------------------------------------------------------------------
  
  In this case the objects consumed will be moved to myothercamelbucket bucket and deleted from the original one (because of deleteAfterRead set to true as default).
  
  == Using customer key as encryption
  
  We introduced also the customer key support (an alternative of using KMS). The following code shows an example.
  
  [source,java]
  --------------------------------------------------------------------------------
  String key = UUID.randomUUID().toString();
  byte[] secretKey = generateSecretKey();
  String b64Key = Base64.getEncoder().encodeToString(secretKey);
  String b64KeyMd5 = Md5Utils.md5AsBase64(secretKey);
  
  String awsEndpoint = "aws2-s3://mycamel?autoCreateBucket=false&useCustomerKey=true&customerKeyId=RAW(" + b64Key + ")&customerKeyMD5=RAW(" + b64KeyMd5 + ")&customerAlgorithm=" + AES256.name();
  
  from("direct:putObject")
      .setHeader(AWS2S3Constants.KEY, constant("test.txt"))
      .setBody(constant("Test"))
      .to(awsEndpoint);
  --------------------------------------------------------------------------------
  
  == Using a POJO as body
  
  Sometimes build an AWS Request can be complex, because of multiple options. We introduce the possibility to use a POJO as body.
  In AWS S3 there are multiple operations you can submit, as an example for List brokers request, you can do something like:
  
  ------------------------------------------------------------------------------------------------------
  from("direct:aws2-s3")
       .setBody(ListObjectsRequest.builder().bucket(bucketName).build())
       .to("aws2-s3://test?amazonS3Client=#amazonS3Client&operation=listObjects&pojoRequest=true")
  ------------------------------------------------------------------------------------------------------
  
  In this way you'll pass the request directly without the need of passing headers and options specifically related to this operation.
  
  == Dependencies
  
  
negative.code: ---------------------------------------
  <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-aws2-athena</artifactId>
      <version>${camel-version}</version>
  </dependency>
  ---------------------------------------
  