[ 
https://issues.apache.org/jira/browse/CAMEL-18022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17529030#comment-17529030
 ] 

Andrea Cosentino commented on CAMEL-18022:
------------------------------------------

Head bucket is a cheaper and faster invocation then listing all the buckets and 
check. This is the main reason for using it. Can you please show an example of 
your route and bucket name and structure?

It's really a corner case and moving away from this for a corner case needs a 
justification 

> camel-aws - Head Bucket Request Fails when route is configured to folders in 
> Bucket
> -----------------------------------------------------------------------------------
>
>                 Key: CAMEL-18022
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18022
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-aws2
>    Affects Versions: 3.15.0, 3.16.0
>            Reporter: Jawad Ahmad
>            Assignee: Andrea Cosentino
>            Priority: Major
>
> I am trying to configure AWS2 S3 component. I have folders under a hierarchy 
> where the bucket name is top of the hierarchy and then different subfolders 
> which will have actual files.
> But when I configure the route, it fails with 403 error on Head Bucket 
> Request. I believe as my bucket name doesn't match the regex pattern (as it 
> contains a subfolder name as well), this request gets failed.
> We need to move away from HeadBucketRequests or provide a way to configure 
> herirchical folders structure. 
> {code:java}
>  try {
>             
> s3Client.headBucket(HeadBucketRequest.builder().bucket(bucketName).build());
>             LOG.trace("Bucket [{}] already exists", bucketName);
>             return;
>         } catch (AwsServiceException ase) {
>             /* 404 means the bucket doesn't exist */
>             if (!(ase.awsErrorDetails().sdkHttpResponse().statusCode() == 
> 404)) {
>                 throw ase;
>             }
>         }
> {code}
> E.g : If bucket name = Test and folder name = CSV then S3 path of folder 
> would look like : s3://Test/CSV/ . Configuring this in AWS route fails on 
> Bucket Head Request.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to