Skip to content

Commit

Permalink
cloud_storage_clients: handle both gcp and s3 request ids
Browse files Browse the repository at this point in the history
We use the same API client for both GCP and S3 so it should handle
response from both.

Fixes redpanda-data#15210

(cherry picked from commit 37487f0)
  • Loading branch information
nvartolomei authored and vbotbuildovich committed Nov 30, 2023
1 parent 5768117 commit 658f33c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/v/cloud_storage_clients/s3_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ struct aws_header_names {
static constexpr boost::beast::string_view x_amz_tagging = "x-amz-tagging";
static constexpr boost::beast::string_view x_amz_request_id
= "x-amz-request-id";
// https://cloud.google.com/storage/docs/xml-api/reference-headers#xguploaderuploadid
static constexpr boost::beast::string_view x_guploader_uploadid
= "x-guploader-uploadid";
static constexpr boost::beast::string_view delimiter = "delimiter";
};

Expand Down Expand Up @@ -401,7 +404,13 @@ ss::future<ResultT> parse_head_error_response(
code = fmt::format("{}", status_to_error_code(hdr.result()));
msg = ss::sstring(hdr.reason().data(), hdr.reason().size());
}
auto rid = hdr.at(aws_header_names::x_amz_request_id);
boost::string_view rid;
if (hdr.find(aws_header_names::x_amz_request_id) != hdr.end()) {
rid = hdr.at(aws_header_names::x_amz_request_id);
} else if (
hdr.find(aws_header_names::x_guploader_uploadid) != hdr.end()) {
rid = hdr.at(aws_header_names::x_guploader_uploadid);
}
rest_error_response err(
code, msg, ss::sstring(rid.data(), rid.size()), key().native());
return ss::make_exception_future<ResultT>(err);
Expand Down

0 comments on commit 658f33c

Please sign in to comment.