You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/09/28 06:33:03 UTC

[camel] branch master updated (fb7264b -> 7adb4fe)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from fb7264b  Regen
     new 00f758a  CAMEL-15561 - Camel-AWS2-Eventbridge: More producer operations - listTargetsByRule
     new b705ed7  Camel-AWS2-Eventbridge: Regen
     new 4d09c2c  Camel-AWS2-Eventbridge: Regen catalog
     new 26607ca  Camel-AWS2-Eventbridge: Added documentation for operation listTargetsByRule
     new 0687690  Camel-AWS2-Eventbridge: Regen docs
     new 7adb4fe  Camel-AWS2-Eventbridge: Added listTargetsByRule test with localstack and test containers

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/catalog/components/aws2-eventbridge.json |  4 +--
 .../catalog/docs/aws2-eventbridge-component.adoc   | 22 +++++++++++--
 .../aws2/eventbridge/aws2-eventbridge.json         |  4 +--
 .../src/main/docs/aws2-eventbridge-component.adoc  | 22 +++++++++++--
 .../aws2/eventbridge/EventbridgeOperations.java    |  3 +-
 .../aws2/eventbridge/EventbridgeProducer.java      | 38 ++++++++++++++++++++++
 ...ventbridgeListTargetsByRuleLocalstackTest.java} | 17 +++++-----
 .../dsl/EventbridgeEndpointBuilderFactory.java     |  3 +-
 .../ROOT/pages/aws2-eventbridge-component.adoc     | 22 +++++++++++--
 9 files changed, 115 insertions(+), 20 deletions(-)
 copy components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/{EventbridgeDescribeRuleLocalstackTest.java => EventbridgeListTargetsByRuleLocalstackTest.java} (81%)


[camel] 05/06: Camel-AWS2-Eventbridge: Regen docs

Posted by ac...@apache.org.
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 0687690c02578bb5a403b5a8334a061dbae29c2b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Sep 28 08:24:49 2020 +0200

    Camel-AWS2-Eventbridge: Regen docs
---
 .../camel/catalog/docs/aws2-eventbridge-component.adoc | 18 ++++++++++++++++++
 .../modules/ROOT/pages/aws2-eventbridge-component.adoc | 18 ++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc
index 561f028..a2d6dbc 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc
@@ -130,6 +130,7 @@ Camel-AWS2-Eventbridge component provides the following operation on the produce
 - disableRule
 - listRules
 - describeRule
+- listTargetsByRule
 
 - PutRule: this operation create a rule related to an eventbus
 
@@ -275,6 +276,23 @@ This operation will list all the rules with prefix first from the test eventbus.
 
 This operation will describe the firstrule rule from the test eventbus.
 
+- ListTargetsByRule: this operation will return a list of targets associated with a rule
+
+[source,java]
+--------------------------------------------------------------------------------
+  from("direct:start").process(new Processor() {
+                    
+      @Override
+      public void process(Exchange exchange) throws Exception {
+          exchange.getIn().setHeader(EventbridgeConstants.RULE_NAME, "firstrule");
+      }
+  })
+  .to("aws2-eventbridge://test?operation=listTargetsByRule")
+  .to("mock:result");
+--------------------------------------------------------------------------------
+
+this operation will return a list of targets associated with the firstrule rule.
+
 == Automatic detection of EventbridgeClient client in registry
 
 The component is capable of detecting the presence of an EventbridgeClient bean into the registry.
diff --git a/docs/components/modules/ROOT/pages/aws2-eventbridge-component.adoc b/docs/components/modules/ROOT/pages/aws2-eventbridge-component.adoc
index 2db7b45..e8c8723 100644
--- a/docs/components/modules/ROOT/pages/aws2-eventbridge-component.adoc
+++ b/docs/components/modules/ROOT/pages/aws2-eventbridge-component.adoc
@@ -132,6 +132,7 @@ Camel-AWS2-Eventbridge component provides the following operation on the produce
 - disableRule
 - listRules
 - describeRule
+- listTargetsByRule
 
 - PutRule: this operation create a rule related to an eventbus
 
@@ -277,6 +278,23 @@ This operation will list all the rules with prefix first from the test eventbus.
 
 This operation will describe the firstrule rule from the test eventbus.
 
+- ListTargetsByRule: this operation will return a list of targets associated with a rule
+
+[source,java]
+--------------------------------------------------------------------------------
+  from("direct:start").process(new Processor() {
+                    
+      @Override
+      public void process(Exchange exchange) throws Exception {
+          exchange.getIn().setHeader(EventbridgeConstants.RULE_NAME, "firstrule");
+      }
+  })
+  .to("aws2-eventbridge://test?operation=listTargetsByRule")
+  .to("mock:result");
+--------------------------------------------------------------------------------
+
+this operation will return a list of targets associated with the firstrule rule.
+
 == Automatic detection of EventbridgeClient client in registry
 
 The component is capable of detecting the presence of an EventbridgeClient bean into the registry.


[camel] 01/06: CAMEL-15561 - Camel-AWS2-Eventbridge: More producer operations - listTargetsByRule

Posted by ac...@apache.org.
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 00f758a3a84cf71a32468b356b002d1e68b74743
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Sep 28 08:13:30 2020 +0200

    CAMEL-15561 - Camel-AWS2-Eventbridge: More producer operations - listTargetsByRule
---
 .../aws2/eventbridge/EventbridgeOperations.java    |  3 +-
 .../aws2/eventbridge/EventbridgeProducer.java      | 38 ++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeOperations.java b/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeOperations.java
index 9c923c6..ae2b6da 100644
--- a/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeOperations.java
+++ b/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeOperations.java
@@ -25,5 +25,6 @@ public enum EventbridgeOperations {
     enableRule,
     disableRule,
     describeRule,
-    listRules
+    listRules,
+    listTargetsByRule
 }
diff --git a/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeProducer.java b/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeProducer.java
index cf677d2..0c17ca8 100644
--- a/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeProducer.java
+++ b/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeProducer.java
@@ -44,6 +44,8 @@ import software.amazon.awssdk.services.eventbridge.model.EnableRuleRequest;
 import software.amazon.awssdk.services.eventbridge.model.EnableRuleResponse;
 import software.amazon.awssdk.services.eventbridge.model.ListRulesRequest;
 import software.amazon.awssdk.services.eventbridge.model.ListRulesResponse;
+import software.amazon.awssdk.services.eventbridge.model.ListTargetsByRuleRequest;
+import software.amazon.awssdk.services.eventbridge.model.ListTargetsByRuleResponse;
 import software.amazon.awssdk.services.eventbridge.model.PutRuleRequest;
 import software.amazon.awssdk.services.eventbridge.model.PutRuleResponse;
 import software.amazon.awssdk.services.eventbridge.model.PutTargetsRequest;
@@ -93,6 +95,9 @@ public class EventbridgeProducer extends DefaultProducer {
             case describeRule:
                 describeRule(getEndpoint().getEventbridgeClient(), exchange);
                 break;
+            case listTargetsByRule:
+                listTargetsByRule(getEndpoint().getEventbridgeClient(), exchange);
+                break;
             default:
                 throw new IllegalArgumentException("Unsupported operation");
         }
@@ -403,6 +408,39 @@ public class EventbridgeProducer extends DefaultProducer {
             message.setBody(result);
         }
     }
+    
+    private void listTargetsByRule(EventBridgeClient eventbridgeClient, Exchange exchange) throws InvalidPayloadException {
+        if (getConfiguration().isPojoRequest()) {
+            Object payload = exchange.getIn().getMandatoryBody();
+            if (payload instanceof ListTargetsByRuleRequest) {
+                ListTargetsByRuleResponse result;
+                try {
+                    result = eventbridgeClient.listTargetsByRule((ListTargetsByRuleRequest) payload);
+                } catch (AwsServiceException ase) {
+                    LOG.trace("List Targets by Rule command returned the error code {}", ase.awsErrorDetails().errorCode());
+                    throw ase;
+                }
+                Message message = getMessageForResponse(exchange);
+                message.setBody(result);
+            }
+        } else {
+        	ListTargetsByRuleRequest.Builder builder = ListTargetsByRuleRequest.builder();
+            if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EventbridgeConstants.RULE_NAME))) {
+                String ruleName = exchange.getIn().getHeader(EventbridgeConstants.RULE_NAME, String.class);
+                builder.rule(ruleName);
+            }
+            builder.eventBusName(getConfiguration().getEventbusName());
+            ListTargetsByRuleResponse result;
+            try {
+                result = eventbridgeClient.listTargetsByRule(builder.build());
+            } catch (AwsServiceException ase) {
+                LOG.trace("List Targets by Rule command returned the error code {}", ase.awsErrorDetails().errorCode());
+                throw ase;
+            }
+            Message message = getMessageForResponse(exchange);
+            message.setBody(result);
+        }
+    }
 
     @Override
     public EventbridgeEndpoint getEndpoint() {


[camel] 06/06: Camel-AWS2-Eventbridge: Added listTargetsByRule test with localstack and test containers

Posted by ac...@apache.org.
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 7adb4fecf2c33c0bf196ea006b63d14ec960a3ef
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Sep 28 08:31:12 2020 +0200

    Camel-AWS2-Eventbridge: Added listTargetsByRule test with localstack and test containers
---
 ...EventbridgeListTargetsByRuleLocalstackTest.java | 97 ++++++++++++++++++++++
 1 file changed, 97 insertions(+)

diff --git a/components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/EventbridgeListTargetsByRuleLocalstackTest.java b/components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/EventbridgeListTargetsByRuleLocalstackTest.java
new file mode 100644
index 0000000..bb0f314
--- /dev/null
+++ b/components/camel-aws2-eventbridge/src/test/java/org/apache/camel/component/aws2/eventbridge/localstack/EventbridgeListTargetsByRuleLocalstackTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.aws2.eventbridge.localstack;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.aws2.eventbridge.EventbridgeConstants;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.services.eventbridge.model.ListTargetsByRuleResponse;
+import software.amazon.awssdk.services.eventbridge.model.Target;
+
+import static org.junit.Assert.assertEquals;
+
+public class EventbridgeListTargetsByRuleLocalstackTest extends Aws2EventbridgeBaseTest {
+
+    @EndpointInject
+    private ProducerTemplate template;
+
+    @EndpointInject("mock:result")
+    private MockEndpoint result;
+
+    @Test
+    public void sendIn() throws Exception {
+        result.expectedMessageCount(1);
+
+        template.send("direct:evs", new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(EventbridgeConstants.RULE_NAME, "firstrule");
+            }
+        });
+
+        template.send("direct:evs-targets", new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(EventbridgeConstants.RULE_NAME, "firstrule");
+                Target target = Target.builder().id("sqs-queue").arn("arn:aws:sqs:eu-west-1:780410022472:camel-connector-test")
+                        .build();
+                List<Target> targets = new ArrayList<Target>();
+                targets.add(target);
+                exchange.getIn().setHeader(EventbridgeConstants.TARGETS, targets);
+            }
+        });
+
+        template.send("direct:evs-list-targets", new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setHeader(EventbridgeConstants.RULE_NAME, "firstrule");
+            }
+        });
+        assertMockEndpointsSatisfied();
+        assertEquals(1, result.getExchanges().size());
+        assertEquals(1, result.getExchanges().get(0).getIn().getBody(ListTargetsByRuleResponse.class).targets().size());
+        assertEquals("sqs-queue",
+                result.getExchanges().get(0).getIn().getBody(ListTargetsByRuleResponse.class).targets().get(0).id());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                String awsEndpoint
+                        = "aws2-eventbridge://default?operation=putRule&eventPatternFile=file:src/test/resources/eventpattern.json";
+                String target = "aws2-eventbridge://default?operation=putTargets";
+                String listTargets = "aws2-eventbridge://default?operation=listTargetsByRule";
+                from("direct:evs").to(awsEndpoint);
+                from("direct:evs-targets").to(target);
+                from("direct:evs-list-targets").to(listTargets).to("mock:result");
+            }
+        };
+    }
+}


[camel] 03/06: Camel-AWS2-Eventbridge: Regen catalog

Posted by ac...@apache.org.
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 4d09c2c80daac67d402ce7306e7c8211a265bff2
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Sep 28 08:21:03 2020 +0200

    Camel-AWS2-Eventbridge: Regen catalog
---
 .../org/apache/camel/catalog/components/aws2-eventbridge.json         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eventbridge.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eventbridge.json
index d64f9dd..a165738 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eventbridge.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-eventbridge.json
@@ -27,7 +27,7 @@
     "eventbridgeClient": { "kind": "property", "displayName": "Eventbridge Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.eventbridge.EventBridgeClient", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To use a existing configured AWS Eventbridge as client" },
     "eventPatternFile": { "kind": "property", "displayName": "Event Pattern File", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "EventPattern File" },
     "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": 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 starting and cause the r [...]
-    "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.eventbridge.EventbridgeOperations", "enum": [ "putRule", "putTargets", "removeTargets", "deleteRule", "enableRule", "disableRule", "describeRule", "listRules" ], "deprecated": false, "deprecationNote": "", "secret": false, "defaultValue": "putRule", "configurationClass": "org.apache.camel.component.aws2.event [...]
+    "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.eventbridge.EventbridgeOperations", "enum": [ "putRule", "putTargets", "removeTargets", "deleteRule", "enableRule", "disableRule", "describeRule", "listRules", "listTargetsByRule" ], "deprecated": false, "deprecationNote": "", "secret": false, "defaultValue": "putRule", "configurationClass": "org.apache.camel [...]
     "pojoRequest": { "kind": "property", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "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, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the Eventbridge client" },
     "proxyPort": { "kind": "property", "displayName": "Proxy Port", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the Eventbridge client" },
@@ -44,7 +44,7 @@
     "eventbridgeClient": { "kind": "parameter", "displayName": "Eventbridge Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.eventbridge.EventBridgeClient", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To use a existing configured AWS Eventbridge as client" },
     "eventPatternFile": { "kind": "parameter", "displayName": "Event Pattern File", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "EventPattern File" },
     "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": 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 starting and cause the  [...]
-    "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.eventbridge.EventbridgeOperations", "enum": [ "putRule", "putTargets", "removeTargets", "deleteRule", "enableRule", "disableRule", "describeRule", "listRules" ], "deprecated": false, "deprecationNote": "", "secret": false, "defaultValue": "putRule", "configurationClass": "org.apache.camel.component.aws2.even [...]
+    "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.eventbridge.EventbridgeOperations", "enum": [ "putRule", "putTargets", "removeTargets", "deleteRule", "enableRule", "disableRule", "describeRule", "listRules", "listTargetsByRule" ], "deprecated": false, "deprecationNote": "", "secret": false, "defaultValue": "putRule", "configurationClass": "org.apache.came [...]
     "pojoRequest": { "kind": "parameter", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "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, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the Eventbridge client" },
     "proxyPort": { "kind": "parameter", "displayName": "Proxy Port", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the Eventbridge client" },


[camel] 02/06: Camel-AWS2-Eventbridge: Regen

Posted by ac...@apache.org.
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 b705ed734e9aabd1c9f770599f62f8b7c68e28f8
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Sep 28 08:17:47 2020 +0200

    Camel-AWS2-Eventbridge: Regen
---
 .../org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc     | 4 ++--
 .../org/apache/camel/component/aws2/eventbridge/aws2-eventbridge.json | 4 ++--
 .../src/main/docs/aws2-eventbridge-component.adoc                     | 4 ++--
 .../apache/camel/component/aws2/eventbridge/EventbridgeProducer.java  | 4 ++--
 .../camel/builder/endpoint/dsl/EventbridgeEndpointBuilderFactory.java | 3 ++-
 docs/components/modules/ROOT/pages/aws2-eventbridge-component.adoc    | 4 ++--
 6 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc
index ccbdb2f..561f028 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-eventbridge-component.adoc
@@ -59,7 +59,7 @@ The AWS 2 Eventbridge component supports 15 options, which are listed below.
 | *eventbridgeClient* (producer) | To use a existing configured AWS Eventbridge as client |  | EventBridgeClient
 | *eventPatternFile* (producer) | EventPattern File |  | String
 | *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 8 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules | putRule | EventbridgeOperations
+| *operation* (producer) | *Required* The operation to perform. There are 9 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules, listTargetsByRule | putRule | EventbridgeOperations
 | *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 Eventbridge client |  | String
 | *proxyPort* (producer) | To define a proxy port when instantiating the Eventbridge client |  | Integer
@@ -104,7 +104,7 @@ with the following path and query parameters:
 | *eventbridgeClient* (producer) | To use a existing configured AWS Eventbridge as client |  | EventBridgeClient
 | *eventPatternFile* (producer) | EventPattern File |  | String
 | *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 8 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules | putRule | EventbridgeOperations
+| *operation* (producer) | *Required* The operation to perform. There are 9 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules, listTargetsByRule | putRule | EventbridgeOperations
 | *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 Eventbridge client |  | String
 | *proxyPort* (producer) | To define a proxy port when instantiating the Eventbridge client |  | Integer
diff --git a/components/camel-aws2-eventbridge/src/generated/resources/org/apache/camel/component/aws2/eventbridge/aws2-eventbridge.json b/components/camel-aws2-eventbridge/src/generated/resources/org/apache/camel/component/aws2/eventbridge/aws2-eventbridge.json
index d64f9dd..a165738 100644
--- a/components/camel-aws2-eventbridge/src/generated/resources/org/apache/camel/component/aws2/eventbridge/aws2-eventbridge.json
+++ b/components/camel-aws2-eventbridge/src/generated/resources/org/apache/camel/component/aws2/eventbridge/aws2-eventbridge.json
@@ -27,7 +27,7 @@
     "eventbridgeClient": { "kind": "property", "displayName": "Eventbridge Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.eventbridge.EventBridgeClient", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To use a existing configured AWS Eventbridge as client" },
     "eventPatternFile": { "kind": "property", "displayName": "Event Pattern File", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "EventPattern File" },
     "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": 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 starting and cause the r [...]
-    "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.eventbridge.EventbridgeOperations", "enum": [ "putRule", "putTargets", "removeTargets", "deleteRule", "enableRule", "disableRule", "describeRule", "listRules" ], "deprecated": false, "deprecationNote": "", "secret": false, "defaultValue": "putRule", "configurationClass": "org.apache.camel.component.aws2.event [...]
+    "operation": { "kind": "property", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.eventbridge.EventbridgeOperations", "enum": [ "putRule", "putTargets", "removeTargets", "deleteRule", "enableRule", "disableRule", "describeRule", "listRules", "listTargetsByRule" ], "deprecated": false, "deprecationNote": "", "secret": false, "defaultValue": "putRule", "configurationClass": "org.apache.camel [...]
     "pojoRequest": { "kind": "property", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "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, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the Eventbridge client" },
     "proxyPort": { "kind": "property", "displayName": "Proxy Port", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the Eventbridge client" },
@@ -44,7 +44,7 @@
     "eventbridgeClient": { "kind": "parameter", "displayName": "Eventbridge Client", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.eventbridge.EventBridgeClient", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To use a existing configured AWS Eventbridge as client" },
     "eventPatternFile": { "kind": "parameter", "displayName": "Event Pattern File", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "EventPattern File" },
     "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": 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 starting and cause the  [...]
-    "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.eventbridge.EventbridgeOperations", "enum": [ "putRule", "putTargets", "removeTargets", "deleteRule", "enableRule", "disableRule", "describeRule", "listRules" ], "deprecated": false, "deprecationNote": "", "secret": false, "defaultValue": "putRule", "configurationClass": "org.apache.camel.component.aws2.even [...]
+    "operation": { "kind": "parameter", "displayName": "Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.aws2.eventbridge.EventbridgeOperations", "enum": [ "putRule", "putTargets", "removeTargets", "deleteRule", "enableRule", "disableRule", "describeRule", "listRules", "listTargetsByRule" ], "deprecated": false, "deprecationNote": "", "secret": false, "defaultValue": "putRule", "configurationClass": "org.apache.came [...]
     "pojoRequest": { "kind": "parameter", "displayName": "Pojo Request", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "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, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the Eventbridge client" },
     "proxyPort": { "kind": "parameter", "displayName": "Proxy Port", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.eventbridge.EventbridgeConfiguration", "configurationField": "configuration", "description": "To define a proxy port when instantiating the Eventbridge client" },
diff --git a/components/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc b/components/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc
index ccbdb2f..561f028 100644
--- a/components/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc
+++ b/components/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc
@@ -59,7 +59,7 @@ The AWS 2 Eventbridge component supports 15 options, which are listed below.
 | *eventbridgeClient* (producer) | To use a existing configured AWS Eventbridge as client |  | EventBridgeClient
 | *eventPatternFile* (producer) | EventPattern File |  | String
 | *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 8 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules | putRule | EventbridgeOperations
+| *operation* (producer) | *Required* The operation to perform. There are 9 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules, listTargetsByRule | putRule | EventbridgeOperations
 | *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 Eventbridge client |  | String
 | *proxyPort* (producer) | To define a proxy port when instantiating the Eventbridge client |  | Integer
@@ -104,7 +104,7 @@ with the following path and query parameters:
 | *eventbridgeClient* (producer) | To use a existing configured AWS Eventbridge as client |  | EventBridgeClient
 | *eventPatternFile* (producer) | EventPattern File |  | String
 | *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 8 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules | putRule | EventbridgeOperations
+| *operation* (producer) | *Required* The operation to perform. There are 9 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules, listTargetsByRule | putRule | EventbridgeOperations
 | *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 Eventbridge client |  | String
 | *proxyPort* (producer) | To define a proxy port when instantiating the Eventbridge client |  | Integer
diff --git a/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeProducer.java b/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeProducer.java
index 0c17ca8..055647c 100644
--- a/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeProducer.java
+++ b/components/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/EventbridgeProducer.java
@@ -408,7 +408,7 @@ public class EventbridgeProducer extends DefaultProducer {
             message.setBody(result);
         }
     }
-    
+
     private void listTargetsByRule(EventBridgeClient eventbridgeClient, Exchange exchange) throws InvalidPayloadException {
         if (getConfiguration().isPojoRequest()) {
             Object payload = exchange.getIn().getMandatoryBody();
@@ -424,7 +424,7 @@ public class EventbridgeProducer extends DefaultProducer {
                 message.setBody(result);
             }
         } else {
-        	ListTargetsByRuleRequest.Builder builder = ListTargetsByRuleRequest.builder();
+            ListTargetsByRuleRequest.Builder builder = ListTargetsByRuleRequest.builder();
             if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EventbridgeConstants.RULE_NAME))) {
                 String ruleName = exchange.getIn().getHeader(EventbridgeConstants.RULE_NAME, String.class);
                 builder.rule(ruleName);
diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EventbridgeEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EventbridgeEndpointBuilderFactory.java
index 95edada2..ed033b8 100644
--- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EventbridgeEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/EventbridgeEndpointBuilderFactory.java
@@ -407,7 +407,8 @@ public interface EventbridgeEndpointBuilderFactory {
         enableRule,
         disableRule,
         describeRule,
-        listRules;
+        listRules,
+        listTargetsByRule;
     }
 
     /**
diff --git a/docs/components/modules/ROOT/pages/aws2-eventbridge-component.adoc b/docs/components/modules/ROOT/pages/aws2-eventbridge-component.adoc
index c465236..2db7b45 100644
--- a/docs/components/modules/ROOT/pages/aws2-eventbridge-component.adoc
+++ b/docs/components/modules/ROOT/pages/aws2-eventbridge-component.adoc
@@ -61,7 +61,7 @@ The AWS 2 Eventbridge component supports 15 options, which are listed below.
 | *eventbridgeClient* (producer) | To use a existing configured AWS Eventbridge as client |  | EventBridgeClient
 | *eventPatternFile* (producer) | EventPattern File |  | String
 | *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 8 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules | putRule | EventbridgeOperations
+| *operation* (producer) | *Required* The operation to perform. There are 9 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules, listTargetsByRule | putRule | EventbridgeOperations
 | *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 Eventbridge client |  | String
 | *proxyPort* (producer) | To define a proxy port when instantiating the Eventbridge client |  | Integer
@@ -106,7 +106,7 @@ with the following path and query parameters:
 | *eventbridgeClient* (producer) | To use a existing configured AWS Eventbridge as client |  | EventBridgeClient
 | *eventPatternFile* (producer) | EventPattern File |  | String
 | *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 8 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules | putRule | EventbridgeOperations
+| *operation* (producer) | *Required* The operation to perform. There are 9 enums and the value can be one of: putRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules, listTargetsByRule | putRule | EventbridgeOperations
 | *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 Eventbridge client |  | String
 | *proxyPort* (producer) | To define a proxy port when instantiating the Eventbridge client |  | Integer


[camel] 04/06: Camel-AWS2-Eventbridge: Added documentation for operation listTargetsByRule

Posted by ac...@apache.org.
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 26607ca152d08cd7c8cba0b32680917df530fee0
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Sep 28 08:22:53 2020 +0200

    Camel-AWS2-Eventbridge: Added documentation for operation listTargetsByRule
---
 .../src/main/docs/aws2-eventbridge-component.adoc      | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/components/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc b/components/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc
index 561f028..a2d6dbc 100644
--- a/components/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc
+++ b/components/camel-aws2-eventbridge/src/main/docs/aws2-eventbridge-component.adoc
@@ -130,6 +130,7 @@ Camel-AWS2-Eventbridge component provides the following operation on the produce
 - disableRule
 - listRules
 - describeRule
+- listTargetsByRule
 
 - PutRule: this operation create a rule related to an eventbus
 
@@ -275,6 +276,23 @@ This operation will list all the rules with prefix first from the test eventbus.
 
 This operation will describe the firstrule rule from the test eventbus.
 
+- ListTargetsByRule: this operation will return a list of targets associated with a rule
+
+[source,java]
+--------------------------------------------------------------------------------
+  from("direct:start").process(new Processor() {
+                    
+      @Override
+      public void process(Exchange exchange) throws Exception {
+          exchange.getIn().setHeader(EventbridgeConstants.RULE_NAME, "firstrule");
+      }
+  })
+  .to("aws2-eventbridge://test?operation=listTargetsByRule")
+  .to("mock:result");
+--------------------------------------------------------------------------------
+
+this operation will return a list of targets associated with the firstrule rule.
+
 == Automatic detection of EventbridgeClient client in registry
 
 The component is capable of detecting the presence of an EventbridgeClient bean into the registry.