gnodet-bot commented on code in PR #28314:
URL: https://github.com/apache/camel/pull/28314#discussion_r4353380081


##########
components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java:
##########
@@ -33,6 +34,33 @@
 @UriEndpoint(firstVersion = "3.2.0", scheme = "aws2-lambda", title = "AWS 
Lambda", syntax = "aws2-lambda:function",
              producerOnly = true, category = { Category.CLOUD, 
Category.SERVERLESS },
              headersClass = Lambda2Constants.class)
+@BodyTypes(producerIn = @BodyType(value = { Carrier.TEXT, Carrier.BYTES, 
Carrier.STREAM, Carrier.FILE },
+                                  dependsOn = "operation",
+                                  byOption = {
+                                          @BodyType.When(option = "operation", 
value = "invokeFunction",
+                                                         carriers = {
+                                                                 Carrier.TEXT, 
Carrier.BYTES, Carrier.STREAM, Carrier.FILE }),
+                                          @BodyType.When(option = "operation", 
value = "createFunction",
+                                                         carriers = {
+                                                                 
Carrier.BYTES, Carrier.STREAM, Carrier.FILE, Carrier.NULL }),
+                                          @BodyType.When(option = "operation", 
value = "updateFunction",
+                                                         carriers = {
+                                                                 
Carrier.BYTES, Carrier.STREAM, Carrier.FILE, Carrier.NULL }) },
+                                  description = "The payload of 
invokeFunction, the default, as JSON text: bytes, a stream or a"
+                                                + " file are read as text, a 
Map or a POJO is sent as its toString(), so"
+                                                + " marshal it first, and no 
body fails. createFunction and updateFunction take"
+                                                + " the zip of the code as 
bytes, a stream or a file, or no body with the"
+                                                + " CamelAwsLambdaZipFile 
header or the S3 headers. The other operations take"
+                                                + " their input from headers, 
or with pojoRequest=true from the request of the"
+                                                + " AWS SDK in the body"),
+           producerOut = @BodyType(value = Carrier.TEXT, javaType = 
"java.lang.String", dependsOn = "operation",

Review Comment:
   💡 **Suggestion:** The `byOption` override for `invokeFunction` specifies 
`carriers = Carrier.TEXT` — which is identical to the default `value = 
Carrier.TEXT`. This is redundant and can be removed. The description already 
handles the distinction.



##########
components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Endpoint.java:
##########
@@ -33,6 +34,33 @@
 @UriEndpoint(firstVersion = "3.2.0", scheme = "aws2-lambda", title = "AWS 
Lambda", syntax = "aws2-lambda:function",
              producerOnly = true, category = { Category.CLOUD, 
Category.SERVERLESS },
              headersClass = Lambda2Constants.class)
+@BodyTypes(producerIn = @BodyType(value = { Carrier.TEXT, Carrier.BYTES, 
Carrier.STREAM, Carrier.FILE },

Review Comment:
   💡 **Suggestion:** The `producerIn` default value `{ Carrier.TEXT, 
Carrier.BYTES, Carrier.STREAM, Carrier.FILE }` applies to the 28 operations 
that don't consume a body (they use headers). Other AWS components in this PR 
(`aws2-secretsmanager`, `aws2-ec2`, `aws2-iam`, `aws2-kms`, `aws2-sts`) 
correctly use `Carrier.ANY` as the default for header-driven operations.
   
   Consider:
   ```suggestion
   @BodyTypes(producerIn = @BodyType(value = Carrier.ANY,
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to