Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud_storage_clients: add cloud_storage_backend::oracle and fix s3_client::self_configure() #22902

Merged
merged 5 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions src/v/cloud_storage_clients/configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,21 @@ operator<<(std::ostream& o, const client_self_configuration_output& r) {
r);
}

model::cloud_storage_backend
infer_backend_from_uri(const access_point_uri& uri) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

auto result
= string_switch<model::cloud_storage_backend>(uri())
.match_expr("google", model::cloud_storage_backend::google_s3_compat)
.match_expr(R"(127\.0\.0\.1)", model::cloud_storage_backend::aws)
.match_expr("localhost", model::cloud_storage_backend::aws)
.match_expr("minio", model::cloud_storage_backend::minio)
.match_expr("amazon", model::cloud_storage_backend::aws)
.match_expr(
"oraclecloud", model::cloud_storage_backend::oracle_s3_compat)
.default_match(model::cloud_storage_backend::unknown);
return result;
}

model::cloud_storage_backend infer_backend_from_configuration(
const client_configuration& client_config,
model::cloud_credentials_source cloud_storage_credentials_source) {
Expand Down Expand Up @@ -374,15 +389,7 @@ model::cloud_storage_backend infer_backend_from_configuration(

auto& s3_config = std::get<s3_configuration>(client_config);
const auto& uri = s3_config.uri;

auto result
= string_switch<model::cloud_storage_backend>(uri())
.match_expr("google", model::cloud_storage_backend::google_s3_compat)
.match_expr(R"(127\.0\.0\.1)", model::cloud_storage_backend::aws)
.match_expr("localhost", model::cloud_storage_backend::aws)
.match_expr("minio", model::cloud_storage_backend::minio)
.match_expr("amazon", model::cloud_storage_backend::aws)
.default_match(model::cloud_storage_backend::unknown);
auto result = infer_backend_from_uri(uri);

vlog(
client_config_log.info,
Expand Down
5 changes: 5 additions & 0 deletions src/v/cloud_storage_clients/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ std::ostream& operator<<(std::ostream&, const s3_self_configuration_result&);
std::ostream&
operator<<(std::ostream&, const client_self_configuration_output&);

// In the case of S3-compatible providers, all that is needed to infer the
// backend is the access point/uri.
model::cloud_storage_backend
infer_backend_from_uri(const access_point_uri& uri);

model::cloud_storage_backend infer_backend_from_configuration(
const client_configuration& client_config,
model::cloud_credentials_source cloud_storage_credentials_source);
Expand Down