From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 02/13] pdm-api-types: views: add ViewFilterConfig type
Date: Wed, 29 Oct 2025 15:48:51 +0100 [thread overview]
Message-ID: <20251029144902.446852-3-l.wagner@proxmox.com> (raw)
In-Reply-To: <20251029144902.446852-1-l.wagner@proxmox.com>
This type will be used to define view filters.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
lib/pdm-api-types/src/lib.rs | 2 +
lib/pdm-api-types/src/views.rs | 147 +++++++++++++++++++++++++++++++++
2 files changed, 149 insertions(+)
create mode 100644 lib/pdm-api-types/src/views.rs
diff --git a/lib/pdm-api-types/src/lib.rs b/lib/pdm-api-types/src/lib.rs
index 2fb61ef7..a7ba6d89 100644
--- a/lib/pdm-api-types/src/lib.rs
+++ b/lib/pdm-api-types/src/lib.rs
@@ -106,6 +106,8 @@ pub mod subscription;
pub mod sdn;
+pub mod views;
+
const_regex! {
// just a rough check - dummy acceptor is used before persisting
pub OPENSSL_CIPHERS_REGEX = r"^[0-9A-Za-z_:, +!\-@=.]+$";
diff --git a/lib/pdm-api-types/src/views.rs b/lib/pdm-api-types/src/views.rs
new file mode 100644
index 00000000..8a00f4de
--- /dev/null
+++ b/lib/pdm-api-types/src/views.rs
@@ -0,0 +1,147 @@
+use serde::{Deserialize, Serialize};
+
+use proxmox_schema::{api, Updater};
+
+use crate::{remotes::REMOTE_ID_SCHEMA, resource::ResourceType};
+
+#[api(
+ properties: {
+ "include-resource-id": {
+ type: Array,
+ items: {
+ // TODO: Define some schema for this somewhere.
+ type: String,
+ description: "Global resource ID, e.g. 'remote/{remote}/node/{nodename}'",
+ },
+ optional: true,
+ },
+ "exclude-resource-id": {
+ type: Array,
+ items: {
+ // TODO: Define some schema for this somewhere.
+ type: String,
+ description: "Global resource ID, e.g. 'remote/{remote}/node/{nodename}'",
+ },
+ optional: true,
+ },
+ "include-remote": {
+ type: Array,
+ items: {
+ schema: REMOTE_ID_SCHEMA,
+ },
+ optional: true,
+ },
+ "exclude-remote": {
+ type: Array,
+ items: {
+ schema: REMOTE_ID_SCHEMA,
+ },
+ optional: true,
+ },
+ "include-resource-type": {
+ type: Array,
+ items: {
+ type: ResourceType,
+ },
+ optional: true,
+ },
+ "exclude-resource-type": {
+ type: Array,
+ items: {
+ type: ResourceType,
+ },
+ optional: true,
+ },
+ "include-tag": {
+ type: Array,
+ items: {
+ type: String,
+ description: "A tag of remote guest."
+ },
+ optional: true,
+ },
+ "exclude-tag": {
+ type: Array,
+ items: {
+ type: String,
+ description: "A tag of remote guest."
+ },
+ optional: true,
+ },
+ "include-resource-pool": {
+ type: Array,
+ items: {
+ // TODO: Define some schema for this somewhere.
+ type: String,
+ description: "Pool name."
+ },
+ optional: true,
+ },
+ "exclude-resource-pool": {
+ type: Array,
+ items: {
+ // TODO: Define some schema for this somewhere.
+ type: String,
+ description: "Pool name."
+ },
+ optional: true,
+ }
+ }
+)]
+#[derive(Clone, Default, Deserialize, Serialize, Updater)]
+#[serde(rename_all = "kebab-case")]
+/// View definition
+pub struct ViewFilterConfig {
+ /// View filter name
+ pub id: String,
+
+ /// List of resource IDs to include.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[updater(serde(skip_serializing_if = "Option::is_none"))]
+ pub include_resource_id: Vec<String>,
+
+ /// List of remotes to include.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[updater(serde(skip_serializing_if = "Option::is_none"))]
+ pub include_remote: Vec<String>,
+
+ /// List of included resource types.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[updater(serde(skip_serializing_if = "Option::is_none"))]
+ pub include_resource_type: Vec<ResourceType>,
+
+ /// List of included tags.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[updater(serde(skip_serializing_if = "Option::is_none"))]
+ pub include_tag: Vec<String>,
+
+ /// List of included resource pools.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[updater(serde(skip_serializing_if = "Option::is_none"))]
+ pub include_resource_pool: Vec<String>,
+
+ /// List of resource IDs to exclude.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[updater(serde(skip_serializing_if = "Option::is_none"))]
+ pub exclude_resource_id: Vec<String>,
+
+ /// List of remotes to exclude.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[updater(serde(skip_serializing_if = "Option::is_none"))]
+ pub exclude_remote: Vec<String>,
+
+ /// List of excluded resource types.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[updater(serde(skip_serializing_if = "Option::is_none"))]
+ pub exclude_resource_type: Vec<ResourceType>,
+
+ /// List of excluded tags.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[updater(serde(skip_serializing_if = "Option::is_none"))]
+ pub exclude_tag: Vec<String>,
+
+ /// List of excluded resource pools.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[updater(serde(skip_serializing_if = "Option::is_none"))]
+ pub exclude_resource_pool: Vec<String>,
+}
--
2.47.3
_______________________________________________
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:[~2025-10-29 14:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 14:48 [pdm-devel] [RFC datacenter-manager 00/13] backend implementation for view filters Lukas Wagner
2025-10-29 14:48 ` [pdm-devel] [PATCH datacenter-manager 01/13] fake remote: add missing parameter for cluster_metrics_export function Lukas Wagner
2025-10-30 10:26 ` [pdm-devel] applied: " Wolfgang Bumiller
2025-10-29 14:48 ` Lukas Wagner [this message]
2025-10-29 14:48 ` [pdm-devel] [PATCH datacenter-manager 03/13] pdm-config: views: add support for view-filters Lukas Wagner
2025-10-29 14:48 ` [pdm-devel] [PATCH datacenter-manager 04/13] acl: add '/view' and '/view/{view-id}' as allowed ACL paths Lukas Wagner
2025-10-29 14:48 ` [pdm-devel] [PATCH datacenter-manager 05/13] views: add implementation for view filters Lukas Wagner
2025-10-30 11:44 ` Shannon Sterz
2025-10-30 13:30 ` Lukas Wagner
2025-10-29 14:48 ` [pdm-devel] [PATCH datacenter-manager 06/13] views: add tests for view filter implementation Lukas Wagner
2025-10-29 14:48 ` [pdm-devel] [PATCH datacenter-manager 07/13] api: resources: list: add support for view-filter parameter Lukas Wagner
2025-10-30 11:21 ` Wolfgang Bumiller
2025-10-29 14:48 ` [pdm-devel] [PATCH datacenter-manager 08/13] api: resources: top entities: " Lukas Wagner
2025-10-29 14:48 ` [pdm-devel] [PATCH datacenter-manager 09/13] api: resources: status: " Lukas Wagner
2025-10-29 14:48 ` [pdm-devel] [PATCH datacenter-manager 10/13] api: subscription " Lukas Wagner
2025-10-30 11:31 ` Wolfgang Bumiller
2025-10-30 11:44 ` Shannon Sterz
2025-10-29 14:49 ` [pdm-devel] [PATCH datacenter-manager 11/13] api: remote-tasks: " Lukas Wagner
2025-10-29 14:49 ` [pdm-devel] [PATCH datacenter-manager 12/13] pdm-client: resource list: add " Lukas Wagner
2025-10-29 14:49 ` [pdm-devel] [PATCH datacenter-manager 13/13] pdm-client: top entities: " Lukas Wagner
2025-10-30 11:41 ` [pdm-devel] [RFC datacenter-manager 00/13] backend implementation for view filters Wolfgang Bumiller
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=20251029144902.446852-3-l.wagner@proxmox.com \
--to=l.wagner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.