public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] api: add schema for http proxy configuration - HTTP_PROXY_SCHEMA
Date: Wed, 28 Apr 2021 11:01:34 +0200	[thread overview]
Message-ID: <20210428090134.25652-1-dietmar@proxmox.com> (raw)

---
 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




                 reply	other threads:[~2021-04-28  9:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210428090134.25652-1-dietmar@proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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