davsclaus opened a new pull request, #28314:
URL: https://github.com/apache/camel/pull/28314

   Stacked on #28309. This group covers eleven more AWS components of the 
catalog body types (CAMEL-24961): aws2-ddb, aws2-ddbstream, aws2-cw, aws2-ec2, 
aws2-eventbridge, aws2-lambda, aws2-sts, aws2-ses, aws-secrets-manager, 
aws2-kms and aws2-iam.
   
   **What the catalog says now**
   
   | Component | Consumer | Producer input | Producer output |
   |---|---|---|---|
   | aws2-ddb | | `any`: the item, the key and the statement are headers | 
`unchanged` for every operation: the result is in headers |
   | aws2-ddbstream | the `Record` of the AWS SDK, one per change | | |
   | aws2-cw | | `any`: putMetricData sends a `MetricDatum` or a List of them, 
else the metric comes from headers | `unchanged` for putMetricData, the 
default; the response of the SDK for listMetrics, describeAlarms and 
describeAlarmsForMetric |
   | aws2-ec2 | | `any`: the inputs are headers; the request of the SDK with 
pojoRequest=true | the response of the SDK per operation; `unchanged` for 
rebootInstances |
   | aws2-eventbridge | the event as JSON `text`, the envelope of EventBridge | 
`any`; text, bytes, a stream or a file for putEvent, the detail of the event | 
the response of the SDK |
   | aws2-lambda | | text, bytes, a stream or a file for invokeFunction, the 
default; bytes, a stream, a file or no body for createFunction and 
updateFunction, the zip | the payload of the response as `text` for 
invokeFunction; the response of the SDK for the other operations |
   | aws2-sts | | `any`: the inputs are headers; the request of the SDK with 
pojoRequest=true | the response of the SDK |
   | aws2-ses | | text, bytes, a stream or a file: the text of the mail | 
`unchanged` |
   | aws-secrets-manager | | `any`; text, bytes, a stream or a file for 
createSecret, updateSecret and putSecretValue, the value of the secret | the 
secret as `text` for getSecret, or no body for a binary secret; a List of the 
values for batchGetSecret; the response of the SDK for the others |
   | aws2-kms | | `any`: the inputs are headers; the request of the SDK with 
pojoRequest=true | the response of the SDK |
   | aws2-iam | | `any`: the inputs are headers; the request of the SDK with 
pojoRequest=true | the response of the SDK |
   
   **Checked at runtime.** Routes run with `camel run` against the AWS emulator 
of `camel infra run aws` logged the class of the body after each step, with 
text, bytes, streams, files, Maps, Lists, POJOs and no body:
   - **aws2-ddb:** every operation tried keeps the body, a Map and a List too, 
and puts its result in headers; the DescribeTable headers are a `TableStatus` 
enum and an `Instant`.
   - **aws2-ddbstream:** a table with a stream gives one `Record` per INSERT 
and MODIFY; Jackson cannot marshal a Record.
   - **aws2-cw:** putMetricData keeps the body; a List of anything but 
`MetricDatum` fails with a ClassCastException.
   - **aws2-ec2:** every operation gives its response, except rebootInstances, 
which keeps the body; with pojoRequest=true another body than the request fails.
   - **aws2-eventbridge:**
     - putEvent sends the body as the detail: a plain text detail and a Map 
(its toString()) are rejected as MalformedDetail, and the exchange does not 
fail;
     - the consumer gives the envelope of each event as JSON text.
   - **aws2-lambda:**
     - createFunction takes the zip as a file, bytes or a stream, or no body 
with the zip file header; a String is a broken zip, and a Map fails with a 
NullPointerException;
     - invokeFunction gives the payload of the response as text, also when the 
function fails, and fails without a body.
   - **aws2-sts:** each operation gives its response; assumeRole was run with a 
role aws2-iam made.
   - **aws2-ses:** every body is sent as the text of the mail, a Map as its 
toString(), and the body is kept; a `jakarta.mail` Message is sent as a raw 
mail.
   - **aws-secrets-manager:**
     - text, bytes, a stream and a file are stored as their text, and a Map as 
its toString();
     - getSecret gives the secret as text, and no body for a binary secret 
unless binaryPayload=true;
     - batchGetSecret gives a List of the values.
   - **aws2-kms and aws2-iam:** each operation gives its response; the 29 IAM 
operations of users, groups, roles, policies, instance profiles and access keys 
were run.
   
   **Choices**
   - `pojoRequest` is named only where the input side is `any`. Every AWS 
option is a component option as well, so a side that names an option is not 
known for a step that leaves it out: on aws-secrets-manager, aws2-lambda and 
aws2-eventbridge it would turn off the check of the text body of createSecret, 
invokeFunction and putEvent.
   - Where every operation gives the response of the SDK (aws2-sts, aws2-kms, 
aws2-iam, aws2-eventbridge), the output side is one `pojo`, and the description 
names the response class.
   - aws2-lambda (31 operations) depends on the operation, with the body of the 
four that read or give one. One option value per operation would take the 
camel_catalog_doc answers of aws2-lambda and aws2-iam over the cap of 18 000 
characters.
   
   **Bugs found** (to be filed, one per component)
   - aws2-ddb: the catalog gives wrong types for the TableStatus, CreationDate, 
ConsumedCapacity, LastEvaluatedKey and BatchResponse headers; 
CamelAwsDdbNextToken is not in the catalog; the table name and the capacities 
DescribeTable sets are read by the next aws2-ddb step.
   - aws2-cw: a List body of anything but MetricDatum fails with a bare 
ClassCastException; a `Date` in CamelAwsCwMetricTimestamp, as the catalog says, 
is ignored; an upper-case unit is sent as "null".
   - aws2-ec2: no operation fails with a NullPointerException; the docs' 
instance type `t2.micro` fails to convert; a text CamelAwsEC2InstancesIds 
header is dropped, so stopInstances stops nothing.
   - aws2-lambda: invokeFunction without a body, and createFunction with a Map, 
fail with a NullPointerException; the body wins over the zip file header.
   - aws2-eventbridge: a rejected event does not fail the exchange; no body 
fails with a bare RuntimeException; the consumer integration test is disabled, 
but the consumer works against the emulator.
   - aws2-ses: the Java example of the docs uses a class that does not exist, 
and sets the To header to a List, which is sent as "[[email protected]]".
   - aws-secrets-manager: with binaryPayload=true the binary stored is the 
Base64 text of the value; getSecret with binaryPayload=true of a string secret 
fails with a NullPointerException; batchGetSecret gives null for a binary 
secret and drops the errors; no operation fails with a NullPointerException.
   - aws2-iam: the CamelAwsIAMAccessKeyStatus values must be `Active` or 
`Inactive`, but the header doc says active and inactive.
   - camel-jbang (CLI validator): a YAML route with the short form `- to: 
aws-secrets-manager:sm?...` is reported for setting a header of that component 
("is not set by timer"); the long form `to: {uri: ...}` is not.
   
   **Docs fixed**
   - **aws2-eventbridge:** the putEvent examples send a JSON object as the 
detail, and the text says what the body is before and after the call.
   
   **Measured.**
   - The validator over the 1204 human-written and 1209 model-written route 
files gives the same reports as with #28309.
   - Body types now cover 96.6% of the endpoint uses in the human-written 
routes (95.9% with #28309), and 127 of the 413 component JSONs have them.
   
   **Tests**
   - `TextBodyFlowTest.testTheBodyOfAwsServices`:
     - reported: a Map sent to aws2-ses, to createSecret, to invokeFunction, to 
createFunction and to putEvent; a field read after getSecret, after 
invokeFunction and after the eventbridge consumer;
     - not reported: a field read after aws2-ddb (the body is kept) and after 
the ddbstream consumer (a POJO), and a Map sent to aws2-iam.
   - These pass:
     - the 292 tests of camel-yaml-dsl-validator;
     - the 265 validator and catalog doc tests of camel-jbang-core;
     - the builds of camel-yaml-dsl-maven-plugin and 
camel-yaml-dsl-deserializers.
   - The answers of camel_catalog_doc stay under 18 000 characters: aws2-iam, 
the largest, is 17 875.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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