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 006A21FF17A for ; Fri, 18 Jul 2025 10:39:41 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C883E16E81; Fri, 18 Jul 2025 10:40:49 +0200 (CEST) Message-ID: <4deacaf5-74a4-4296-bf3b-4daf30af4748@proxmox.com> Date: Fri, 18 Jul 2025 10:40:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Lukas Wagner , Proxmox Backup Server development discussion References: <20250715125332.954494-1-c.ebner@proxmox.com> <20250715125332.954494-13-c.ebner@proxmox.com> Content-Language: en-US, de-DE From: Christian Ebner In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1752828043009 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.046 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 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: Re: [pbs-devel] [PATCH proxmox-backup v8 03/45] api: config: implement endpoints to manipulate and list s3 configs X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" On 7/18/25 9:32 AM, Lukas Wagner wrote: > Reviewed-by: Lukas Wagner > > > On 2025-07-15 14:52, Christian Ebner wrote: >> +/// Update an s3 client configuration. >> +#[allow(clippy::too_many_arguments)] >> +pub fn update_s3_client_config( >> + id: String, >> + update: S3ClientConfigUpdater, >> + update_secrets: S3ClientSecretsConfigUpdater, >> + delete: Option>, >> + digest: Option, >> + _rpcenv: &mut dyn RpcEnvironment, >> +) -> Result<(), Error> { >> + let _lock = s3::lock_config()?; >> + let (mut config, expected_digest) = s3::config()?; >> + let (mut secrets, secrets_digest) = s3::secrets_config()?; >> + let expected_digest = digest_with_secrets(&expected_digest, &secrets_digest); >> + >> + // Secrets are not included in digest concurrent changes therefore not detected. >> + if let Some(ref digest) = digest { >> + let digest = <[u8; 32]>::from_hex(digest)?; >> + crate::tools::detect_modified_configuration_file(&digest, &expected_digest)?; >> + } >> + >> + let mut data: S3ClientConfig = config.lookup("s3client", &id)?; >> + >> + if let Some(delete) = delete { >> + for delete_prop in delete { >> + match delete_prop { >> + DeletableProperty::Port => { >> + data.port = None; >> + } >> + DeletableProperty::Region => { >> + data.region = None; >> + } >> + DeletableProperty::Fingerprint => { >> + data.fingerprint = None; >> + } >> + DeletableProperty::PathStyle => { >> + data.path_style = None; >> + } >> + } >> + } >> + } > > Some time ago I've found that it is quite useful to > destructure the updater like I did in proxmox-notify [1]. > This ensures that you don't forget to update the > API handler after adding a new field to the config struct. > Not a must, just a suggestion, since I like this pattern quite a bit :) If fine by you, I'll keep this for now and do this as a followup, including the same changes to the sync jobs and other configs were we have this pattern. Would like to focus on the other comments first, as these seem more pressing. > [1] https://git.proxmox.com/?p=proxmox.git;a=blob;f=proxmox-notify/src/api/webhook.rs;h=9d904d0bf57f9f789bb6723e1d8ca710fcf0cb96;hb=HEAD#l175 > >> + >> + if let Some(endpoint) = update.endpoint { >> + data.endpoint = endpoint; >> + } >> + if let Some(port) = update.port { >> + data.port = Some(port); >> + } >> + if let Some(region) = update.region { >> + data.region = Some(region); >> + } >> + if let Some(access_key) = update.access_key { >> + data.access_key = access_key; >> + } >> + if let Some(fingerprint) = update.fingerprint { >> + data.fingerprint = Some(fingerprint); >> + } >> + if let Some(path_style) = update.path_style { >> + data.path_style = Some(path_style); >> + } >> + >> + let mut secrets_data: S3ClientSecretsConfig = secrets.lookup("s3secrets", &id)?; >> + if let Some(secret_key) = update_secrets.secret_key { >> + secrets_data.secret_key = secret_key; >> + } >> + >> + config.set_data(&id, "s3client", &data)?; >> + secrets.set_data(&id, "s3secrets", &secrets_data)?; >> + s3::save_config(&config, &secrets)?; >> + >> + Ok(()) >> +} > > _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel