This is an automated email from the ASF dual-hosted git repository.

cdeppisch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git

commit a1c29736dbaeff8f5a7a7559fdb537e3260a3782
Author: Christoph Deppisch <cdeppi...@redhat.com>
AuthorDate: Thu Nov 9 09:42:54 2023 +0100

    chore: Add forcePathStyle option to aws-s3 Kamelets
    
    - Since Apache Camel 4 the aws-s3 component supports to force the path 
style when accessing buckets on AWS S3
    - Path style access is essential when testing with local AWS S3 instances 
such as LocalStack
---
 kamelets/aws-s3-sink.kamelet.yaml                              | 10 +++++++++-
 kamelets/aws-s3-source.kamelet.yaml                            |  8 ++++++++
 kamelets/aws-s3-streaming-upload-sink.kamelet.yaml             | 10 +++++++++-
 .../src/main/resources/kamelets/aws-s3-sink.kamelet.yaml       | 10 +++++++++-
 .../src/main/resources/kamelets/aws-s3-source.kamelet.yaml     |  8 ++++++++
 .../kamelets/aws-s3-streaming-upload-sink.kamelet.yaml         | 10 +++++++++-
 test/aws-s3/amazonS3Client.groovy                              |  3 ++-
 test/aws-s3/aws-s3-credentials.properties                      |  1 +
 test/aws-s3/aws-s3-to-http.yaml                                |  1 +
 test/aws-s3/aws-s3-to-knative-broker.yaml                      |  1 +
 test/aws-s3/aws-s3-to-knative-channel.yaml                     |  1 +
 test/aws-s3/aws-s3-to-log-uri-based.groovy                     |  1 +
 test/aws-s3/aws-s3-uri-pipe.yaml                               |  1 +
 13 files changed, 60 insertions(+), 5 deletions(-)

diff --git a/kamelets/aws-s3-sink.kamelet.yaml 
b/kamelets/aws-s3-sink.kamelet.yaml
index 3e07c156..9141f5a7 100644
--- a/kamelets/aws-s3-sink.kamelet.yaml
+++ b/kamelets/aws-s3-sink.kamelet.yaml
@@ -96,6 +96,13 @@ spec:
         x-descriptors:
           - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
         default: false
+      forcePathStyle:
+        title: Force Path Style
+        description: Forces path style when accessing AWS S3 buckets.
+        type: boolean
+        x-descriptors:
+          - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+        default: false
       keyName:
         title: Key Name
         description: The key name for saving an element in the bucket.
@@ -113,7 +120,7 @@ spec:
           when:
             - simple: '${propertiesExist:!keyName}'
               steps:
-                - choice:   
+                - choice:
                     when:
                       - simple: "${header[file]}"
                         steps:
@@ -140,4 +147,5 @@ spec:
             useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
             uriEndpointOverride: "{{?uriEndpointOverride}}"
             overrideEndpoint: "{{overrideEndpoint}}"
+            forcePathStyle: "{{forcePathStyle}}"
             keyName: "{{?keyName}}"
diff --git a/kamelets/aws-s3-source.kamelet.yaml 
b/kamelets/aws-s3-source.kamelet.yaml
index 6c09eb8a..d3cceeba 100644
--- a/kamelets/aws-s3-source.kamelet.yaml
+++ b/kamelets/aws-s3-source.kamelet.yaml
@@ -96,6 +96,13 @@ spec:
         x-descriptors:
           - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
         default: false
+      forcePathStyle:
+        title: Force Path Style
+        description: Forces path style when accessing AWS S3 buckets.
+        type: boolean
+        x-descriptors:
+          - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+        default: false
       delay:
         title: Delay
         description: The number of milliseconds before the next poll of the 
selected bucket.
@@ -188,6 +195,7 @@ spec:
         useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
         uriEndpointOverride: "{{?uriEndpointOverride}}"
         overrideEndpoint: "{{overrideEndpoint}}"
+        forcePathStyle: "{{forcePathStyle}}"
         delay: "{{delay}}"
         maxMessagesPerPoll: "{{maxMessagesPerPoll}}"
       steps:
diff --git a/kamelets/aws-s3-streaming-upload-sink.kamelet.yaml 
b/kamelets/aws-s3-streaming-upload-sink.kamelet.yaml
index fcaad8dd..3570272d 100644
--- a/kamelets/aws-s3-streaming-upload-sink.kamelet.yaml
+++ b/kamelets/aws-s3-streaming-upload-sink.kamelet.yaml
@@ -99,7 +99,7 @@ spec:
         description: The naming strategy to use in streaming upload mode. 
There are 2 enums and the value can be one of progressive, random
         type: string
         default: "progressive"
-      keyName: 
+      keyName:
         title: Key Name
         description: Setting the key name for an element in the bucket through 
endpoint parameter. In Streaming Upload, with the default configuration, this 
will be the base for the progressive creation of files.
         type: string
@@ -121,6 +121,13 @@ spec:
         x-descriptors:
           - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
         default: false
+      forcePathStyle:
+        title: Force Path Style
+        description: Forces path style when accessing AWS S3 buckets.
+        type: boolean
+        x-descriptors:
+          - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+        default: false
   dependencies:
     - "camel:aws2-s3"
     - "camel:kamelet"
@@ -145,3 +152,4 @@ spec:
             useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
             uriEndpointOverride: "{{?uriEndpointOverride}}"
             overrideEndpoint: "{{overrideEndpoint}}"
+            forcePathStyle: "{{forcePathStyle}}"
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/aws-s3-sink.kamelet.yaml 
b/library/camel-kamelets/src/main/resources/kamelets/aws-s3-sink.kamelet.yaml
index 3e07c156..9141f5a7 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/aws-s3-sink.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/aws-s3-sink.kamelet.yaml
@@ -96,6 +96,13 @@ spec:
         x-descriptors:
           - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
         default: false
+      forcePathStyle:
+        title: Force Path Style
+        description: Forces path style when accessing AWS S3 buckets.
+        type: boolean
+        x-descriptors:
+          - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+        default: false
       keyName:
         title: Key Name
         description: The key name for saving an element in the bucket.
@@ -113,7 +120,7 @@ spec:
           when:
             - simple: '${propertiesExist:!keyName}'
               steps:
-                - choice:   
+                - choice:
                     when:
                       - simple: "${header[file]}"
                         steps:
@@ -140,4 +147,5 @@ spec:
             useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
             uriEndpointOverride: "{{?uriEndpointOverride}}"
             overrideEndpoint: "{{overrideEndpoint}}"
+            forcePathStyle: "{{forcePathStyle}}"
             keyName: "{{?keyName}}"
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/aws-s3-source.kamelet.yaml 
b/library/camel-kamelets/src/main/resources/kamelets/aws-s3-source.kamelet.yaml
index 6c09eb8a..d3cceeba 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/aws-s3-source.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/aws-s3-source.kamelet.yaml
@@ -96,6 +96,13 @@ spec:
         x-descriptors:
           - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
         default: false
+      forcePathStyle:
+        title: Force Path Style
+        description: Forces path style when accessing AWS S3 buckets.
+        type: boolean
+        x-descriptors:
+          - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+        default: false
       delay:
         title: Delay
         description: The number of milliseconds before the next poll of the 
selected bucket.
@@ -188,6 +195,7 @@ spec:
         useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
         uriEndpointOverride: "{{?uriEndpointOverride}}"
         overrideEndpoint: "{{overrideEndpoint}}"
+        forcePathStyle: "{{forcePathStyle}}"
         delay: "{{delay}}"
         maxMessagesPerPoll: "{{maxMessagesPerPoll}}"
       steps:
diff --git 
a/library/camel-kamelets/src/main/resources/kamelets/aws-s3-streaming-upload-sink.kamelet.yaml
 
b/library/camel-kamelets/src/main/resources/kamelets/aws-s3-streaming-upload-sink.kamelet.yaml
index fcaad8dd..3570272d 100644
--- 
a/library/camel-kamelets/src/main/resources/kamelets/aws-s3-streaming-upload-sink.kamelet.yaml
+++ 
b/library/camel-kamelets/src/main/resources/kamelets/aws-s3-streaming-upload-sink.kamelet.yaml
@@ -99,7 +99,7 @@ spec:
         description: The naming strategy to use in streaming upload mode. 
There are 2 enums and the value can be one of progressive, random
         type: string
         default: "progressive"
-      keyName: 
+      keyName:
         title: Key Name
         description: Setting the key name for an element in the bucket through 
endpoint parameter. In Streaming Upload, with the default configuration, this 
will be the base for the progressive creation of files.
         type: string
@@ -121,6 +121,13 @@ spec:
         x-descriptors:
           - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
         default: false
+      forcePathStyle:
+        title: Force Path Style
+        description: Forces path style when accessing AWS S3 buckets.
+        type: boolean
+        x-descriptors:
+          - 'urn:alm:descriptor:com.tectonic.ui:checkbox'
+        default: false
   dependencies:
     - "camel:aws2-s3"
     - "camel:kamelet"
@@ -145,3 +152,4 @@ spec:
             useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
             uriEndpointOverride: "{{?uriEndpointOverride}}"
             overrideEndpoint: "{{overrideEndpoint}}"
+            forcePathStyle: "{{forcePathStyle}}"
diff --git a/test/aws-s3/amazonS3Client.groovy 
b/test/aws-s3/amazonS3Client.groovy
index 7e31c675..5a8c5f0d 100644
--- a/test/aws-s3/amazonS3Client.groovy
+++ b/test/aws-s3/amazonS3Client.groovy
@@ -22,12 +22,13 @@ import software.amazon.awssdk.services.s3.S3Client
 
 S3Client s3 = S3Client
         .builder()
-        
.endpointOverride(URI.create("${YAKS_TESTCONTAINERS_LOCALSTACK_S3_LOCAL_URL}".replace('localhost',
 '127.0.0.1')))
+        
.endpointOverride(URI.create("${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}"))
         .credentialsProvider(StaticCredentialsProvider.create(
                 AwsBasicCredentials.create(
                         "${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}",
                         "${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}")
         ))
+        .forcePathStyle(true)
         .region(Region.of("${YAKS_TESTCONTAINERS_LOCALSTACK_REGION}"))
         .build()
 
diff --git a/test/aws-s3/aws-s3-credentials.properties 
b/test/aws-s3/aws-s3-credentials.properties
index f9dd1e10..aa0e29a3 100644
--- a/test/aws-s3/aws-s3-credentials.properties
+++ b/test/aws-s3/aws-s3-credentials.properties
@@ -1,6 +1,7 @@
 # Please add your AWS S3 account credentials
 
camel.kamelet.aws-s3-source.aws-s3-credentials.bucketNameOrArn=${aws.s3.bucketNameOrArn}
 camel.kamelet.aws-s3-source.aws-s3-credentials.overrideEndpoint=true
+camel.kamelet.aws-s3-source.aws-s3-credentials.forcePathStyle=true
 
camel.kamelet.aws-s3-source.aws-s3-credentials.uriEndpointOverride=${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}
 
camel.kamelet.aws-s3-source.aws-s3-credentials.secretKey=${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}
 
camel.kamelet.aws-s3-source.aws-s3-credentials.accessKey=${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}
diff --git a/test/aws-s3/aws-s3-to-http.yaml b/test/aws-s3/aws-s3-to-http.yaml
index eea7cf7b..702f8718 100644
--- a/test/aws-s3/aws-s3-to-http.yaml
+++ b/test/aws-s3/aws-s3-to-http.yaml
@@ -31,6 +31,7 @@ spec:
     properties:
       bucketNameOrArn: ${aws.s3.bucketNameOrArn}
       overrideEndpoint: true
+      forcePathStyle: true
       uriEndpointOverride: ${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}
       accessKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}
       secretKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}
diff --git a/test/aws-s3/aws-s3-to-knative-broker.yaml 
b/test/aws-s3/aws-s3-to-knative-broker.yaml
index 4ee1d92d..7ecacdfb 100644
--- a/test/aws-s3/aws-s3-to-knative-broker.yaml
+++ b/test/aws-s3/aws-s3-to-knative-broker.yaml
@@ -28,6 +28,7 @@ spec:
     properties:
       bucketNameOrArn: ${aws.s3.bucketNameOrArn}
       overrideEndpoint: true
+      forcePathStyle: true
       uriEndpointOverride: ${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}
       accessKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}
       secretKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}
diff --git a/test/aws-s3/aws-s3-to-knative-channel.yaml 
b/test/aws-s3/aws-s3-to-knative-channel.yaml
index 4d0f246c..6314a596 100644
--- a/test/aws-s3/aws-s3-to-knative-channel.yaml
+++ b/test/aws-s3/aws-s3-to-knative-channel.yaml
@@ -28,6 +28,7 @@ spec:
     properties:
       bucketNameOrArn: ${aws.s3.bucketNameOrArn}
       overrideEndpoint: true
+      forcePathStyle: true
       uriEndpointOverride: ${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}
       accessKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}
       secretKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}
diff --git a/test/aws-s3/aws-s3-to-log-uri-based.groovy 
b/test/aws-s3/aws-s3-to-log-uri-based.groovy
index 145b5510..a1163335 100644
--- a/test/aws-s3/aws-s3-to-log-uri-based.groovy
+++ b/test/aws-s3/aws-s3-to-log-uri-based.groovy
@@ -19,6 +19,7 @@
 
 def parameters = 'bucketNameOrArn=${aws.s3.bucketNameOrArn}&'+
                  'overrideEndpoint=true&' +
+                 'forcePathStyle=true&' +
                  
'uriEndpointOverride=${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}&' +
                  'accessKey=${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}&' +
                  'secretKey=${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}&'+
diff --git a/test/aws-s3/aws-s3-uri-pipe.yaml b/test/aws-s3/aws-s3-uri-pipe.yaml
index 1827a125..4638a908 100644
--- a/test/aws-s3/aws-s3-uri-pipe.yaml
+++ b/test/aws-s3/aws-s3-uri-pipe.yaml
@@ -28,6 +28,7 @@ spec:
     properties:
       bucketNameOrArn: ${aws.s3.bucketNameOrArn}
       overrideEndpoint: true
+      forcePathStyle: true
       uriEndpointOverride: ${YAKS_TESTCONTAINERS_LOCALSTACK_S3_URL}
       accessKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}
       secretKey: ${YAKS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}

Reply via email to