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 0967C1FF139 for ; Tue, 27 Jan 2026 13:27:38 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0276621717; Tue, 27 Jan 2026 13:28:02 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Tue, 27 Jan 2026 13:27:10 +0100 Message-ID: <20260127122712.505774-3-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260127122712.505774-1-c.ebner@proxmox.com> References: <20260127122712.505774-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1769516780211 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.048 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [client.rs] Subject: [pbs-devel] [PATCH proxmox 2/3] s3-client: parse and return headers for delete object response 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Mimic the response elements from the list objects parsing in the delete object response. In preparation for being able to perform delete objects via individual delete object api calls, if the respective provider quirk is set in the client options. Signed-off-by: Christian Ebner --- proxmox-s3-client/src/client.rs | 9 +++++---- proxmox-s3-client/src/response_reader.rs | 21 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/client.rs index 83176b39..3d0af5d6 100644 --- a/proxmox-s3-client/src/client.rs +++ b/proxmox-s3-client/src/client.rs @@ -29,8 +29,9 @@ use crate::aws_sign_v4::AWS_SIGN_V4_DATETIME_FORMAT; use crate::aws_sign_v4::{aws_sign_v4_signature, aws_sign_v4_uri_encode}; use crate::object_key::S3ObjectKey; use crate::response_reader::{ - CopyObjectResponse, DeleteObjectsResponse, GetObjectResponse, HeadObjectResponse, - ListBucketsResponse, ListObjectsV2Response, PutObjectResponse, ResponseReader, + CopyObjectResponse, DeleteObjectsResponse, DeletedObject, GetObjectResponse, + HeadObjectResponse, ListBucketsResponse, ListObjectsV2Response, PutObjectResponse, + ResponseReader, }; /// Default timeout for s3 api requests. @@ -544,7 +545,7 @@ impl S3Client { /// Removes an object from a bucket. /// See reference docs: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html - pub async fn delete_object(&self, object_key: S3ObjectKey) -> Result<(), Error> { + pub async fn delete_object(&self, object_key: S3ObjectKey) -> Result { let object_key = object_key.to_full_key(&self.options.common_prefix); let request = Request::builder() .method(Method::DELETE) @@ -553,7 +554,7 @@ impl S3Client { let response = self.send(request, None).await?; let response_reader = ResponseReader::new(response); - response_reader.delete_object_response().await + response_reader.delete_object_response(object_key).await } /// Delete multiple objects from a bucket using a single HTTP request. diff --git a/proxmox-s3-client/src/response_reader.rs b/proxmox-s3-client/src/response_reader.rs index 7066c33b..be7c0950 100644 --- a/proxmox-s3-client/src/response_reader.rs +++ b/proxmox-s3-client/src/response_reader.rs @@ -361,7 +361,10 @@ impl ResponseReader { /// Read and parse the delete object response. /// /// Returns with error if an unexpected status code is encountered. - pub(crate) async fn delete_object_response(self) -> Result<(), Error> { + pub(crate) async fn delete_object_response( + self, + key: S3ObjectKey, + ) -> Result { let (parts, _body) = self.response.into_parts(); match parts.status { @@ -369,7 +372,21 @@ impl ResponseReader { status_code => bail!("unexpected status code {status_code}"), }; - Ok(()) + let delete_marker = Self::parse_optional_header( + HeaderName::from_static("x-amz-delete-marker"), + &parts.headers, + )?; + let delete_marker_version_id = Self::parse_optional_header( + HeaderName::from_static("x-amz-version-id"), + &parts.headers, + )?; + + Ok(DeletedObject { + delete_marker, + delete_marker_version_id, + key: Some(key), + version_id: None, + }) } /// Read and parse the delete objects response. -- 2.47.3 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel