You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "oscerd (via GitHub)" <gi...@apache.org> on 2026/07/22 10:00:55 UTC

[PR] CAMEL-21955: camel-ibm-secrets-manager - add Secrets Dev Console [camel]

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

   ### Motivation
   
   [CAMEL-21955](https://issues.apache.org/jira/browse/CAMEL-21955). IBM Secrets Manager was the only supported secrets backend without a dev console — AWS Secrets Manager, HashiCorp Vault and Kubernetes all ship one.
   
   ### Changes
   
   New `SecretsDevConsole` (`ibm-secrets`) in `camel-ibm-secrets-manager`, following the same shape as the AWS console. Everything it needs already existed:
   
   - `IBMSecretsManagerPropertiesFunction` registers as `ibm` and exposes `getSecrets()`.
   - `IBMEventStreamReloadTriggerTask` exposes `getLastCheckTime()` / `getLastReloadTime()` / `getUpdates()` — the same API the AWS console consumes from its CloudTrail task.
   
   Reported in both text and JSON output:
   
   - Service URL, and `Login: IAM Token`
   - Whether refresh is enabled, and when it is, the Event Stream topic and bootstrap servers
   - Last check / last reload times from the reload trigger task
   - Secrets in use, sorted, with their last-update age
   
   **No secrets are printed.** Consistent with the existing consoles, only non-sensitive configuration is reported — the IAM token and the Event Stream password are never emitted; the login is described by kind (`IAM Token`) rather than by value.
   
   `camel-util-json` is added to the module's dependencies for `JsonObject`/`JsonArray`, matching how `camel-aws-secrets-manager` declares it.
   
   ### Testing
   
   - `mvn install` in `components/camel-ibm/camel-ibm-secrets-manager`: BUILD SUCCESS, 8 tests pass (the integration tests are skipped without IBM credentials).
   - Dev-console SPI metadata generated as expected, and the catalog picked up the new `ibm-secrets` console entry.
   - Full reactor `mvn clean install -DskipTests` from root: success, all generated files committed.
   
   Main-only (4.22.0), additive — no backport.
   
   _Claude Code on behalf of Andrea Cosentino (@oscerd)._
   
   🤖 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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-21955: camel-ibm-secrets-manager - add Secrets Dev Console [camel]

Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd merged PR #25013:
URL: https://github.com/apache/camel/pull/25013


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-21955: camel-ibm-secrets-manager - add Secrets Dev Console [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #25013:
URL: https://github.com/apache/camel/pull/25013#discussion_r3629759864


##########
components/camel-ibm/camel-ibm-secrets-manager/src/main/java/org/apache/camel/component/ibm/secrets/manager/SecretsDevConsole.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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.component.ibm.secrets.manager;
+
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.component.ibm.secrets.manager.vault.IBMEventStreamReloadTriggerTask;
+import org.apache.camel.spi.PeriodTaskScheduler;
+import org.apache.camel.spi.PropertiesFunction;
+import org.apache.camel.spi.annotations.DevConsole;
+import org.apache.camel.support.PluginHelper;
+import org.apache.camel.support.console.AbstractDevConsole;
+import org.apache.camel.util.TimeUtils;
+import org.apache.camel.util.json.JsonArray;
+import org.apache.camel.util.json.JsonObject;
+import org.apache.camel.vault.IBMSecretsManagerVaultConfiguration;
+
+@DevConsole(name = "ibm-secrets", displayName = "IBM Secrets", description = "IBM Secrets Manager")
+public class SecretsDevConsole extends AbstractDevConsole {
+
+    private IBMSecretsManagerPropertiesFunction propertiesFunction;
+    private IBMEventStreamReloadTriggerTask secretsRefreshTask;
+
+    public SecretsDevConsole() {
+        super("camel", "ibm-secrets", "IBM Secrets", "IBM Secrets Manager");
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+
+        if (getCamelContext().getPropertiesComponent().hasPropertiesFunction("ibm")) {
+            PropertiesFunction pf = getCamelContext().getPropertiesComponent().getPropertiesFunction("ibm");
+            if (pf instanceof IBMSecretsManagerPropertiesFunction ibmPropertiesFunction) {
+                propertiesFunction = ibmPropertiesFunction;
+            }
+        }
+        IBMSecretsManagerVaultConfiguration ibm
+                = getCamelContext().getVaultConfiguration().getIBMSecretsManagerVaultConfiguration();
+        if (ibm != null && ibm.isRefreshEnabled()) {
+            PeriodTaskScheduler scheduler = PluginHelper.getPeriodTaskScheduler(getCamelContext());
+            secretsRefreshTask = scheduler.getTaskByType(IBMEventStreamReloadTriggerTask.class);
+        }
+    }
+
+    @Override
+    protected String doCallText(Map<String, Object> options) {
+        StringBuilder sb = new StringBuilder();
+
+        if (propertiesFunction != null) {
+            IBMSecretsManagerVaultConfiguration ibm
+                    = getCamelContext().getVaultConfiguration().getIBMSecretsManagerVaultConfiguration();
+            sb.append("IBM Secrets Manager:");
+            if (ibm != null) {
+                sb.append(String.format("%n    Service URL: %s", ibm.getServiceUrl()));
+                sb.append("\n    Login: IAM Token");
+                sb.append(String.format("%n    Refresh Enabled: %s", ibm.isRefreshEnabled()));
+                if (ibm.isRefreshEnabled()) {
+                    sb.append(String.format("%n    Event Stream Topic: %s", ibm.getEventStreamTopic()));
+                    sb.append(String.format("%n    Event Stream Bootstrap Servers: %s",
+                            ibm.getEventStreamBootstrapServers()));
+                }
+            }
+            if (secretsRefreshTask != null) {
+                Instant last = secretsRefreshTask.getLastCheckTime();
+                String s = last != null ? TimeUtils.printSince(last.toEpochMilli()) : "none";
+                sb.append(String.format("%n    Last Check: %s", s));
+                last = secretsRefreshTask.getLastReloadTime();
+                s = last != null ? TimeUtils.printSince(last.toEpochMilli()) : "none";
+                sb.append(String.format("%n    Last Reload: %s", s));
+            }
+            sb.append("\n\nSecrets in use:");
+
+            List<String> sorted = new ArrayList<>(propertiesFunction.getSecrets());
+            Collections.sort(sorted);
+
+            for (String sec : sorted) {
+                Instant last = secretsRefreshTask != null ? secretsRefreshTask.getUpdates().get(sec) : null;
+                String age = last != null ? TimeUtils.printSince(last.toEpochMilli()) : null;
+                if (age != null) {
+                    sb.append(String.format("%n    %s (age: %s)", sec, age));
+                } else {
+                    sb.append(String.format("%n    %s", sec));
+                }
+            }
+        }
+
+        return sb.toString();
+    }
+
+    @Override
+    protected JsonObject doCallJson(Map<String, Object> options) {
+        JsonObject root = new JsonObject();
+
+        if (propertiesFunction != null) {
+            IBMSecretsManagerVaultConfiguration ibm
+                    = getCamelContext().getVaultConfiguration().getIBMSecretsManagerVaultConfiguration();
+            if (ibm != null) {
+                root.put("serviceUrl", ibm.getServiceUrl());
+                root.put("login", "IAM Token");
+                root.put("refreshEnabled", ibm.isRefreshEnabled());
+                if (ibm.isRefreshEnabled()) {
+                    root.put("eventStreamTopic", ibm.getEventStreamTopic());
+                    root.put("eventStreamBootstrapServers", ibm.getEventStreamBootstrapServers());
+                }
+            }
+            if (secretsRefreshTask != null) {
+                Instant last = secretsRefreshTask.getLastCheckTime();
+                if (last != null) {
+                    root.put("lastCheckTimestamp", last.toEpochMilli());
+                    root.put("lastCheckAge", TimeUtils.printSince(last.toEpochMilli()));
+                }
+                last = secretsRefreshTask.getLastReloadTime();
+                if (last != null) {
+                    root.put("lastReloadTimestamp", last.toEpochMilli());
+                    root.put("lastReloadAge", TimeUtils.printSince(last.toEpochMilli()));
+                }
+            }
+
+            JsonArray arr = new JsonArray();
+            List<String> sorted = new ArrayList<>(propertiesFunction.getSecrets());
+            Collections.sort(sorted);
+
+            for (String sec : sorted) {
+                JsonObject jo = new JsonObject();
+                jo.put("name", sec);
+                Instant last = secretsRefreshTask != null ? secretsRefreshTask.getUpdates().get(sec) : null;
+                if (last != null) {
+                    jo.put("timestamp", last.toEpochMilli());
+                    jo.put("age", TimeUtils.printSince(last.toEpochMilli()));
+                }

Review Comment:
   Minor: The AWS `SecretsDevConsole` always includes the `"secrets"` key in the JSON response (even when the array is empty), while this version conditionally includes it. For API consistency, consider always including it:
   
   ```suggestion
               root.put("secrets", arr);
   ```
   
   Non-blocking — just a consistency observation.



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-21955: camel-ibm-secrets-manager - add Secrets Dev Console [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #25013:
URL: https://github.com/apache/camel/pull/25013#issuecomment-5045399285

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `catalog/camel-catalog`
   - `components/camel-ibm/camel-ibm-secrets-manager`
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 10 tested, 28 compile-only — current: 9 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **38 affected modules** (current approach: 9).
   
   <details><summary>:warning: Modules only in Scalpel (29)</summary>
   
   - `apache-camel`
   - `camel-allcomponents`
   - `camel-catalog`
   - `camel-catalog-console`
   - `camel-catalog-lucene`
   - `camel-catalog-maven`
   - `camel-catalog-suggest`
   - `camel-componentdsl`
   - `camel-csimple-maven-plugin`
   - `camel-endpointdsl`
   - `camel-endpointdsl-support`
   - `camel-itest`
   - `camel-jbang-core`
   - `camel-jbang-it`
   - `camel-jbang-main`
   - `camel-jbang-plugin-edit`
   - `camel-jbang-plugin-generate`
   - `camel-jbang-plugin-kubernetes`
   - `camel-jbang-plugin-test`
   - `camel-kamelet-main`
   - `camel-launcher`
   - `camel-report-maven-plugin`
   - `camel-route-parser`
   - `camel-yaml-dsl`
   - `camel-yaml-dsl-deserializers`
   - `camel-yaml-dsl-maven-plugin`
   - `coverage`
   - `docs`
   - `dummy-component`
   
   </details>
   
   **Skip-tests mode would test 10 modules** (2 direct + 8 downstream), **skip tests for 28** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (10)</summary>
   
   - `camel-catalog`
   - `camel-ibm-secrets-manager`
   - `camel-jbang-mcp`
   - `camel-jbang-plugin-mcp`
   - `camel-jbang-plugin-route-parser`
   - `camel-jbang-plugin-tui`
   - `camel-jbang-plugin-validate`
   - `camel-launcher-container`
   - `camel-yaml-dsl-validator`
   - `camel-yaml-dsl-validator-maven-plugin`
   
   </details>
   
   <details><summary>Modules with tests skipped (28)</summary>
   
   - `apache-camel`
   - `camel-allcomponents`
   - `camel-catalog-console`
   - `camel-catalog-lucene`
   - `camel-catalog-maven`
   - `camel-catalog-suggest`
   - `camel-componentdsl`
   - `camel-csimple-maven-plugin`
   - `camel-endpointdsl`
   - `camel-endpointdsl-support`
   - `camel-itest`
   - `camel-jbang-core`
   - `camel-jbang-it`
   - `camel-jbang-main`
   - `camel-jbang-plugin-edit`
   - `camel-jbang-plugin-generate`
   - `camel-jbang-plugin-kubernetes`
   - `camel-jbang-plugin-test`
   - `camel-kamelet-main`
   - `camel-launcher`
   - `camel-report-maven-plugin`
   - `camel-route-parser`
   - `camel-yaml-dsl`
   - `camel-yaml-dsl-deserializers`
   - `camel-yaml-dsl-maven-plugin`
   - `coverage`
   - `docs`
   - `dummy-component`
   
   </details>
   
   > :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
   
   </details>
   
   <details><summary>All tested modules (38 modules)</summary>
   
   - Camel :: All Components Sync point
   - Camel :: Assembly
   - Camel :: Catalog :: CSimple Maven Plugin (deprecated)
   - Camel :: Catalog :: Camel Catalog
   - Camel :: Catalog :: Camel Report Maven Plugin
   - Camel :: Catalog :: Camel Route Parser
   - Camel :: Catalog :: Console
   - Camel :: Catalog :: Dummy Component
   - Camel :: Catalog :: Lucene (deprecated)
   - Camel :: Catalog :: Maven
   - Camel :: Catalog :: Suggest
   - Camel :: Component DSL
   - Camel :: Coverage
   - Camel :: Docs
   - Camel :: Endpoint DSL
   - Camel :: Endpoint DSL :: Support
   - Camel :: IBM :: Secrets Manager
   - Camel :: Integration Tests
   - Camel :: JBang :: Core
   - Camel :: JBang :: Integration tests
   - Camel :: JBang :: MCP
   - Camel :: JBang :: Main
   - Camel :: JBang :: Plugin :: Edit
   - Camel :: JBang :: Plugin :: Generate
   - Camel :: JBang :: Plugin :: Kubernetes
   - Camel :: JBang :: Plugin :: MCP
   - Camel :: JBang :: Plugin :: Route Parser
   - Camel :: JBang :: Plugin :: TUI
   - Camel :: JBang :: Plugin :: Testing
   - Camel :: JBang :: Plugin :: Validate
   - Camel :: Kamelet Main
   - Camel :: Launcher
   - Camel :: Launcher :: Container
   - Camel :: YAML DSL
   - Camel :: YAML DSL :: Deserializers
   - Camel :: YAML DSL :: Maven Plugins
   - Camel :: YAML DSL :: Validator
   - Camel :: YAML DSL :: Validator Maven Plugin
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/29910265680)


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-21955: camel-ibm-secrets-manager - add Secrets Dev Console [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #25013:
URL: https://github.com/apache/camel/pull/25013#issuecomment-5045048292

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: Apache Camel Committers, please review the following items:
   
     * First-time contributors **require MANUAL approval** for the GitHub Actions to run
     * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
     * You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
     * Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org