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 42c2c8e085da135239a69a923c3cafe967eeb541
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Feb 21 13:59:52 2022 +0100

    CAMEL-17685 - Create a Camel Google Secrets Manager component
---
 catalog/camel-allcomponents/pom.xml                |   4 +
 .../camel-google-secrets-manager/pom.xml           | 122 +++++++++++
 .../GoogleSecretManagerComponentConfigurer.java    |  55 +++++
 .../GoogleSecretManagerEndpointConfigurer.java     |  72 +++++++
 .../services/org/apache/camel/component.properties |   7 +
 .../apache/camel/component/google-secret-manager   |   2 +
 .../configurer/google-secret-manager-component     |   2 +
 .../configurer/google-secret-manager-endpoint      |   2 +
 .../urifactory/google-secret-manager-endpoint      |   2 +
 .../secret/manager/google-secret-manager.json      |  36 ++++
 .../src/main/docs/google-functions-component.adoc  | 237 +++++++++++++++++++++
 .../manager/GoogleSecretManagerClientFactory.java  |  59 +++++
 .../manager/GoogleSecretManagerComponent.java      |  56 +++++
 .../manager/GoogleSecretManagerConfiguration.java  | 116 ++++++++++
 .../manager/GoogleSecretManagerConstants.java      |  23 ++
 .../manager/GoogleSecretManagerEndpoint.java       |  93 ++++++++
 .../manager/GoogleSecretManagerOperations.java     |  23 ++
 .../manager/GoogleSecretManagerProducer.java       | 102 +++++++++
 .../secret/manager/integration/GoogleCloudIT.java  |  67 ++++++
 .../src/test/resources/log4j.properties            |  31 +++
 parent/pom.xml                                     |   6 +
 21 files changed, 1117 insertions(+)

diff --git a/catalog/camel-allcomponents/pom.xml 
b/catalog/camel-allcomponents/pom.xml
index 5b0ac540..cc3e829 100644
--- a/catalog/camel-allcomponents/pom.xml
+++ b/catalog/camel-allcomponents/pom.xml
@@ -563,6 +563,10 @@
                </dependency>
                <dependency>
                        <groupId>org.apache.camel</groupId>
+                       <artifactId>camel-google-secrets-manager</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.camel</groupId>
                        <artifactId>camel-google-sheets</artifactId>
                </dependency>
                <dependency>
diff --git a/components/camel-google/camel-google-secrets-manager/pom.xml 
b/components/camel-google/camel-google-secrets-manager/pom.xml
new file mode 100644
index 0000000..7c9e28d
--- /dev/null
+++ b/components/camel-google/camel-google-secrets-manager/pom.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-google-parent</artifactId>
+        <version>3.16.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-google-secrets-manager</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Google :: Secrets Manager</name>
+    <description>Camel Component for Google Cloud Platform Secrets 
Manager</description>
+
+    <properties>
+        <firstVersion>3.16.0</firstVersion>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Override the android JDK 7 guava in libraries-bom -->
+            <dependency>
+                <groupId>com.google.guava</groupId>
+                <artifactId>guava</artifactId>
+                <version>${google-cloud-guava-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.google.cloud</groupId>
+                <artifactId>google-cloud-secretmanager-bom</artifactId>
+                <version>${google-cloud-secretmanager-bom-version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-support</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.google.code.findbugs</groupId>
+                    <artifactId>jsr305</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.google.cloud</groupId>
+            <artifactId>google-cloud-secretmanager</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.google.code.findbugs</groupId>
+                    <artifactId>jsr305</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+<dependency>
+    <groupId>com.google.auth</groupId>
+    <artifactId>google-auth-library-oauth2-http</artifactId>
+    <version>1.4.0</version>
+</dependency>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-junit5</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-junit-jupiter</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <childDelegation>false</childDelegation>
+                    <useFile>true</useFile>
+                    <forkCount>1</forkCount>
+                    <reuseForks>true</reuseForks>
+                    
<forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/generated/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerComponentConfigurer.java
 
b/components/camel-google/camel-google-secrets-manager/src/generated/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerComponentConfigurer.java
new file mode 100644
index 0000000..54f6f42
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/generated/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerComponentConfigurer.java
@@ -0,0 +1,55 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.google.secret.manager;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.spi.ConfigurerStrategy;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.component.PropertyConfigurerSupport;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class GoogleSecretManagerComponentConfigurer extends 
PropertyConfigurerSupport implements GeneratedPropertyConfigurer, 
PropertyConfigurerGetter {
+
+    @Override
+    public boolean configure(CamelContext camelContext, Object obj, String 
name, Object value, boolean ignoreCase) {
+        GoogleSecretManagerComponent target = (GoogleSecretManagerComponent) 
obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "autowiredenabled":
+        case "autowiredEnabled": 
target.setAutowiredEnabled(property(camelContext, boolean.class, value)); 
return true;
+        case "lazystartproducer":
+        case "lazyStartProducer": 
target.setLazyStartProducer(property(camelContext, boolean.class, value)); 
return true;
+        default: return false;
+        }
+    }
+
+    @Override
+    public Class<?> getOptionType(String name, boolean ignoreCase) {
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "autowiredenabled":
+        case "autowiredEnabled": return boolean.class;
+        case "lazystartproducer":
+        case "lazyStartProducer": return boolean.class;
+        default: return null;
+        }
+    }
+
+    @Override
+    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+        GoogleSecretManagerComponent target = (GoogleSecretManagerComponent) 
obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "autowiredenabled":
+        case "autowiredEnabled": return target.isAutowiredEnabled();
+        case "lazystartproducer":
+        case "lazyStartProducer": return target.isLazyStartProducer();
+        default: return null;
+        }
+    }
+}
+
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/generated/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerEndpointConfigurer.java
 
b/components/camel-google/camel-google-secrets-manager/src/generated/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerEndpointConfigurer.java
new file mode 100644
index 0000000..53ba6a1
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/generated/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerEndpointConfigurer.java
@@ -0,0 +1,72 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.google.secret.manager;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.spi.ConfigurerStrategy;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.component.PropertyConfigurerSupport;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class GoogleSecretManagerEndpointConfigurer extends 
PropertyConfigurerSupport implements GeneratedPropertyConfigurer, 
PropertyConfigurerGetter {
+
+    @Override
+    public boolean configure(CamelContext camelContext, Object obj, String 
name, Object value, boolean ignoreCase) {
+        GoogleSecretManagerEndpoint target = (GoogleSecretManagerEndpoint) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "client": 
target.getConfiguration().setClient(property(camelContext, 
com.google.cloud.secretmanager.v1.SecretManagerServiceClient.class, value)); 
return true;
+        case "lazystartproducer":
+        case "lazyStartProducer": 
target.setLazyStartProducer(property(camelContext, boolean.class, value)); 
return true;
+        case "operation": 
target.getConfiguration().setOperation(property(camelContext, 
org.apache.camel.component.google.secret.manager.GoogleSecretManagerOperations.class,
 value)); return true;
+        case "pojorequest":
+        case "pojoRequest": 
target.getConfiguration().setPojoRequest(property(camelContext, boolean.class, 
value)); return true;
+        case "serviceaccountkey":
+        case "serviceAccountKey": 
target.getConfiguration().setServiceAccountKey(property(camelContext, 
java.lang.String.class, value)); return true;
+        default: return false;
+        }
+    }
+
+    @Override
+    public String[] getAutowiredNames() {
+        return new String[]{"client"};
+    }
+
+    @Override
+    public Class<?> getOptionType(String name, boolean ignoreCase) {
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "client": return 
com.google.cloud.secretmanager.v1.SecretManagerServiceClient.class;
+        case "lazystartproducer":
+        case "lazyStartProducer": return boolean.class;
+        case "operation": return 
org.apache.camel.component.google.secret.manager.GoogleSecretManagerOperations.class;
+        case "pojorequest":
+        case "pojoRequest": return boolean.class;
+        case "serviceaccountkey":
+        case "serviceAccountKey": return java.lang.String.class;
+        default: return null;
+        }
+    }
+
+    @Override
+    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+        GoogleSecretManagerEndpoint target = (GoogleSecretManagerEndpoint) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "client": return target.getConfiguration().getClient();
+        case "lazystartproducer":
+        case "lazyStartProducer": return target.isLazyStartProducer();
+        case "operation": return target.getConfiguration().getOperation();
+        case "pojorequest":
+        case "pojoRequest": return target.getConfiguration().isPojoRequest();
+        case "serviceaccountkey":
+        case "serviceAccountKey": return 
target.getConfiguration().getServiceAccountKey();
+        default: return null;
+        }
+    }
+}
+
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component.properties
 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component.properties
new file mode 100644
index 0000000..61b6f74
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component.properties
@@ -0,0 +1,7 @@
+# Generated by camel build tools - do NOT edit this file!
+components=google-secret-manager
+groupId=org.apache.camel
+artifactId=camel-google-secrets-manager
+version=3.16.0-SNAPSHOT
+projectName=Camel :: Google :: Secrets Manager
+projectDescription=Camel Component for Google Cloud Platform Secrets Manager
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component/google-secret-manager
 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component/google-secret-manager
new file mode 100644
index 0000000..3695f2c
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component/google-secret-manager
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.google.secret.manager.GoogleSecretManagerComponent
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-secret-manager-component
 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-secret-manager-component
new file mode 100644
index 0000000..8ed6305
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-secret-manager-component
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.google.secret.manager.GoogleSecretManagerComponentConfigurer
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-secret-manager-endpoint
 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-secret-manager-endpoint
new file mode 100644
index 0000000..04899a3
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/google-secret-manager-endpoint
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.google.secret.manager.GoogleSecretManagerEndpointConfigurer
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/urifactory/google-secret-manager-endpoint
 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/urifactory/google-secret-manager-endpoint
new file mode 100644
index 0000000..f499e5b
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/urifactory/google-secret-manager-endpoint
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.google.secret.manager.GoogleSecretManagerEndpointUriFactory
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/generated/resources/org/apache/camel/component/google/secret/manager/google-secret-manager.json
 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/org/apache/camel/component/google/secret/manager/google-secret-manager.json
new file mode 100644
index 0000000..c76b3eb
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/generated/resources/org/apache/camel/component/google/secret/manager/google-secret-manager.json
@@ -0,0 +1,36 @@
+{
+  "component": {
+    "kind": "component",
+    "name": "google-secret-manager",
+    "title": "Google Secret Manager",
+    "description": "Manage Google Secret Manager Secrets",
+    "deprecated": false,
+    "firstVersion": "3.16.0",
+    "label": "cloud",
+    "javaType": 
"org.apache.camel.component.google.secret.manager.GoogleSecretManagerComponent",
+    "supportLevel": "Preview",
+    "groupId": "org.apache.camel",
+    "artifactId": "camel-google-secrets-manager",
+    "version": "3.16.0-SNAPSHOT",
+    "scheme": "google-secret-manager",
+    "extendsScheme": "",
+    "syntax": "google-secret-manager:project",
+    "async": false,
+    "api": false,
+    "consumerOnly": false,
+    "producerOnly": true,
+    "lenientProperties": false
+  },
+  "componentProperties": {
+    "lazyStartProducer": { "kind": "property", "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 star [...]
+    "autowiredEnabled": { "kind": "property", "displayName": "Autowired 
Enabled", "group": "advanced", "label": "advanced", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": true, "description": "Whether autowiring is 
enabled. This is used for automatic autowiring options (the option must be 
marked as autowired) by looking up in the registry to find if there is a single 
instance of matching type, which t [...]
+  },
+  "properties": {
+    "project": { "kind": "path", "displayName": "Project", "group": "common", 
"label": "common", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.google.secret.manager.GoogleSecretManagerConfiguration",
 "configurationField": "configuration", "description": "The Google Cloud 
Project Id name related to the Secret Manager" },
+    "serviceAccountKey": { "kind": "parameter", "displayName": "Service 
Account Key", "group": "common", "label": "common", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.google.secret.manager.GoogleSecretManagerConfiguration",
 "configurationField": "configuration", "description": "Service account key to 
authenticate an application as a service account" },
+    "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.google.secret.manager.GoogleSecretManagerOperations",
 "enum": [ "createSecret" ], "deprecated": false, "autowired": false, "secret": 
false, "configurationClass": 
"org.apache.camel.component.google.secret.manager.GoogleSecretManagerConfiguration",
 "configurationField": "configuration", "description": "The [...]
+    "pojoRequest": { "kind": "parameter", "displayName": "Pojo Request", 
"group": "producer", "label": "", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.google.secret.manager.GoogleSecretManagerConfiguration",
 "configurationField": "configuration", "description": "Specifies if the 
request is a pojo request" },
+    "client": { "kind": "parameter", "displayName": "Client", "group": 
"advanced", "label": "advanced", "required": false, "type": "object", 
"javaType": "com.google.cloud.secretmanager.v1.SecretManagerServiceClient", 
"deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, 
"configurationClass": 
"org.apache.camel.component.google.secret.manager.GoogleSecretManagerConfiguration",
 "configurationField": "configuration", "description": "The client to use 
during service  [...]
+  }
+}
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/main/docs/google-functions-component.adoc
 
b/components/camel-google/camel-google-secrets-manager/src/main/docs/google-functions-component.adoc
new file mode 100644
index 0000000..2bd645f
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/main/docs/google-functions-component.adoc
@@ -0,0 +1,237 @@
+= Google Cloud Functions Component
+:doctitle: Google Cloud Functions
+:shortname: google-functions
+:artifactid: camel-google-functions
+:description: Manage and invoke Google Cloud Functions
+:since: 3.9
+:supportlevel: Stable
+:component-header: Only producer is supported
+//Manually maintained attributes
+:group: Google
+:camel-spring-boot-name: google-functions
+
+*Since Camel {since}*
+
+*{component-header}*
+
+The Google Functions component provides access to 
https://cloud.google.com/functions/[Google Cloud Functions] via
+the https://github.com/googleapis/java-functions[Google Cloud Functions Client 
for Java].
+
+Maven users will need to add the following dependency to their pom.xml
+for this component:
+
+[source,xml]
+------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-google-functions</artifactId>
+    <!-- use the same version as your Camel core version -->
+    <version>x.x.x</version>
+</dependency>
+
+------------------------------------------------------
+
+[[GoogleFunctions-AuthenticationConfiguration]]
+
+== Authentication Configuration
+
+Google Functions component authentication is targeted for use with the GCP 
Service Accounts.
+For more information please refer to 
https://github.com/googleapis/google-cloud-java#authentication[Google Cloud 
Authentication].
+
+When you have the **service account key** you can provide authentication 
credentials to your application code.
+Google security credentials can be set through the component endpoint:
+
+[source,java]
+--------------------------------------------------------
+String endpoint = 
"google-functions://myCamelFunction?serviceAccountKey=/home/user/Downloads/my-key.json";
+--------------------------------------------------------
+
+Or by setting the environment variable `GOOGLE_APPLICATION_CREDENTIALS` :
+
+--------------------------------------------------------
+export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/my-key.json"
+--------------------------------------------------------
+
+
+== URI Format
+
+--------------------------------------------------------
+google-functions://functionName[?options]
+--------------------------------------------------------
+
+You can append query options to the URI in the following format,
+`?options=value&option2=value&...`
+
+For example in order to call the function `myCamelFunction` from the project 
`myProject` and location `us-central1`, use the following snippet:
+
+[source,java]
+--------------------------------------------------------------------------------
+from("google-functions://myCamelFunction?project=myProject&location=us-central1&operation=callFunction&serviceAccountKey=/home/user/Downloads/my-key.json")
+  .to("direct:test");
+--------------------------------------------------------------------------------
+
+
+
+// component-configure options: START
+
+// component-configure options: END
+
+// component options: START
+include::partial$component-configure-options.adoc[]
+include::partial$component-endpoint-options.adoc[]
+// component options: END
+
+// endpoint options: START
+
+// endpoint options: END
+
+
+== Usage
+
+=== Message headers evaluated by the Google Functions Producer
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Header |Type |Description
+|`GoogleCloudFunctionsOperation` |`String` |The operation to perform. 
Permitted values are listFunctions, getFunction, callFunction, 
generateDownloadUrl, generateUploadUrl, createFunction, updateFunction, 
deleteFunction
+|`GoogleCloudFunctionsEntryPoint` |`String` |The name of the function (as 
defined in source code) that will be executed. Used for createFunction 
operation.
+|`GoogleCloudFunctionsRuntime` |`String` |The runtime in which to run the 
function. Possible values are `nodejs10`, `nodejs12`, `nodejs14`, `python37`, 
`python38`, `python39`, `go111`, `go113`, `java11`, `dotnet3`, `ruby26`, 
`nodejs6`, `nodejs8`. Used for createFunction operation.
+|`GoogleCloudFunctionsSourceArchiveUrl` |`String` |The Google Cloud Storage 
URL, starting with `gs://`, pointing to the zip archive which contains the 
function. Used for createFunction operation.
+
+|=======================================================================
+
+=== Message headers set by the Google Functions Producer
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Header |Type |Description
+|`GoogleCloudFunctionsResponseObject` |`Object` |The response object resulting 
from the Google Functions Client invocation
+|=======================================================================
+
+=== Google Functions Producer operations
+
+Google Functions component provides the following operation on the producer 
side:
+
+- listFunctions
+- getFunction
+- callFunction
+- generateDownloadUrl
+- generateUploadUrl
+- createFunction
+- updateFunction
+- deleteFunction
+
+If you don't specify an operation by default the producer will use the 
`callFunction` operation.
+
+=== Advanced component configuration
+
+If you need to have more control over the `client` instance configuration, you 
can create your own instance and refer to it in your Camel google-functions 
component configuration:
+
+[source,java]
+--------------------------------------------------------------------------------
+from("google-functions://myCamelFunction?client=#myClient")
+    .to("mock:result");
+--------------------------------------------------------------------------------
+
+=== Google Functions Producer Operation examples
+
+- ListFunctions: This operation invoke the Google Functions client and get the 
list of cloud Functions
+
+[source,java]
+--------------------------------------------------------------------------------
+//list functions
+from("direct:start")
+    
.to("google-functions://myCamelFunction?serviceAccountKey=/home/user/Downloads/my-key.json&project=myProject&location=us-central1&operation=listFunctions")
+    .log("body:${body}")
+--------------------------------------------------------------------------------
+
+This operation will get the list of cloud functions for the project 
`myProject` and location `us-central1`.
+
+- GetFunction: this operation get the Cloud Functions object
+
+[source,java]
+--------------------------------------------------------------------------------
+//get function
+from("direct:start")
+    
.to("google-functions://myCamelFunction?serviceAccountKey=/home/user/Downloads/my-key.json&project=myProject&location=us-central1&operation=getFunction")
+    .log("body:${body}")
+    .to("mock:result");
+--------------------------------------------------------------------------------
+
+This operation will get the `CloudFunction` object for the project 
`myProject`, location `us-central1` and functionName `myCamelFunction`.
+
+- CallFunction: this operation call the function using an HTTP request
+
+[source,java]
+--------------------------------------------------------------------------------
+//call function
+from("direct:start")
+    .process(exchange -> {
+      exchange.getIn().setBody("just a message");
+    })
+    
.to("google-functions://myCamelFunction?serviceAccountKey=/home/user/Downloads/my-key.json&project=myProject&location=us-central1&operation=callFunction")
+    .log("body:${body}")
+    .to("mock:result");
+--------------------------------------------------------------------------------
+
+- GenerateDownloadUrl: this operation generate the signed URL for downloading 
deployed function source code.
+
+[source,java]
+--------------------------------------------------------------------------------
+//generate download url
+from("direct:start").to("google-functions://myCamelFunction?serviceAccountKey=/home/user/Downloads/my-key.json&project=myProject&location=us-central1&operation=generateDownloadUrl")
+.log("body:${body}")
+.to("mock:result");
+--------------------------------------------------------------------------------
+
+- GenerateUploadUrl: this operation generate a signed URL for uploading a 
function source code.
+
+[source,java]
+--------------------------------------------------------------------------------
+from("direct:start").to("google-functions://myCamelFunction?serviceAccountKey=/home/user/Downloads/my-key.json&project=myProject&location=us-central1&operation=generateUploadUrl")
+    .log("body:${body}")
+    .to("mock:result");
+--------------------------------------------------------------------------------
+
+- createFunction: this operation creates a new function.
+
+[source,java]
+--------------------------------------------------------------------------------
+
+from("direct:start")
+    .process(exchange -> {
+      exchange.getIn().setHeader(GoogleCloudFunctionsConstants.ENTRY_POINT, 
"com.example.Example");
+      exchange.getIn().setHeader(GoogleCloudFunctionsConstants.RUNTIME, 
"java11");
+      
exchange.getIn().setHeader(GoogleCloudFunctionsConstants.SOURCE_ARCHIVE_URL, 
"gs://myBucket/source.zip");
+    
}).to("google-functions://myCamelFunction?serviceAccountKey=/home/user/Downloads/my-key.json&project=myProject&location=us-central1&operation=createFunction")
+    .log("body:${body}")
+    .to("mock:result");
+--------------------------------------------------------------------------------
+
+- updateFunction: this operation updates existing function.
+
+[source,java]
+--------------------------------------------------------------------------------
+from("direct:start")
+.process(exchange -> {
+  UpdateFunctionRequest request = UpdateFunctionRequest.newBuilder()
+    .setFunction(CloudFunction.newBuilder().build())
+    .setUpdateMask(FieldMask.newBuilder().build()).build();
+  exchange.getIn().setBody(request);
+}).to("google-functions://myCamelFunction?serviceAccountKey=/home/user/Downloads/my-key.json&project=myProject&location=us-central1&operation=updateFunction&pojoRequest=true")
+.log("body:${body}")
+.to("mock:result");
+--------------------------------------------------------------------------------
+
+- deleteFunction: this operation Deletes a function with the given name from 
the specified project.
+
+[source,java]
+--------------------------------------------------------------------------------
+from("direct:start")
+.to("google-functions://myCamelFunction?serviceAccountKey=/home/user/Downloads/my-key.json&project=myProject&location=us-central1&operation=deleteFunction")
+.log("body:${body}")
+.to("mock:result");
+--------------------------------------------------------------------------------
+
+
+include::spring-boot:partial$starter.adoc[]
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerClientFactory.java
 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerClientFactory.java
new file mode 100644
index 0000000..ab190b9
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerClientFactory.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.google.secret.manager;
+
+import java.io.InputStream;
+
+import com.google.api.gax.core.FixedCredentialsProvider;
+import com.google.auth.Credentials;
+import com.google.auth.oauth2.ServiceAccountCredentials;
+import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;
+import com.google.cloud.secretmanager.v1.SecretManagerServiceSettings;
+import com.google.common.base.Strings;
+import org.apache.camel.CamelContext;
+import org.apache.camel.support.ResourceHelper;
+
+public final class GoogleSecretManagerClientFactory {
+    /**
+     * Prevent instantiation.
+     */
+    private GoogleSecretManagerClientFactory() {
+    }
+
+    public static SecretManagerServiceClient create(
+            CamelContext context,
+            GoogleSecretManagerConfiguration configuration)
+            throws Exception {
+        SecretManagerServiceClient secretManagerServiceClient = null;
+        if (!Strings.isNullOrEmpty(configuration.getServiceAccountKey())) {
+            InputStream resolveMandatoryResourceAsInputStream
+                    = 
ResourceHelper.resolveMandatoryResourceAsInputStream(context, 
configuration.getServiceAccountKey());
+            Credentials myCredentials = ServiceAccountCredentials
+                    .fromStream(resolveMandatoryResourceAsInputStream);
+            SecretManagerServiceSettings settings = 
SecretManagerServiceSettings.newBuilder()
+                    
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)).build();
+            secretManagerServiceClient = 
SecretManagerServiceClient.create(settings);
+        } else {
+            // it needs to define the environment variable 
GOOGLE_APPLICATION_CREDENTIALS
+            // with the service account file
+            // more info at 
https://cloud.google.com/docs/authentication/production
+            SecretManagerServiceSettings settings = 
SecretManagerServiceSettings.newBuilder().build();
+            secretManagerServiceClient = 
SecretManagerServiceClient.create(settings);
+        }
+        return secretManagerServiceClient;
+    }
+}
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerComponent.java
 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerComponent.java
new file mode 100644
index 0000000..52b5f67e
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerComponent.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.google.secret.manager;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.support.DefaultComponent;
+
+@Component("google-secret-manager")
+public class GoogleSecretManagerComponent extends DefaultComponent {
+
+    @Metadata
+    private GoogleSecretManagerConfiguration configuration = new 
GoogleSecretManagerConfiguration();
+
+    public GoogleSecretManagerComponent() {
+    }
+
+    public GoogleSecretManagerComponent(CamelContext context) {
+        super(context);
+    }
+
+    protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
+        if (remaining == null || remaining.trim().length() == 0) {
+            throw new IllegalArgumentException("Project id must be 
specified.");
+        }
+        final GoogleSecretManagerConfiguration configuration
+                = this.configuration != null ? this.configuration.copy() : new 
GoogleSecretManagerConfiguration();
+        configuration.setProject(remaining);
+
+        Endpoint endpoint = new GoogleSecretManagerEndpoint(uri, this, 
configuration);
+        setProperties(endpoint, parameters);
+        return endpoint;
+    }
+
+    public GoogleSecretManagerConfiguration getConfiguration() {
+        return configuration;
+    }
+}
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerConfiguration.java
 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerConfiguration.java
new file mode 100644
index 0000000..f2186bd
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerConfiguration.java
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.google.secret.manager;
+
+import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
+
+@UriParams
+public class GoogleSecretManagerConfiguration implements Cloneable {
+
+    @UriPath(label = "common", description = "The Google Cloud Project Id name 
related to the Secret Manager")
+    @Metadata(required = true)
+    private String project;
+
+    @UriParam(label = "common", description = "Service account key to 
authenticate an application as a service account")
+    private String serviceAccountKey;
+
+    @UriParam(label = "producer",
+              enums = "createSecret")
+    private GoogleSecretManagerOperations operation;
+
+    @UriParam(defaultValue = "false", description = "Specifies if the request 
is a pojo request")
+    private boolean pojoRequest;
+
+    @UriParam(label = "advanced")
+    @Metadata(autowired = true)
+    private SecretManagerServiceClient client;
+
+    public String getServiceAccountKey() {
+        return serviceAccountKey;
+    }
+
+    /**
+     * Service account key
+     * 
+     * @param serviceAccountKey
+     */
+    public void setServiceAccountKey(String serviceAccountKey) {
+        this.serviceAccountKey = serviceAccountKey;
+    }
+
+    public String getProject() {
+        return project;
+    }
+
+    /**
+     * The project to work with.
+     * 
+     * @param project
+     */
+    public void setProject(String project) {
+        this.project = project;
+    }
+
+    public GoogleSecretManagerOperations getOperation() {
+        return operation;
+    }
+
+    /**
+     * The operation to perform on the producer.
+     */
+    public void setOperation(GoogleSecretManagerOperations operation) {
+        this.operation = operation;
+    }
+
+    public SecretManagerServiceClient getClient() {
+        return client;
+    }
+
+    /**
+     * The client to use during service invocation.
+     */
+    public void setClient(SecretManagerServiceClient client) {
+        this.client = client;
+    }
+
+    public boolean isPojoRequest() {
+        return pojoRequest;
+    }
+
+    /**
+     * Configure the input type. If true the message will be POJO type.
+     * 
+     * @param pojoRequest
+     */
+    public void setPojoRequest(boolean pojoRequest) {
+        this.pojoRequest = pojoRequest;
+    }
+
+    public GoogleSecretManagerConfiguration copy() {
+        try {
+            return (GoogleSecretManagerConfiguration) super.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeCamelException(e);
+        }
+    }
+
+}
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerConstants.java
 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerConstants.java
new file mode 100644
index 0000000..593f76b
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerConstants.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.google.secret.manager;
+
+public interface GoogleSecretManagerConstants {
+    String OPERATION = "GoogleSecretManagerOperation";
+    String SECRET_ID = "CamelGoogleSecretManagerSecretId";
+    String REPLICATION = "CamelGoogleSecretManagerReplication";
+}
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerEndpoint.java
 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerEndpoint.java
new file mode 100644
index 0000000..9649d9c
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerEndpoint.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.google.secret.manager;
+
+import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;
+import org.apache.camel.Category;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.support.DefaultEndpoint;
+
+/**
+ * Manage Google Secret Manager Secrets
+ * 
+ * Google Functions Endpoint definition represents a function within the GCP 
and contains configuration to customize the
+ * behavior of Producer.
+ */
+@UriEndpoint(firstVersion = "3.16.0", scheme = "google-secret-manager", title 
= "Google Secret Manager",
+             syntax = "google-secret-manager:project", category = {
+                     Category.CLOUD },
+             producerOnly = true)
+public class GoogleSecretManagerEndpoint extends DefaultEndpoint {
+
+    @UriParam
+    private GoogleSecretManagerConfiguration configuration;
+
+    private SecretManagerServiceClient secretManagerServiceClient;
+
+    public GoogleSecretManagerEndpoint(String uri, 
GoogleSecretManagerComponent component,
+                                       GoogleSecretManagerConfiguration 
configuration) {
+        super(uri, component);
+        this.configuration = configuration;
+    }
+
+    public Producer createProducer() throws Exception {
+        return new GoogleSecretManagerProducer(this);
+    }
+
+    public Consumer createConsumer(Processor processor) throws Exception {
+        throw new UnsupportedOperationException(
+                "Cannot consume from the google-secret-manager endpoint: " + 
getEndpointUri());
+    }
+
+    public GoogleSecretManagerConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    /**
+     * Setup configuration
+     */
+    public void setConfiguration(GoogleSecretManagerConfiguration 
configuration) {
+        this.configuration = configuration;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        if (configuration.getClient() != null) {
+            secretManagerServiceClient = configuration.getClient();
+        } else {
+            secretManagerServiceClient = 
GoogleSecretManagerClientFactory.create(this.getCamelContext(), configuration);
+        }
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        super.doStop();
+        if (configuration.getClient() == null && secretManagerServiceClient != 
null) {
+            secretManagerServiceClient.close();
+        }
+    }
+
+    public SecretManagerServiceClient getClient() {
+        return secretManagerServiceClient;
+    }
+
+}
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerOperations.java
 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerOperations.java
new file mode 100644
index 0000000..b5c27a1
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerOperations.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.google.secret.manager;
+
+public enum GoogleSecretManagerOperations {
+
+    createSecret,
+    deleteSecret;
+}
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerProducer.java
 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerProducer.java
new file mode 100644
index 0000000..873531c
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/main/java/org/apache/camel/component/google/secret/manager/GoogleSecretManagerProducer.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.google.secret.manager;
+
+import com.google.cloud.secretmanager.v1.AddSecretVersionRequest;
+import com.google.cloud.secretmanager.v1.ProjectName;
+import com.google.cloud.secretmanager.v1.Replication;
+import com.google.cloud.secretmanager.v1.Secret;
+import com.google.cloud.secretmanager.v1.SecretManagerServiceClient;
+import com.google.cloud.secretmanager.v1.SecretPayload;
+import com.google.cloud.secretmanager.v1.SecretVersion;
+import com.google.protobuf.ByteString;
+import org.apache.camel.Exchange;
+import org.apache.camel.InvalidPayloadException;
+import org.apache.camel.Message;
+import org.apache.camel.support.DefaultProducer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The Google Secret Manager producer.
+ */
+public class GoogleSecretManagerProducer extends DefaultProducer {
+    private static final Logger LOG = 
LoggerFactory.getLogger(GoogleSecretManagerProducer.class);
+
+    private GoogleSecretManagerEndpoint endpoint;
+
+    public GoogleSecretManagerProducer(GoogleSecretManagerEndpoint endpoint) {
+        super(endpoint);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    public void process(final Exchange exchange) throws Exception {
+        switch (determineOperation(exchange)) {
+            case createSecret:
+                createSecret(endpoint.getClient(), exchange);
+                break;
+
+            default:
+                throw new IllegalArgumentException("Unsupported operation");
+        }
+    }
+
+    private void createSecret(SecretManagerServiceClient client, Exchange 
exchange) throws InvalidPayloadException {
+        SecretVersion response = null;
+        if (getConfiguration().isPojoRequest()) {
+            AddSecretVersionRequest request = 
exchange.getIn().getMandatoryBody(AddSecretVersionRequest.class);
+            response = client.addSecretVersion(request);
+        } else {
+            String secretId = 
exchange.getMessage().getHeader(GoogleSecretManagerConstants.SECRET_ID, 
String.class);
+            Secret secret = Secret.newBuilder()
+                    .setReplication(
+                            Replication.newBuilder()
+                                    
.setAutomatic(Replication.Automatic.newBuilder().build())
+                                    .build())
+                    .build();
+
+            Secret createdSecret = 
client.createSecret(ProjectName.of(getConfiguration().getProject()), secretId, 
secret);
+
+            SecretPayload payload = SecretPayload.newBuilder()
+                    
.setData(ByteString.copyFromUtf8(exchange.getMessage().getBody(String.class))).build();
+            response = client.addSecretVersion(createdSecret.getName(), 
payload);
+        }
+        Message message = getMessageForResponse(exchange);
+        message.setBody(response);
+    }
+
+    private GoogleSecretManagerOperations determineOperation(Exchange 
exchange) {
+        GoogleSecretManagerOperations operation = 
exchange.getIn().getHeader(GoogleSecretManagerConstants.OPERATION,
+                GoogleSecretManagerOperations.class);
+        if (operation == null) {
+            operation = getConfiguration().getOperation() == null
+                    ? GoogleSecretManagerOperations.createSecret
+                    : getConfiguration().getOperation();
+        }
+        return operation;
+    }
+
+    public static Message getMessageForResponse(final Exchange exchange) {
+        return exchange.getMessage();
+    }
+
+    private GoogleSecretManagerConfiguration getConfiguration() {
+        return this.endpoint.getConfiguration();
+    }
+
+}
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleCloudIT.java
 
b/components/camel-google/camel-google-secrets-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleCloudIT.java
new file mode 100644
index 0000000..6027a22
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleCloudIT.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.google.secret.manager.integration;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import 
org.apache.camel.component.google.secret.manager.GoogleSecretManagerConstants;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+
+@EnabledIfEnvironmentVariable(named = "GOOGLE_APPLICATION_CREDENTIALS", 
matches = ".*",
+                              disabledReason = "Application credentials were 
not provided")
+public class GoogleCloudIT extends CamelTestSupport {
+
+    final String serviceAccountKeyFile = 
System.getenv("GOOGLE_APPLICATION_CREDENTIALS");
+    final String project = "myProject";
+
+    @EndpointInject("mock:createSecret")
+    private MockEndpoint mockSecret;
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+
+                from("timer:timer1?repeatCount=1").process(new Processor() {
+                    @Override
+                    public void process(Exchange exchange) throws Exception {
+                        
exchange.getMessage().setHeader(GoogleSecretManagerConstants.SECRET_ID, 
"test123");
+                        exchange.getMessage().setBody("Hello");
+                    }
+                })
+                        .to("google-secret-manager://" + project + 
"?serviceAccountKey="
+                            + serviceAccountKeyFile + 
"&operation=createSecret")
+                        .to("mock:createSecret");
+
+            }
+        };
+    }
+
+    @Test
+    public void sendIn() throws Exception {
+
+        mockSecret.expectedMessageCount(1);
+        Thread.sleep(10000);
+    }
+
+}
diff --git 
a/components/camel-google/camel-google-secrets-manager/src/test/resources/log4j.properties
 
b/components/camel-google/camel-google-secrets-manager/src/test/resources/log4j.properties
new file mode 100644
index 0000000..fcf7425
--- /dev/null
+++ 
b/components/camel-google/camel-google-secrets-manager/src/test/resources/log4j.properties
@@ -0,0 +1,31 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-google-secret-manager-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file
\ No newline at end of file
diff --git a/parent/pom.xml b/parent/pom.xml
index 75b79ce..932d5b7 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -215,6 +215,7 @@
         
<google-cloud-functions-bom-version>1.0.8</google-cloud-functions-bom-version>
         
<google-cloud-functions-gax-grpc-version>1.62.0</google-cloud-functions-gax-grpc-version>
         <google-cloud-guava-version>30.0-jre</google-cloud-guava-version>
+        
<google-cloud-secretmanager-bom-version>2.1.1</google-cloud-secretmanager-bom-version>
         <graaljs-version>21.3.0</graaljs-version>
         <graphql-java-version>14.0</graphql-java-version>
         <grizzly-websockets-version>2.4.4</grizzly-websockets-version>
@@ -1493,6 +1494,11 @@
                        </dependency>
                        <dependency>
                                <groupId>org.apache.camel</groupId>
+                               
<artifactId>camel-google-secrets-manager</artifactId>
+                               <version>${project.version}</version>
+                       </dependency>
+                       <dependency>
+                               <groupId>org.apache.camel</groupId>
                                <artifactId>camel-google-sheets</artifactId>
                                <version>${project.version}</version>
                        </dependency>

Reply via email to