jamesnetherton commented on code in PR #9042:
URL: https://github.com/apache/camel-quarkus/pull/9042#discussion_r3904605637


##########
integration-test-groups/aws2/aws2-sts/src/main/java/org/apache/camel/quarkus/component/aws2/sts/it/Aws2StsResource.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.aws2.sts.it;
+
+import java.util.Map;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.aws2.sts.STS2Operations;
+import software.amazon.awssdk.services.sts.model.Credentials;
+import software.amazon.awssdk.services.sts.model.GetSessionTokenResponse;
+
+@Path("/aws2-sts")
+@ApplicationScoped
+public class Aws2StsResource {
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Path("/session-token")
+    @POST
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getSessionToken() {
+        GetSessionTokenResponse response = producerTemplate.requestBody(
+                componentUri(STS2Operations.getSessionToken),
+                null,
+                GetSessionTokenResponse.class);
+
+        Credentials credentials = response.credentials();

Review Comment:
   Worth guarding `response.credentials()` before the `Map.of(...)` below — 
`Map.of` throws NPE on a null value, so an unexpected response shape surfaces 
as an opaque 500 rather than something readable in a CI log.
   
   `Aws2EcsResource.describeCluster` (`aws2-ecs/.../Aws2EcsResource.java:76`) 
does exactly this before extracting its nested object:
   
   ```java
   if (response.clusters().isEmpty()) {
       return Response.status(Response.Status.NOT_FOUND).build();
   }
   ```
   
   Not reachable with Floci — just aligning with the existing pattern.



##########
poms/build-parent/pom.xml:
##########
@@ -114,6 +114,8 @@
                         <removeUnused>true</removeUnused>
                         <staticAfter>true</staticAfter>
                         
<staticGroups>java.,javax.,org.w3c.,org.xml.,junit.</staticGroups>
+                        <!-- Plugin default is ${maven.compiler.release}. An 
empty override maps to JavaParser POPULAR (JAVA_11) and rejects instanceof 
pattern matching. -->
+                        <compliance>${maven.compiler.source}</compliance>

Review Comment:
   Could this be dropped, or split into its own PR? It looks like a no-op: 
`maven.compiler.source`, `target` and `release` are all defined together at 
`pom.xml:297-299` and all resolve to `17`, so this is an exact synonym for the 
plugin's own default of `${maven.compiler.release}`.
   
   The comment's premise doesn't hold either — the `POPULAR`/JAVA_11 fallback 
only triggers when the resolved value is null or empty, which can't happen 
while `maven.compiler.release` is set in the root pom. I removed this hunk 
locally and ran `./mvnw process-sources -pl 
integration-test-groups/aws2/aws2-sqs` (that module's 
`SelectorRouteBuilder.java` uses `instanceof` pattern matching) and impsort ran 
clean.
   
   Was there a specific failure that prompted it? If so, it'd be worth 
understanding — the fix may belong elsewhere.



##########
integration-test-groups/aws2/aws2-sts/src/main/resources/application.properties:
##########
@@ -0,0 +1,21 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+camel.component.aws2-sts.access-key=${AWS_ACCESS_KEY}

Review Comment:
   Heads-up rather than a change request: this file is byte-identical to 
`aws2-iam`/`aws2-ecs` apart from the component name, so it inherits their gap — 
`AWS_USE_DEFAULT_CREDENTIALS_PROVIDER=true` (documented in the group 
`README.adoc`) doesn't work. With that env set, the app boots but endpoint 
resolution fails:
   
   ```
   useDefaultCredentialsProvider is set to false, useProfileCredentialsProvider 
is set to false,
   Amazon STS client or accessKey and secretKey must be specified
   ```
   
   `aws2-iam` fails identically, so this is a pre-existing convention issue, 
not something this PR introduces. `aws2-kms`/`aws2-cw`/`aws2-ses` avoid it with 
`camel.component.aws2-<x>.useDefaultCredentialsProvider=${AWS_USE_DEFAULT_CREDENTIALS_PROVIDER}`.
 Fine to leave for a separate PR — flagging it since the new `README.adoc` 
doesn't mention the mode.



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