Skip to content

Commit

Permalink
EXPERIMENT: [C++] Use S3ClientConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
pitrou committed Feb 29, 2024
1 parent d3ae788 commit 1fadf2a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cpp/src/arrow/filesystem/s3fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/identity-management/auth/STSAssumeRoleCredentialsProvider.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/S3ClientConfiguration.h>
#include <aws/s3/S3Errors.h>
#include <aws/s3/model/AbortMultipartUploadRequest.h>
#include <aws/s3/model/CompleteMultipartUploadRequest.h>
Expand Down Expand Up @@ -937,6 +938,9 @@ class ClientBuilder {
static_cast<long>(ceil(options_.connect_timeout * 1000)); // NOLINT runtime/int
}

client_config_.useVirtualAddressing =
options_.endpoint_override.empty() || options_.force_virtual_addressing;
;
client_config_.endpointOverride = ToAwsString(options_.endpoint_override);
if (options_.scheme == "http") {
client_config_.scheme = Aws::Http::Scheme::HTTP;
Expand All @@ -958,9 +962,6 @@ class ClientBuilder {
client_config_.caPath = ToAwsString(internal::global_options.tls_ca_dir_path);
}

const bool use_virtual_addressing =
options_.endpoint_override.empty() || options_.force_virtual_addressing;

// Set proxy options if provided
if (!options_.proxy_options.scheme.empty()) {
if (options_.proxy_options.scheme == "http") {
Expand Down Expand Up @@ -990,10 +991,9 @@ class ClientBuilder {
client_config_.maxConnections = std::max(io_context->executor()->GetCapacity(), 25);
}

auto client = std::make_shared<S3Client>(
credentials_provider_, client_config_,
Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never,
use_virtual_addressing);
auto client =
std::make_shared<S3Client>(credentials_provider_,
/*endpointProvider=*/nullptr, client_config_);
client->s3_retry_strategy_ = options_.retry_strategy;
return GetClientHolder(std::move(client));
}
Expand All @@ -1002,7 +1002,7 @@ class ClientBuilder {

protected:
S3Options options_;
Aws::Client::ClientConfiguration client_config_;
Aws::S3::S3ClientConfiguration client_config_;
std::shared_ptr<Aws::Auth::AWSCredentialsProvider> credentials_provider_;
};

Expand Down

0 comments on commit 1fadf2a

Please sign in to comment.