Claus Ibsen created CAMEL-27658:
-----------------------------------
Summary: camel-aws2-ec2: health check DOWN without region,
operation marked required, client label
Key: CAMEL-27658
URL: https://issues.apache.org/jira/browse/CAMEL-27658
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-ec2 for CAMEL-23832
(PR (commit
https://github.com/apache/camel/commit/39c29a155ceb3af2fd76ed30b7fa830a481c5934)).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. The producer health check is always DOWN when the region option is not
set
{{AWS2EC2ProducerHealthCheck.doCall()}} checks
{{Ec2Client.serviceMetadata().regions().contains(Region.of(configuration.getRegion()))}}.
When the {{region}} option is not set, {{Region.of(null)}} throws (the AWS SDK
validates the value with {{Validate.paramNotBlank}}), the {{catch (Exception
e)}} block marks the check as errored, and the check reports DOWN.
This happens whenever the region comes from the AWS SDK itself (for example the
{{AWS_REGION}} environment variable or the profile), and when a custom
{{amazonEc2Client}} is used without the {{region}} option, even though the
client works. The user sees a DOWN producer health check (once producer health
checks are enabled) for a working endpoint.
Proposed change: skip the region check when the {{region}} option is not set,
or take the region from the client
({{client.serviceClientConfiguration().region()}}).
h4. 2. The operation option is marked required although a header can replace it
{{AWS2EC2Configuration.operation}} has {{@Metadata(required = true)}}, but
{{AWS2EC2Producer.determineOperation()}} reads the {{CamelAwsEC2Operation}}
header first and uses the option only when the header is not set. Tools that
validate endpoint URIs against the catalog then report an endpoint that sets
the operation by header as invalid.
Proposed change: remove {{required = true}}; the producer already fails with a
clear message when neither the option nor the header is set.
h4. 3. The amazonEc2Client option is not in the advanced group
{{AWS2EC2Configuration.amazonEc2Client}} has {{@UriParam(label = "producer")}}
and {{@Metadata(label = "advanced", autowired = true)}}. The {{@UriParam}}
label wins, so the catalog and the docs show the label {{producer}}, not
{{advanced}}.
Proposed change: set the intended label on {{@UriParam}} (for example {{label =
"producer,advanced"}}) and drop it from {{@Metadata}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)