Skip to content

Commit

Permalink
cloud_storage_clients/abs_client: wire in alternative get_account_info
Browse files Browse the repository at this point in the history
used in case the credential applier uses oauth
  • Loading branch information
andijcr committed Apr 17, 2024
1 parent ea8883a commit f330020
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/v/cloud_storage_clients/abs_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ abs_client::abs_client(
: _data_lake_v2_client_config(
conf.is_hns_enabled ? std::make_optional(conf.make_adls_configuration())
: std::nullopt)
, _is_oauth(apply_credentials->is_oauth())
, _requestor(conf, std::move(apply_credentials))
, _client(conf)
, _adls_client(
Expand All @@ -432,6 +433,7 @@ abs_client::abs_client(
: _data_lake_v2_client_config(
conf.is_hns_enabled ? std::make_optional(conf.make_adls_configuration())
: std::nullopt)
, _is_oauth(apply_credentials->is_oauth())
, _requestor(conf, std::move(apply_credentials))
, _client(conf, &as, conf._probe, conf.max_idle_time)
, _adls_client(
Expand Down Expand Up @@ -874,7 +876,12 @@ ss::future<abs_client::list_bucket_result> abs_client::do_list_objects(

ss::future<result<abs_client::storage_account_info, error_outcome>>
abs_client::get_account_info(ss::lowres_clock::duration timeout) {
return send_request(do_get_account_info(timeout), object_key{""});
if (_is_oauth) {
return send_request(
do_test_set_expiry_on_dummy_file(timeout), object_key{""});
} else {
return send_request(do_get_account_info(timeout), object_key{""});
}
}

ss::future<abs_client::storage_account_info>
Expand Down
8 changes: 8 additions & 0 deletions src/v/cloud_storage_clients/abs_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@ class abs_client : public client {
ss::lowres_clock::duration timeout);

std::optional<abs_configuration> _data_lake_v2_client_config;

// currently the implementation supports Signing requests or OAuth.
// not all api are available for oauth, this variable is initialized at
// startup to allow alternative codepaths when using oauth this is fine
// because to change authentication method the user changes
// cloud_storage_credentials_source, and that requires a restart
bool _is_oauth;

abs_request_creator _requestor;
http::client _client;

Expand Down

0 comments on commit f330020

Please sign in to comment.