public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] api: add schema for http proxy configuration - HTTP_PROXY_SCHEMA
@ 2021-04-28  9:01 Dietmar Maurer
  0 siblings, 0 replies; only message in thread
From: Dietmar Maurer @ 2021-04-28  9:01 UTC (permalink / raw)
  To: pbs-devel

---
 src/api2/types/mod.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/api2/types/mod.rs b/src/api2/types/mod.rs
index 66b4d258..0b4e3e55 100644
--- a/src/api2/types/mod.rs
+++ b/src/api2/types/mod.rs
@@ -1610,3 +1610,14 @@ pub struct NodeStatus {
     pub cpuinfo: NodeCpuInformation,
     pub info: NodeInformation,
 }
+
+pub const HTTP_PROXY_SCHEMA: Schema = StringSchema::new(
+    "HTTP proxy configuration [http://]<host>[:port]")
+    .format(&ApiStringFormat::VerifyFn(|s| {
+        crate::tools::http::ProxyConfig::parse_proxy_url(s)?;
+        Ok(())
+    }))
+    .min_length(1)
+    .max_length(128)
+    .type_text("[http://]<host>[:port]")
+    .schema();
-- 
2.20.1




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-28  9:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28  9:01 [pbs-devel] [PATCH proxmox-backup] api: add schema for http proxy configuration - HTTP_PROXY_SCHEMA Dietmar Maurer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal