Claus Ibsen created CAMEL-27746:
-----------------------------------
Summary: camel-huaweicloud-iam: property cast, lazy client,
ignored proxyHost, metadata issues
Key: CAMEL-27746
URL: https://issues.apache.org/jira/browse/CAMEL-27746
Project: Camel
Issue Type: Bug
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-huaweicloud-iam for
CAMEL-23832 (commit
https://github.com/apache/camel/commit/b82eef5b59e581059179cfd3aa240e1194ec9c8c).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. Exchange properties that are not a String fail with a ClassCastException
{{IAMProducer.updateClientConfigs()}} reads the CamelHwCloudIamOperation,
CamelHwCloudIamUserId and CamelHwCloudIamGroupId exchange properties with a
cast, such as {{(String) exchange.getProperty(IAMProperties.USER_ID)}}. A
property set to another type, for example a number or a UUID, fails the
exchange with a ClassCastException instead of being converted.
Read them with {{exchange.getProperty(name, String.class)}}.
h4. 2. The IAM client is created on the first message, without synchronization
{{IAMProducer.process()}} creates the client with {{endpoint.initClient()}}
when the {{iamClient}} field is null. Missing access keys or an unknown region
show up only on the first message, not at startup, and concurrent first
exchanges can each build a client, as the field is not volatile or guarded.
Create the client in {{IAMProducer.doStart()}}.
h4. 3. proxyHost without proxyPort is ignored silently
{{IAMEndpoint.initClient()}} configures the proxy only when {{proxyHost}} is
set and {{proxyPort}} is above 0. With only {{proxyHost}} set (proxyPort has no
default, so it is 0), the producer connects directly and logs nothing.
Fail at startup, or log a warning, when proxyHost is set without a proxyPort.
h4. 4. accessKey and secretKey are marked as required
Both options have {{@Metadata(required = true)}}, but
{{IAMEndpoint.initClient()}} does not use them when the serviceKeys option is
set. Tools that check required options reject a valid endpoint that uses only
serviceKeys.
Set required to false.
h4. 5. userId and groupId are marked as secret
Both options have {{security = "secret"}}, so the catalog shows them with
{{"secret": true}} and tools mask them, although they are IDs of IAM objects,
not credentials.
Remove {{security = "secret"}} from both.
h4. 6. The operation path has no enums
The {{operation}} path parameter accepts only listUsers, getUser, updateUser,
listGroups, getGroupUsers and updateGroup ({{IAMOperations}}), but the metadata
has no {{enums}}, so tools cannot offer or validate the values.
Add {{enums =
"listUsers,getUser,updateUser,listGroups,getGroupUsers,updateGroup"}}.
h4. 7. Options have no labels
Apart from ignoreSslVerification, the options have no label, so they all land
in the producer group. accessKey, secretKey and serviceKeys belong in the
security group, and the proxy options in a proxy group.
Add {{label = "security"}} and {{label = "proxy"}} as in other components.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)