Claus Ibsen created CAMEL-27652:
-----------------------------------
Summary: camel-aws2-mq: createBroker requires optional values,
required operation, header labels
Key: CAMEL-27652
URL: https://issues.apache.org/jira/browse/CAMEL-27652
Project: Camel
Issue Type: Bug
Components: camel-aws2
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-aws2-mq for CAMEL-23832
(commit
https://github.com/apache/camel/commit/2193048af93978376f066a535dccdcbbae202933).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. createBroker requires the engine version and the users, which Amazon MQ
makes optional
{{MQ2Producer.createBroker()}} throws an {{IllegalArgumentException}} when the
{{CamelAwsMQBrokerEngineVersion}} header is not set ("Broker Engine Version
must be specified") and when the {{CamelAwsMQBrokerUsers}} header is not set
("A Users list must be specified"). This happens for every {{createBroker}}
call that does not use {{pojoRequest=true}}.
In the Amazon MQ API both are optional: {{engineVersion}} defaults to the
latest version of the engine, and a broker with OAuth 2.0 accepts no user. So
without {{pojoRequest=true}} the user cannot create a broker with the latest
engine version or a broker without users.
Proposed change: set {{engineVersion}} and {{users}} on the
{{CreateBrokerRequest}} only when the header is set, and let Amazon MQ reject a
request that misses a value it needs.
h4. 2. The operation option is marked required, but the header can replace it
{{MQ2Configuration.operation}} has {{@Metadata(required = true)}} and no
default value. {{MQ2Producer.determineOperation()}} takes the operation from
the {{CamelAwsMQOperation}} header first and uses the option only when the
header is not set. It fails only when neither is set.
So an endpoint such as {{aws2-mq:broker}} that gets the operation from the
header works, but tooling that checks the catalog metadata reports a missing
required option.
Proposed change: remove {{required = true}} from the {{operation}} option, as
the producer already gives a clear error when neither the option nor the header
is set.
h4. 3. The request headers have no label
In {{MQ2Constants}}, the response headers name their operation in the label
({{CamelAwsMQNextToken}} and {{CamelAwsMQIsTruncated}}: {{listBrokers}},
{{CamelAwsMQBrokerArn}}: {{createBroker describeBroker}},
{{CamelAwsMQBrokerState}}: {{describeBroker}}). The headers that the operations
read have no label: {{CamelAwsMQOperation}}, {{CamelAwsMQMaxResults}},
{{CamelAwsMQBrokerName}}, {{CamelAwsMQBrokerEngine}},
{{CamelAwsMQBrokerEngineVersion}}, {{CamelAwsMQBrokerID}},
{{CamelAwsMQConfigurationID}}, {{CamelAwsMQBrokerDeploymentMode}},
{{CamelAwsMQBrokerInstanceType}}, {{CamelAwsMQBrokerUsers}} and
{{CamelAwsMQBrokerPubliclyAccessible}}.
Proposed change: add the operations as label, for example {{createBroker}} for
the broker name, engine, engine version, deployment mode, instance type, users
and publicly accessible headers, {{listBrokers}} for {{CamelAwsMQMaxResults}},
and {{createBroker deleteBroker rebootBroker updateBroker describeBroker}} for
{{CamelAwsMQBrokerID}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)