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 84f0081f7de519e06e53c70d8f5c64262f4238a0 Author: Andrea Cosentino <[email protected]> AuthorDate: Mon Apr 20 12:57:51 2020 +0200 CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-lambda fixed tests --- .../aws2/lambda/Lambda2ComponentConfigurer.java | 5 +++++ .../aws2/lambda/Lambda2EndpointConfigurer.java | 5 +++++ .../camel/component/aws2/lambda/aws2-lambda.json | 2 ++ .../src/main/docs/aws2-lambda-component.adoc | 6 ++++-- .../component/aws2/lambda/Lambda2Producer.java | 2 +- .../dsl/Aws2LambdaComponentBuilderFactory.java | 13 ++++++++++++ .../dsl/Lambda2EndpointBuilderFactory.java | 24 ++++++++++++++++++++++ 7 files changed, 54 insertions(+), 3 deletions(-) diff --git a/components/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java b/components/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java index afbe82b..6edfc11 100644 --- a/components/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java +++ b/components/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2ComponentConfigurer.java @@ -36,6 +36,8 @@ public class Lambda2ComponentConfigurer extends PropertyConfigurerSupport implem case "lazystartproducer": case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; case "operation": getOrCreateConfiguration(target).setOperation(property(camelContext, org.apache.camel.component.aws2.lambda.Lambda2Operations.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": @@ -58,6 +60,7 @@ public class Lambda2ComponentConfigurer extends PropertyConfigurerSupport implem answer.put("configuration", org.apache.camel.component.aws2.lambda.Lambda2Configuration.class); answer.put("lazyStartProducer", boolean.class); answer.put("operation", org.apache.camel.component.aws2.lambda.Lambda2Operations.class); + answer.put("pojoRequest", boolean.class); answer.put("proxyHost", java.lang.String.class); answer.put("proxyPort", java.lang.Integer.class); answer.put("proxyProtocol", software.amazon.awssdk.core.Protocol.class); @@ -80,6 +83,8 @@ public class Lambda2ComponentConfigurer extends PropertyConfigurerSupport implem case "lazystartproducer": case "lazyStartProducer": return target.isLazyStartProducer(); case "operation": return getOrCreateConfiguration(target).getOperation(); + case "pojorequest": + case "pojoRequest": return getOrCreateConfiguration(target).isPojoRequest(); case "proxyhost": case "proxyHost": return getOrCreateConfiguration(target).getProxyHost(); case "proxyport": diff --git a/components/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointConfigurer.java b/components/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointConfigurer.java index 16e49a04..003ec93 100644 --- a/components/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointConfigurer.java +++ b/components/camel-aws2-lambda/src/generated/java/org/apache/camel/component/aws2/lambda/Lambda2EndpointConfigurer.java @@ -28,6 +28,8 @@ public class Lambda2EndpointConfigurer extends PropertyConfigurerSupport impleme case "lazystartproducer": case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; case "operation": target.getConfiguration().setOperation(property(camelContext, org.apache.camel.component.aws2.lambda.Lambda2Operations.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": @@ -50,6 +52,7 @@ public class Lambda2EndpointConfigurer extends PropertyConfigurerSupport impleme answer.put("basicPropertyBinding", boolean.class); answer.put("lazyStartProducer", boolean.class); answer.put("operation", org.apache.camel.component.aws2.lambda.Lambda2Operations.class); + answer.put("pojoRequest", boolean.class); answer.put("proxyHost", java.lang.String.class); answer.put("proxyPort", java.lang.Integer.class); answer.put("proxyProtocol", software.amazon.awssdk.core.Protocol.class); @@ -72,6 +75,8 @@ public class Lambda2EndpointConfigurer extends PropertyConfigurerSupport impleme case "lazystartproducer": case "lazyStartProducer": return target.isLazyStartProducer(); case "operation": return target.getConfiguration().getOperation(); + case "pojorequest": + case "pojoRequest": return target.getConfiguration().isPojoRequest(); case "proxyhost": case "proxyHost": return target.getConfiguration().getProxyHost(); case "proxyport": diff --git a/components/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json b/components/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json index 513f4c4..05a8714 100644 --- a/components/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json +++ b/components/camel-aws2-lambda/src/generated/resources/org/apache/camel/component/aws2/lambda/aws2-lambda.json @@ -24,6 +24,7 @@ "configuration": { "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "deprecated": 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, "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": false, "type": "object", "javaType": "org.apache.camel.component.aws2.lambda.Lambda2Operations", "enum": [ "listFunctions", "getFunction", "createAlias", "deleteAlias", "getAlias", "listAliases", "createFunction", "deleteFunction", "invokeFunction", "updateFunction", "createEventSourceMapping", "deleteEventSourceMapping", "listEventSourceMapping", "listTags", "tagResource", "u [...] + "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.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" }, "region": { "kind": "property", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "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 a [...] "awsLambdaClient": { "kind": "property", "displayName": "Aws Lambda Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.lambda.LambdaClient", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To use a existing configured AwsLambdaClient as client" }, "basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" }, @@ -37,6 +38,7 @@ "function": { "kind": "path", "displayName": "Function", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "description": "Name of the Lambda function." }, "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": false, "type": "object", "javaType": "org.apache.camel.component.aws2.lambda.Lambda2Operations", "enum": [ "listFunctions", "getFunction", "createAlias", "deleteAlias", "getAlias", "listAliases", "createFunction", "deleteFunction", "invokeFunction", "updateFunction", "createEventSourceMapping", "deleteEventSourceMapping", "listEventSourceMapping", "listTags", "tagResource", " [...] + "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.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "If we want to use a POJO request as body or not" }, "region": { "kind": "parameter", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "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 [...] "awsLambdaClient": { "kind": "parameter", "displayName": "Aws Lambda Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "software.amazon.awssdk.services.lambda.LambdaClient", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.lambda.Lambda2Configuration", "configurationField": "configuration", "description": "To use a existing configured AwsLambdaClient as client" }, "basicPropertyBinding": { "kind": "parameter", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" }, diff --git a/components/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc b/components/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc index 203912d..4ec93dd 100644 --- a/components/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc +++ b/components/camel-aws2-lambda/src/main/docs/aws2-lambda-component.adoc @@ -41,7 +41,7 @@ You can append query options to the URI in the following format, // component options: START -The AWS Lambda component supports 11 options, which are listed below. +The AWS Lambda component supports 12 options, which are listed below. @@ -51,6 +51,7 @@ The AWS Lambda component supports 11 options, which are listed below. | *configuration* (producer) | Component configuration | | Lambda2Configuration | *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) | The operation to perform. It can be listFunctions, getFunction, createFunction, deleteFunction or invokeFunction. The value can be one of: listFunctions, getFunction, createAlias, deleteAlias, getAlias, listAliases, createFunction, deleteFunction, invokeFunction, updateFunction, createEventSourceMapping, deleteEventSourceMapping, listEventSourceMapping, listTags, tagResource, untagResource, publishVersion, listVersions | invokeFunction | Lambda2Operations +| *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean | *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 | *awsLambdaClient* (advanced) | To use a existing configured AwsLambdaClient as client | | LambdaClient | *basicPropertyBinding* (advanced) | Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean @@ -84,7 +85,7 @@ with the following path and query parameters: |=== -=== Query Parameters (11 parameters): +=== Query Parameters (12 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -92,6 +93,7 @@ with the following path and query parameters: | Name | Description | Default | Type | *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) | The operation to perform. It can be listFunctions, getFunction, createFunction, deleteFunction or invokeFunction. The value can be one of: listFunctions, getFunction, createAlias, deleteAlias, getAlias, listAliases, createFunction, deleteFunction, invokeFunction, updateFunction, createEventSourceMapping, deleteEventSourceMapping, listEventSourceMapping, listTags, tagResource, untagResource, publishVersion, listVersions | invokeFunction | Lambda2Operations +| *pojoRequest* (producer) | If we want to use a POJO request as body or not | false | boolean | *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 | *awsLambdaClient* (advanced) | To use a existing configured AwsLambdaClient as client | | LambdaClient | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean diff --git a/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java b/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java index e31a2e4..a0ba594 100644 --- a/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java +++ b/components/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java @@ -277,6 +277,7 @@ public class Lambda2Producer extends DefaultProducer { Message message = getMessageForResponse(exchange); message.setBody(result); + } } else { CreateFunctionResponse result; @@ -401,7 +402,6 @@ public class Lambda2Producer extends DefaultProducer { Message message = getMessageForResponse(exchange); message.setBody(result); } - } } private void updateFunction(LambdaClient lambdaClient, Exchange exchange) throws Exception { diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2LambdaComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2LambdaComponentBuilderFactory.java index 561947f..ed2aa45 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2LambdaComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2LambdaComponentBuilderFactory.java @@ -101,6 +101,18 @@ public interface Aws2LambdaComponentBuilderFactory { 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 + */ + default Aws2LambdaComponentBuilder pojoRequest(boolean pojoRequest) { + doSetProperty("pojoRequest", pojoRequest); + 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 @@ -227,6 +239,7 @@ public interface Aws2LambdaComponentBuilderFactory { case "configuration": ((Lambda2Component) component).setConfiguration((org.apache.camel.component.aws2.lambda.Lambda2Configuration) value); return true; case "lazyStartProducer": ((Lambda2Component) component).setLazyStartProducer((boolean) value); return true; case "operation": getOrCreateConfiguration((Lambda2Component) component).setOperation((org.apache.camel.component.aws2.lambda.Lambda2Operations) value); return true; + case "pojoRequest": getOrCreateConfiguration((Lambda2Component) component).setPojoRequest((boolean) value); return true; case "region": getOrCreateConfiguration((Lambda2Component) component).setRegion((java.lang.String) value); return true; case "awsLambdaClient": getOrCreateConfiguration((Lambda2Component) component).setAwsLambdaClient((software.amazon.awssdk.services.lambda.LambdaClient) value); return true; case "basicPropertyBinding": ((Lambda2Component) component).setBasicPropertyBinding((boolean) value); return true; diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Lambda2EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Lambda2EndpointBuilderFactory.java index 9b1c4f9..f560063 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Lambda2EndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Lambda2EndpointBuilderFactory.java @@ -111,6 +111,30 @@ public interface Lambda2EndpointBuilderFactory { 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 + */ + default Lambda2EndpointBuilder 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 + */ + default Lambda2EndpointBuilder pojoRequest(String pojoRequest) { + doSetProperty("pojoRequest", pojoRequest); + 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
