[pve-devel] [PATCH 1/2] DNSChallenge: make plugins a hash with an optional schema

Dominik Csapak d.csapak at proxmox.com
Tue May 5 14:38:11 CEST 2020


so that we can use that schema to generate form fields in the gui

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PVE/ACME/DNSChallenge.pm | 235 ++++++++++++++++++++---------------
 1 file changed, 132 insertions(+), 103 deletions(-)

diff --git a/src/PVE/ACME/DNSChallenge.pm b/src/PVE/ACME/DNSChallenge.pm
index 2b4f051..8a393f4 100644
--- a/src/PVE/ACME/DNSChallenge.pm
+++ b/src/PVE/ACME/DNSChallenge.pm
@@ -18,109 +18,138 @@ sub type {
     return 'dns';
 }
 
-my $plugin_names = [
-    'acmedns',
-    'acmeproxy',
-    'active24',
-    'ad',
-    'ali',
-    'autodns',
-    'aws',
-    'azure',
-    'cf',
-    'clouddns',
-    'cloudns',
-    'cn',
-    'conoha',
-    'constellix',
-    'cx',
-    'cyon',
-    'da',
-    'ddnss',
-    'desec',
-    'dgon',
-    'dnsimple',
-    'do',
-    'doapi',
-    'domeneshop',
-    'dp',
-    'dpi',
-    'dreamhost',
-    'duckdns',
-    'durabledns',
-    'dyn',
-    'dynu',
-    'dynv6',
-    'easydns',
-    'euserv',
-    'exoscale',
-    'freedns',
-    'gandi_livedns',
-    'gcloud',
-    'gd',
-    'gdnsdk',
-    'he',
-    'hexonet',
-    'hostingde',
-    'infoblox',
-    'internetbs',
-    'inwx',
-    'ispconfig',
-    'jd',
-    'kas',
-    'kinghost',
-    'knot',
-    'leaseweb',
-    'lexicon',
-    'linode',
-    'linode_v4',
-    'loopia',
-    'lua',
-    'maradns',
-    'me',
-    'miab',
-    'misaka',
-    'myapi',
-    'mydevil',
-    'mydnsjp',
-    'namecheap',
-    'namecom',
-    'namesilo',
-    'nederhost',
-    'neodigit',
-    'netcup',
-    'nic',
-    'nsd',
-    'nsone',
-    'nsupdate',
-    'nw',
-    'one',
-    'online',
-    'openprovider',
-    'opnsense',
-    'ovh',
-    'pdns',
-    'pleskxml',
-    'pointhq',
-    'rackspace',
-    'rcode0',
-    'regru',
-    'schlundtech',
-    'selectel',
-    'servercow',
-    'tele3',
-    'ultra',
-    'unoeuro',
-    'variomedia',
-    'vscale',
-    'vultr',
-    'yandex',
-    'zilore',
-    'zone',
-    'zonomi',
-];
+# describe the data schema of the supported plugins
+my $plugins = {
+    'acmedns' => {},
+    'acmeproxy' => {},
+    'active24' => {},
+    'ad' => {},
+    'ali' => {},
+    'autodns' => {},
+    'aws' => {},
+    'azure' => {},
+    'cf' => {},
+    'clouddns' => {},
+    'cloudns' => {},
+    'cn' => {},
+    'conoha' => {},
+    'constellix' => {},
+    'cx' => {},
+    'cyon' => {},
+    'da' => {},
+    'ddnss' => {},
+    'desec' => {},
+    'dgon' => {},
+    'dnsimple' => {},
+    'do' => {},
+    'doapi' => {},
+    'domeneshop' => {},
+    'dp' => {},
+    'dpi' => {},
+    'dreamhost' => {},
+    'duckdns' => {},
+    'durabledns' => {},
+    'dyn' => {},
+    'dynu' => {},
+    'dynv6' => {},
+    'easydns' => {},
+    'euserv' => {},
+    'exoscale' => {},
+    'freedns' => {},
+    'gandi_livedns' => {},
+    'gcloud' => {},
+    'gd' => {},
+    'gdnsdk' => {},
+    'he' => {},
+    'hexonet' => {},
+    'hostingde' => {},
+    'infoblox' => {},
+    'internetbs' => {},
+    'inwx' => {},
+    'ispconfig' => {},
+    'jd' => {},
+    'kas' => {},
+    'kinghost' => {},
+    'knot' => {},
+    'leaseweb' => {},
+    'lexicon' => {},
+    'linode' => {},
+    'linode_v4' => {},
+    'loopia' => {},
+    'lua' => {},
+    'maradns' => {},
+    'me' => {},
+    'miab' => {},
+    'misaka' => {},
+    'myapi' => {},
+    'mydevil' => {},
+    'mydnsjp' => {},
+    'namecheap' => {},
+    'namecom' => {},
+    'namesilo' => {},
+    'nederhost' => {},
+    'neodigit' => {},
+    'netcup' => {},
+    'nic' => {},
+    'nsd' => {},
+    'nsone' => {},
+    'nsupdate' => {},
+    'nw' => {},
+    'one' => {},
+    'online' => {},
+    'openprovider' => {},
+    'opnsense' => {},
+    'ovh' => {
+	'OVH_END_POINT' => {
+	    description => "The OVH endpoint",
+	    type => 'string',
+	},
+	'OVH_AK' => {
+	    description => "The application key.",
+	    type => 'string',
+	},
+	'OVH_AS' => {
+	    description => "The application secret.",
+	    type => 'string',
+	},
+    },
+    'pdns' => {
+	'PDNS_Url' => {
+	    description => "The PowerDNS API endpoint.",
+	    type => 'string',
+	},
+	'PDNS_ServerId'=> {
+	    type => 'string',
+	},
+	'PDNS_Token'=> {
+	    type => 'string',
+	},
+	'PDNS_Ttl'=> {
+	    type => 'integer',
+	},
+    },
+    'pleskxml' => {},
+    'pointhq' => {},
+    'rackspace' => {},
+    'rcode0' => {},
+    'regru' => {},
+    'schlundtech' => {},
+    'selectel' => {},
+    'servercow' => {},
+    'tele3' => {},
+    'ultra' => {},
+    'unoeuro' => {},
+    'variomedia' => {},
+    'vscale' => {},
+    'vultr' => {},
+    'yandex' => {},
+    'zilore' => {},
+    'zone' => {},
+    'zonomi' => {},
+};
+
 sub get_supported_plugins {
-    return $plugin_names;
+    return $plugins;
 }
 
 sub properties {
@@ -128,7 +157,7 @@ sub properties {
 	api => {
 	    description => "API plugin name",
 	    type => 'string',
-	    enum => $plugin_names,
+	    enum => [sort keys %$plugins],
 	},
 	data => {
 	    type => 'string',
-- 
2.20.1





More information about the pve-devel mailing list