]> git.proxmox.com Git - proxmox-backup.git/commitdiff
manager: acme plugin: auto-complete available DNS challenge types
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 10 May 2021 13:55:49 +0000 (15:55 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 10 May 2021 13:55:49 +0000 (15:55 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/bin/proxmox_backup_manager/acme.rs
src/config/acme/mod.rs

index a42a7aa463e45e582299a81e0c90953e1a0e83f8..61ce12b53de3a4d42966d6810abf0e59fb6abceb 100644 (file)
@@ -343,6 +343,7 @@ pub fn plugin_cli() -> CommandLineInterface {
             "add",
             CliCommand::new(&API_METHOD_ADD_PLUGIN)
                 .arg_param(&["type", "id"])
+                .completion_cb("api", crate::config::acme::complete_acme_api_challenge_type)
                 .completion_cb("type", crate::config::acme::complete_acme_plugin_type),
         )
         .insert(
index ca2d96718c83f1c07d83787f3062b2b8d0df4d5a..142ed2df3dc678387eeb95f534736effa5000c2c 100644 (file)
@@ -161,3 +161,14 @@ pub fn complete_acme_plugin_type(_arg: &str, _param: &HashMap<String, String>) -
         //"http".to_string(), // makes currently not realyl sense to create or the like
     ]
 }
+
+pub fn complete_acme_api_challenge_type(_arg: &str, param: &HashMap<String, String>) -> Vec<String> {
+    if param.get("type") == Some(&"dns".to_string()) {
+        match load_dns_challenge_schema() {
+            Ok(schema) => schema.into_iter().map(|s| s.id).collect(),
+            Err(_) => Vec::new(),
+        }
+    } else {
+        Vec::new()
+    }
+}