This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 7e9693b750201bbb4ee865d02588b06628ceec07
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Sep 22 11:28:01 2022 +0200

    camel-azure-key-vault - Add dev console for secrets
---
 .../org/apache/camel/dev-console/azure-secrets        |  2 ++
 .../dsl/jbang/core/commands/process/ListVault.java    | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-azure/camel-azure-key-vault/src/generated/resources/META-INF/services/org/apache/camel/dev-console/azure-secrets
 
b/components/camel-azure/camel-azure-key-vault/src/generated/resources/META-INF/services/org/apache/camel/dev-console/azure-secrets
new file mode 100644
index 00000000000..451c64fd185
--- /dev/null
+++ 
b/components/camel-azure/camel-azure-key-vault/src/generated/resources/META-INF/services/org/apache/camel/dev-console/azure-secrets
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.azure.key.vault.AzureKeyVaultManagerDevConsole
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVault.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVault.java
index aee406651f5..64dd9b8661d 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVault.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ListVault.java
@@ -32,7 +32,7 @@ import picocli.CommandLine;
 import picocli.CommandLine.Command;
 
 @Command(name = "vault", aliases = { "vault", "vaults" },
-         description = "List secrets from security vaults (AWS) used by 
running Camel integrations")
+         description = "List secrets from security vaults (AWS,GCP and Azure) 
used by running Camel integrations")
 public class ListVault extends ProcessBaseCommand {
 
     @CommandLine.Option(names = { "--sort" },
@@ -98,6 +98,23 @@ public class ListVault extends ProcessBaseCommand {
                                 }
                             }
                         }
+                        JsonObject azure = (JsonObject) 
vaults.get("azure-secrets");
+                        if (azure != null) {
+                            row.vault = "Azure";
+                            row.lastCheck = 
azure.getLongOrDefault("lastCheckTimestamp", 0);
+                            row.lastReload = 
azure.getLongOrDefault("lastReloadTimestamp", 0);
+                            JsonArray arr = (JsonArray) azure.get("secrets");
+                            for (int i = 0; i < arr.size(); i++) {
+                                if (i > 0) {
+                                    // create a copy for 2+ secrets
+                                    row = row.copy();
+                                }
+                                JsonObject jo = (JsonObject) arr.get(i);
+                                row.secret = jo.getString("name");
+                                row.timestamp = 
jo.getLongOrDefault("timestamp", 0);
+                                rows.add(row);
+                            }
+                        }
                     }
                 });
 

Reply via email to