From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 84F4C1FF13E for ; Fri, 03 Apr 2026 18:56:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4DA0582A6; Fri, 3 Apr 2026 18:56:33 +0200 (CEST) From: Christoph Heiss To: pdm-devel@lists.proxmox.com Subject: [PATCH datacenter-manager v3 14/38] api-types, cli: use ReturnType::new() instead of constructing it manually Date: Fri, 3 Apr 2026 18:53:46 +0200 Message-ID: <20260403165437.2166551-15-c.heiss@proxmox.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260403165437.2166551-1-c.heiss@proxmox.com> References: <20260403165437.2166551-1-c.heiss@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1775235298282 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.066 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: GSS3NMKCB2SB3XDQUO54RYCYQLCG2PK3 X-Message-ID-Hash: GSS3NMKCB2SB3XDQUO54RYCYQLCG2PK3 X-MailFrom: c.heiss@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: .. like everywhere else. Signed-off-by: Christoph Heiss --- Changes v2 -> v3: * new patch cli/client/src/pbs.rs | 10 ++-------- cli/client/src/pve.rs | 15 +++------------ cli/client/src/remotes.rs | 5 +---- lib/pdm-api-types/src/lib.rs | 8 ++++---- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/cli/client/src/pbs.rs b/cli/client/src/pbs.rs index 9972824..c59e0be 100644 --- a/cli/client/src/pbs.rs +++ b/cli/client/src/pbs.rs @@ -239,10 +239,7 @@ async fn list_tasks(remote: String) -> Result<(), Error> { format_and_print_result_full( &mut serde_json::to_value(data)?, - &ReturnType { - optional: false, - schema: &TASK_LIST_SCHEMA, - }, + &ReturnType::new(false, &TASK_LIST_SCHEMA), &env().format_args.output_format.to_string(), &proxmox_router::cli::default_table_format_options(), ); @@ -266,10 +263,7 @@ async fn task_status(remote: String, upid: String) -> Result<(), Error> { format_and_print_result_full( &mut serde_json::to_value(data)?, - &ReturnType { - optional: false, - schema: &pdm_api_types::pbs::TaskStatus::API_SCHEMA, - }, + &ReturnType::new(false, &pdm_api_types::pbs::TaskStatus::API_SCHEMA), &env().format_args.output_format.to_string(), &Default::default(), ); diff --git a/cli/client/src/pve.rs b/cli/client/src/pve.rs index 19bd098..3bbc399 100644 --- a/cli/client/src/pve.rs +++ b/cli/client/src/pve.rs @@ -238,10 +238,7 @@ async fn cluster_resources( format_and_print_result_full( &mut serde_json::to_value(data)?, - &ReturnType { - optional: false, - schema: &CLUSTER_LIST_SCHEMA, - }, + &ReturnType::new(false, &CLUSTER_LIST_SCHEMA), &env().format_args.output_format.to_string(), &Default::default(), ); @@ -1077,10 +1074,7 @@ async fn list_tasks(remote: String, node: Option) -> Result<(), Error> { format_and_print_result_full( &mut serde_json::to_value(data)?, - &ReturnType { - optional: false, - schema: &TASK_LIST_SCHEMA, - }, + &ReturnType::new(false, &TASK_LIST_SCHEMA), &env().format_args.output_format.to_string(), &proxmox_router::cli::default_table_format_options(), ); @@ -1104,10 +1098,7 @@ async fn task_status(remote: String, upid: String) -> Result<(), Error> { format_and_print_result_full( &mut serde_json::to_value(data)?, - &ReturnType { - optional: false, - schema: &pve_api_types::TaskStatus::API_SCHEMA, - }, + &ReturnType::new(false, &pve_api_types::TaskStatus::API_SCHEMA), &env().format_args.output_format.to_string(), &Default::default(), ); diff --git a/cli/client/src/remotes.rs b/cli/client/src/remotes.rs index e087809..693774f 100644 --- a/cli/client/src/remotes.rs +++ b/cli/client/src/remotes.rs @@ -142,10 +142,7 @@ async fn remote_version(id: String) -> Result<(), Error> { let data = client()?.remote_version(&id).await?; format_and_print_result_full( &mut serde_json::to_value(data)?, - &ReturnType { - optional: false, - schema: &pve_api_types::VersionResponse::API_SCHEMA, - }, + &ReturnType::new(false, &pve_api_types::VersionResponse::API_SCHEMA), &env().format_args.output_format.to_string(), &Default::default(), ); diff --git a/lib/pdm-api-types/src/lib.rs b/lib/pdm-api-types/src/lib.rs index fec3c8f..aea1b5d 100644 --- a/lib/pdm-api-types/src/lib.rs +++ b/lib/pdm-api-types/src/lib.rs @@ -322,10 +322,10 @@ pub struct TaskStatistics { pub by_remote: HashMap, } -pub const NODE_TASKS_LIST_TASKS_RETURN_TYPE: ReturnType = ReturnType { - optional: false, - schema: &ArraySchema::new("A list of tasks.", &TaskListItem::API_SCHEMA).schema(), -}; +pub const NODE_TASKS_LIST_TASKS_RETURN_TYPE: ReturnType = ReturnType::new( + false, + &ArraySchema::new("A list of tasks.", &TaskListItem::API_SCHEMA).schema(), +); #[api] #[derive(Deserialize, Serialize, Copy, Clone, PartialEq, Eq)] -- 2.53.0