all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 0/4] clean up return statements tree wide
Date: Fri, 28 Nov 2025 16:38:51 +0100	[thread overview]
Message-ID: <20251128153855.543210-1-s.sterz@proxmox.com> (raw)

these patches clean up the return section of all api endpoints as much
as possible. most of these are either additions of `returns` sections or
making the `returns` section match the actual api method it references.

the last two commit here are slightly different in that the first one
changes the actual return type of an api method. see the third commit
for the reasoning there. the last commit fixes up the description of an
api endpoint that was noticed along the way.

there are some other areas that seem inconsistent, but aren't addressed
here, as that would require more in-depth changes/discussion:

* `list_network_devices` in server/src/api/nodes/network.rs: this
  endpoint has an returns sections that specifies a list of
  `Interface`s, but the endpoint actually returns a `Value`. this
  `Value` contains almost a list of `Interface`s, but extends them with
  two field: `digest` and `iface`. ideally we could define these two
  fields as optional field in `Interface` or similar.
* endpoints that upgrade to a websocket don't really have proper returns
  sections, but i'm not sure what would be the proper definition anyway.
* pbs and pve tls probing endpoints: these return `TlsProbeOutcome` which
  is an enum. this enum has a unit and an unnamed variant, which isn't
  supported by the api macro. investigated a little bit, but there
  doesn't seem to be a way to make this work without some refactoring.
* `refresh_remote_update_summaries` in server/src/api/remote_updates.rs:
  this returns a parsed UPID struct instead of its string
  representation. while this is fine, it is also inconsistent with all
  other endpoints returning UPIDs afaict (though a lot of endpoints
  return a `RemoteUpid`)
* `ping` in server/src/api/mod.rs: returns the string `"pong"` whereas
  the equivalent pbs endpoint returns `{ "pong": true }`

the following endpoints could probably benefit from an access section:

* `get_node_rrddata` in server/src/nodes/rrddata.rs
* `list_remotes` in server/src/api/pbs/mod.rs
* `trigger_metric_collection` and `get_metric_collection_status` in
  server/src/api/metric_collection.rs

Shannon Sterz (4):
  tree-wide: add missing `returns` definitions to api macro
  tree-wide: make `returns` defintion match the return type of api
    methods
  api: pve: make to `get_storage_rrd_data` return PveStorageDataPoint
  api: pbs: fix description of list namespace endpoint

 server/src/api/access/tfa.rs           | 10 ++++++
 server/src/api/config/access/ad.rs     |  1 -
 server/src/api/config/access/ldap.rs   |  1 -
 server/src/api/config/access/openid.rs |  1 -
 server/src/api/config/acme.rs          |  9 +++++
 server/src/api/config/views.rs         |  1 +
 server/src/api/metric_collection.rs    | 10 +++++-
 server/src/api/mod.rs                  | 22 ++++++++++++
 server/src/api/nodes/certificates.rs   |  9 +++++
 server/src/api/nodes/network.rs        |  3 ++
 server/src/api/nodes/rrddata.rs        |  7 ++++
 server/src/api/nodes/tasks.rs          | 50 +++++++++++++++++++++++++-
 server/src/api/pbs/mod.rs              |  9 ++++-
 server/src/api/pbs/rrddata.rs          | 14 ++++++--
 server/src/api/pbs/tasks.rs            |  8 +++--
 server/src/api/pve/firewall.rs         | 24 +++----------
 server/src/api/pve/lxc.rs              |  4 +--
 server/src/api/pve/mod.rs              |  8 +++++
 server/src/api/pve/node.rs             | 15 ++++++++
 server/src/api/pve/qemu.rs             |  1 +
 server/src/api/pve/rrddata.rs          | 32 +++++++++++++++--
 server/src/api/pve/storage.rs          |  2 +-
 server/src/api/pve/tasks.rs            |  8 ++++-
 server/src/api/remote_tasks.rs         |  8 +++++
 server/src/api/remote_updates.rs       |  3 ++
 server/src/api/remotes.rs              | 11 ++++--
 server/src/api/resources.rs            |  9 ++---
 server/src/api/sdn/vnets.rs            |  2 +-
 server/src/api/sdn/zones.rs            |  2 +-
 29 files changed, 236 insertions(+), 48 deletions(-)

--
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


             reply	other threads:[~2025-11-28 15:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 15:38 Shannon Sterz [this message]
2025-11-28 15:38 ` [pdm-devel] [PATCH datacenter-manager 1/4] tree-wide: add missing `returns` definitions to api macro Shannon Sterz
2025-11-28 15:38 ` [pdm-devel] [PATCH datacenter-manager 2/4] tree-wide: make `returns` defintion match the return type of api methods Shannon Sterz
2025-11-28 15:38 ` [pdm-devel] [PATCH datacenter-manager 3/4] api: pve: make to `get_storage_rrd_data` return PveStorageDataPoint Shannon Sterz
2025-11-28 15:38 ` [pdm-devel] [PATCH datacenter-manager 4/4] api: pbs: fix description of list namespace endpoint Shannon Sterz
2025-11-28 18:53 ` [pdm-devel] applied: [PATCH datacenter-manager 0/4] clean up return statements tree wide 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=20251128153855.543210-1-s.sterz@proxmox.com \
    --to=s.sterz@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal