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.git
commit 0affeef1bf9e93de7c0004c15a9575578f64f43f Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Fri Mar 12 15:09:21 2021 +0100 CAMEL-16323 - Create a Camel-AWS-Secret-Manager component --- .../camel-aws/camel-aws-secrets-manager/pom.xml | 71 ++++ .../SecretsManagerComponentConfigurer.java | 136 ++++++ .../SecretsManagerEndpointConfigurer.java | 120 ++++++ .../SecretsManagerEndpointUriFactory.java | 77 ++++ .../services/org/apache/camel/component.properties | 7 + .../org/apache/camel/component/aws-secrets-manaer | 2 + .../org/apache/camel/component/aws-secrets-manager | 2 + .../camel/configurer/aws-secrets-manager-component | 2 + .../camel/configurer/aws-secrets-manager-endpoint | 2 + .../camel/urifactory/aws-secrets-manager-endpoint | 2 + .../aws/secretsmanager/aws-secrets-manager.json | 57 +++ .../src/main/docs/aws2-ecs-component.adoc | 186 +++++++++ .../secretsmanager/SecretsManagerComponent.java | 68 +++ .../SecretsManagerConfiguration.java | 205 +++++++++ .../secretsmanager/SecretsManagerConstants.java | 25 ++ .../aws/secretsmanager/SecretsManagerEndpoint.java | 136 ++++++ .../secretsmanager/SecretsManagerOperations.java | 22 + .../aws/secretsmanager/SecretsManagerProducer.java | 122 ++++++ .../SecretsManagerProducerIntegrationTest.java | 63 +++ .../src/test/resources/log4j2.properties | 28 ++ core/camel-allcomponents/pom.xml | 4 + .../component/ComponentsBuilderFactory.java | 13 + .../AwsSecretsManagerComponentBuilderFactory.java | 349 ++++++++++++++++ .../src/generated/resources/metadata.json | 22 + .../builder/endpoint/EndpointBuilderFactory.java | 1 + .../camel/builder/endpoint/EndpointBuilders.java | 1 + .../builder/endpoint/StaticEndpointBuilders.java | 43 ++ .../dsl/SecretsManagerEndpointBuilderFactory.java | 463 +++++++++++++++++++++ parent/pom.xml | 5 + 29 files changed, 2234 insertions(+) diff --git a/components/camel-aws/camel-aws-secrets-manager/pom.xml b/components/camel-aws/camel-aws-secrets-manager/pom.xml new file mode 100644 index 0000000..9f09640 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/pom.xml @@ -0,0 +1,71 @@ +<?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-aws-parent</artifactId> + <version>3.9.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-aws-secrets-manager</artifactId> + <packaging>jar</packaging> + + <name>Camel :: AWS2 Secrets Manager</name> + <description>A Camel Amazon Secrets Manager Web Service Component</description> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-support</artifactId> + </dependency> + <dependency> + <groupId>software.amazon.awssdk</groupId> + <artifactId>secretsmanager</artifactId> + <version>${aws-java-sdk2-version}</version> + </dependency> + <dependency> + <groupId>software.amazon.awssdk</groupId> + <artifactId>apache-client</artifactId> + <version>${aws-java-sdk2-version}</version> + </dependency> + + <!-- for testing --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-test-spring-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-core-catalog</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerComponentConfigurer.java b/components/camel-aws/camel-aws-secrets-manager/src/generated/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerComponentConfigurer.java new file mode 100644 index 0000000..ae2a635 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/generated/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerComponentConfigurer.java @@ -0,0 +1,136 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.component.aws.secretsmanager; + +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 SecretsManagerComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { + + private org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration getOrCreateConfiguration(SecretsManagerComponent target) { + if (target.getConfiguration() == null) { + target.setConfiguration(new org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration()); + } + return target.getConfiguration(); + } + + @Override + public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { + SecretsManagerComponent target = (SecretsManagerComponent) obj; + switch (ignoreCase ? name.toLowerCase() : name) { + case "accesskey": + case "accessKey": getOrCreateConfiguration(target).setAccessKey(property(camelContext, java.lang.String.class, value)); return true; + case "autowiredenabled": + case "autowiredEnabled": target.setAutowiredEnabled(property(camelContext, boolean.class, value)); return true; + case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration.class, value)); return true; + case "lazystartproducer": + case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; + case "operation": getOrCreateConfiguration(target).setOperation(property(camelContext, org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations.class, value)); return true; + case "overrideendpoint": + case "overrideEndpoint": getOrCreateConfiguration(target).setOverrideEndpoint(property(camelContext, boolean.class, value)); return true; + case "pojorequest": + case "pojoRequest": getOrCreateConfiguration(target).setPojoRequest(property(camelContext, boolean.class, value)); return true; + case "proxyhost": + case "proxyHost": getOrCreateConfiguration(target).setProxyHost(property(camelContext, java.lang.String.class, value)); return true; + case "proxyport": + case "proxyPort": getOrCreateConfiguration(target).setProxyPort(property(camelContext, java.lang.Integer.class, value)); return true; + case "proxyprotocol": + case "proxyProtocol": getOrCreateConfiguration(target).setProxyProtocol(property(camelContext, software.amazon.awssdk.core.Protocol.class, value)); return true; + case "region": getOrCreateConfiguration(target).setRegion(property(camelContext, java.lang.String.class, value)); return true; + case "secretkey": + case "secretKey": getOrCreateConfiguration(target).setSecretKey(property(camelContext, java.lang.String.class, value)); return true; + case "secretsmanagerclient": + case "secretsManagerClient": getOrCreateConfiguration(target).setSecretsManagerClient(property(camelContext, software.amazon.awssdk.services.secretsmanager.SecretsManagerClient.class, value)); return true; + case "trustallcertificates": + case "trustAllCertificates": getOrCreateConfiguration(target).setTrustAllCertificates(property(camelContext, boolean.class, value)); return true; + case "uriendpointoverride": + case "uriEndpointOverride": getOrCreateConfiguration(target).setUriEndpointOverride(property(camelContext, java.lang.String.class, value)); return true; + default: return false; + } + } + + @Override + public String[] getAutowiredNames() { + return new String[]{"secretsManagerClient"}; + } + + @Override + public Class<?> getOptionType(String name, boolean ignoreCase) { + switch (ignoreCase ? name.toLowerCase() : name) { + case "accesskey": + case "accessKey": return java.lang.String.class; + case "autowiredenabled": + case "autowiredEnabled": return boolean.class; + case "configuration": return org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration.class; + case "lazystartproducer": + case "lazyStartProducer": return boolean.class; + case "operation": return org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations.class; + case "overrideendpoint": + case "overrideEndpoint": return boolean.class; + case "pojorequest": + case "pojoRequest": return boolean.class; + case "proxyhost": + case "proxyHost": return java.lang.String.class; + case "proxyport": + case "proxyPort": return java.lang.Integer.class; + case "proxyprotocol": + case "proxyProtocol": return software.amazon.awssdk.core.Protocol.class; + case "region": return java.lang.String.class; + case "secretkey": + case "secretKey": return java.lang.String.class; + case "secretsmanagerclient": + case "secretsManagerClient": return software.amazon.awssdk.services.secretsmanager.SecretsManagerClient.class; + case "trustallcertificates": + case "trustAllCertificates": return boolean.class; + case "uriendpointoverride": + case "uriEndpointOverride": return java.lang.String.class; + default: return null; + } + } + + @Override + public Object getOptionValue(Object obj, String name, boolean ignoreCase) { + SecretsManagerComponent target = (SecretsManagerComponent) obj; + switch (ignoreCase ? name.toLowerCase() : name) { + case "accesskey": + case "accessKey": return getOrCreateConfiguration(target).getAccessKey(); + case "autowiredenabled": + case "autowiredEnabled": return target.isAutowiredEnabled(); + case "configuration": return target.getConfiguration(); + case "lazystartproducer": + case "lazyStartProducer": return target.isLazyStartProducer(); + case "operation": return getOrCreateConfiguration(target).getOperation(); + case "overrideendpoint": + case "overrideEndpoint": return getOrCreateConfiguration(target).isOverrideEndpoint(); + case "pojorequest": + case "pojoRequest": return getOrCreateConfiguration(target).isPojoRequest(); + case "proxyhost": + case "proxyHost": return getOrCreateConfiguration(target).getProxyHost(); + case "proxyport": + case "proxyPort": return getOrCreateConfiguration(target).getProxyPort(); + case "proxyprotocol": + case "proxyProtocol": return getOrCreateConfiguration(target).getProxyProtocol(); + case "region": return getOrCreateConfiguration(target).getRegion(); + case "secretkey": + case "secretKey": return getOrCreateConfiguration(target).getSecretKey(); + case "secretsmanagerclient": + case "secretsManagerClient": return getOrCreateConfiguration(target).getSecretsManagerClient(); + case "trustallcertificates": + case "trustAllCertificates": return getOrCreateConfiguration(target).isTrustAllCertificates(); + case "uriendpointoverride": + case "uriEndpointOverride": return getOrCreateConfiguration(target).getUriEndpointOverride(); + default: return null; + } + } +} + diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpointConfigurer.java b/components/camel-aws/camel-aws-secrets-manager/src/generated/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpointConfigurer.java new file mode 100644 index 0000000..fd0a0e3 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/generated/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpointConfigurer.java @@ -0,0 +1,120 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.component.aws.secretsmanager; + +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 SecretsManagerEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { + + @Override + public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { + SecretsManagerEndpoint target = (SecretsManagerEndpoint) obj; + switch (ignoreCase ? name.toLowerCase() : name) { + case "accesskey": + case "accessKey": target.getConfiguration().setAccessKey(property(camelContext, java.lang.String.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.aws.secretsmanager.SecretsManagerOperations.class, value)); return true; + case "overrideendpoint": + case "overrideEndpoint": target.getConfiguration().setOverrideEndpoint(property(camelContext, boolean.class, value)); return true; + case "pojorequest": + case "pojoRequest": target.getConfiguration().setPojoRequest(property(camelContext, boolean.class, value)); return true; + case "proxyhost": + case "proxyHost": target.getConfiguration().setProxyHost(property(camelContext, java.lang.String.class, value)); return true; + case "proxyport": + case "proxyPort": target.getConfiguration().setProxyPort(property(camelContext, java.lang.Integer.class, value)); return true; + case "proxyprotocol": + case "proxyProtocol": target.getConfiguration().setProxyProtocol(property(camelContext, software.amazon.awssdk.core.Protocol.class, value)); return true; + case "region": target.getConfiguration().setRegion(property(camelContext, java.lang.String.class, value)); return true; + case "secretkey": + case "secretKey": target.getConfiguration().setSecretKey(property(camelContext, java.lang.String.class, value)); return true; + case "secretsmanagerclient": + case "secretsManagerClient": target.getConfiguration().setSecretsManagerClient(property(camelContext, software.amazon.awssdk.services.secretsmanager.SecretsManagerClient.class, value)); return true; + case "trustallcertificates": + case "trustAllCertificates": target.getConfiguration().setTrustAllCertificates(property(camelContext, boolean.class, value)); return true; + case "uriendpointoverride": + case "uriEndpointOverride": target.getConfiguration().setUriEndpointOverride(property(camelContext, java.lang.String.class, value)); return true; + default: return false; + } + } + + @Override + public String[] getAutowiredNames() { + return new String[]{"secretsManagerClient"}; + } + + @Override + public Class<?> getOptionType(String name, boolean ignoreCase) { + switch (ignoreCase ? name.toLowerCase() : name) { + case "accesskey": + case "accessKey": return java.lang.String.class; + case "lazystartproducer": + case "lazyStartProducer": return boolean.class; + case "operation": return org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations.class; + case "overrideendpoint": + case "overrideEndpoint": return boolean.class; + case "pojorequest": + case "pojoRequest": return boolean.class; + case "proxyhost": + case "proxyHost": return java.lang.String.class; + case "proxyport": + case "proxyPort": return java.lang.Integer.class; + case "proxyprotocol": + case "proxyProtocol": return software.amazon.awssdk.core.Protocol.class; + case "region": return java.lang.String.class; + case "secretkey": + case "secretKey": return java.lang.String.class; + case "secretsmanagerclient": + case "secretsManagerClient": return software.amazon.awssdk.services.secretsmanager.SecretsManagerClient.class; + case "trustallcertificates": + case "trustAllCertificates": return boolean.class; + case "uriendpointoverride": + case "uriEndpointOverride": return java.lang.String.class; + default: return null; + } + } + + @Override + public Object getOptionValue(Object obj, String name, boolean ignoreCase) { + SecretsManagerEndpoint target = (SecretsManagerEndpoint) obj; + switch (ignoreCase ? name.toLowerCase() : name) { + case "accesskey": + case "accessKey": return target.getConfiguration().getAccessKey(); + case "lazystartproducer": + case "lazyStartProducer": return target.isLazyStartProducer(); + case "operation": return target.getConfiguration().getOperation(); + case "overrideendpoint": + case "overrideEndpoint": return target.getConfiguration().isOverrideEndpoint(); + case "pojorequest": + case "pojoRequest": return target.getConfiguration().isPojoRequest(); + case "proxyhost": + case "proxyHost": return target.getConfiguration().getProxyHost(); + case "proxyport": + case "proxyPort": return target.getConfiguration().getProxyPort(); + case "proxyprotocol": + case "proxyProtocol": return target.getConfiguration().getProxyProtocol(); + case "region": return target.getConfiguration().getRegion(); + case "secretkey": + case "secretKey": return target.getConfiguration().getSecretKey(); + case "secretsmanagerclient": + case "secretsManagerClient": return target.getConfiguration().getSecretsManagerClient(); + case "trustallcertificates": + case "trustAllCertificates": return target.getConfiguration().isTrustAllCertificates(); + case "uriendpointoverride": + case "uriEndpointOverride": return target.getConfiguration().getUriEndpointOverride(); + default: return null; + } + } +} + diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpointUriFactory.java b/components/camel-aws/camel-aws-secrets-manager/src/generated/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpointUriFactory.java new file mode 100644 index 0000000..95a3253 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/generated/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpointUriFactory.java @@ -0,0 +1,77 @@ +/* Generated by camel build tools - do NOT edit this file! */ +package org.apache.camel.component.aws.secretsmanager; + +import java.net.URISyntaxException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.camel.spi.EndpointUriFactory; + +/** + * Generated by camel build tools - do NOT edit this file! + */ +public class SecretsManagerEndpointUriFactory extends org.apache.camel.support.component.EndpointUriFactorySupport implements EndpointUriFactory { + + private static final String BASE = "://label"; + + private static final Set<String> PROPERTY_NAMES; + private static final Set<String> SECRET_PROPERTY_NAMES; + static { + Set<String> props = new HashSet<>(14); + props.add("proxyProtocol"); + props.add("secretKey"); + props.add("uriEndpointOverride"); + props.add("label"); + props.add("pojoRequest"); + props.add("proxyHost"); + props.add("trustAllCertificates"); + props.add("proxyPort"); + props.add("secretsManagerClient"); + props.add("lazyStartProducer"); + props.add("accessKey"); + props.add("overrideEndpoint"); + props.add("region"); + props.add("operation"); + PROPERTY_NAMES = Collections.unmodifiableSet(props); + Set<String> secretProps = new HashSet<>(2); + secretProps.add("secretKey"); + secretProps.add("accessKey"); + SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps); + } + + @Override + public boolean isEnabled(String scheme) { + return "aws-secrets-manager".equals(scheme); + } + + @Override + public String buildUri(String scheme, Map<String, Object> properties, boolean encode) throws URISyntaxException { + String syntax = scheme + BASE; + String uri = syntax; + + Map<String, Object> copy = new HashMap<>(properties); + + uri = buildPathParameter(syntax, uri, "label", null, true, copy); + uri = buildQueryParameters(uri, copy, encode); + return uri; + } + + @Override + public Set<String> propertyNames() { + return PROPERTY_NAMES; + } + + @Override + public Set<String> secretPropertyNames() { + return SECRET_PROPERTY_NAMES; + } + + @Override + public boolean isLenientProperties() { + return false; + } +} + diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component.properties b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component.properties new file mode 100644 index 0000000..e2f3a2f --- /dev/null +++ b/components/camel-aws/camel-aws-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=aws-secrets-manaer aws-secrets-manager +groupId=org.apache.camel +artifactId=camel-aws-secrets-manager +version=3.9.0-SNAPSHOT +projectName=Camel :: AWS2 Secrets Manager +projectDescription=A Camel Amazon Secrets Manager Web Service Component diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component/aws-secrets-manaer b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component/aws-secrets-manaer new file mode 100644 index 0000000..00a77d0 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component/aws-secrets-manaer @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.aws.secretsmanager.SecretsManagerComponent diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component/aws-secrets-manager b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component/aws-secrets-manager new file mode 100644 index 0000000..00a77d0 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/component/aws-secrets-manager @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.aws.secretsmanager.SecretsManagerComponent diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-secrets-manager-component b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-secrets-manager-component new file mode 100644 index 0000000..0caed46 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-secrets-manager-component @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.aws.secretsmanager.SecretsManagerComponentConfigurer diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-secrets-manager-endpoint b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-secrets-manager-endpoint new file mode 100644 index 0000000..9c268fb --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/configurer/aws-secrets-manager-endpoint @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.aws.secretsmanager.SecretsManagerEndpointConfigurer diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/urifactory/aws-secrets-manager-endpoint b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/urifactory/aws-secrets-manager-endpoint new file mode 100644 index 0000000..8e9a510 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/META-INF/services/org/apache/camel/urifactory/aws-secrets-manager-endpoint @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.aws.secretsmanager.SecretsManagerEndpointUriFactory diff --git a/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/org/apache/camel/component/aws/secretsmanager/aws-secrets-manager.json b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/org/apache/camel/component/aws/secretsmanager/aws-secrets-manager.json new file mode 100644 index 0000000..441fa71 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/generated/resources/org/apache/camel/component/aws/secretsmanager/aws-secrets-manager.json @@ -0,0 +1,57 @@ +{ + "component": { + "kind": "component", + "name": "aws-secrets-manager", + "title": "AWS Secrets Manager", + "description": "Manage AWS Secrets Manager services using AWS SDK version 2.x.", + "deprecated": false, + "firstVersion": "3.9.0", + "label": "cloud,management", + "javaType": "org.apache.camel.component.aws.secretsmanager.SecretsManagerComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-aws-secrets-manager", + "version": "3.9.0-SNAPSHOT", + "scheme": "aws-secrets-manager", + "extendsScheme": "", + "syntax": "aws-secrets-manager:\/\/label", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false + }, + "componentProperties": { + "configuration": { "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "Component configuration" }, + "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 [...] + "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations", "enum": [ "listSecrets" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "The ope [...] + "overrideEndpoint": { "kind": "property", "displayName": "Override Endpoint", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Set the need for overidding the endpoint. This option needs to be used in combin [...] + "pojoRequest": { "kind": "property", "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.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" }, + "proxyHost": { "kind": "property", "displayName": "Proxy Host", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the ECS client" }, + "proxyPort": { "kind": "property", "displayName": "Proxy Port", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the ECS client" }, + "proxyProtocol": { "kind": "property", "displayName": "Proxy Protocol", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.core.Protocol", "enum": [ "HTTP", "HTTPS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "HTTPS", "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "To define a proxy protocol [...] + "region": { "kind": "property", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "The region in which ECS client needs to work. When using this parameter, the configuration will expect the lowercase [...] + "secretsManagerClient": { "kind": "property", "displayName": "Secrets Manager Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.secretsmanager.SecretsManagerClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "To use a exis [...] + "trustAllCertificates": { "kind": "property", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" }, + "uriEndpointOverride": { "kind": "property", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overri [...] + "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 [...] + "accessKey": { "kind": "property", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Amazon AWS Access Key" }, + "secretKey": { "kind": "property", "displayName": "Secret Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" } + }, + "properties": { + "label": { "kind": "path", "displayName": "Label", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Logical name" }, + "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": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations", "enum": [ "listSecrets" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "The op [...] + "overrideEndpoint": { "kind": "parameter", "displayName": "Override Endpoint", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Set the need for overidding the endpoint. This option needs to be used in combi [...] + "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.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" }, + "proxyHost": { "kind": "parameter", "displayName": "Proxy Host", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the ECS client" }, + "proxyPort": { "kind": "parameter", "displayName": "Proxy Port", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the ECS client" }, + "proxyProtocol": { "kind": "parameter", "displayName": "Proxy Protocol", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.core.Protocol", "enum": [ "HTTP", "HTTPS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "HTTPS", "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "To define a proxy protocol [...] + "region": { "kind": "parameter", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "The region in which ECS client needs to work. When using this parameter, the configuration will expect the lowercas [...] + "secretsManagerClient": { "kind": "parameter", "displayName": "Secrets Manager Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.secretsmanager.SecretsManagerClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "To use a exi [...] + "trustAllCertificates": { "kind": "parameter", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" }, + "uriEndpointOverride": { "kind": "parameter", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overr [...] + "accessKey": { "kind": "parameter", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Amazon AWS Access Key" }, + "secretKey": { "kind": "parameter", "displayName": "Secret Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" } + } +} diff --git a/components/camel-aws/camel-aws-secrets-manager/src/main/docs/aws2-ecs-component.adoc b/components/camel-aws/camel-aws-secrets-manager/src/main/docs/aws2-ecs-component.adoc new file mode 100644 index 0000000..158a98e --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/main/docs/aws2-ecs-component.adoc @@ -0,0 +1,186 @@ +[[aws2-ecs-component]] += AWS 2 Elastic Container Service (ECS) Component +:docTitle: AWS 2 Elastic Container Service (ECS) +:artifactId: camel-aws2-ecs +:description: Manage AWS ECS cluster instances using AWS SDK version 2.x. +:since: 3.1 +:supportLevel: Stable +:component-header: Only producer is supported +include::{cq-version}@camel-quarkus:ROOT:partial$reference/components/aws2-ecs.adoc[opts=optional] +//Manually maintained attributes +:group: AWS 2 + +*Since Camel {since}* + +*{component-header}* + +The AWS2 ECS component supports create, delete, describe and list clusters +https://aws.amazon.com/ecs/[AWS ECS] clusters instances. + +Prerequisites + +You must have a valid Amazon Web Services developer account, and be +signed up to use Amazon ECS. More information is available at +https://aws.amazon.com/ecs/[Amazon ECS]. + +[NOTE] +==== +The AWS2 ECS component is not supported in OSGI +==== + +== URI Format + +[source,java] +------------------------- +aws2-ecs://label[?options] +------------------------- + +You can append query options to the URI in the following format, +?options=value&option2=value&... + +== URI Options + + +// component options: START +The AWS 2 Elastic Container Service (ECS) component supports 15 options, which are listed below. + + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *configuration* (producer) | Component configuration | | ECS2Configuration +| *ecsClient* (producer) | *Autowired* To use a existing configured AWS ECS as client | | EcsClient +| *lazyStartProducer* (producer) | 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 starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] +| *operation* (producer) | *Required* The operation to perform. There are 4 enums and the value can be one of: listClusters, describeCluster, createCluster, deleteCluster | | ECS2Operations +| *overrideEndpoint* (producer) | Set the need for overidding the endpoint. This option needs to be used in combination with uriEndpointOverride option | false | boolean +| *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean +| *proxyHost* (producer) | To define a proxy host when instantiating the ECS client | | String +| *proxyPort* (producer) | To define a proxy port when instantiating the ECS client | | Integer +| *proxyProtocol* (producer) | To define a proxy protocol when instantiating the ECS client. There are 2 enums and the value can be one of: HTTP, HTTPS | HTTPS | Protocol +| *region* (producer) | The region in which ECS client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example ap-east-1) You'll need to use the name Region.EU_WEST_1.id() | | String +| *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean +| *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *autowiredEnabled* (advanced) | 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 then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean +| *accessKey* (security) | Amazon AWS Access Key | | String +| *secretKey* (security) | Amazon AWS Secret Key | | String +|=== +// component options: END + + + + +// endpoint options: START +The AWS 2 Elastic Container Service (ECS) endpoint is configured using URI syntax: + +---- +aws2-ecs:label +---- + +with the following path and query parameters: + +=== Path Parameters (1 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *label* | *Required* Logical name | | String +|=== + + +=== Query Parameters (13 parameters): + + +[width="100%",cols="2,5,^1,2",options="header"] +|=== +| Name | Description | Default | Type +| *ecsClient* (producer) | *Autowired* To use a existing configured AWS ECS as client | | EcsClient +| *lazyStartProducer* (producer) | 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 starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] +| *operation* (producer) | *Required* The operation to perform. There are 4 enums and the value can be one of: listClusters, describeCluster, createCluster, deleteCluster | | ECS2Operations +| *overrideEndpoint* (producer) | Set the need for overidding the endpoint. This option needs to be used in combination with uriEndpointOverride option | false | boolean +| *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean +| *proxyHost* (producer) | To define a proxy host when instantiating the ECS client | | String +| *proxyPort* (producer) | To define a proxy port when instantiating the ECS client | | Integer +| *proxyProtocol* (producer) | To define a proxy protocol when instantiating the ECS client. There are 2 enums and the value can be one of: HTTP, HTTPS | HTTPS | Protocol +| *region* (producer) | The region in which ECS client needs to work. When using this parameter, the configuration will expect the lowercase name of the region (for example ap-east-1) You'll need to use the name Region.EU_WEST_1.id() | | String +| *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean +| *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option | | String +| *accessKey* (security) | Amazon AWS Access Key | | String +| *secretKey* (security) | Amazon AWS Secret Key | | String +|=== +// endpoint options: END + + + +Required ECS component options + +You have to provide the amazonECSClient in the +Registry or your accessKey and secretKey to access +the https://aws.amazon.com/ecs/[Amazon ECS] service. + +== Usage + +=== Message headers evaluated by the ECS producer + +[width="100%",cols="10%,10%,80%",options="header",] +|======================================================================= +|Header |Type |Description + +|`CamelAwsECSMaxResults` |`Integer` |The limit number of results while listing clusters + +|`CamelAwsECSOperation` |`String` |The operation we want to perform + +|`CamelAwsECSClusterName` |`String` |The cluster name +|======================================================================= + +=== ECS Producer operations + +Camel-AWS ECS component provides the following operation on the producer side: + +- listClusters +- createCluster +- describeCluster +- deleteCluster + +== Producer Examples + +- listClusters: this operation will list the available clusters in ECS + +[source,java] +-------------------------------------------------------------------------------- +from("direct:listClusters") + .to("aws2-ecs://test?ecsClient=#amazonEcsClient&operation=listClusters") +-------------------------------------------------------------------------------- + +== Using a POJO as body + +Sometimes build an AWS Request can be complex, because of multiple options. We introduce the possibility to use a POJO as body. +In AWS ECS there are multiple operations you can submit, as an example for List cluster request, you can do something like: + +------------------------------------------------------------------------------------------------------ +from("direct:start") + .setBody(ListClustersRequest.builder().maxResults(10).build()) + .to("aws2-ecs://test?ecsClient=#amazonEcsClient&operation=listClusters&pojoRequest=true") +------------------------------------------------------------------------------------------------------ + +In this way you'll pass the request directly without the need of passing headers and options specifically related to this operation. + +== Dependencies + +Maven users will need to add the following dependency to their pom.xml. + +*pom.xml* + +[source,xml] +--------------------------------------- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-aws2-ecs</artifactId> + <version>${camel-version}</version> +</dependency> +--------------------------------------- + +where `$\{camel-version}` must be replaced by the actual version of Camel. + +include::camel-spring-boot::page$aws2-ecs-starter.adoc[] diff --git a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerComponent.java b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerComponent.java new file mode 100644 index 0000000..a9e11e6 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerComponent.java @@ -0,0 +1,68 @@ +/* + * 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.aws.secretsmanager; + +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; + +/** + * For working with Amazon Secrets Manager SDK v2. + */ +@Component("aws-secrets-manager") +public class SecretsManagerComponent extends DefaultComponent { + + @Metadata + private SecretsManagerConfiguration configuration = new SecretsManagerConfiguration(); + + public SecretsManagerComponent() { + this(null); + } + + public SecretsManagerComponent(CamelContext context) { + super(context); + } + + @Override + protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { + SecretsManagerConfiguration configuration + = this.configuration != null ? this.configuration.copy() : new SecretsManagerConfiguration(); + SecretsManagerEndpoint endpoint = new SecretsManagerEndpoint(uri, this, configuration); + setProperties(endpoint, parameters); + if (configuration.getSecretsManagerClient() == null + && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) { + throw new IllegalArgumentException("Amazon Secrets Manager client or accessKey and secretKey must be specified"); + } + + return endpoint; + } + + public SecretsManagerConfiguration getConfiguration() { + return configuration; + } + + /** + * Component configuration + */ + public void setConfiguration(SecretsManagerConfiguration configuration) { + this.configuration = configuration; + } +} diff --git a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerConfiguration.java b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerConfiguration.java new file mode 100644 index 0000000..5feb5b1 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerConfiguration.java @@ -0,0 +1,205 @@ +/* + * 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.aws.secretsmanager; + +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; +import software.amazon.awssdk.core.Protocol; +import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; + +@UriParams +public class SecretsManagerConfiguration implements Cloneable { + + @UriPath(description = "Logical name") + @Metadata(required = true) + private String label; + @UriParam + @Metadata(autowired = true) + private SecretsManagerClient secretsManagerClient; + @UriParam(label = "security", secret = true) + private String accessKey; + @UriParam(label = "security", secret = true) + private String secretKey; + @UriParam + @Metadata(required = true) + private SecretsManagerOperations operation; + @UriParam(enums = "HTTP,HTTPS", defaultValue = "HTTPS") + private Protocol proxyProtocol = Protocol.HTTPS; + @UriParam + private String proxyHost; + @UriParam + private Integer proxyPort; + @UriParam + private String region; + @UriParam(defaultValue = "false") + private boolean pojoRequest; + @UriParam(defaultValue = "false") + private boolean trustAllCertificates; + @UriParam(defaultValue = "false") + private boolean overrideEndpoint; + @UriParam + private String uriEndpointOverride; + + public SecretsManagerClient getSecretsManagerClient() { + return secretsManagerClient; + } + + /** + * To use a existing configured AWS Secrets Manager as client + */ + public void setSecretsManagerClient(SecretsManagerClient secretsManagerClient) { + this.secretsManagerClient = secretsManagerClient; + } + + public String getAccessKey() { + return accessKey; + } + + /** + * Amazon AWS Access Key + */ + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public String getSecretKey() { + return secretKey; + } + + /** + * Amazon AWS Secret Key + */ + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public SecretsManagerOperations getOperation() { + return operation; + } + + /** + * The operation to perform + */ + public void setOperation(SecretsManagerOperations operation) { + this.operation = operation; + } + + public Protocol getProxyProtocol() { + return proxyProtocol; + } + + /** + * To define a proxy protocol when instantiating the ECS client + */ + public void setProxyProtocol(Protocol proxyProtocol) { + this.proxyProtocol = proxyProtocol; + } + + public String getProxyHost() { + return proxyHost; + } + + /** + * To define a proxy host when instantiating the ECS client + */ + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + public Integer getProxyPort() { + return proxyPort; + } + + /** + * To define a proxy port when instantiating the ECS client + */ + public void setProxyPort(Integer proxyPort) { + this.proxyPort = proxyPort; + } + + public String getRegion() { + return region; + } + + /** + * The region in which ECS client needs to work. When using this parameter, the configuration will expect the + * lowercase name of the region (for example ap-east-1) You'll need to use the name Region.EU_WEST_1.id() + */ + public void setRegion(String region) { + this.region = region; + } + + public boolean isPojoRequest() { + return pojoRequest; + } + + /** + * If we want to use a POJO request as body or not + */ + public void setPojoRequest(boolean pojoRequest) { + this.pojoRequest = pojoRequest; + } + + public boolean isTrustAllCertificates() { + return trustAllCertificates; + } + + /** + * If we want to trust all certificates in case of overriding the endpoint + */ + public void setTrustAllCertificates(boolean trustAllCertificates) { + this.trustAllCertificates = trustAllCertificates; + } + + public boolean isOverrideEndpoint() { + return overrideEndpoint; + } + + /** + * Set the need for overidding the endpoint. This option needs to be used in combination with uriEndpointOverride + * option + */ + public void setOverrideEndpoint(boolean overrideEndpoint) { + this.overrideEndpoint = overrideEndpoint; + } + + public String getUriEndpointOverride() { + return uriEndpointOverride; + } + + /** + * Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option + */ + public void setUriEndpointOverride(String uriEndpointOverride) { + this.uriEndpointOverride = uriEndpointOverride; + } + + // ************************************************* + // + // ************************************************* + + public SecretsManagerConfiguration copy() { + try { + return (SecretsManagerConfiguration) super.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeCamelException(e); + } + } +} diff --git a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerConstants.java b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerConstants.java new file mode 100644 index 0000000..ed0b00c --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerConstants.java @@ -0,0 +1,25 @@ +/* + * 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.aws.secretsmanager; + +/** + * Constants used in Camel AWS Secrets Manager module + */ +public interface SecretsManagerConstants { + String OPERATION = "CamelAwsSecretsManagerOperation"; + String MAX_RESULTS = "CamelAwsSecretsManagerMaxResults"; +} diff --git a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpoint.java b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpoint.java new file mode 100644 index 0000000..619f7b3 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerEndpoint.java @@ -0,0 +1,136 @@ +/* + * 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.aws.secretsmanager; + +import java.net.URI; + +import org.apache.camel.Category; +import org.apache.camel.Component; +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.ScheduledPollEndpoint; +import org.apache.camel.util.ObjectHelper; +import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; +import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; +import software.amazon.awssdk.http.SdkHttpClient; +import software.amazon.awssdk.http.SdkHttpConfigurationOption; +import software.amazon.awssdk.http.apache.ApacheHttpClient; +import software.amazon.awssdk.http.apache.ProxyConfiguration; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; +import software.amazon.awssdk.services.secretsmanager.SecretsManagerClientBuilder; +import software.amazon.awssdk.utils.AttributeMap; + +/** + * Manage AWS Secrets Manager services using AWS SDK version 2.x. + */ +@UriEndpoint(firstVersion = "3.9.0", scheme = "aws-secrets-manager", title = "AWS Secrets Manager", + syntax = "aws-secrets-manager://label", producerOnly = true, category = { Category.CLOUD, Category.MANAGEMENT }) +public class SecretsManagerEndpoint extends ScheduledPollEndpoint { + + private SecretsManagerClient secretsManagerClient; + + @UriParam + private SecretsManagerConfiguration configuration; + + public SecretsManagerEndpoint(String uri, Component component, SecretsManagerConfiguration configuration) { + super(uri, component); + this.configuration = configuration; + } + + @Override + public Consumer createConsumer(Processor processor) throws Exception { + throw new UnsupportedOperationException("You cannot receive messages from this endpoint"); + } + + @Override + public Producer createProducer() throws Exception { + return new SecretsManagerProducer(this); + } + + @Override + public void doStart() throws Exception { + super.doStart(); + + secretsManagerClient = configuration.getSecretsManagerClient() != null + ? configuration.getSecretsManagerClient() : createSecretsManagerClient(); + } + + @Override + public void doStop() throws Exception { + if (ObjectHelper.isEmpty(configuration.getSecretsManagerClient())) { + if (secretsManagerClient != null) { + secretsManagerClient.close(); + } + } + super.doStop(); + } + + public SecretsManagerConfiguration getConfiguration() { + return configuration; + } + + public SecretsManagerClient getSecretsManagerClient() { + return secretsManagerClient; + } + + SecretsManagerClient createSecretsManagerClient() { + SecretsManagerClient client = null; + SecretsManagerClientBuilder clientBuilder = SecretsManagerClient.builder(); + ProxyConfiguration.Builder proxyConfig = null; + ApacheHttpClient.Builder httpClientBuilder = null; + boolean isClientConfigFound = false; + if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) { + proxyConfig = ProxyConfiguration.builder(); + URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":" + + configuration.getProxyPort()); + proxyConfig.endpoint(proxyEndpoint); + httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build()); + isClientConfigFound = true; + } + if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) { + AwsBasicCredentials cred = AwsBasicCredentials.create(configuration.getAccessKey(), configuration.getSecretKey()); + if (isClientConfigFound) { + clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder) + .credentialsProvider(StaticCredentialsProvider.create(cred)); + } else { + clientBuilder = clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred)); + } + } else { + if (!isClientConfigFound) { + clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder); + } + } + if (ObjectHelper.isNotEmpty(configuration.getRegion())) { + clientBuilder = clientBuilder.region(Region.of(configuration.getRegion())); + } + if (configuration.isTrustAllCertificates()) { + SdkHttpClient ahc = ApacheHttpClient.builder().buildWithDefaults(AttributeMap + .builder() + .put( + SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES, + Boolean.TRUE) + .build()); + clientBuilder.httpClient(ahc); + } + client = clientBuilder.build(); + return client; + } +} diff --git a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerOperations.java b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerOperations.java new file mode 100644 index 0000000..7daf9bd --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerOperations.java @@ -0,0 +1,22 @@ +/* + * 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.aws.secretsmanager; + +public enum SecretsManagerOperations { + + listSecrets +} diff --git a/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerProducer.java b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerProducer.java new file mode 100644 index 0000000..9142d59 --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/main/java/org/apache/camel/component/aws/secretsmanager/SecretsManagerProducer.java @@ -0,0 +1,122 @@ +/* + * 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.aws.secretsmanager; + +import org.apache.camel.Endpoint; +import org.apache.camel.Exchange; +import org.apache.camel.InvalidPayloadException; +import org.apache.camel.Message; +import org.apache.camel.support.DefaultProducer; +import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import software.amazon.awssdk.awscore.exception.AwsServiceException; +import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient; +import software.amazon.awssdk.services.secretsmanager.model.ListSecretsRequest; +import software.amazon.awssdk.services.secretsmanager.model.ListSecretsRequest.Builder; +import software.amazon.awssdk.services.secretsmanager.model.ListSecretsResponse; + +/** + * A Producer which sends messages to the Amazon Secrets Manager Service SDK v2 + * <a href="http://aws.amazon.com/secrets-manager/">AWS ECS</a> + */ +public class SecretsManagerProducer extends DefaultProducer { + + private static final Logger LOG = LoggerFactory.getLogger(SecretsManagerProducer.class); + + private transient String ecsProducerToString; + + public SecretsManagerProducer(Endpoint endpoint) { + super(endpoint); + } + + @Override + public void process(Exchange exchange) throws Exception { + switch (determineOperation(exchange)) { + case listSecrets: + listSecrets(getEndpoint().getSecretsManagerClient(), exchange); + break; + default: + throw new IllegalArgumentException("Unsupported operation"); + } + } + + private SecretsManagerOperations determineOperation(Exchange exchange) { + SecretsManagerOperations operation + = exchange.getIn().getHeader(SecretsManagerConstants.OPERATION, SecretsManagerOperations.class); + if (operation == null) { + operation = getConfiguration().getOperation(); + } + return operation; + } + + protected SecretsManagerConfiguration getConfiguration() { + return getEndpoint().getConfiguration(); + } + + @Override + public String toString() { + if (ecsProducerToString == null) { + ecsProducerToString = "SecretsManagerProducer[" + URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]"; + } + return ecsProducerToString; + } + + @Override + public SecretsManagerEndpoint getEndpoint() { + return (SecretsManagerEndpoint) super.getEndpoint(); + } + + private void listSecrets(SecretsManagerClient secretsManagerClient, Exchange exchange) throws InvalidPayloadException { + if (getConfiguration().isPojoRequest()) { + Object payload = exchange.getIn().getMandatoryBody(); + if (payload instanceof ListSecretsRequest) { + ListSecretsResponse result; + try { + ListSecretsRequest request = (ListSecretsRequest) payload; + result = secretsManagerClient.listSecrets(request); + } catch (AwsServiceException ase) { + LOG.trace("List Secrets command returned the error code {}", ase.awsErrorDetails().errorCode()); + throw ase; + } + Message message = getMessageForResponse(exchange); + message.setBody(result); + } + } else { + Builder builder = ListSecretsRequest.builder(); + if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(SecretsManagerConstants.MAX_RESULTS))) { + int maxRes = exchange.getIn().getHeader(SecretsManagerConstants.MAX_RESULTS, Integer.class); + builder.maxResults(maxRes); + } + ListSecretsResponse result; + try { + ListSecretsRequest request = builder.build(); + result = secretsManagerClient.listSecrets(request); + } catch (AwsServiceException ase) { + LOG.trace("List Secrets command returned the error code {}", ase.awsErrorDetails().errorCode()); + throw ase; + } + Message message = getMessageForResponse(exchange); + message.setBody(result); + } + } + + public static Message getMessageForResponse(final Exchange exchange) { + return exchange.getMessage(); + } +} diff --git a/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerProducerIntegrationTest.java b/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerProducerIntegrationTest.java new file mode 100644 index 0000000..c6e0e7a --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/test/java/org/apache/camel/component/aws/secretsmanager/integration/SecretsManagerProducerIntegrationTest.java @@ -0,0 +1,63 @@ +/* + * 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.aws.secretsmanager.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.mock.MockEndpoint; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import software.amazon.awssdk.services.secretsmanager.model.ListSecretsResponse; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@Disabled("This test must be manually started, you need to specify AWS Credentials") +public class SecretsManagerProducerIntegrationTest extends CamelTestSupport { + + @EndpointInject("mock:result") + private MockEndpoint mock; + + @Test + public void translateTextTest() throws Exception { + + mock.expectedMessageCount(1); + Exchange exchange = template.request("direct:listSecrets", new Processor() { + @Override + public void process(Exchange exchange) throws Exception { + exchange.getIn().setBody("Test"); + } + }); + + ListSecretsResponse resultGet = (ListSecretsResponse) exchange.getIn().getBody(); + assertEquals(0, resultGet.secretList().size()); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:listSecrets") + .to("aws-secrets-manager://test?accessKey=RAW(xxxx)&secretKey=RAW(yyyy)®ion=eu-west-1&operation=listSecrets") + .to("mock:result"); + } + }; + } +} diff --git a/components/camel-aws/camel-aws-secrets-manager/src/test/resources/log4j2.properties b/components/camel-aws/camel-aws-secrets-manager/src/test/resources/log4j2.properties new file mode 100644 index 0000000..fef64dd --- /dev/null +++ b/components/camel-aws/camel-aws-secrets-manager/src/test/resources/log4j2.properties @@ -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. +## --------------------------------------------------------------------------- + +appender.file.type = File +appender.file.name = file +appender.file.fileName = target/camel-aws-secrets-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 diff --git a/core/camel-allcomponents/pom.xml b/core/camel-allcomponents/pom.xml index 645fbfe..8109c7d 100644 --- a/core/camel-allcomponents/pom.xml +++ b/core/camel-allcomponents/pom.xml @@ -111,6 +111,10 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-aws-secrets-manager</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-aws-xray</artifactId> </dependency> <dependency> diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java index 0cc66d7..3ff0013 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java @@ -306,6 +306,19 @@ public interface ComponentsBuilderFactory { return org.apache.camel.builder.component.dsl.AvroComponentBuilderFactory.avro(); } /** + * AWS Secrets Manager (camel-aws-secrets-manager) + * Manage AWS Secrets Manager services using AWS SDK version 2.x. + * + * Category: cloud,management + * Since: 3.9 + * Maven coordinates: org.apache.camel:camel-aws-secrets-manager + * + * @return the dsl builder + */ + static org.apache.camel.builder.component.dsl.AwsSecretsManagerComponentBuilderFactory.AwsSecretsManagerComponentBuilder awsSecretsManager() { + return org.apache.camel.builder.component.dsl.AwsSecretsManagerComponentBuilderFactory.awsSecretsManager(); + } + /** * AWS 2 Athena (camel-aws2-athena) * Access AWS Athena service using AWS SDK version 2.x. * diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsSecretsManagerComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsSecretsManagerComponentBuilderFactory.java new file mode 100644 index 0000000..84b2dc6 --- /dev/null +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AwsSecretsManagerComponentBuilderFactory.java @@ -0,0 +1,349 @@ +/* + * 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.builder.component.dsl; + +import javax.annotation.Generated; +import org.apache.camel.Component; +import org.apache.camel.builder.component.AbstractComponentBuilder; +import org.apache.camel.builder.component.ComponentBuilder; +import org.apache.camel.component.aws.secretsmanager.SecretsManagerComponent; + +/** + * Manage AWS Secrets Manager services using AWS SDK version 2.x. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.ComponentDslMojo") +public interface AwsSecretsManagerComponentBuilderFactory { + + /** + * AWS Secrets Manager (camel-aws-secrets-manager) + * Manage AWS Secrets Manager services using AWS SDK version 2.x. + * + * Category: cloud,management + * Since: 3.9 + * Maven coordinates: org.apache.camel:camel-aws-secrets-manager + * + * @return the dsl builder + */ + static AwsSecretsManagerComponentBuilder awsSecretsManager() { + return new AwsSecretsManagerComponentBuilderImpl(); + } + + /** + * Builder for the AWS Secrets Manager component. + */ + interface AwsSecretsManagerComponentBuilder + extends + ComponentBuilder<SecretsManagerComponent> { + /** + * Component configuration. + * + * The option is a: + * <code>org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration</code> type. + * + * Group: producer + * + * @param configuration the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder configuration( + org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration configuration) { + doSetProperty("configuration", configuration); + return this; + } + /** + * Whether the producer should be started lazy (on the first message). + * By starting lazy you can use this to allow CamelContext and routes to + * startup in situations where a producer may otherwise fail during + * starting and cause the route to fail being started. By deferring this + * startup to be lazy then the startup failure can be handled during + * routing messages via Camel's routing error handlers. Beware that when + * the first message is processed then creating and starting the + * producer may take a little time and prolong the total processing time + * of the processing. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder lazyStartProducer( + boolean lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * The operation to perform. + * + * The option is a: + * <code>org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations</code> type. + * + * Group: producer + * + * @param operation the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder operation( + org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations operation) { + doSetProperty("operation", operation); + return this; + } + /** + * Set the need for overidding the endpoint. This option needs to be + * used in combination with uriEndpointOverride option. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param overrideEndpoint the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder overrideEndpoint( + boolean overrideEndpoint) { + doSetProperty("overrideEndpoint", overrideEndpoint); + return this; + } + /** + * If we want to use a POJO request as body or not. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param pojoRequest the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder pojoRequest( + boolean pojoRequest) { + doSetProperty("pojoRequest", pojoRequest); + return this; + } + /** + * To define a proxy host when instantiating the ECS client. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param proxyHost the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder proxyHost( + java.lang.String proxyHost) { + doSetProperty("proxyHost", proxyHost); + return this; + } + /** + * To define a proxy port when instantiating the ECS client. + * + * The option is a: <code>java.lang.Integer</code> type. + * + * Group: producer + * + * @param proxyPort the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder proxyPort( + java.lang.Integer proxyPort) { + doSetProperty("proxyPort", proxyPort); + return this; + } + /** + * To define a proxy protocol when instantiating the ECS client. + * + * The option is a: + * <code>software.amazon.awssdk.core.Protocol</code> type. + * + * Default: HTTPS + * Group: producer + * + * @param proxyProtocol the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder proxyProtocol( + software.amazon.awssdk.core.Protocol proxyProtocol) { + doSetProperty("proxyProtocol", proxyProtocol); + return this; + } + /** + * The region in which ECS client needs to work. When using this + * parameter, the configuration will expect the lowercase name of the + * region (for example ap-east-1) You'll need to use the name + * Region.EU_WEST_1.id(). + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param region the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder region(java.lang.String region) { + doSetProperty("region", region); + return this; + } + /** + * To use a existing configured AWS Secrets Manager as client. + * + * The option is a: + * <code>software.amazon.awssdk.services.secretsmanager.SecretsManagerClient</code> type. + * + * Group: producer + * + * @param secretsManagerClient the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder secretsManagerClient( + software.amazon.awssdk.services.secretsmanager.SecretsManagerClient secretsManagerClient) { + doSetProperty("secretsManagerClient", secretsManagerClient); + return this; + } + /** + * If we want to trust all certificates in case of overriding the + * endpoint. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param trustAllCertificates the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder trustAllCertificates( + boolean trustAllCertificates) { + doSetProperty("trustAllCertificates", trustAllCertificates); + return this; + } + /** + * Set the overriding uri endpoint. This option needs to be used in + * combination with overrideEndpoint option. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param uriEndpointOverride the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder uriEndpointOverride( + java.lang.String uriEndpointOverride) { + doSetProperty("uriEndpointOverride", uriEndpointOverride); + return this; + } + /** + * 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 then gets configured on the component. This can be used for + * automatic configuring JDBC data sources, JMS connection factories, + * AWS Clients, etc. + * + * The option is a: <code>boolean</code> type. + * + * Default: true + * Group: advanced + * + * @param autowiredEnabled the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder autowiredEnabled( + boolean autowiredEnabled) { + doSetProperty("autowiredEnabled", autowiredEnabled); + return this; + } + /** + * Amazon AWS Access Key. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + * + * @param accessKey the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder accessKey( + java.lang.String accessKey) { + doSetProperty("accessKey", accessKey); + return this; + } + /** + * Amazon AWS Secret Key. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + * + * @param secretKey the value to set + * @return the dsl builder + */ + default AwsSecretsManagerComponentBuilder secretKey( + java.lang.String secretKey) { + doSetProperty("secretKey", secretKey); + return this; + } + } + + class AwsSecretsManagerComponentBuilderImpl + extends + AbstractComponentBuilder<SecretsManagerComponent> + implements + AwsSecretsManagerComponentBuilder { + @Override + protected SecretsManagerComponent buildConcreteComponent() { + return new SecretsManagerComponent(); + } + private org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration getOrCreateConfiguration( + org.apache.camel.component.aws.secretsmanager.SecretsManagerComponent component) { + if (component.getConfiguration() == null) { + component.setConfiguration(new org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration()); + } + return component.getConfiguration(); + } + @Override + protected boolean setPropertyOnComponent( + Component component, + String name, + Object value) { + switch (name) { + case "configuration": ((SecretsManagerComponent) component).setConfiguration((org.apache.camel.component.aws.secretsmanager.SecretsManagerConfiguration) value); return true; + case "lazyStartProducer": ((SecretsManagerComponent) component).setLazyStartProducer((boolean) value); return true; + case "operation": getOrCreateConfiguration((SecretsManagerComponent) component).setOperation((org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations) value); return true; + case "overrideEndpoint": getOrCreateConfiguration((SecretsManagerComponent) component).setOverrideEndpoint((boolean) value); return true; + case "pojoRequest": getOrCreateConfiguration((SecretsManagerComponent) component).setPojoRequest((boolean) value); return true; + case "proxyHost": getOrCreateConfiguration((SecretsManagerComponent) component).setProxyHost((java.lang.String) value); return true; + case "proxyPort": getOrCreateConfiguration((SecretsManagerComponent) component).setProxyPort((java.lang.Integer) value); return true; + case "proxyProtocol": getOrCreateConfiguration((SecretsManagerComponent) component).setProxyProtocol((software.amazon.awssdk.core.Protocol) value); return true; + case "region": getOrCreateConfiguration((SecretsManagerComponent) component).setRegion((java.lang.String) value); return true; + case "secretsManagerClient": getOrCreateConfiguration((SecretsManagerComponent) component).setSecretsManagerClient((software.amazon.awssdk.services.secretsmanager.SecretsManagerClient) value); return true; + case "trustAllCertificates": getOrCreateConfiguration((SecretsManagerComponent) component).setTrustAllCertificates((boolean) value); return true; + case "uriEndpointOverride": getOrCreateConfiguration((SecretsManagerComponent) component).setUriEndpointOverride((java.lang.String) value); return true; + case "autowiredEnabled": ((SecretsManagerComponent) component).setAutowiredEnabled((boolean) value); return true; + case "accessKey": getOrCreateConfiguration((SecretsManagerComponent) component).setAccessKey((java.lang.String) value); return true; + case "secretKey": getOrCreateConfiguration((SecretsManagerComponent) component).setSecretKey((java.lang.String) value); return true; + default: return false; + } + } + } +} \ No newline at end of file diff --git a/core/camel-componentdsl/src/generated/resources/metadata.json b/core/camel-componentdsl/src/generated/resources/metadata.json index c65046d..2894a69 100644 --- a/core/camel-componentdsl/src/generated/resources/metadata.json +++ b/core/camel-componentdsl/src/generated/resources/metadata.json @@ -906,6 +906,28 @@ "producerOnly": true, "lenientProperties": false }, + "AwsSecretsManagerComponentBuilderFactory": { + "kind": "component", + "name": "aws-secrets-manager", + "title": "AWS Secrets Manager", + "description": "Manage AWS Secrets Manager services using AWS SDK version 2.x.", + "deprecated": false, + "firstVersion": "3.9.0", + "label": "cloud,management", + "javaType": "org.apache.camel.component.aws.secretsmanager.SecretsManagerComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-aws-secrets-manager", + "version": "3.9.0-SNAPSHOT", + "scheme": "aws-secrets-manager", + "extendsScheme": "", + "syntax": "aws-secrets-manager:\/\/label", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false + }, "AzureEventhubsComponentBuilderFactory": { "kind": "component", "name": "azure-eventhubs", diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java index 9ab9a8c..8681314 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java @@ -286,6 +286,7 @@ public interface EndpointBuilderFactory org.apache.camel.builder.endpoint.dsl.SchedulerEndpointBuilderFactory.SchedulerBuilders, org.apache.camel.builder.endpoint.dsl.SchematronEndpointBuilderFactory.SchematronBuilders, org.apache.camel.builder.endpoint.dsl.ScpEndpointBuilderFactory.ScpBuilders, + org.apache.camel.builder.endpoint.dsl.SecretsManagerEndpointBuilderFactory.SecretsManagerBuilders, org.apache.camel.builder.endpoint.dsl.SedaEndpointBuilderFactory.SedaBuilders, org.apache.camel.builder.endpoint.dsl.ServerEndpointBuilderFactory.ServerBuilders, org.apache.camel.builder.endpoint.dsl.ServiceEndpointBuilderFactory.ServiceBuilders, diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java index 82488c1..787ec64 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java @@ -283,6 +283,7 @@ public interface EndpointBuilders org.apache.camel.builder.endpoint.dsl.SchedulerEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.SchematronEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.ScpEndpointBuilderFactory, + org.apache.camel.builder.endpoint.dsl.SecretsManagerEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.SedaEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.ServerEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.ServiceEndpointBuilderFactory, diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index 825ea5e..ab5a70a 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -1832,6 +1832,49 @@ public class StaticEndpointBuilders { return org.apache.camel.builder.endpoint.dsl.Translate2EndpointBuilderFactory.endpointBuilder(componentName, path); } /** + * AWS Secrets Manager (camel-aws-secrets-manager) + * Manage AWS Secrets Manager services using AWS SDK version 2.x. + * + * Category: cloud,management + * Since: 3.9 + * Maven coordinates: org.apache.camel:camel-aws-secrets-manager + * + * Syntax: <code>aws-secrets-manager://label</code> + * + * Path parameter: label (required) + * Logical name + * + * @param path //label + * @return the dsl builder + */ + public static org.apache.camel.builder.endpoint.dsl.SecretsManagerEndpointBuilderFactory.SecretsManagerEndpointBuilder awsSecretsManager( + String path) { + return org.apache.camel.builder.endpoint.dsl.SecretsManagerEndpointBuilderFactory.endpointBuilder("aws-secrets-manager", path); + } + /** + * AWS Secrets Manager (camel-aws-secrets-manager) + * Manage AWS Secrets Manager services using AWS SDK version 2.x. + * + * Category: cloud,management + * Since: 3.9 + * Maven coordinates: org.apache.camel:camel-aws-secrets-manager + * + * Syntax: <code>aws-secrets-manager://label</code> + * + * Path parameter: label (required) + * Logical name + * + * @param componentName to use a custom component name for the endpoint + * instead of the default name + * @param path //label + * @return the dsl builder + */ + public static org.apache.camel.builder.endpoint.dsl.SecretsManagerEndpointBuilderFactory.SecretsManagerEndpointBuilder awsSecretsManager( + String componentName, + String path) { + return org.apache.camel.builder.endpoint.dsl.SecretsManagerEndpointBuilderFactory.endpointBuilder(componentName, path); + } + /** * Azure Event Hubs (camel-azure-eventhubs) * The azure-eventhubs component that integrates Azure Event Hubs using AMQP * protocol. Azure EventHubs is a highly scalable publish-subscribe service diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SecretsManagerEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SecretsManagerEndpointBuilderFactory.java new file mode 100644 index 0000000..561de2a --- /dev/null +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SecretsManagerEndpointBuilderFactory.java @@ -0,0 +1,463 @@ +/* + * 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.builder.endpoint.dsl; + +import javax.annotation.Generated; +import org.apache.camel.builder.EndpointConsumerBuilder; +import org.apache.camel.builder.EndpointProducerBuilder; +import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; + +/** + * Manage AWS Secrets Manager services using AWS SDK version 2.x. + * + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.EndpointDslMojo") +public interface SecretsManagerEndpointBuilderFactory { + + + /** + * Builder for endpoint for the AWS Secrets Manager component. + */ + public interface SecretsManagerEndpointBuilder + extends + EndpointProducerBuilder { + /** + * 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 + * starting and cause the route to fail being started. By deferring this + * startup to be lazy then the startup failure can be handled during + * routing messages via Camel's routing error handlers. Beware that when + * the first message is processed then creating and starting the + * producer may take a little time and prolong the total processing time + * of the processing. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder lazyStartProducer( + boolean lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * Whether the producer should be started lazy (on the first message). + * By starting lazy you can use this to allow CamelContext and routes to + * startup in situations where a producer may otherwise fail during + * starting and cause the route to fail being started. By deferring this + * startup to be lazy then the startup failure can be handled during + * routing messages via Camel's routing error handlers. Beware that when + * the first message is processed then creating and starting the + * producer may take a little time and prolong the total processing time + * of the processing. + * + * The option will be converted to a <code>boolean</code> + * type. + * + * Default: false + * Group: producer + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder lazyStartProducer( + String lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * The operation to perform. + * + * The option is a: + * <code>org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations</code> type. + * + * Required: true + * Group: producer + * + * @param operation the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder operation( + SecretsManagerOperations operation) { + doSetProperty("operation", operation); + return this; + } + /** + * The operation to perform. + * + * The option will be converted to a + * <code>org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations</code> type. + * + * Required: true + * Group: producer + * + * @param operation the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder operation(String operation) { + doSetProperty("operation", operation); + return this; + } + /** + * Set the need for overidding the endpoint. This option needs to be + * used in combination with uriEndpointOverride option. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param overrideEndpoint the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder overrideEndpoint( + boolean overrideEndpoint) { + doSetProperty("overrideEndpoint", overrideEndpoint); + return this; + } + /** + * Set the need for overidding the endpoint. This option needs to be + * used in combination with uriEndpointOverride option. + * + * The option will be converted to a <code>boolean</code> + * type. + * + * Default: false + * Group: producer + * + * @param overrideEndpoint the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder overrideEndpoint( + String overrideEndpoint) { + doSetProperty("overrideEndpoint", overrideEndpoint); + return this; + } + /** + * If we want to use a POJO request as body or not. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param pojoRequest the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder pojoRequest(boolean pojoRequest) { + doSetProperty("pojoRequest", pojoRequest); + return this; + } + /** + * If we want to use a POJO request as body or not. + * + * The option will be converted to a <code>boolean</code> + * type. + * + * Default: false + * Group: producer + * + * @param pojoRequest the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder pojoRequest(String pojoRequest) { + doSetProperty("pojoRequest", pojoRequest); + return this; + } + /** + * To define a proxy host when instantiating the ECS client. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param proxyHost the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder proxyHost(String proxyHost) { + doSetProperty("proxyHost", proxyHost); + return this; + } + /** + * To define a proxy port when instantiating the ECS client. + * + * The option is a: <code>java.lang.Integer</code> type. + * + * Group: producer + * + * @param proxyPort the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder proxyPort(Integer proxyPort) { + doSetProperty("proxyPort", proxyPort); + return this; + } + /** + * To define a proxy port when instantiating the ECS client. + * + * The option will be converted to a + * <code>java.lang.Integer</code> type. + * + * Group: producer + * + * @param proxyPort the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder proxyPort(String proxyPort) { + doSetProperty("proxyPort", proxyPort); + return this; + } + /** + * To define a proxy protocol when instantiating the ECS client. + * + * The option is a: + * <code>software.amazon.awssdk.core.Protocol</code> type. + * + * Default: HTTPS + * Group: producer + * + * @param proxyProtocol the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder proxyProtocol( + Protocol proxyProtocol) { + doSetProperty("proxyProtocol", proxyProtocol); + return this; + } + /** + * To define a proxy protocol when instantiating the ECS client. + * + * The option will be converted to a + * <code>software.amazon.awssdk.core.Protocol</code> type. + * + * Default: HTTPS + * Group: producer + * + * @param proxyProtocol the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder proxyProtocol(String proxyProtocol) { + doSetProperty("proxyProtocol", proxyProtocol); + return this; + } + /** + * The region in which ECS client needs to work. When using this + * parameter, the configuration will expect the lowercase name of the + * region (for example ap-east-1) You'll need to use the name + * Region.EU_WEST_1.id(). + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param region the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder region(String region) { + doSetProperty("region", region); + return this; + } + /** + * To use a existing configured AWS Secrets Manager as client. + * + * The option is a: + * <code>software.amazon.awssdk.services.secretsmanager.SecretsManagerClient</code> type. + * + * Group: producer + * + * @param secretsManagerClient the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder secretsManagerClient( + Object secretsManagerClient) { + doSetProperty("secretsManagerClient", secretsManagerClient); + return this; + } + /** + * To use a existing configured AWS Secrets Manager as client. + * + * The option will be converted to a + * <code>software.amazon.awssdk.services.secretsmanager.SecretsManagerClient</code> type. + * + * Group: producer + * + * @param secretsManagerClient the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder secretsManagerClient( + String secretsManagerClient) { + doSetProperty("secretsManagerClient", secretsManagerClient); + return this; + } + /** + * If we want to trust all certificates in case of overriding the + * endpoint. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param trustAllCertificates the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder trustAllCertificates( + boolean trustAllCertificates) { + doSetProperty("trustAllCertificates", trustAllCertificates); + return this; + } + /** + * If we want to trust all certificates in case of overriding the + * endpoint. + * + * The option will be converted to a <code>boolean</code> + * type. + * + * Default: false + * Group: producer + * + * @param trustAllCertificates the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder trustAllCertificates( + String trustAllCertificates) { + doSetProperty("trustAllCertificates", trustAllCertificates); + return this; + } + /** + * Set the overriding uri endpoint. This option needs to be used in + * combination with overrideEndpoint option. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param uriEndpointOverride the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder uriEndpointOverride( + String uriEndpointOverride) { + doSetProperty("uriEndpointOverride", uriEndpointOverride); + return this; + } + /** + * Amazon AWS Access Key. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + * + * @param accessKey the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder accessKey(String accessKey) { + doSetProperty("accessKey", accessKey); + return this; + } + /** + * Amazon AWS Secret Key. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + * + * @param secretKey the value to set + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder secretKey(String secretKey) { + doSetProperty("secretKey", secretKey); + return this; + } + } + + /** + * Proxy enum for + * <code>org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations</code> enum. + */ + enum SecretsManagerOperations { + listSecrets; + } + + /** + * Proxy enum for <code>software.amazon.awssdk.core.Protocol</code> enum. + */ + enum Protocol { + HTTP, + HTTPS; + } + + public interface SecretsManagerBuilders { + /** + * AWS Secrets Manager (camel-aws-secrets-manager) + * Manage AWS Secrets Manager services using AWS SDK version 2.x. + * + * Category: cloud,management + * Since: 3.9 + * Maven coordinates: org.apache.camel:camel-aws-secrets-manager + * + * Syntax: <code>aws-secrets-manager://label</code> + * + * Path parameter: label (required) + * Logical name + * + * @param path //label + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder awsSecretsManager(String path) { + return SecretsManagerEndpointBuilderFactory.endpointBuilder("aws-secrets-manager", path); + } + /** + * AWS Secrets Manager (camel-aws-secrets-manager) + * Manage AWS Secrets Manager services using AWS SDK version 2.x. + * + * Category: cloud,management + * Since: 3.9 + * Maven coordinates: org.apache.camel:camel-aws-secrets-manager + * + * Syntax: <code>aws-secrets-manager://label</code> + * + * Path parameter: label (required) + * Logical name + * + * @param componentName to use a custom component name for the endpoint + * instead of the default name + * @param path //label + * @return the dsl builder + */ + default SecretsManagerEndpointBuilder awsSecretsManager( + String componentName, + String path) { + return SecretsManagerEndpointBuilderFactory.endpointBuilder(componentName, path); + } + } + static SecretsManagerEndpointBuilder endpointBuilder( + String componentName, + String path) { + class SecretsManagerEndpointBuilderImpl extends AbstractEndpointBuilder implements SecretsManagerEndpointBuilder { + public SecretsManagerEndpointBuilderImpl(String path) { + super(componentName, path); + } + } + return new SecretsManagerEndpointBuilderImpl(path); + } +} \ No newline at end of file diff --git a/parent/pom.xml b/parent/pom.xml index 55e63c9..0f7385a 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -867,6 +867,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-aws-secrets-manager</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-aws-xray</artifactId> <version>${project.version}</version> </dependency>