From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-api-types 1/1] add /access/domains GET call
Date: Thu, 19 Dec 2024 13:09:17 +0100 [thread overview]
Message-ID: <20241219120920.2046373-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20241219120920.2046373-1-d.csapak@proxmox.com>
so we can query remote realms
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
pve-api-types/generate.pl | 7 +++-
pve-api-types/src/generated/code.rs | 12 ++++++-
pve-api-types/src/generated/types.rs | 51 ++++++++++++++++++++++++++++
3 files changed, 68 insertions(+), 2 deletions(-)
diff --git a/pve-api-types/generate.pl b/pve-api-types/generate.pl
index e72898e..4c8e164 100644
--- a/pve-api-types/generate.pl
+++ b/pve-api-types/generate.pl
@@ -280,7 +280,12 @@ Schema2Rust::register_api_extensions('ClusterJoinInfo', {
api(GET => '/cluster/config/join', 'cluster_config_join', 'return-name' => 'ClusterJoinInfo');
# api(GET => '/storage', 'list_storages', 'return-name' => 'StorageList');
-# api(GET => '/access/domains', 'list_domains', 'return-name' => 'ListRealm');
+Schema2Rust::register_api_extensions('ListRealm', {
+ '/properties/realm' => { description => sq("FIXME: Missing description in PVE.") },
+ '/properties/type' => { description => sq("FIXME: Missing description in PVE.") },
+});
+api(GET => '/access/domains', 'list_domains', 'return-name' => 'ListRealm');
+Schema2Rust::derive('ListRealm' => 'Clone', 'PartialEq');
# api(GET => '/access/groups', 'list_groups', 'return-name' => 'ListGroups');
# api(GET => '/access/groups/{groupid}', 'get_group', 'return-name' => 'Group');
# api(GET => '/access/users', 'list_users', 'return-name' => 'ListUsers');
diff --git a/pve-api-types/src/generated/code.rs b/pve-api-types/src/generated/code.rs
index 33317a3..dc17cd9 100644
--- a/pve-api-types/src/generated/code.rs
+++ b/pve-api-types/src/generated/code.rs
@@ -4,7 +4,6 @@
/// ```text
/// - /access
/// - /access/acl
-/// - /access/domains
/// - /access/domains/{realm}
/// - /access/domains/{realm}/sync
/// - /access/groups
@@ -438,6 +437,11 @@ pub trait PveClient {
Err(Error::Other("get_task_status not implemented"))
}
+ /// Authentication domain index.
+ async fn list_domains(&self) -> Result<Vec<ListRealm>, Error> {
+ Err(Error::Other("list_domains not implemented"))
+ }
+
/// LXC container index (per node).
async fn list_lxc(&self, node: &str) -> Result<Vec<LxcEntry>, Error> {
Err(Error::Other("list_lxc not implemented"))
@@ -758,6 +762,12 @@ where
Ok(self.0.get(&url).await?.expect_json()?.data)
}
+ /// Authentication domain index.
+ async fn list_domains(&self) -> Result<Vec<ListRealm>, Error> {
+ let url = format!("/api2/extjs/access/domains");
+ Ok(self.0.get(&url).await?.expect_json()?.data)
+ }
+
/// LXC container index (per node).
async fn list_lxc(&self, node: &str) -> Result<Vec<LxcEntry>, Error> {
let url = format!("/api2/extjs/nodes/{node}/lxc");
diff --git a/pve-api-types/src/generated/types.rs b/pve-api-types/src/generated/types.rs
index 06d9fe3..76c66b5 100644
--- a/pve-api-types/src/generated/types.rs
+++ b/pve-api-types/src/generated/types.rs
@@ -969,6 +969,57 @@ pub enum ListNetworksType {
serde_plain::derive_display_from_serialize!(ListNetworksType);
serde_plain::derive_fromstr_from_deserialize!(ListNetworksType);
+#[api(
+ properties: {
+ comment: {
+ optional: true,
+ type: String,
+ },
+ realm: {
+ type: String,
+ description: "FIXME: Missing description in PVE.",
+ },
+ tfa: {
+ optional: true,
+ type: ListRealmTfa,
+ },
+ type: {
+ type: String,
+ description: "FIXME: Missing description in PVE.",
+ },
+ },
+)]
+/// Object.
+#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
+pub struct ListRealm {
+ /// A comment. The GUI use this text when you select a domain (Realm) on the
+ /// login window.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub comment: Option<String>,
+
+ pub realm: String,
+
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub tfa: Option<ListRealmTfa>,
+
+ #[serde(rename = "type")]
+ pub ty: String,
+}
+
+#[api]
+/// Two-factor authentication provider.
+#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+pub enum ListRealmTfa {
+ #[serde(rename = "yubico")]
+ /// yubico.
+ Yubico,
+ #[serde(rename = "oath")]
+ /// oath.
+ Oath,
+}
+serde_plain::derive_display_from_serialize!(ListRealmTfa);
+serde_plain::derive_fromstr_from_deserialize!(ListRealmTfa);
+
const_regex! {
LIST_TASKS_STATUSFILTER_RE = r##"^(?i:ok|error|warning|unknown)$"##;
--
2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2024-12-19 12:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 12:09 [pdm-devel] [PATCH yew-widget-toolkit/proxmox-api-types/pdm] overhaul remote wizard Dominik Csapak
2024-12-19 12:09 ` [pdm-devel] [PATCH yew-widget-toolkit 1/1] widget: input panel: use correct column for custom childs Dominik Csapak
2024-12-19 12:22 ` [pdm-devel] applied: " Thomas Lamprecht
2024-12-19 12:09 ` Dominik Csapak [this message]
2024-12-19 12:22 ` [pdm-devel] applied: [PATCH proxmox-api-types 1/1] add /access/domains GET call Thomas Lamprecht
2024-12-19 12:09 ` [pdm-devel] [PATCH datacenter-manager 1/3] server: api: add 'realms' add point for PVE Dominik Csapak
2024-12-19 12:09 ` [pdm-devel] [PATCH datacenter-manager 2/3] pdm-client: expose `ListRealm` type Dominik Csapak
2024-12-19 12:09 ` [pdm-devel] [PATCH datacenter-manager 3/3] ui: restructure wizard to have a better flow Dominik Csapak
2024-12-19 12:31 ` [pdm-devel] applied: [PATCH yew-widget-toolkit/proxmox-api-types/pdm] overhaul remote wizard Thomas Lamprecht
2024-12-19 12:35 ` Dominik Csapak
2024-12-19 12:40 ` Thomas Lamprecht
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=20241219120920.2046373-3-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pdm-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