This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push: new c8f9255 Add Camel-AWS-KMS extension c8f9255 is described below commit c8f9255b455039103f0fa943113355b799b2e092 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue Nov 19 12:02:57 2019 +0100 Add Camel-AWS-KMS extension --- .../pages/list-of-camel-quarkus-extensions.adoc | 3 + extensions/aws-kms/deployment/pom.xml | 79 +++++++++++++++ .../aws/kms/deployment/AwsKmsProcessor.java | 98 ++++++++++++++++++ extensions/aws-kms/pom.xml | 39 +++++++ extensions/aws-kms/runtime/pom.xml | 112 +++++++++++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 28 ++++++ extensions/pom.xml | 1 + extensions/readme.adoc | 3 + integration-tests/aws/pom.xml | 4 + .../camel/quarkus/component/aws/CamelRoute.java | 5 + .../aws/src/main/resources/application.properties | 7 ++ poms/bom-deployment/pom.xml | 5 + poms/bom/pom.xml | 10 ++ 13 files changed, 394 insertions(+) diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc index 7c98c1b..05e21ad 100644 --- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc +++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc @@ -15,6 +15,9 @@ Number of Camel components: 39 in 34 JAR artifacts (0 deprecated) | link:https://camel.apache.org/components/latest/aws-eks-component.html[AWS EKS] (camel-quarkus-aws-eks) + `aws-eks:label` | 0.2 | The aws-kms is used for managing Amazon EKS +| link:https://camel.apache.org/components/latest/aws-kms-component.html[AWS KMS] (camel-quarkus-aws-kms) + +`aws-kms:label` | 0.5 | The aws-kms is used for managing Amazon KMS + | link:https://camel.apache.org/components/latest/aws-s3-component.html[AWS S3 Storage Service] (camel-quarkus-aws-s3) + `aws-s3://bucketNameOrArn` | 0.2 | The aws-s3 component is used for storing and retrieving object from Amazon S3 Storage Service. diff --git a/extensions/aws-kms/deployment/pom.xml b/extensions/aws-kms/deployment/pom.xml new file mode 100644 index 0000000..d9af347 --- /dev/null +++ b/extensions/aws-kms/deployment/pom.xml @@ -0,0 +1,79 @@ +<?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.quarkus</groupId> + <artifactId>camel-quarkus-aws-kms-parent</artifactId> + <version>0.4.1-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-aws-kms-deployment</artifactId> + <name>Camel Quarkus :: AWS KMS :: Deployment</name> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-support-xml-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws-kms</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/extensions/aws-kms/deployment/src/main/java/org/apache/camel/quarkus/component/aws/kms/deployment/AwsKmsProcessor.java b/extensions/aws-kms/deployment/src/main/java/org/apache/camel/quarkus/component/aws/kms/deployment/AwsKmsProcessor.java new file mode 100644 index 0000000..574a16b --- /dev/null +++ b/extensions/aws-kms/deployment/src/main/java/org/apache/camel/quarkus/component/aws/kms/deployment/AwsKmsProcessor.java @@ -0,0 +1,98 @@ +/* + * 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.quarkus.component.aws.kms.deployment; + +import java.util.Collection; +import java.util.stream.Collectors; + +import org.apache.camel.component.aws.kms.KMSConfiguration; +import org.jboss.jandex.ClassInfo; +import org.jboss.jandex.DotName; +import org.jboss.jandex.IndexView; + +import com.amazonaws.partitions.model.CredentialScope; +import com.amazonaws.partitions.model.Endpoint; +import com.amazonaws.partitions.model.Partition; +import com.amazonaws.partitions.model.Partitions; +import com.amazonaws.partitions.model.Region; +import com.amazonaws.partitions.model.Service; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; + +import io.quarkus.deployment.annotations.BuildProducer; +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.CombinedIndexBuildItem; +import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem; +import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem; +import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; +import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; + +class AwsKmsProcessor { + + public static final String AWS_KMS_APPLICATION_ARCHIVE_MARKERS = "com/amazonaws"; + + private static final String FEATURE = "camel-aws-kms"; + + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } + + @BuildStep + ExtensionSslNativeSupportBuildItem activateSslNativeSupport() { + return new ExtensionSslNativeSupportBuildItem(FEATURE); + } + + @BuildStep + NativeImageProxyDefinitionBuildItem httpProxies() { + return new NativeImageProxyDefinitionBuildItem("org.apache.http.conn.HttpClientConnectionManager", + "org.apache.http.pool.ConnPoolControl", "com.amazonaws.http.conn.Wrapped"); + } + + @BuildStep(applicationArchiveMarkers = { AWS_KMS_APPLICATION_ARCHIVE_MARKERS }) + void process(CombinedIndexBuildItem combinedIndexBuildItem, + BuildProducer<ReflectiveClassBuildItem> reflectiveClass, + BuildProducer<NativeImageResourceBuildItem> resource) { + + IndexView view = combinedIndexBuildItem.getIndex(); + + resource.produce(new NativeImageResourceBuildItem("com/amazonaws/partitions/endpoints.json")); + for (String s : getImplementations(view, JsonDeserializer.class)) { + reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, s)); + } + for (String s : getImplementations(view, JsonSerializer.class)) { + reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, s)); + } + reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, + Partitions.class.getCanonicalName(), + Partition.class.getCanonicalName(), + Endpoint.class.getCanonicalName(), + Region.class.getCanonicalName(), + Service.class.getCanonicalName(), + CredentialScope.class.getCanonicalName(), + "org.apache.commons.logging.impl.LogFactoryImpl", + "org.apache.commons.logging.impl.Jdk14Logger", + KMSConfiguration.class.getCanonicalName())); + } + + protected Collection<String> getImplementations(IndexView view, Class<?> type) { + return view.getAllKnownImplementors(DotName.createSimple(type.getName())).stream() + .map(ClassInfo::toString) + .collect(Collectors.toList()); + } +} diff --git a/extensions/aws-kms/pom.xml b/extensions/aws-kms/pom.xml new file mode 100644 index 0000000..81a90ef --- /dev/null +++ b/extensions/aws-kms/pom.xml @@ -0,0 +1,39 @@ +<?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.quarkus</groupId> + <artifactId>camel-quarkus-build-parent</artifactId> + <version>0.4.1-SNAPSHOT</version> + <relativePath>../../poms/build-parent/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-aws-kms-parent</artifactId> + <name>Camel Quarkus :: AWS KMS</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + </modules> +</project> diff --git a/extensions/aws-kms/runtime/pom.xml b/extensions/aws-kms/runtime/pom.xml new file mode 100644 index 0000000..8bf5e78 --- /dev/null +++ b/extensions/aws-kms/runtime/pom.xml @@ -0,0 +1,112 @@ +<?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.quarkus</groupId> + <artifactId>camel-quarkus-aws-kms-parent</artifactId> + <version>0.4.1-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-aws-kms</artifactId> + <name>Camel Quarkus :: AWS KMS :: Runtime</name> + + <properties> + <firstVersion>0.5.0</firstVersion> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-support-xml</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-aws-kms</artifactId> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-cbor</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-cbor</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>commons-logging-jboss-logging</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-bootstrap-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/extensions/aws-kms/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/aws-kms/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..5e8a323 --- /dev/null +++ b/extensions/aws-kms/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,28 @@ +# +# 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. +# + +--- +name: "Camel Quarkus AWS KMS" +description: "A Camel Amazon KMS Web Service Component" +metadata: + keywords: + - "camel" + - "aws" + - "cloud" + guide: "https://quarkus.io/guides/camel" + categories: + - "integration" diff --git a/extensions/pom.xml b/extensions/pom.xml index 8488311..71ca2b7 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -86,6 +86,7 @@ <module>vm</module> <module>zipfile</module> <module>xslt</module> + <module>aws-kms</module> </modules> <build> diff --git a/extensions/readme.adoc b/extensions/readme.adoc index ab8ea51..da2be5c 100644 --- a/extensions/readme.adoc +++ b/extensions/readme.adoc @@ -14,6 +14,9 @@ Number of Camel components: 39 in 34 JAR artifacts (0 deprecated) | link:https://camel.apache.org/components/latest/aws-eks-component.html[AWS EKS] (camel-quarkus-aws-eks) + `aws-eks:label` | 0.2 | The aws-kms is used for managing Amazon EKS +| link:https://camel.apache.org/components/latest/aws-kms-component.html[AWS KMS] (camel-quarkus-aws-kms) + +`aws-kms:label` | 0.5 | The aws-kms is used for managing Amazon KMS + | link:https://camel.apache.org/components/latest/aws-s3-component.html[AWS S3 Storage Service] (camel-quarkus-aws-s3) + `aws-s3://bucketNameOrArn` | 0.2 | The aws-s3 component is used for storing and retrieving object from Amazon S3 Storage Service. diff --git a/integration-tests/aws/pom.xml b/integration-tests/aws/pom.xml index 769c893..2dfc658 100644 --- a/integration-tests/aws/pom.xml +++ b/integration-tests/aws/pom.xml @@ -48,6 +48,10 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws-kms</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-log</artifactId> </dependency> <dependency> diff --git a/integration-tests/aws/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java b/integration-tests/aws/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java index c7718a8..08bfdcc 100644 --- a/integration-tests/aws/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java +++ b/integration-tests/aws/src/main/java/org/apache/camel/quarkus/component/aws/CamelRoute.java @@ -44,6 +44,11 @@ public class CamelRoute extends RouteBuilder { .setBody(constant("Quarkus is great!")) .to("aws-sns://topic1") .to("log:sf?showAll=true"); + + from("timer:quarkus-kms?repeatCount=1") + .setHeader("CamelAwsKMSOperation", constant("listKeys")) + .to("aws-kms://cluster") + .to("log:sf?showAll=true"); } } diff --git a/integration-tests/aws/src/main/resources/application.properties b/integration-tests/aws/src/main/resources/application.properties index e57d54c..da2ebfb 100644 --- a/integration-tests/aws/src/main/resources/application.properties +++ b/integration-tests/aws/src/main/resources/application.properties @@ -52,3 +52,10 @@ camel.component.aws-eks.region={{env:AWS_REGION}} camel.component.aws-sqs.access-key={{env:AWS_ACCESS_KEY}} camel.component.aws-sqs.secret-key={{env:AWS_SECRET_KEY}} camel.component.aws-sqs.region={{env:AWS_REGION}} + +# +# Camel :: AWS KMS +# +camel.component.aws-kms.access-key={{env:AWS_ACCESS_KEY}} +camel.component.aws-kms.secret-key={{env:AWS_SECRET_KEY}} +camel.component.aws-kms.region={{env:AWS_REGION}} diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml index 8ae8e05..0c37339 100644 --- a/poms/bom-deployment/pom.xml +++ b/poms/bom-deployment/pom.xml @@ -333,6 +333,11 @@ <artifactId>camel-quarkus-xslt-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws-kms-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> </dependencies> </dependencyManagement> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index f7fe4c3..a776e2a 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -66,6 +66,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-aws-kms</artifactId> + <version>${camel.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-aws-s3</artifactId> <version>${camel.version}</version> </dependency> @@ -670,6 +675,11 @@ <artifactId>xalan</artifactId> <version>${xalan.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-aws-kms</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> </dependencies> </dependencyManagement>