You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/03/30 13:53:38 UTC

[camel] branch main updated (41f898c -> 80e4991)

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

acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 41f898c  (chores) ci: avoid commenting the PR every time it is synced
     new 032c8d1  CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration
     new 534f44f  CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration
     new a900570  CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration
     new 80e4991  CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/catalog/components/azure-key-vault.json  |   7 +-
 .../key/vault/KeyVaultEndpointConfigurer.java      |  11 +++
 .../key/vault/KeyVaultEndpointUriFactory.java      |   3 +-
 .../component/azure/key/vault/azure-key-vault.json |   7 +-
 .../azure/key/vault/KeyVaultComponent.java         |  13 ++-
 .../azure/key/vault/KeyVaultConfiguration.java     |  18 +++-
 .../azure/key/vault/KeyVaultEndpoint.java          |   9 +-
 .../dsl/KeyVaultEndpointBuilderFactory.java        | 102 +++++++++++++++++++--
 8 files changed, 147 insertions(+), 23 deletions(-)

[camel] 02/04: CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration

Posted by ac...@apache.org.
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

commit 534f44f3b5be3bf524c5e862736d6efdc4b89473
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 30 15:27:14 2022 +0200

    CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration
---
 .../azure/key/vault/KeyVaultEndpointConfigurer.java        | 11 +++++++++++
 .../azure/key/vault/KeyVaultEndpointUriFactory.java        |  3 ++-
 .../camel/component/azure/key/vault/azure-key-vault.json   |  7 ++++---
 .../camel/component/azure/key/vault/KeyVaultComponent.java | 14 ++++++++------
 4 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/components/camel-azure/camel-azure-key-vault/src/generated/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpointConfigurer.java b/components/camel-azure/camel-azure-key-vault/src/generated/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpointConfigurer.java
index bde50b7..20f48a8 100644
--- a/components/camel-azure/camel-azure-key-vault/src/generated/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpointConfigurer.java
+++ b/components/camel-azure/camel-azure-key-vault/src/generated/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpointConfigurer.java
@@ -34,6 +34,8 @@ public class KeyVaultEndpointConfigurer extends PropertyConfigurerSupport implem
         case "lazystartproducer":
         case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
         case "operation": target.getConfiguration().setOperation(property(camelContext, org.apache.camel.component.azure.key.vault.KeyVaultOperation.class, value)); return true;
+        case "secretclient":
+        case "secretClient": target.getConfiguration().setSecretClient(property(camelContext, com.azure.security.keyvault.secrets.SecretClient.class, value)); return true;
         case "tenantid":
         case "tenantId": target.getConfiguration().setTenantId(property(camelContext, java.lang.String.class, value)); return true;
         default: return false;
@@ -41,6 +43,11 @@ public class KeyVaultEndpointConfigurer extends PropertyConfigurerSupport implem
     }
 
     @Override
+    public String[] getAutowiredNames() {
+        return new String[]{"secretClient"};
+    }
+
+    @Override
     public Class<?> getOptionType(String name, boolean ignoreCase) {
         switch (ignoreCase ? name.toLowerCase() : name) {
         case "bridgeerrorhandler":
@@ -56,6 +63,8 @@ public class KeyVaultEndpointConfigurer extends PropertyConfigurerSupport implem
         case "lazystartproducer":
         case "lazyStartProducer": return boolean.class;
         case "operation": return org.apache.camel.component.azure.key.vault.KeyVaultOperation.class;
+        case "secretclient":
+        case "secretClient": return com.azure.security.keyvault.secrets.SecretClient.class;
         case "tenantid":
         case "tenantId": return java.lang.String.class;
         default: return null;
@@ -79,6 +88,8 @@ public class KeyVaultEndpointConfigurer extends PropertyConfigurerSupport implem
         case "lazystartproducer":
         case "lazyStartProducer": return target.isLazyStartProducer();
         case "operation": return target.getConfiguration().getOperation();
+        case "secretclient":
+        case "secretClient": return target.getConfiguration().getSecretClient();
         case "tenantid":
         case "tenantId": return target.getConfiguration().getTenantId();
         default: return null;
diff --git a/components/camel-azure/camel-azure-key-vault/src/generated/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpointUriFactory.java b/components/camel-azure/camel-azure-key-vault/src/generated/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpointUriFactory.java
index 657c2e8..8f1e827 100644
--- a/components/camel-azure/camel-azure-key-vault/src/generated/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpointUriFactory.java
+++ b/components/camel-azure/camel-azure-key-vault/src/generated/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpointUriFactory.java
@@ -21,7 +21,7 @@ public class KeyVaultEndpointUriFactory extends org.apache.camel.support.compone
     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<>(10);
         props.add("bridgeErrorHandler");
         props.add("clientId");
         props.add("clientSecret");
@@ -29,6 +29,7 @@ public class KeyVaultEndpointUriFactory extends org.apache.camel.support.compone
         props.add("exchangePattern");
         props.add("lazyStartProducer");
         props.add("operation");
+        props.add("secretClient");
         props.add("tenantId");
         props.add("vaultName");
         PROPERTY_NAMES = Collections.unmodifiableSet(props);
diff --git a/components/camel-azure/camel-azure-key-vault/src/generated/resources/org/apache/camel/component/azure/key/vault/azure-key-vault.json b/components/camel-azure/camel-azure-key-vault/src/generated/resources/org/apache/camel/component/azure/key/vault/azure-key-vault.json
index 4b78c18..a3c7d4b 100644
--- a/components/camel-azure/camel-azure-key-vault/src/generated/resources/org/apache/camel/component/azure/key/vault/azure-key-vault.json
+++ b/components/camel-azure/camel-azure-key-vault/src/generated/resources/org/apache/camel/component/azure/key/vault/azure-key-vault.json
@@ -32,13 +32,14 @@
   },
   "properties": {
     "vaultName": { "kind": "path", "displayName": "Vault Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Vault Name to be used" },
+    "secretClient": { "kind": "parameter", "displayName": "Secret Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.azure.security.keyvault.secrets.SecretClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Instance of Secret client" },
     "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a m [...]
     "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the con [...]
     "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
     "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "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 producer may otherwise fail during sta [...]
     "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.key.vault.KeyVaultOperation", "enum": [ "createSecret", "getSecret", "deleteSecret" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Operation [...]
-    "clientId": { "kind": "parameter", "displayName": "Client Id", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Id to be used" },
-    "clientSecret": { "kind": "parameter", "displayName": "Client Secret", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Secret to be used" },
-    "tenantId": { "kind": "parameter", "displayName": "Tenant Id", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Tenant Id to be used" }
+    "clientId": { "kind": "parameter", "displayName": "Client Id", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Id to be used" },
+    "clientSecret": { "kind": "parameter", "displayName": "Client Secret", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Secret to be used" },
+    "tenantId": { "kind": "parameter", "displayName": "Tenant Id", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Tenant Id to be used" }
   }
 }
diff --git a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultComponent.java b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultComponent.java
index 9d1c77a..f738cec 100644
--- a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultComponent.java
+++ b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultComponent.java
@@ -51,18 +51,20 @@ public class KeyVaultComponent extends DefaultComponent {
             throw new IllegalArgumentException("A vault name must be specified.");
         }
 
-        final KeyVaultConfiguration configuration
+        final KeyVaultConfiguration epConfiguration
                 = this.configuration != null ? this.configuration.copy() : new KeyVaultConfiguration();
 
         // set account or topic name
-        configuration.setVaultName(remaining);
+        epConfiguration.setVaultName(remaining);
 
-        final KeyVaultEndpoint endpoint = new KeyVaultEndpoint(uri, this, configuration);
+        final KeyVaultEndpoint endpoint = new KeyVaultEndpoint(uri, this, epConfiguration);
         setProperties(endpoint, parameters);
 
-        if (configuration.getSecretClient() == null
-                && (configuration.getClientId() == null || configuration.getClientSecret() == null || configuration.getTenantId() == null)) {
-            throw new IllegalArgumentException("Azure Secret Client or client Id, client secret and tenant Id must be specified");
+        if (epConfiguration.getSecretClient() == null
+                && (epConfiguration.getClientId() == null || epConfiguration.getClientSecret() == null
+                        || epConfiguration.getTenantId() == null)) {
+            throw new IllegalArgumentException(
+                    "Azure Secret Client or client Id, client secret and tenant Id must be specified");
         }
 
         return endpoint;

[camel] 03/04: CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration

Posted by ac...@apache.org.
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

commit a900570441110e3b48f01e8c41aa264cd9e84777
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 30 15:32:55 2022 +0200

    CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration
---
 .../apache/camel/component/azure/key/vault/KeyVaultEndpoint.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpoint.java b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpoint.java
index a3219b0..58eb085 100644
--- a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpoint.java
+++ b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultEndpoint.java
@@ -51,7 +51,12 @@ public class KeyVaultEndpoint extends DefaultEndpoint {
     @Override
     public void doInit() throws Exception {
         super.doInit();
+        secretClient = configuration.getSecretClient() != null
+                ? configuration.getSecretClient() : createSecretClient();
+    }
 
+    private SecretClient createSecretClient() {
+        SecretClient localClient;
         // Build key vault URI
         String keyVaultUri = "https://" + getConfiguration().getVaultName() + ".vault.azure.net";
 
@@ -63,10 +68,12 @@ public class KeyVaultEndpoint extends DefaultEndpoint {
                 .build();
 
         // Build Client
-        secretClient = new SecretClientBuilder()
+        localClient = new SecretClientBuilder()
                 .vaultUrl(keyVaultUri)
                 .credential(credential)
                 .buildClient();
+
+        return localClient;
     }
 
     @Override

[camel] 04/04: CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration

Posted by ac...@apache.org.
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

commit 80e4991d6f6a8591b7fe096bf29b1cc22178747a
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 30 15:51:18 2022 +0200

    CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration
---
 .../camel/catalog/components/azure-key-vault.json  |   7 +-
 .../dsl/KeyVaultEndpointBuilderFactory.java        | 102 +++++++++++++++++++--
 2 files changed, 97 insertions(+), 12 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-key-vault.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-key-vault.json
index 4b78c18..a3c7d4b 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-key-vault.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-key-vault.json
@@ -32,13 +32,14 @@
   },
   "properties": {
     "vaultName": { "kind": "path", "displayName": "Vault Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Vault Name to be used" },
+    "secretClient": { "kind": "parameter", "displayName": "Secret Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.azure.security.keyvault.secrets.SecretClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Instance of Secret client" },
     "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a m [...]
     "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the con [...]
     "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
     "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "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 producer may otherwise fail during sta [...]
     "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.azure.key.vault.KeyVaultOperation", "enum": [ "createSecret", "getSecret", "deleteSecret" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Operation [...]
-    "clientId": { "kind": "parameter", "displayName": "Client Id", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Id to be used" },
-    "clientSecret": { "kind": "parameter", "displayName": "Client Secret", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Secret to be used" },
-    "tenantId": { "kind": "parameter", "displayName": "Tenant Id", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Tenant Id to be used" }
+    "clientId": { "kind": "parameter", "displayName": "Client Id", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Id to be used" },
+    "clientSecret": { "kind": "parameter", "displayName": "Client Secret", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Client Secret to be used" },
+    "tenantId": { "kind": "parameter", "displayName": "Tenant Id", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.azure.key.vault.KeyVaultConfiguration", "configurationField": "configuration", "description": "Tenant Id to be used" }
   }
 }
diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KeyVaultEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KeyVaultEndpointBuilderFactory.java
index 4676409..c191792 100644
--- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KeyVaultEndpointBuilderFactory.java
+++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/KeyVaultEndpointBuilderFactory.java
@@ -44,6 +44,37 @@ public interface KeyVaultEndpointBuilderFactory {
             return (AdvancedKeyVaultEndpointConsumerBuilder) this;
         }
         /**
+         * Instance of Secret client.
+         * 
+         * The option is a:
+         * &lt;code&gt;com.azure.security.keyvault.secrets.SecretClient&lt;/code&gt; type.
+         * 
+         * Group: common
+         * 
+         * @param secretClient the value to set
+         * @return the dsl builder
+         */
+        default KeyVaultEndpointConsumerBuilder secretClient(
+                com.azure.security.keyvault.secrets.SecretClient secretClient) {
+            doSetProperty("secretClient", secretClient);
+            return this;
+        }
+        /**
+         * Instance of Secret client.
+         * 
+         * The option will be converted to a
+         * &lt;code&gt;com.azure.security.keyvault.secrets.SecretClient&lt;/code&gt; type.
+         * 
+         * Group: common
+         * 
+         * @param secretClient the value to set
+         * @return the dsl builder
+         */
+        default KeyVaultEndpointConsumerBuilder secretClient(String secretClient) {
+            doSetProperty("secretClient", secretClient);
+            return this;
+        }
+        /**
          * Allows for bridging the consumer to the Camel routing Error Handler,
          * which mean any exceptions occurred while the consumer is trying to
          * pickup incoming messages, or the likes, will now be processed as a
@@ -93,7 +124,6 @@ public interface KeyVaultEndpointBuilderFactory {
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
-         * Required: true
          * Group: security
          * 
          * @param clientId the value to set
@@ -108,7 +138,6 @@ public interface KeyVaultEndpointBuilderFactory {
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
-         * Required: true
          * Group: security
          * 
          * @param clientSecret the value to set
@@ -123,7 +152,6 @@ public interface KeyVaultEndpointBuilderFactory {
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
-         * Required: true
          * Group: security
          * 
          * @param tenantId the value to set
@@ -227,6 +255,37 @@ public interface KeyVaultEndpointBuilderFactory {
             return (AdvancedKeyVaultEndpointProducerBuilder) this;
         }
         /**
+         * Instance of Secret client.
+         * 
+         * The option is a:
+         * &lt;code&gt;com.azure.security.keyvault.secrets.SecretClient&lt;/code&gt; type.
+         * 
+         * Group: common
+         * 
+         * @param secretClient the value to set
+         * @return the dsl builder
+         */
+        default KeyVaultEndpointProducerBuilder secretClient(
+                com.azure.security.keyvault.secrets.SecretClient secretClient) {
+            doSetProperty("secretClient", secretClient);
+            return this;
+        }
+        /**
+         * Instance of Secret client.
+         * 
+         * The option will be converted to a
+         * &lt;code&gt;com.azure.security.keyvault.secrets.SecretClient&lt;/code&gt; type.
+         * 
+         * Group: common
+         * 
+         * @param secretClient the value to set
+         * @return the dsl builder
+         */
+        default KeyVaultEndpointProducerBuilder secretClient(String secretClient) {
+            doSetProperty("secretClient", secretClient);
+            return this;
+        }
+        /**
          * 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 producer may otherwise fail during
@@ -311,7 +370,6 @@ public interface KeyVaultEndpointBuilderFactory {
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
-         * Required: true
          * Group: security
          * 
          * @param clientId the value to set
@@ -326,7 +384,6 @@ public interface KeyVaultEndpointBuilderFactory {
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
-         * Required: true
          * Group: security
          * 
          * @param clientSecret the value to set
@@ -341,7 +398,6 @@ public interface KeyVaultEndpointBuilderFactory {
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
-         * Required: true
          * Group: security
          * 
          * @param tenantId the value to set
@@ -376,11 +432,41 @@ public interface KeyVaultEndpointBuilderFactory {
             return (AdvancedKeyVaultEndpointBuilder) this;
         }
         /**
+         * Instance of Secret client.
+         * 
+         * The option is a:
+         * &lt;code&gt;com.azure.security.keyvault.secrets.SecretClient&lt;/code&gt; type.
+         * 
+         * Group: common
+         * 
+         * @param secretClient the value to set
+         * @return the dsl builder
+         */
+        default KeyVaultEndpointBuilder secretClient(
+                com.azure.security.keyvault.secrets.SecretClient secretClient) {
+            doSetProperty("secretClient", secretClient);
+            return this;
+        }
+        /**
+         * Instance of Secret client.
+         * 
+         * The option will be converted to a
+         * &lt;code&gt;com.azure.security.keyvault.secrets.SecretClient&lt;/code&gt; type.
+         * 
+         * Group: common
+         * 
+         * @param secretClient the value to set
+         * @return the dsl builder
+         */
+        default KeyVaultEndpointBuilder secretClient(String secretClient) {
+            doSetProperty("secretClient", secretClient);
+            return this;
+        }
+        /**
          * Client Id to be used.
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
-         * Required: true
          * Group: security
          * 
          * @param clientId the value to set
@@ -395,7 +481,6 @@ public interface KeyVaultEndpointBuilderFactory {
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
-         * Required: true
          * Group: security
          * 
          * @param clientSecret the value to set
@@ -410,7 +495,6 @@ public interface KeyVaultEndpointBuilderFactory {
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
-         * Required: true
          * Group: security
          * 
          * @param tenantId the value to set

[camel] 01/04: CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration

Posted by ac...@apache.org.
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

commit 032c8d1d6b694c26d0b333276b51bc824aa2224f
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Mar 30 15:01:44 2022 +0200

    CAMEL-17687 - Create a Camel Azure Key Vault component - Adding client instance to configuration
---
 .../component/azure/key/vault/KeyVaultComponent.java   |  5 +++++
 .../azure/key/vault/KeyVaultConfiguration.java         | 18 +++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultComponent.java b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultComponent.java
index 3236024..9d1c77a 100644
--- a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultComponent.java
+++ b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultComponent.java
@@ -60,6 +60,11 @@ public class KeyVaultComponent extends DefaultComponent {
         final KeyVaultEndpoint endpoint = new KeyVaultEndpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
 
+        if (configuration.getSecretClient() == null
+                && (configuration.getClientId() == null || configuration.getClientSecret() == null || configuration.getTenantId() == null)) {
+            throw new IllegalArgumentException("Azure Secret Client or client Id, client secret and tenant Id must be specified");
+        }
+
         return endpoint;
     }
 }
diff --git a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultConfiguration.java b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultConfiguration.java
index 625032f..a92ef9e 100644
--- a/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultConfiguration.java
+++ b/components/camel-azure/camel-azure-key-vault/src/main/java/org/apache/camel/component/azure/key/vault/KeyVaultConfiguration.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.azure.key.vault;
 
+import com.azure.security.keyvault.secrets.SecretClient;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
@@ -27,19 +28,30 @@ public class KeyVaultConfiguration implements Cloneable {
 
     @UriPath
     private String vaultName;
+    @UriParam
+    @Metadata(autowired = true)
+    private SecretClient secretClient;
     @UriParam(label = "security", secret = true)
-    @Metadata(required = true)
     private String clientId;
     @UriParam(label = "security", secret = true)
-    @Metadata(required = true)
     private String clientSecret;
     @UriParam(label = "security", secret = true)
-    @Metadata(required = true)
     private String tenantId;
     @UriParam(label = "producer")
     private KeyVaultOperation operation = KeyVaultOperation.createSecret;
 
     /**
+     * Instance of Secret client
+     */
+    public SecretClient getSecretClient() {
+        return secretClient;
+    }
+
+    public void setSecretClient(SecretClient secretClient) {
+        this.secretClient = secretClient;
+    }
+
+    /**
      * Vault Name to be used
      */
     public String getVaultName() {