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

acosentino pushed a commit to branch CAMEL-21330
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1083d932521b41ff2f0d8b6fa3850406d4b6f5e0
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Wed Oct 23 10:16:44 2024 +0200

    CAMEL-21330 - Camel-AWS-Secrets-Manager: Support Properties Function with 
Localstack
    
    Signed-off-by: Andrea Cosentino <anco...@gmail.com>
---
 .../main/camel-main-configuration-metadata.json    |  2 +
 .../SecretsManagerPropertiesFunction.java          | 29 +++++++++++
 .../apache/camel/vault/AwsVaultConfiguration.java  | 27 ++++++++++
 .../main/AwsVaultConfigurationConfigurer.java      | 12 +++++
 .../AwsVaultConfigurationPropertiesConfigurer.java | 14 ++++++
 .../camel-main-configuration-metadata.json         |  2 +
 core/camel-main/src/main/docs/main.adoc            |  4 +-
 .../main/AwsVaultConfigurationProperties.java      | 17 +++++++
 .../java/org/apache/camel/main/MainVaultTest.java  | 58 ++++++++++++++++++++++
 9 files changed, 164 insertions(+), 1 deletion(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index 908b4a774bd..289eec71365 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -335,6 +335,7 @@
     { "name": "camel.trace.traceTemplates", "description": "Whether to trace 
routes that is created from route templates or kamelets.", "sourceType": 
"org.apache.camel.main.TracerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.vault.aws.accessKey", "description": "The AWS access 
key", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.defaultCredentialsProvider", "description": 
"Define if we want to use the AWS Default Credentials Provider or not", 
"sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"boolean", "javaType": "boolean", "defaultValue": "false" },
+    { "name": "camel.vault.aws.overrideEndpoint", "description": "Set the need 
for overriding the endpoint. This option needs to be used in combination with 
the uriEndpointOverride option", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": 
"boolean", "defaultValue": "false" },
     { "name": "camel.vault.aws.profileCredentialsProvider", "description": 
"Define if we want to use the AWS Profile Credentials Provider or not", 
"sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"boolean", "javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.vault.aws.profileName", "description": "Define the 
profile name to use if Profile Credentials Provider is selected", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "string", "javaType": 
"java.lang.String" },
     { "name": "camel.vault.aws.refreshEnabled", "description": "Whether to 
automatically reload Camel upon secrets being updated in AWS.", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": 
"boolean", "defaultValue": "false" },
@@ -343,6 +344,7 @@
     { "name": "camel.vault.aws.secretKey", "description": "The AWS secret 
key", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.secrets", "description": "Specify the secret 
names (or pattern) to check for updates. Multiple secrets can be separated by 
comma.", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.sqsQueueUrl", "description": "In case of usage 
of SQS notification this field will specified the Queue URL to use", 
"sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "string", 
"javaType": "java.lang.String" },
+    { "name": "camel.vault.aws.uriEndpointOverride", "description": "Set the 
overriding uri endpoint. This option needs to be used in combination with 
overrideEndpoint option", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "string", "javaType": 
"java.lang.String" },
     { "name": "camel.vault.aws.useSqsNotification", "description": "Whether to 
use AWS SQS for secrets updates notification, this will require setting up 
Eventbridge\/Cloudtrail\/SQS communication", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": 
"boolean", "defaultValue": "false" },
     { "name": "camel.vault.azure.azureIdentityEnabled", "description": 
"Whether the Azure Identity Authentication should be used or not.", 
"sourceType": "org.apache.camel.vault.AzureVaultConfiguration", "type": 
"boolean", "javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.vault.azure.blobAccessKey", "description": "The Eventhubs 
Blob Access Key for CheckpointStore purpose", "sourceType": 
"org.apache.camel.vault.AzureVaultConfiguration", "type": "string", "javaType": 
"java.lang.String" },
diff --git 
a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerPropertiesFunction.java
 
b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerPropertiesFunction.java
index 7ab78ae2d2c..51d0713f158 100644
--- 
a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerPropertiesFunction.java
+++ 
b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerPropertiesFunction.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.aws.secretsmanager;
 
+import java.net.URI;
 import java.util.Base64;
 import java.util.HashSet;
 import java.util.Set;
@@ -94,6 +95,11 @@ public class SecretsManagerPropertiesFunction extends 
ServiceSupport implements
     private static final String CAMEL_AWS_VAULT_PROFILE_NAME_ENV
             = "CAMEL_AWS_VAULT_PROFILE_NAME";
 
+    private static final String CAMEL_AWS_VAULT_IS_OVERRIDE_ENDPOINT
+            = "CAMEL_AWS_VAULT_IS_OVERRIDE_ENDPOINT";
+
+    private static final String CAMEL_AWS_VAULT_URI_ENDPOINT_OVERRIDE = 
"CAMEL_AWS_VAULT_URI_ENDPOINT_OVERRIDE";
+
     private CamelContext camelContext;
     private SecretsManagerClient client;
 
@@ -106,6 +112,10 @@ public class SecretsManagerPropertiesFunction extends 
ServiceSupport implements
 
     private String profileName;
 
+    private boolean isOverrideEndpoint;
+
+    private String uriEndpointOverride;
+
     public SecretsManagerPropertiesFunction() {
         super();
     }
@@ -127,6 +137,8 @@ public class SecretsManagerPropertiesFunction extends 
ServiceSupport implements
         boolean useProfileCredentialsProvider
                 = 
Boolean.parseBoolean(System.getenv(CAMEL_AWS_VAULT_USE_PROFILE_CREDENTIALS_PROVIDER_ENV));
         String profileName = System.getenv(CAMEL_AWS_VAULT_PROFILE_NAME_ENV);
+        boolean isOverrideEndpoint = 
Boolean.parseBoolean(System.getenv(CAMEL_AWS_VAULT_IS_OVERRIDE_ENDPOINT));
+        String uriEndpointOverride = 
System.getenv(CAMEL_AWS_VAULT_URI_ENDPOINT_OVERRIDE);
         if (ObjectHelper.isEmpty(accessKey) && ObjectHelper.isEmpty(secretKey) 
&& ObjectHelper.isEmpty(region)) {
             AwsVaultConfiguration awsVaultConfiguration = 
getCamelContext().getVaultConfiguration().aws();
             if (ObjectHelper.isNotEmpty(awsVaultConfiguration)) {
@@ -136,6 +148,8 @@ public class SecretsManagerPropertiesFunction extends 
ServiceSupport implements
                 useDefaultCredentialsProvider = 
awsVaultConfiguration.isDefaultCredentialsProvider();
                 useProfileCredentialsProvider = 
awsVaultConfiguration.isProfileCredentialsProvider();
                 profileName = awsVaultConfiguration.getProfileName();
+                isOverrideEndpoint = 
awsVaultConfiguration.isOverrideEndpoint();
+                uriEndpointOverride = 
awsVaultConfiguration.getUriEndpointOverride();
             }
         }
         this.region = region;
@@ -144,11 +158,21 @@ public class SecretsManagerPropertiesFunction extends 
ServiceSupport implements
             AwsBasicCredentials cred = AwsBasicCredentials.create(accessKey, 
secretKey);
             clientBuilder = 
clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred));
             clientBuilder.region(Region.of(region));
+            if (isOverrideEndpoint) {
+                if (ObjectHelper.isNotEmpty(uriEndpointOverride)) {
+                    
clientBuilder.endpointOverride(URI.create(uriEndpointOverride));
+                }
+            }
             client = clientBuilder.build();
         } else if (useDefaultCredentialsProvider && 
ObjectHelper.isNotEmpty(region)) {
             this.defaultCredentialsProvider = true;
             SecretsManagerClientBuilder clientBuilder = 
SecretsManagerClient.builder();
             clientBuilder.region(Region.of(region));
+            if (isOverrideEndpoint) {
+                if (ObjectHelper.isNotEmpty(uriEndpointOverride)) {
+                    
clientBuilder.endpointOverride(URI.create(uriEndpointOverride));
+                }
+            }
             client = clientBuilder.build();
         } else if (useProfileCredentialsProvider && 
ObjectHelper.isNotEmpty(profileName)) {
             this.profleCredentialsProvider = true;
@@ -156,6 +180,11 @@ public class SecretsManagerPropertiesFunction extends 
ServiceSupport implements
             SecretsManagerClientBuilder clientBuilder = 
SecretsManagerClient.builder();
             
clientBuilder.credentialsProvider(ProfileCredentialsProvider.create(profileName));
             clientBuilder.region(Region.of(region));
+            if (isOverrideEndpoint) {
+                if (ObjectHelper.isNotEmpty(uriEndpointOverride)) {
+                    
clientBuilder.endpointOverride(URI.create(uriEndpointOverride));
+                }
+            }
             client = clientBuilder.build();
         } else {
             throw new RuntimeCamelException(
diff --git 
a/core/camel-api/src/main/java/org/apache/camel/vault/AwsVaultConfiguration.java
 
b/core/camel-api/src/main/java/org/apache/camel/vault/AwsVaultConfiguration.java
index 0423e106ade..ce79dedb7b2 100644
--- 
a/core/camel-api/src/main/java/org/apache/camel/vault/AwsVaultConfiguration.java
+++ 
b/core/camel-api/src/main/java/org/apache/camel/vault/AwsVaultConfiguration.java
@@ -45,6 +45,10 @@ public class AwsVaultConfiguration extends 
VaultConfiguration {
     private boolean useSqsNotification;
     @Metadata
     private String sqsQueueUrl;
+    @Metadata
+    private boolean overrideEndpoint;
+    @Metadata
+    private String uriEndpointOverride;
 
     public String getAccessKey() {
         return accessKey;
@@ -167,4 +171,27 @@ public class AwsVaultConfiguration extends 
VaultConfiguration {
     public void setSqsQueueUrl(String sqsQueueUrl) {
         this.sqsQueueUrl = sqsQueueUrl;
     }
+
+    public boolean isOverrideEndpoint() {
+        return overrideEndpoint;
+    }
+
+    /**
+     * Set the need for overriding the endpoint. This option needs to be used 
in combination with the
+     * uriEndpointOverride option
+     */
+    public void setOverrideEndpoint(boolean overrideEndpoint) {
+        this.overrideEndpoint = overrideEndpoint;
+    }
+
+    public String getUriEndpointOverride() {
+        return uriEndpointOverride;
+    }
+
+    /**
+     * Set the overriding uri endpoint. This option needs to be used in 
combination with overrideEndpoint option
+     */
+    public void setUriEndpointOverride(String uriEndpointOverride) {
+        this.uriEndpointOverride = uriEndpointOverride;
+    }
 }
diff --git 
a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java
 
b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java
index 50136343622..3bd64e971d6 100644
--- 
a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java
+++ 
b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationConfigurer.java
@@ -37,6 +37,8 @@ public class AwsVaultConfigurationConfigurer extends 
org.apache.camel.support.co
         case "hashicorpVaultConfiguration": 
target.setHashicorpVaultConfiguration(property(camelContext, 
org.apache.camel.vault.HashicorpVaultConfiguration.class, value)); return true;
         case "kubernetesvaultconfiguration":
         case "kubernetesVaultConfiguration": 
target.setKubernetesVaultConfiguration(property(camelContext, 
org.apache.camel.vault.KubernetesVaultConfiguration.class, value)); return true;
+        case "overrideendpoint":
+        case "overrideEndpoint": 
target.setOverrideEndpoint(property(camelContext, boolean.class, value)); 
return true;
         case "profilecredentialsprovider":
         case "profileCredentialsProvider": 
target.setProfileCredentialsProvider(property(camelContext, boolean.class, 
value)); return true;
         case "profilename":
@@ -51,6 +53,8 @@ public class AwsVaultConfigurationConfigurer extends 
org.apache.camel.support.co
         case "secrets": target.setSecrets(property(camelContext, 
java.lang.String.class, value)); return true;
         case "sqsqueueurl":
         case "sqsQueueUrl": target.setSqsQueueUrl(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "uriendpointoverride":
+        case "uriEndpointOverride": 
target.setUriEndpointOverride(property(camelContext, java.lang.String.class, 
value)); return true;
         case "usesqsnotification":
         case "useSqsNotification": 
target.setUseSqsNotification(property(camelContext, boolean.class, value)); 
return true;
         default: return false;
@@ -74,6 +78,8 @@ public class AwsVaultConfigurationConfigurer extends 
org.apache.camel.support.co
         case "hashicorpVaultConfiguration": return 
org.apache.camel.vault.HashicorpVaultConfiguration.class;
         case "kubernetesvaultconfiguration":
         case "kubernetesVaultConfiguration": return 
org.apache.camel.vault.KubernetesVaultConfiguration.class;
+        case "overrideendpoint":
+        case "overrideEndpoint": return boolean.class;
         case "profilecredentialsprovider":
         case "profileCredentialsProvider": return boolean.class;
         case "profilename":
@@ -88,6 +94,8 @@ public class AwsVaultConfigurationConfigurer extends 
org.apache.camel.support.co
         case "secrets": return java.lang.String.class;
         case "sqsqueueurl":
         case "sqsQueueUrl": return java.lang.String.class;
+        case "uriendpointoverride":
+        case "uriEndpointOverride": return java.lang.String.class;
         case "usesqsnotification":
         case "useSqsNotification": return boolean.class;
         default: return null;
@@ -112,6 +120,8 @@ public class AwsVaultConfigurationConfigurer extends 
org.apache.camel.support.co
         case "hashicorpVaultConfiguration": return 
target.getHashicorpVaultConfiguration();
         case "kubernetesvaultconfiguration":
         case "kubernetesVaultConfiguration": return 
target.getKubernetesVaultConfiguration();
+        case "overrideendpoint":
+        case "overrideEndpoint": return target.isOverrideEndpoint();
         case "profilecredentialsprovider":
         case "profileCredentialsProvider": return 
target.isProfileCredentialsProvider();
         case "profilename":
@@ -126,6 +136,8 @@ public class AwsVaultConfigurationConfigurer extends 
org.apache.camel.support.co
         case "secrets": return target.getSecrets();
         case "sqsqueueurl":
         case "sqsQueueUrl": return target.getSqsQueueUrl();
+        case "uriendpointoverride":
+        case "uriEndpointOverride": return target.getUriEndpointOverride();
         case "usesqsnotification":
         case "useSqsNotification": return target.isUseSqsNotification();
         default: return null;
diff --git 
a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java
 
b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java
index 5fe91949794..82b5eb73123 100644
--- 
a/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java
+++ 
b/core/camel-main/src/generated/java/org/apache/camel/main/AwsVaultConfigurationPropertiesConfigurer.java
@@ -29,6 +29,7 @@ public class AwsVaultConfigurationPropertiesConfigurer 
extends org.apache.camel.
         map.put("GcpVaultConfiguration", 
org.apache.camel.vault.GcpVaultConfiguration.class);
         map.put("HashicorpVaultConfiguration", 
org.apache.camel.vault.HashicorpVaultConfiguration.class);
         map.put("KubernetesVaultConfiguration", 
org.apache.camel.vault.KubernetesVaultConfiguration.class);
+        map.put("OverrideEndpoint", boolean.class);
         map.put("ProfileCredentialsProvider", boolean.class);
         map.put("ProfileName", java.lang.String.class);
         map.put("RefreshEnabled", boolean.class);
@@ -37,6 +38,7 @@ public class AwsVaultConfigurationPropertiesConfigurer 
extends org.apache.camel.
         map.put("SecretKey", java.lang.String.class);
         map.put("Secrets", java.lang.String.class);
         map.put("SqsQueueUrl", java.lang.String.class);
+        map.put("UriEndpointOverride", java.lang.String.class);
         map.put("UseSqsNotification", boolean.class);
         ALL_OPTIONS = map;
         
ConfigurerStrategy.addBootstrapConfigurerClearer(AwsVaultConfigurationPropertiesConfigurer::clearBootstrapConfigurers);
@@ -60,6 +62,8 @@ public class AwsVaultConfigurationPropertiesConfigurer 
extends org.apache.camel.
         case "hashicorpVaultConfiguration": 
target.setHashicorpVaultConfiguration(property(camelContext, 
org.apache.camel.vault.HashicorpVaultConfiguration.class, value)); return true;
         case "kubernetesvaultconfiguration":
         case "kubernetesVaultConfiguration": 
target.setKubernetesVaultConfiguration(property(camelContext, 
org.apache.camel.vault.KubernetesVaultConfiguration.class, value)); return true;
+        case "overrideendpoint":
+        case "overrideEndpoint": 
target.setOverrideEndpoint(property(camelContext, boolean.class, value)); 
return true;
         case "profilecredentialsprovider":
         case "profileCredentialsProvider": 
target.setProfileCredentialsProvider(property(camelContext, boolean.class, 
value)); return true;
         case "profilename":
@@ -74,6 +78,8 @@ public class AwsVaultConfigurationPropertiesConfigurer 
extends org.apache.camel.
         case "secrets": target.setSecrets(property(camelContext, 
java.lang.String.class, value)); return true;
         case "sqsqueueurl":
         case "sqsQueueUrl": target.setSqsQueueUrl(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "uriendpointoverride":
+        case "uriEndpointOverride": 
target.setUriEndpointOverride(property(camelContext, java.lang.String.class, 
value)); return true;
         case "usesqsnotification":
         case "useSqsNotification": 
target.setUseSqsNotification(property(camelContext, boolean.class, value)); 
return true;
         default: return false;
@@ -106,6 +112,8 @@ public class AwsVaultConfigurationPropertiesConfigurer 
extends org.apache.camel.
         case "hashicorpVaultConfiguration": return 
org.apache.camel.vault.HashicorpVaultConfiguration.class;
         case "kubernetesvaultconfiguration":
         case "kubernetesVaultConfiguration": return 
org.apache.camel.vault.KubernetesVaultConfiguration.class;
+        case "overrideendpoint":
+        case "overrideEndpoint": return boolean.class;
         case "profilecredentialsprovider":
         case "profileCredentialsProvider": return boolean.class;
         case "profilename":
@@ -120,6 +128,8 @@ public class AwsVaultConfigurationPropertiesConfigurer 
extends org.apache.camel.
         case "secrets": return java.lang.String.class;
         case "sqsqueueurl":
         case "sqsQueueUrl": return java.lang.String.class;
+        case "uriendpointoverride":
+        case "uriEndpointOverride": return java.lang.String.class;
         case "usesqsnotification":
         case "useSqsNotification": return boolean.class;
         default: return null;
@@ -144,6 +154,8 @@ public class AwsVaultConfigurationPropertiesConfigurer 
extends org.apache.camel.
         case "hashicorpVaultConfiguration": return 
target.getHashicorpVaultConfiguration();
         case "kubernetesvaultconfiguration":
         case "kubernetesVaultConfiguration": return 
target.getKubernetesVaultConfiguration();
+        case "overrideendpoint":
+        case "overrideEndpoint": return target.isOverrideEndpoint();
         case "profilecredentialsprovider":
         case "profileCredentialsProvider": return 
target.isProfileCredentialsProvider();
         case "profilename":
@@ -158,6 +170,8 @@ public class AwsVaultConfigurationPropertiesConfigurer 
extends org.apache.camel.
         case "secrets": return target.getSecrets();
         case "sqsqueueurl":
         case "sqsQueueUrl": return target.getSqsQueueUrl();
+        case "uriendpointoverride":
+        case "uriEndpointOverride": return target.getUriEndpointOverride();
         case "usesqsnotification":
         case "useSqsNotification": return target.isUseSqsNotification();
         default: return null;
diff --git 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index 908b4a774bd..289eec71365 100644
--- 
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++ 
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -335,6 +335,7 @@
     { "name": "camel.trace.traceTemplates", "description": "Whether to trace 
routes that is created from route templates or kamelets.", "sourceType": 
"org.apache.camel.main.TracerConfigurationProperties", "type": "boolean", 
"javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.vault.aws.accessKey", "description": "The AWS access 
key", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.defaultCredentialsProvider", "description": 
"Define if we want to use the AWS Default Credentials Provider or not", 
"sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"boolean", "javaType": "boolean", "defaultValue": "false" },
+    { "name": "camel.vault.aws.overrideEndpoint", "description": "Set the need 
for overriding the endpoint. This option needs to be used in combination with 
the uriEndpointOverride option", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": 
"boolean", "defaultValue": "false" },
     { "name": "camel.vault.aws.profileCredentialsProvider", "description": 
"Define if we want to use the AWS Profile Credentials Provider or not", 
"sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"boolean", "javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.vault.aws.profileName", "description": "Define the 
profile name to use if Profile Credentials Provider is selected", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "string", "javaType": 
"java.lang.String" },
     { "name": "camel.vault.aws.refreshEnabled", "description": "Whether to 
automatically reload Camel upon secrets being updated in AWS.", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": 
"boolean", "defaultValue": "false" },
@@ -343,6 +344,7 @@
     { "name": "camel.vault.aws.secretKey", "description": "The AWS secret 
key", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.secrets", "description": "Specify the secret 
names (or pattern) to check for updates. Multiple secrets can be separated by 
comma.", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.sqsQueueUrl", "description": "In case of usage 
of SQS notification this field will specified the Queue URL to use", 
"sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "string", 
"javaType": "java.lang.String" },
+    { "name": "camel.vault.aws.uriEndpointOverride", "description": "Set the 
overriding uri endpoint. This option needs to be used in combination with 
overrideEndpoint option", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "string", "javaType": 
"java.lang.String" },
     { "name": "camel.vault.aws.useSqsNotification", "description": "Whether to 
use AWS SQS for secrets updates notification, this will require setting up 
Eventbridge\/Cloudtrail\/SQS communication", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": 
"boolean", "defaultValue": "false" },
     { "name": "camel.vault.azure.azureIdentityEnabled", "description": 
"Whether the Azure Identity Authentication should be used or not.", 
"sourceType": "org.apache.camel.vault.AzureVaultConfiguration", "type": 
"boolean", "javaType": "boolean", "defaultValue": "false" },
     { "name": "camel.vault.azure.blobAccessKey", "description": "The Eventhubs 
Blob Access Key for CheckpointStore purpose", "sourceType": 
"org.apache.camel.vault.AzureVaultConfiguration", "type": "string", "javaType": 
"java.lang.String" },
diff --git a/core/camel-main/src/main/docs/main.adoc 
b/core/camel-main/src/main/docs/main.adoc
index 82f9d33882f..e9899e5ae41 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -367,13 +367,14 @@ The camel.rest supports 29 options, which are listed 
below.
 
 
 === Camel AWS Vault configurations
-The camel.vault.aws supports 11 options, which are listed below.
+The camel.vault.aws supports 13 options, which are listed below.
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
 | *camel.vault.aws.accessKey* | The AWS access key |  | String
 | *camel.vault.aws.default{zwsp}CredentialsProvider* | Define if we want to 
use the AWS Default Credentials Provider or not | false | boolean
+| *camel.vault.aws.override{zwsp}Endpoint* | Set the need for overriding the 
endpoint. This option needs to be used in combination with the 
uriEndpointOverride option | false | boolean
 | *camel.vault.aws.profile{zwsp}CredentialsProvider* | Define if we want to 
use the AWS Profile Credentials Provider or not | false | boolean
 | *camel.vault.aws.profileName* | Define the profile name to use if Profile 
Credentials Provider is selected |  | String
 | *camel.vault.aws.refreshEnabled* | Whether to automatically reload Camel 
upon secrets being updated in AWS. | false | boolean
@@ -382,6 +383,7 @@ The camel.vault.aws supports 11 options, which are listed 
below.
 | *camel.vault.aws.secretKey* | The AWS secret key |  | String
 | *camel.vault.aws.secrets* | Specify the secret names (or pattern) to check 
for updates. Multiple secrets can be separated by comma. |  | String
 | *camel.vault.aws.sqsQueueUrl* | In case of usage of SQS notification this 
field will specified the Queue URL to use |  | String
+| *camel.vault.aws.uriEndpoint{zwsp}Override* | Set the overriding uri 
endpoint. This option needs to be used in combination with overrideEndpoint 
option |  | String
 | *camel.vault.aws.useSqs{zwsp}Notification* | Whether to use AWS SQS for 
secrets updates notification, this will require setting up 
Eventbridge/Cloudtrail/SQS communication | false | boolean
 |===
 
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/AwsVaultConfigurationProperties.java
 
b/core/camel-main/src/main/java/org/apache/camel/main/AwsVaultConfigurationProperties.java
index 0ef8f299f14..31abefa851e 100644
--- 
a/core/camel-main/src/main/java/org/apache/camel/main/AwsVaultConfigurationProperties.java
+++ 
b/core/camel-main/src/main/java/org/apache/camel/main/AwsVaultConfigurationProperties.java
@@ -138,4 +138,21 @@ public class AwsVaultConfigurationProperties extends 
AwsVaultConfiguration imple
         return this;
     }
 
+    /**
+     * Set the need for overriding the endpoint. This option needs to be used 
in combination with the
+     * uriEndpointOverride option
+     */
+    public AwsVaultConfigurationProperties isOverrideEndpoint(boolean 
overrideEndpoint) {
+        setOverrideEndpoint(overrideEndpoint);
+        return this;
+    }
+
+    /**
+     * Set the overriding uri endpoint. This option needs to be used in 
combination with overrideEndpoint option
+     */
+    public AwsVaultConfigurationProperties withUriEndpointOverride(String 
uriEndpointOverride) {
+        setUriEndpointOverride(uriEndpointOverride);
+        return this;
+    }
+
 }
diff --git 
a/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java 
b/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java
index 124ee478a77..9105e9fba78 100644
--- a/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java
+++ b/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java
@@ -50,6 +50,34 @@ public class MainVaultTest {
         main.stop();
     }
 
+    @Test
+    public void testMainOverrideEndpointAws() {
+        Main main = new Main();
+
+        main.addInitialProperty("camel.vault.aws.accessKey", "myKey");
+        main.addInitialProperty("camel.vault.aws.secretKey", "mySecret");
+        main.addInitialProperty("camel.vault.aws.region", "myRegion");
+        main.addInitialProperty("camel.vault.aws.defaultCredentialsProvider", 
"false");
+        main.addInitialProperty("camel.vault.aws.overrideEndpoint", "true");
+        main.addInitialProperty("camel.vault.aws.uriEndpointOverride", 
"http://localhost:8080";);
+
+        main.start();
+
+        CamelContext context = main.getCamelContext();
+        assertNotNull(context);
+
+        AwsVaultConfiguration cfg = context.getVaultConfiguration().aws();
+        assertNotNull(cfg);
+
+        Assertions.assertEquals("myKey", cfg.getAccessKey());
+        Assertions.assertEquals("mySecret", cfg.getSecretKey());
+        Assertions.assertEquals("myRegion", cfg.getRegion());
+        Assertions.assertFalse(cfg.isDefaultCredentialsProvider());
+        Assertions.assertTrue(cfg.isOverrideEndpoint());
+        Assertions.assertEquals("http://localhost:8080";, 
cfg.getUriEndpointOverride());
+        main.stop();
+    }
+
     @Test
     public void testMainProfileAws() {
         final Main main = getMain();
@@ -108,6 +136,36 @@ public class MainVaultTest {
         main.stop();
     }
 
+    @Test
+    public void testMainOverrideEndpointAwsFluent() {
+        Main main = new Main();
+        main.configure().vault().aws()
+                .withAccessKey("myKey")
+                .withSecretKey("mySecret")
+                .withRegion("myRegion")
+                .isOverrideEndpoint(true)
+                .withUriEndpointOverride("http://localhost:8080";)
+                .withDefaultCredentialsProvider(false)
+                .end();
+
+        main.start();
+
+        CamelContext context = main.getCamelContext();
+        assertNotNull(context);
+
+        AwsVaultConfiguration cfg = context.getVaultConfiguration().aws();
+        assertNotNull(cfg);
+
+        Assertions.assertEquals("myKey", cfg.getAccessKey());
+        Assertions.assertEquals("mySecret", cfg.getSecretKey());
+        Assertions.assertEquals("myRegion", cfg.getRegion());
+        Assertions.assertFalse(cfg.isDefaultCredentialsProvider());
+        Assertions.assertTrue(cfg.isOverrideEndpoint());
+        Assertions.assertEquals("http://localhost:8080";, 
cfg.getUriEndpointOverride());
+
+        main.stop();
+    }
+
     @Test
     public void testMainAwsFluent() {
         Main main = new Main();

Reply via email to