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-spring-boot-examples.git

commit 723a2d75f6f9e4ac0d1677cb38fa17a06a4035a0
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Feb 22 07:16:10 2022 +0100

    Added an example of using AWS Secrets Manager Properties source in Camel 
Spring Boot
---
 aws-secrets-manager/README.adoc                    | 33 ++++++++
 aws-secrets-manager/pom.xml                        | 95 ++++++++++++++++++++++
 .../camel/example/springboot/aws/Application.java  | 34 ++++++++
 .../camel/example/springboot/aws/CamelRoute.java   | 32 ++++++++
 .../src/main/resources/application.properties      | 24 ++++++
 aws-secrets-manager/src/main/resources/logback.xml | 36 ++++++++
 6 files changed, 254 insertions(+)

diff --git a/aws-secrets-manager/README.adoc b/aws-secrets-manager/README.adoc
new file mode 100644
index 0000000..3120529
--- /dev/null
+++ b/aws-secrets-manager/README.adoc
@@ -0,0 +1,33 @@
+== Spring Boot Example with AWS2-S3
+
+=== Introduction
+
+This example demonstrates how you can use Camel-AWS2-S3 Starter component. The 
example is really simple: load file into your bucket and consume it.
+
+=== Build
+
+You can build this example using:
+
+    $ mvn package
+
+=== Run
+
+You can run this example following these steps using:
+
+In application.properties set all the AWS credentials and the bucket name
+
+Run the app
+
+    $ mvn spring-boot:run
+
+And you should see output in the console. 
+
+=== Help and contributions
+
+If you hit any problem using Camel or have some feedback, then please
+https://camel.apache.org/support.html[let us know].
+
+We also love contributors, so
+https://camel.apache.org/contributing.html[get involved] :-)
+
+The Camel riders!
diff --git a/aws-secrets-manager/pom.xml b/aws-secrets-manager/pom.xml
new file mode 100644
index 0000000..992551c
--- /dev/null
+++ b/aws-secrets-manager/pom.xml
@@ -0,0 +1,95 @@
+<?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/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel.springboot.example</groupId>
+        <artifactId>examples</artifactId>
+        <version>3.16.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-example-spring-boot-aws-secrets-manager</artifactId>
+    <name>Camel SB Examples :: AWS Secrets Manager</name>
+    <description>An example showing the Camel AWS Secrets Manager Properties 
source with Spring Boot</description>
+
+    <properties>
+        <category>Cloud</category>
+        <spring.boot-version>${spring-boot-version}</spring.boot-version>
+    </properties>
+
+    <!-- Spring-Boot and Camel BOM -->
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring.boot-version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel.springboot</groupId>
+                <artifactId>camel-spring-boot-dependencies</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <!-- Camel -->
+        <dependency>
+            <groupId>org.apache.camel.springboot</groupId>
+            <artifactId>camel-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.springboot</groupId>
+            <artifactId>camel-aws-secrets-manager-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.springboot</groupId>
+            <artifactId>camel-http-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.springboot</groupId>
+            <artifactId>camel-timer-starter</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring.boot-version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>
diff --git 
a/aws-secrets-manager/src/main/java/org/apache/camel/example/springboot/aws/Application.java
 
b/aws-secrets-manager/src/main/java/org/apache/camel/example/springboot/aws/Application.java
new file mode 100644
index 0000000..0a32683
--- /dev/null
+++ 
b/aws-secrets-manager/src/main/java/org/apache/camel/example/springboot/aws/Application.java
@@ -0,0 +1,34 @@
+/*
+ * 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.example.springboot.aws;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+// CHECKSTYLE:OFF
+@SpringBootApplication
+public class Application {
+
+    /**
+     * Main method to start the application.
+     */
+    public static void main(String[] args) {
+        SpringApplication.run(Application.class, args);
+    }
+
+}
+// CHECKSTYLE:ON
diff --git 
a/aws-secrets-manager/src/main/java/org/apache/camel/example/springboot/aws/CamelRoute.java
 
b/aws-secrets-manager/src/main/java/org/apache/camel/example/springboot/aws/CamelRoute.java
new file mode 100644
index 0000000..1ad634d
--- /dev/null
+++ 
b/aws-secrets-manager/src/main/java/org/apache/camel/example/springboot/aws/CamelRoute.java
@@ -0,0 +1,32 @@
+/*
+ * 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.example.springboot.aws;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CamelRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+
+        from("timer://myTimer?fixedRate=true&period=10000")
+            
.toD("https://finnhub.io/api/v1/quote?symbol={{stock}}&token={{aws:finnhub-token-3}}";)
+            .log("${body}");
+    }
+}
diff --git a/aws-secrets-manager/src/main/resources/application.properties 
b/aws-secrets-manager/src/main/resources/application.properties
new file mode 100644
index 0000000..d0eb228
--- /dev/null
+++ b/aws-secrets-manager/src/main/resources/application.properties
@@ -0,0 +1,24 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+camel.vault.aws.accessKey=<accessKey>
+camel.vault.aws.secretKey=<secretKey>
+camel.vault.aws.region=<region>
+camel.springboot.main-run-controller=true
+logging.config=classpath:logback.xml
+stock=AMZN
+
diff --git a/aws-secrets-manager/src/main/resources/logback.xml 
b/aws-secrets-manager/src/main/resources/logback.xml
new file mode 100644
index 0000000..0e4d220
--- /dev/null
+++ b/aws-secrets-manager/src/main/resources/logback.xml
@@ -0,0 +1,36 @@
+<?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.
+
+-->
+<configuration>
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%-15.15thread] %-5level %-30.30logger - 
%msg%n</pattern>
+    </encoder>
+  </appender>
+  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%-15.15thread] %-5level %-30.30logger - 
%msg%n</pattern>
+    </encoder>
+    <file>target/camel-example-spring-boot-aws2-s3-1.log</file>
+  </appender>
+  <root level="INFO">
+    <!--<appender-ref ref="FILE"/>-->
+    <appender-ref ref="STDOUT"/>
+  </root>
+</configuration>

Reply via email to