Initializes s3_client_, if needed, and returns it.
| 296 | |
| 297 | // Initializes s3_client_, if needed, and returns it. |
| 298 | std::shared_ptr<Aws::S3::S3Client> S3FileSystem::GetS3Client() { |
| 299 | std::lock_guard<mutex> lock(this->client_lock_); |
| 300 | |
| 301 | if (this->s3_client_.get() == nullptr) { |
| 302 | AWSLogSystem::InitializeAWSLogging(); |
| 303 | |
| 304 | Aws::SDKOptions options; |
| 305 | options.cryptoOptions.sha256Factory_create_fn = []() { |
| 306 | return Aws::MakeShared<AWSSHA256Factory>(AWSCryptoAllocationTag); |
| 307 | }; |
| 308 | options.cryptoOptions.sha256HMACFactory_create_fn = []() { |
| 309 | return Aws::MakeShared<AWSSHA256HmacFactory>(AWSCryptoAllocationTag); |
| 310 | }; |
| 311 | Aws::InitAPI(options); |
| 312 | |
| 313 | // The creation of S3Client disables virtual addressing: |
| 314 | // S3Client(clientConfiguration, signPayloads, useVirtualAdressing = true) |
| 315 | // The purpose is to address the issue encountered when there is an `.` |
| 316 | // in the bucket name. Due to TLS hostname validation or DNS rules, |
| 317 | // the bucket may not be resolved. Disabling of virtual addressing |
| 318 | // should address the issue. See GitHub issue 16397 for details. |
| 319 | this->s3_client_ = std::shared_ptr<Aws::S3::S3Client>(new Aws::S3::S3Client( |
| 320 | GetDefaultClientConfig(), |
| 321 | Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never, false)); |
| 322 | } |
| 323 | |
| 324 | return this->s3_client_; |
| 325 | } |
| 326 | |
| 327 | Status S3FileSystem::NewRandomAccessFile( |
| 328 | const string& fname, std::unique_ptr<RandomAccessFile>* result) { |
no test coverage detected