This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 7beee8d8dec CAMEL-21642 - Camel-Hashicorp-Vault: Support Hashicorp
cloud Vault instance in the pure component (#16890)
7beee8d8dec is described below
commit 7beee8d8dec940e15879bd6338c5d31f7a88140a
Author: Andrea Cosentino <[email protected]>
AuthorDate: Wed Jan 22 18:00:45 2025 +0100
CAMEL-21642 - Camel-Hashicorp-Vault: Support Hashicorp cloud Vault instance
in the pure component (#16890)
Signed-off-by: Andrea Cosentino <[email protected]>
---
.../camel/catalog/components/hashicorp-vault.json | 18 +++++----
.../vault/HashicorpVaultEndpointConfigurer.java | 6 +++
.../vault/HashicorpVaultEndpointUriFactory.java | 4 +-
.../component/hashicorp/vault/hashicorp-vault.json | 18 +++++----
.../vault/HashicorpVaultConfiguration.java | 27 +++++++++++++
.../hashicorp/vault/HashicorpVaultProducer.java | 24 +++++++++--
.../dsl/HashicorpVaultEndpointBuilderFactory.java | 47 ++++++++++++++++++++++
7 files changed, 124 insertions(+), 20 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hashicorp-vault.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hashicorp-vault.json
index f897fc8b34e..6fa513348b4 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hashicorp-vault.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/hashicorp-vault.json
@@ -35,13 +35,15 @@
},
"properties": {
"secretsEngine": { "index": 0, "kind": "path", "displayName": "Secrets
Engine", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Vault Name to be used" },
- "host": { "index": 1, "kind": "parameter", "displayName": "Host", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
host to be used" },
- "operation": { "index": 2, "kind": "parameter", "displayName":
"Operation", "group": "producer", "label": "producer", "required": false,
"type": "object", "javaType":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultOperation", "enum": [
"createSecret", "getSecret", "deleteSecret", "listSecrets" ], "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "co [...]
- "port": { "index": 3, "kind": "parameter", "displayName": "Port", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "8200", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
port to be used" },
- "scheme": { "index": 4, "kind": "parameter", "displayName": "Scheme",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "https", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
scheme to be used" },
- "secretPath": { "index": 5, "kind": "parameter", "displayName": "Secret
Path", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
secret Path to be used" },
- "vaultTemplate": { "index": 6, "kind": "parameter", "displayName": "Vault
Template", "group": "producer", "label": "", "required": false, "type":
"object", "javaType": "org.springframework.vault.core.VaultTemplate",
"deprecated": false, "deprecationNote": "", "autowired": true, "secret": false,
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Instance of Vault
template" },
- "lazyStartProducer": { "index": 7, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
- "token": { "index": 8, "kind": "parameter", "displayName": "Token",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Token to be used" }
+ "cloud": { "index": 1, "kind": "parameter", "displayName": "Cloud",
"group": "producer", "label": "", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Determine if the
Hashicorp Vault is deployed on Hashicorp Cloud or not" },
+ "host": { "index": 2, "kind": "parameter", "displayName": "Host", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
host to be used" },
+ "namespace": { "index": 3, "kind": "parameter", "displayName":
"Namespace", "group": "producer", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "If the Hashicorp Vault
instance is deployed on Hashicorp Cloud, this field will determine the
namespace" },
+ "operation": { "index": 4, "kind": "parameter", "displayName":
"Operation", "group": "producer", "label": "producer", "required": false,
"type": "object", "javaType":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultOperation", "enum": [
"createSecret", "getSecret", "deleteSecret", "listSecrets" ], "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "co [...]
+ "port": { "index": 5, "kind": "parameter", "displayName": "Port", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "8200", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
port to be used" },
+ "scheme": { "index": 6, "kind": "parameter", "displayName": "Scheme",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "https", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
scheme to be used" },
+ "secretPath": { "index": 7, "kind": "parameter", "displayName": "Secret
Path", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
secret Path to be used" },
+ "vaultTemplate": { "index": 8, "kind": "parameter", "displayName": "Vault
Template", "group": "producer", "label": "", "required": false, "type":
"object", "javaType": "org.springframework.vault.core.VaultTemplate",
"deprecated": false, "deprecationNote": "", "autowired": true, "secret": false,
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Instance of Vault
template" },
+ "lazyStartProducer": { "index": 9, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
+ "token": { "index": 10, "kind": "parameter", "displayName": "Token",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Token to be used" }
}
}
diff --git
a/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointConfigurer.java
b/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointConfigurer.java
index 6341e2f435b..2bda963b06b 100644
---
a/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointConfigurer.java
+++
b/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointConfigurer.java
@@ -23,9 +23,11 @@ public class HashicorpVaultEndpointConfigurer extends
PropertyConfigurerSupport
public boolean configure(CamelContext camelContext, Object obj, String
name, Object value, boolean ignoreCase) {
HashicorpVaultEndpoint target = (HashicorpVaultEndpoint) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
+ case "cloud":
target.getConfiguration().setCloud(property(camelContext, boolean.class,
value)); return true;
case "host": target.getConfiguration().setHost(property(camelContext,
java.lang.String.class, value)); return true;
case "lazystartproducer":
case "lazyStartProducer":
target.setLazyStartProducer(property(camelContext, boolean.class, value));
return true;
+ case "namespace":
target.getConfiguration().setNamespace(property(camelContext,
java.lang.String.class, value)); return true;
case "operation":
target.getConfiguration().setOperation(property(camelContext,
org.apache.camel.component.hashicorp.vault.HashicorpVaultOperation.class,
value)); return true;
case "port": target.getConfiguration().setPort(property(camelContext,
java.lang.String.class, value)); return true;
case "scheme":
target.getConfiguration().setScheme(property(camelContext,
java.lang.String.class, value)); return true;
@@ -46,9 +48,11 @@ public class HashicorpVaultEndpointConfigurer extends
PropertyConfigurerSupport
@Override
public Class<?> getOptionType(String name, boolean ignoreCase) {
switch (ignoreCase ? name.toLowerCase() : name) {
+ case "cloud": return boolean.class;
case "host": return java.lang.String.class;
case "lazystartproducer":
case "lazyStartProducer": return boolean.class;
+ case "namespace": return java.lang.String.class;
case "operation": return
org.apache.camel.component.hashicorp.vault.HashicorpVaultOperation.class;
case "port": return java.lang.String.class;
case "scheme": return java.lang.String.class;
@@ -65,9 +69,11 @@ public class HashicorpVaultEndpointConfigurer extends
PropertyConfigurerSupport
public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
HashicorpVaultEndpoint target = (HashicorpVaultEndpoint) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
+ case "cloud": return target.getConfiguration().isCloud();
case "host": return target.getConfiguration().getHost();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
+ case "namespace": return target.getConfiguration().getNamespace();
case "operation": return target.getConfiguration().getOperation();
case "port": return target.getConfiguration().getPort();
case "scheme": return target.getConfiguration().getScheme();
diff --git
a/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointUriFactory.java
b/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointUriFactory.java
index 3e0a0470af6..a8b76f6525e 100644
---
a/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointUriFactory.java
+++
b/components/camel-hashicorp-vault/src/generated/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultEndpointUriFactory.java
@@ -23,9 +23,11 @@ public class HashicorpVaultEndpointUriFactory extends
org.apache.camel.support.c
private static final Set<String> SECRET_PROPERTY_NAMES;
private static final Set<String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(9);
+ Set<String> props = new HashSet<>(11);
+ props.add("cloud");
props.add("host");
props.add("lazyStartProducer");
+ props.add("namespace");
props.add("operation");
props.add("port");
props.add("scheme");
diff --git
a/components/camel-hashicorp-vault/src/generated/resources/META-INF/org/apache/camel/component/hashicorp/vault/hashicorp-vault.json
b/components/camel-hashicorp-vault/src/generated/resources/META-INF/org/apache/camel/component/hashicorp/vault/hashicorp-vault.json
index f897fc8b34e..6fa513348b4 100644
---
a/components/camel-hashicorp-vault/src/generated/resources/META-INF/org/apache/camel/component/hashicorp/vault/hashicorp-vault.json
+++
b/components/camel-hashicorp-vault/src/generated/resources/META-INF/org/apache/camel/component/hashicorp/vault/hashicorp-vault.json
@@ -35,13 +35,15 @@
},
"properties": {
"secretsEngine": { "index": 0, "kind": "path", "displayName": "Secrets
Engine", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Vault Name to be used" },
- "host": { "index": 1, "kind": "parameter", "displayName": "Host", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
host to be used" },
- "operation": { "index": 2, "kind": "parameter", "displayName":
"Operation", "group": "producer", "label": "producer", "required": false,
"type": "object", "javaType":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultOperation", "enum": [
"createSecret", "getSecret", "deleteSecret", "listSecrets" ], "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "co [...]
- "port": { "index": 3, "kind": "parameter", "displayName": "Port", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "8200", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
port to be used" },
- "scheme": { "index": 4, "kind": "parameter", "displayName": "Scheme",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "https", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
scheme to be used" },
- "secretPath": { "index": 5, "kind": "parameter", "displayName": "Secret
Path", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
secret Path to be used" },
- "vaultTemplate": { "index": 6, "kind": "parameter", "displayName": "Vault
Template", "group": "producer", "label": "", "required": false, "type":
"object", "javaType": "org.springframework.vault.core.VaultTemplate",
"deprecated": false, "deprecationNote": "", "autowired": true, "secret": false,
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Instance of Vault
template" },
- "lazyStartProducer": { "index": 7, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
- "token": { "index": 8, "kind": "parameter", "displayName": "Token",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Token to be used" }
+ "cloud": { "index": 1, "kind": "parameter", "displayName": "Cloud",
"group": "producer", "label": "", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Determine if the
Hashicorp Vault is deployed on Hashicorp Cloud or not" },
+ "host": { "index": 2, "kind": "parameter", "displayName": "Host", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
host to be used" },
+ "namespace": { "index": 3, "kind": "parameter", "displayName":
"Namespace", "group": "producer", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "If the Hashicorp Vault
instance is deployed on Hashicorp Cloud, this field will determine the
namespace" },
+ "operation": { "index": 4, "kind": "parameter", "displayName":
"Operation", "group": "producer", "label": "producer", "required": false,
"type": "object", "javaType":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultOperation", "enum": [
"createSecret", "getSecret", "deleteSecret", "listSecrets" ], "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "co [...]
+ "port": { "index": 5, "kind": "parameter", "displayName": "Port", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "8200", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
port to be used" },
+ "scheme": { "index": 6, "kind": "parameter", "displayName": "Scheme",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "https", "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
scheme to be used" },
+ "secretPath": { "index": 7, "kind": "parameter", "displayName": "Secret
Path", "group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Hashicorp Vault instance
secret Path to be used" },
+ "vaultTemplate": { "index": 8, "kind": "parameter", "displayName": "Vault
Template", "group": "producer", "label": "", "required": false, "type":
"object", "javaType": "org.springframework.vault.core.VaultTemplate",
"deprecated": false, "deprecationNote": "", "autowired": true, "secret": false,
"configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Instance of Vault
template" },
+ "lazyStartProducer": { "index": 9, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
+ "token": { "index": 10, "kind": "parameter", "displayName": "Token",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.hashicorp.vault.HashicorpVaultConfiguration",
"configurationField": "configuration", "description": "Token to be used" }
}
}
diff --git
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultConfiguration.java
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultConfiguration.java
index 404de9c309c..12427011983 100644
---
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultConfiguration.java
+++
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultConfiguration.java
@@ -41,6 +41,11 @@ public class HashicorpVaultConfiguration implements
Cloneable {
private String secretPath;
@UriParam(label = "security", secret = true)
private String token;
+ @UriParam
+ private boolean cloud;
+ @UriParam
+ private String namespace;
+
@UriParam(label = "producer")
private HashicorpVaultOperation operation =
HashicorpVaultOperation.createSecret;
@@ -110,6 +115,28 @@ public class HashicorpVaultConfiguration implements
Cloneable {
this.scheme = scheme;
}
+ /**
+ * Determine if the Hashicorp Vault is deployed on Hashicorp Cloud or not
+ */
+ public boolean isCloud() {
+ return cloud;
+ }
+
+ public void setCloud(boolean cloud) {
+ this.cloud = cloud;
+ }
+
+ /**
+ * If the Hashicorp Vault instance is deployed on Hashicorp Cloud, this
field will determine the namespace
+ */
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
/**
* Hashicorp Vault instance secret Path to be used
*/
diff --git
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultProducer.java
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultProducer.java
index 2fc3e1801f0..89b1cf1883e 100644
---
a/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultProducer.java
+++
b/components/camel-hashicorp-vault/src/main/java/org/apache/camel/component/hashicorp/vault/HashicorpVaultProducer.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.hashicorp.vault;
+import java.util.ArrayList;
import java.util.List;
import org.apache.camel.Endpoint;
@@ -67,7 +68,15 @@ public class HashicorpVaultProducer extends DefaultProducer {
if
(ObjectHelper.isNotEmpty(exchange.getMessage().getHeader(HashicorpVaultConstants.SECRET_VERSION)))
{
secretVersion =
exchange.getMessage().getHeader(HashicorpVaultConstants.SECRET_VERSION,
String.class);
}
- String completePath =
getEndpoint().getConfiguration().getSecretsEngine() + "/" + "data" + "/" +
secretPath;
+ String completePath = "";
+ if (!getEndpoint().getConfiguration().isCloud()) {
+ completePath = getEndpoint().getConfiguration().getSecretsEngine()
+ "/" + "data" + "/" + secretPath;
+ } else {
+ if
(ObjectHelper.isNotEmpty(getEndpoint().getConfiguration().getNamespace())) {
+ completePath = getEndpoint().getConfiguration().getNamespace()
+ "/"
+ +
getEndpoint().getConfiguration().getSecretsEngine() + "/" + "data" + "/" +
secretPath;
+ }
+ }
if (ObjectHelper.isNotEmpty(secretVersion)) {
completePath = completePath + "?version=" + secretVersion;
}
@@ -88,8 +97,17 @@ public class HashicorpVaultProducer extends DefaultProducer {
}
private void listSecrets(Exchange exchange) {
- List<String> secretsList = getEndpoint().getVaultTemplate()
- .list(getEndpoint().getConfiguration().getSecretsEngine() +
"/" + "metadata" + "/");
+ List<String> secretsList = new ArrayList<>();
+ if (!getEndpoint().getConfiguration().isCloud()) {
+ secretsList = getEndpoint().getVaultTemplate()
+ .list(getEndpoint().getConfiguration().getSecretsEngine()
+ "/" + "metadata" + "/");
+ } else {
+ if
(ObjectHelper.isNotEmpty(getEndpoint().getConfiguration().getNamespace())) {
+ secretsList = getEndpoint().getVaultTemplate()
+ .list(getEndpoint().getConfiguration().getNamespace()
+ "/"
+ +
getEndpoint().getConfiguration().getSecretsEngine() + "/" + "metadata" + "/");
+ }
+ }
exchange.getMessage().setBody(secretsList);
}
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HashicorpVaultEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HashicorpVaultEndpointBuilderFactory.java
index 3963a320983..5ebb2e4ac4c 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HashicorpVaultEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/HashicorpVaultEndpointBuilderFactory.java
@@ -44,6 +44,38 @@ public interface HashicorpVaultEndpointBuilderFactory {
return (AdvancedHashicorpVaultEndpointBuilder) this;
}
+ /**
+ * Determine if the Hashicorp Vault is deployed on Hashicorp Cloud or
+ * not.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: producer
+ *
+ * @param cloud the value to set
+ * @return the dsl builder
+ */
+ default HashicorpVaultEndpointBuilder cloud(boolean cloud) {
+ doSetProperty("cloud", cloud);
+ return this;
+ }
+ /**
+ * Determine if the Hashicorp Vault is deployed on Hashicorp Cloud or
+ * not.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: producer
+ *
+ * @param cloud the value to set
+ * @return the dsl builder
+ */
+ default HashicorpVaultEndpointBuilder cloud(String cloud) {
+ doSetProperty("cloud", cloud);
+ return this;
+ }
/**
* Hashicorp Vault instance host to be used.
*
@@ -58,6 +90,21 @@ public interface HashicorpVaultEndpointBuilderFactory {
doSetProperty("host", host);
return this;
}
+ /**
+ * If the Hashicorp Vault instance is deployed on Hashicorp Cloud, this
+ * field will determine the namespace.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: producer
+ *
+ * @param namespace the value to set
+ * @return the dsl builder
+ */
+ default HashicorpVaultEndpointBuilder namespace(String namespace) {
+ doSetProperty("namespace", namespace);
+ return this;
+ }
/**
* Operation to be performed.
*