This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 0e472db Add configuration set param for aws2-ses (#6840) 0e472db is described below commit 0e472db0be0d43a082ef992853505155cb8ee4f4 Author: Billy <10576351+chrysophy...@users.noreply.github.com> AuthorDate: Thu Jan 27 20:08:04 2022 +0100 Add configuration set param for aws2-ses (#6840) --- .../component/aws2/ses/Ses2ComponentConfigurer.java | 6 ++++++ .../camel/component/aws2/ses/Ses2EndpointConfigurer.java | 6 ++++++ .../camel/component/aws2/ses/Ses2EndpointUriFactory.java | 3 ++- .../org/apache/camel/component/aws2/ses/aws2-ses.json | 2 ++ .../camel/component/aws2/ses/Ses2Configuration.java | 16 ++++++++++++++++ .../apache/camel/component/aws2/ses/Ses2Constants.java | 1 + .../apache/camel/component/aws2/ses/Ses2Producer.java | 11 ++++++++++- .../aws2/ses/SesComponentConfigurationTest.java | 7 ++++++- 8 files changed, 49 insertions(+), 3 deletions(-) diff --git a/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2ComponentConfigurer.java b/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2ComponentConfigurer.java index a0fbf49..d55d168 100644 --- a/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2ComponentConfigurer.java +++ b/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2ComponentConfigurer.java @@ -35,6 +35,8 @@ public class Ses2ComponentConfigurer extends PropertyConfigurerSupport implement case "autowiredenabled": case "autowiredEnabled": target.setAutowiredEnabled(property(camelContext, boolean.class, value)); return true; case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.aws2.ses.Ses2Configuration.class, value)); return true; + case "configurationset": + case "configurationSet": getOrCreateConfiguration(target).setConfigurationSet(property(camelContext, java.lang.String.class, value)); return true; case "lazystartproducer": case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; case "overrideendpoint": @@ -79,6 +81,8 @@ public class Ses2ComponentConfigurer extends PropertyConfigurerSupport implement case "autowiredenabled": case "autowiredEnabled": return boolean.class; case "configuration": return org.apache.camel.component.aws2.ses.Ses2Configuration.class; + case "configurationset": + case "configurationSet": return java.lang.String.class; case "lazystartproducer": case "lazyStartProducer": return boolean.class; case "overrideendpoint": @@ -119,6 +123,8 @@ public class Ses2ComponentConfigurer extends PropertyConfigurerSupport implement case "autowiredenabled": case "autowiredEnabled": return target.isAutowiredEnabled(); case "configuration": return target.getConfiguration(); + case "configurationset": + case "configurationSet": return getOrCreateConfiguration(target).getConfigurationSet(); case "lazystartproducer": case "lazyStartProducer": return target.isLazyStartProducer(); case "overrideendpoint": diff --git a/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2EndpointConfigurer.java b/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2EndpointConfigurer.java index 7f35fbe..aac0d8a 100644 --- a/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2EndpointConfigurer.java +++ b/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2EndpointConfigurer.java @@ -25,6 +25,8 @@ public class Ses2EndpointConfigurer extends PropertyConfigurerSupport implements case "accessKey": target.getConfiguration().setAccessKey(property(camelContext, java.lang.String.class, value)); return true; case "amazonsesclient": case "amazonSESClient": target.getConfiguration().setAmazonSESClient(property(camelContext, software.amazon.awssdk.services.ses.SesClient.class, value)); return true; + case "configurationset": + case "configurationSet": target.getConfiguration().setConfigurationSet(property(camelContext, java.lang.String.class, value)); return true; case "lazystartproducer": case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; case "overrideendpoint": @@ -66,6 +68,8 @@ public class Ses2EndpointConfigurer extends PropertyConfigurerSupport implements case "accessKey": return java.lang.String.class; case "amazonsesclient": case "amazonSESClient": return software.amazon.awssdk.services.ses.SesClient.class; + case "configurationset": + case "configurationSet": return java.lang.String.class; case "lazystartproducer": case "lazyStartProducer": return boolean.class; case "overrideendpoint": @@ -103,6 +107,8 @@ public class Ses2EndpointConfigurer extends PropertyConfigurerSupport implements case "accessKey": return target.getConfiguration().getAccessKey(); case "amazonsesclient": case "amazonSESClient": return target.getConfiguration().getAmazonSESClient(); + case "configurationset": + case "configurationSet": return target.getConfiguration().getConfigurationSet(); case "lazystartproducer": case "lazyStartProducer": return target.isLazyStartProducer(); case "overrideendpoint": diff --git a/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2EndpointUriFactory.java b/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2EndpointUriFactory.java index a782d5d..9898675 100644 --- a/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2EndpointUriFactory.java +++ b/components/camel-aws/camel-aws2-ses/src/generated/java/org/apache/camel/component/aws2/ses/Ses2EndpointUriFactory.java @@ -21,7 +21,7 @@ public class Ses2EndpointUriFactory extends org.apache.camel.support.component.E private static final Set<String> SECRET_PROPERTY_NAMES; private static final Set<String> MULTI_VALUE_PREFIXES; static { - Set<String> props = new HashSet<>(17); + Set<String> props = new HashSet<>(18); props.add("proxyProtocol"); props.add("returnPath"); props.add("secretKey"); @@ -32,6 +32,7 @@ public class Ses2EndpointUriFactory extends org.apache.camel.support.component.E props.add("trustAllCertificates"); props.add("proxyPort"); props.add("lazyStartProducer"); + props.add("configurationSet"); props.add("accessKey"); props.add("overrideEndpoint"); props.add("from"); diff --git a/components/camel-aws/camel-aws2-ses/src/generated/resources/org/apache/camel/component/aws2/ses/aws2-ses.json b/components/camel-aws/camel-aws2-ses/src/generated/resources/org/apache/camel/component/aws2/ses/aws2-ses.json index bc4dbbd..e28531b 100644 --- a/components/camel-aws/camel-aws2-ses/src/generated/resources/org/apache/camel/component/aws2/ses/aws2-ses.json +++ b/components/camel-aws/camel-aws2-ses/src/generated/resources/org/apache/camel/component/aws2/ses/aws2-ses.json @@ -24,6 +24,7 @@ "componentProperties": { "amazonSESClient": { "kind": "property", "displayName": "Amazon SESClient", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.ses.SesClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "To use the AmazonSimpleEmailService as the client" }, "configuration": { "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.aws2.ses.Ses2Configuration", "deprecated": false, "autowired": false, "secret": false, "description": "component configuration" }, + "configurationSet": { "kind": "property", "displayName": "Configuration Set", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "Set the configuration set to send with every request. Override it with 'CamelAwsSesConfigurationSet' header." }, "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 [...] "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.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "Set the need for overidding the endpoint. This option needs to be used in combination with uriEndpoi [...] "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.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the SES client" }, @@ -44,6 +45,7 @@ "properties": { "from": { "kind": "path", "displayName": "From", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "The sender's email address." }, "amazonSESClient": { "kind": "parameter", "displayName": "Amazon SESClient", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.ses.SesClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "To use the AmazonSimpleEmailService as the client" }, + "configurationSet": { "kind": "parameter", "displayName": "Configuration Set", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "Set the configuration set to send with every request. Override it with 'CamelAwsSesConfigurationSet' header." }, "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 [...] "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.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "Set the need for overidding the endpoint. This option needs to be used in combination with uriEndpo [...] "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.aws2.ses.Ses2Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the SES client" }, diff --git a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Configuration.java b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Configuration.java index acd40e5..4da9480 100644 --- a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Configuration.java +++ b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Configuration.java @@ -61,6 +61,8 @@ public class Ses2Configuration implements Cloneable { private String uriEndpointOverride; @UriParam(defaultValue = "false") private boolean useDefaultCredentialsProvider; + @UriParam + private String configurationSet; public String getAccessKey() { return accessKey; @@ -239,6 +241,20 @@ public class Ses2Configuration implements Cloneable { this.useDefaultCredentialsProvider = useDefaultCredentialsProvider; } + /** + * The configuration set to send with every request + */ + public String getConfigurationSet() { + return configurationSet; + } + + /** + * Set the configuration set to send with every request. Override it with 'CamelAwsSesConfigurationSet' header. + */ + public void setConfigurationSet(String configurationSet) { + this.configurationSet = configurationSet; + } + public Boolean isUseDefaultCredentialsProvider() { return useDefaultCredentialsProvider; } diff --git a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Constants.java b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Constants.java index 0573798..c08284d 100644 --- a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Constants.java +++ b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Constants.java @@ -28,4 +28,5 @@ public interface Ses2Constants { String SUBJECT = "CamelAwsSesSubject"; String TO = "CamelAwsSesTo"; String HTML_EMAIL = "CamelAwsSesHtmlEmail"; + String CONFIGURATION_SET = "CamelAwsSesConfigurationSet"; } diff --git a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Producer.java b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Producer.java index 9cbca41..b5530a1 100644 --- a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Producer.java +++ b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Producer.java @@ -82,7 +82,7 @@ public class Ses2Producer extends DefaultProducer { request.returnPath(determineReturnPath(exchange)); request.replyToAddresses(determineReplyToAddresses(exchange)); request.message(createMessage(exchange)); - + request.configurationSetName(determineConfigurationSet(exchange)); return request.build(); } @@ -91,6 +91,7 @@ public class Ses2Producer extends DefaultProducer { request.source(determineFrom(exchange)); request.destinations(determineRawTo(exchange)); request.rawMessage(createRawMessage(exchange)); + request.configurationSetName(determineConfigurationSet(exchange)); return request.build(); } @@ -188,6 +189,14 @@ public class Ses2Producer extends DefaultProducer { return subject; } + private String determineConfigurationSet(Exchange exchange) { + String configuration = exchange.getIn().getHeader(Ses2Constants.CONFIGURATION_SET, String.class); + if (configuration == null) { + configuration = getConfiguration().getConfigurationSet(); + } + return configuration; + } + protected Ses2Configuration getConfiguration() { return getEndpoint().getConfiguration(); } diff --git a/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/SesComponentConfigurationTest.java b/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/SesComponentConfigurationTest.java index d298d40..0c6b995 100644 --- a/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/SesComponentConfigurationTest.java +++ b/components/camel-aws/camel-aws2-ses/src/test/java/org/apache/camel/component/aws2/ses/SesComponentConfigurationTest.java @@ -52,6 +52,7 @@ public class SesComponentConfigurationTest extends CamelTestSupport { assertNull(endpoint.getConfiguration().getSubject()); assertNull(endpoint.getConfiguration().getReturnPath()); assertNull(endpoint.getConfiguration().getReplyToAddresses()); + assertNull(endpoint.getConfiguration().getConfigurationSet()); } @Test @@ -68,6 +69,7 @@ public class SesComponentConfigurationTest extends CamelTestSupport { assertNull(endpoint.getConfiguration().getSubject()); assertNull(endpoint.getConfiguration().getReturnPath()); assertNull(endpoint.getConfiguration().getReplyToAddresses()); + assertNull(endpoint.getConfiguration().getConfigurationSet()); } @Test @@ -88,6 +90,7 @@ public class SesComponentConfigurationTest extends CamelTestSupport { assertNull(endpoint.getConfiguration().getSubject()); assertNull(endpoint.getConfiguration().getReturnPath()); assertNull(endpoint.getConfiguration().getReplyToAddresses()); + assertNull(endpoint.getConfiguration().getConfigurationSet()); } @Test @@ -105,7 +108,8 @@ public class SesComponentConfigurationTest extends CamelTestSupport { Ses2Endpoint endpoint = (Ses2Endpoint) component .createEndpoint("aws2-ses://f...@example.com?amazonSESClient=#amazonSESClient&accessKey=xxx" + "&secretKey=yyy&to=t...@example.com,t...@example.com&subject=Subject" - + "&returnPath=bou...@example.com&replyToAddresses=reply...@example.com,reply...@example.com"); + + "&returnPath=bou...@example.com&replyToAddresses=reply...@example.com,reply...@example.com" + + "&configurationSet=development-set"); assertEquals("f...@example.com", endpoint.getConfiguration().getFrom()); assertEquals("xxx", endpoint.getConfiguration().getAccessKey()); @@ -117,6 +121,7 @@ public class SesComponentConfigurationTest extends CamelTestSupport { assertEquals("bou...@example.com", endpoint.getConfiguration().getReturnPath()); assertTrue(endpoint.getConfiguration().getReplyToAddresses().contains("reply...@example.com")); assertTrue(endpoint.getConfiguration().getReplyToAddresses().contains("reply...@example.com")); + assertEquals("development-set", endpoint.getConfiguration().getConfigurationSet()); } @Test