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

   # Description
   
   [CAMEL-27615](https://issues.apache.org/jira/browse/CAMEL-27615)
   
   The ticket lists six problems of camel-aws2-redshift that came up while the 
option descriptions were written for CAMEL-23832 (#30952). I checked each one 
against main and the AWS SDK request classes, and fixed all six.
   
   Fixed:
   1. **Only the first page.** Without `pojoRequest`, `listDatabases`, 
`listSchemas`, `listStatements`, `listTables`, `describeTable` and 
`getStatementResult` never set `nextToken`. The new 
`CamelAwsRedshiftDataNextToken` header is passed to these requests. The 
response, which is the body, holds the `nextToken` for the next call. The 
producer still makes one call per exchange; it does not page by itself.
   2. **listStatements ignored the cluster, workgroup and database headers.** 
`ListStatementsRequest` accepts `ClusterIdentifier`, `WorkgroupName` and 
`Database` as filters, and they are now taken from the same headers as for the 
other operations.
   3. **Request fields without a header.** New headers: 
`CamelAwsRedshiftDataWaitTimeSeconds` (`executeStatement`, 
`batchExecuteStatement`, `getStatementResult`), 
`CamelAwsRedshiftDataExecutionMode` (`batchExecuteStatement`), and 
`CamelAwsRedshiftDataResultFormat`, `CamelAwsRedshiftDataSessionId` and 
`CamelAwsRedshiftDataSessionKeepAliveSeconds` (`executeStatement`, 
`batchExecuteStatement`). For the batch `Parameters` I used the existing 
`CamelAwsRedshiftDataSqlParameterList` header, as it has the same type as for 
`executeStatement`, instead of adding a second header. The description of 
`CamelAwsRedshiftDataResultFormat` says that `getStatementResult` reads JSON 
results only: a CSV result can only be read with `GetStatementResultV2`, which 
the component does not offer (as a header operation or with `pojoRequest`).
   4. **Wrong javaType of CamelAwsRedshiftDataSqlParameterList.** It is now 
`List<software.amazon.awssdk.services.redshiftdata.model.SqlParameter>`.
   5. **The label path parameter was required but not used.** It stays in the 
syntax, so existing URIs keep working, and is no longer required.
   6. **operation was required although a header replaces it.** It is no longer 
required. An exchange with neither the header nor the option now fails with an 
`IllegalArgumentException` that names both, instead of a `NullPointerException` 
in the `switch`.
   
   All fields exist in the request classes of the AWS SDK 2.55.15 jar, which I 
checked. Main uses 2.57.11; the generated SDK models only add members, so it 
has them too.
   
   Behaviour changes are in the 4.24 upgrade guide: `listStatements` now 
filters by the cluster, workgroup and database headers, and 
`batchExecuteStatement` now sends the parameter list header, where before both 
ignored them, so a route that sets these headers for another step gets a 
filtered or parameterized call; a missing operation gives an 
`IllegalArgumentException`.
   
   This touches the same files as #30952 (`RedshiftData2Configuration`, 
`RedshiftData2Constants` and the generated files), so whichever is merged 
second needs a rebase. Descriptions in #30952 that become wrong with this 
change:
   - `CamelAwsRedshiftDataClusterIdentifier`, `CamelAwsRedshiftDataDatabase` 
and `CamelAwsRedshiftDataWorkGroupName` say "Not used by listStatements". They 
are now used by `listStatements` as filters.
   - The max-results headers (`...DatabasesMaxResults`, `...SchemasMaxResults`, 
`...StatementsMaxResults`, `...TablesMaxResults`, `...DescribeTableMaxResults`) 
say "The producer returns only the first page of the response". It still 
returns one page per exchange, but the next one can now be asked for with 
`CamelAwsRedshiftDataNextToken`.
   - `CamelAwsRedshiftDataSqlParameterList` says "The parameters of the SQL 
statement of executeStatement". It is now used by `batchExecuteStatement` too, 
and its javaType in #30952 is still `List<SqlParameterList>`.
   - `CamelAwsRedshiftDataSqlStatementList` says the statements "run one after 
the other in a single transaction, which is rolled back if one of them fails". 
With the new `CamelAwsRedshiftDataExecutionMode` header set to `AUTO_COMMIT` 
each statement is committed on its own.
   - `CamelAwsRedshiftDataSqlStatement` says "The producer does not wait for 
the statement to finish". With the new `CamelAwsRedshiftDataWaitTimeSeconds` 
header it waits up to that many seconds. The same holds for the producer output 
description ("ExecuteStatementResponse of executeStatement, which does not wait 
for the statement").
   - `operation` says "The CamelAwsRedshiftDataOperation header replaces this 
option", which stays true; it is just no longer required.
   
   Tests (new, with a client that records the request, no AWS access):
   - `RedshiftData2ProducerHeadersTest`: the next-page token reaches the 
request of each of the six operations; `listStatements` gets the cluster, 
workgroup and database filters; `getStatementResult` gets the wait time; 
`executeStatement` gets the wait time, result format, session id and 
keep-alive; `batchExecuteStatement` gets the parameters, execution mode, wait 
time, result format and keep-alive; an exchange without an operation fails with 
the `IllegalArgumentException`. With the main producer and configuration (and 
the new header names, so that the test compiles) all 11 fail: the request 
fields are null, and the missing operation gives a `NullPointerException`.
   
   Results (offline, module build of camel-aws2-redshift, test phase): 49 tests 
run, 0 failures, 0 errors, 0 skipped. The new test class passes 5 runs in a 
row. The AWS SDK 2.57.11 of main is not in my local repository, so I built 
against the cached 2.55.15, which has all the fields used here.
   
   Generated files: `aws2-redshift-data.json` of the component and its catalog 
copy, `RedshiftData2EndpointUriFactory` (label not required), and the endpoint 
DSL (`RedshiftData2EndpointBuilderFactory` with the new headers and the 
`Required` lines, `StaticEndpointBuilders` for the label).
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it): 
[CAMEL-27615](https://issues.apache.org/jira/browse/CAMEL-27615).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built camel-aws2-redshift and ran its unit tests, and committed the 
regenerated component JSON and URI factory. The catalog copy and the endpoint 
DSL were updated to match it, as an offline build of those modules was not 
possible here. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 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