From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 8EF781FF163 for ; Thu, 19 Dec 2024 13:09:24 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EABD24661; Thu, 19 Dec 2024 13:09:24 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Thu, 19 Dec 2024 13:09:17 +0100 Message-Id: <20241219120920.2046373-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241219120920.2046373-1-d.csapak@proxmox.com> References: <20241219120920.2046373-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.136 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH proxmox-api-types 1/1] add /access/domains GET call X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" so we can query remote realms Signed-off-by: Dominik Csapak --- 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, Error> { + Err(Error::Other("list_domains not implemented")) + } + /// LXC container index (per node). async fn list_lxc(&self, node: &str) -> Result, 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, 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, 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, + + pub realm: String, + + #[serde(default, skip_serializing_if = "Option::is_none")] + pub tfa: Option, + + #[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