diff options
author | dakovalkov <dakovalkov@yandex-team.com> | 2023-12-03 13:33:55 +0300 |
---|---|---|
committer | dakovalkov <dakovalkov@yandex-team.com> | 2023-12-03 14:04:39 +0300 |
commit | 2a718325637e5302334b6d0a6430f63168f8dbb3 (patch) | |
tree | 64be81080b7df9ec1d86d053a0c394ae53fcf1fe /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3ClientConfiguration.cpp | |
parent | e0d94a470142d95c3007e9c5d80380994940664a (diff) | |
download | ydb-2a718325637e5302334b6d0a6430f63168f8dbb3.tar.gz |
Update contrib/libs/aws-sdk-cpp to 1.11.37
Diffstat (limited to 'contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3ClientConfiguration.cpp')
-rw-r--r-- | contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3ClientConfiguration.cpp | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3ClientConfiguration.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3ClientConfiguration.cpp new file mode 100644 index 0000000000..0e379b3dad --- /dev/null +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-s3/source/S3ClientConfiguration.cpp @@ -0,0 +1,89 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include <aws/s3/S3ClientConfiguration.h> + +namespace Aws +{ +namespace S3 +{ + +static const char US_EAST_1_REGIONAL_ENDPOINT_ENV_VAR[] = "AWS_S3_US_EAST_1_REGIONAL_ENDPOINT"; +static const char US_EAST_1_REGIONAL_ENDPOINT_CONFIG_VAR[] = "s3_us_east_1_regional_endpoint"; +static const char S3_DISABLE_MULTIREGION_ACCESS_POINTS_ENV_VAR[] = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS"; +static const char S3_DISABLE_MULTIREGION_ACCESS_POINTS_CONFIG_VAR[] = "s3_disable_multiregion_access_points"; +static const char S3_USE_ARN_REGION_ENVIRONMENT_VARIABLE[] = "AWS_S3_USE_ARN_REGION"; +static const char S3_USE_ARN_REGION_CONFIG_FILE_OPTION[] = "s3_use_arn_region"; + +void S3ClientConfiguration::LoadS3SpecificConfig(const Aws::String& inputProfileName) +{ + if (Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION::NOT_SET == this->useUSEast1RegionalEndPointOption) + { + const Aws::String& useUSEastOption = + BaseClientConfigClass::LoadConfigFromEnvOrProfile(US_EAST_1_REGIONAL_ENDPOINT_ENV_VAR, + inputProfileName, + US_EAST_1_REGIONAL_ENDPOINT_CONFIG_VAR, + {"legacy", "regional"}, + "regional"); + if (useUSEastOption == "legacy") { + this->useUSEast1RegionalEndPointOption = Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION::LEGACY; + } else { + this->useUSEast1RegionalEndPointOption = Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION::REGIONAL; + } + } + + Aws::String s3DisableMultiRegionAccessPoints = ClientConfiguration::LoadConfigFromEnvOrProfile(S3_DISABLE_MULTIREGION_ACCESS_POINTS_ENV_VAR, + inputProfileName, + S3_DISABLE_MULTIREGION_ACCESS_POINTS_CONFIG_VAR, + {"true", "false"}, + "false"); + if (s3DisableMultiRegionAccessPoints == "true") + { + disableMultiRegionAccessPoints = true; + } + Aws::String useArnRegionCfg = ClientConfiguration::LoadConfigFromEnvOrProfile(S3_USE_ARN_REGION_ENVIRONMENT_VARIABLE, + inputProfileName, + S3_USE_ARN_REGION_CONFIG_FILE_OPTION, + {"true", "false"}, + "false"); + if (useArnRegionCfg == "true") + { + useArnRegion = true; + } +} + +S3ClientConfiguration::S3ClientConfiguration() +: BaseClientConfigClass() +{ + LoadS3SpecificConfig(this->profileName); +} + +S3ClientConfiguration::S3ClientConfiguration(const char* inputProfileName, bool shouldDisableIMDS) +: BaseClientConfigClass(inputProfileName, shouldDisableIMDS) +{ + LoadS3SpecificConfig(Aws::String(inputProfileName)); +} + +S3ClientConfiguration::S3ClientConfiguration(bool useSmartDefaults, const char* defaultMode, bool shouldDisableIMDS) +: BaseClientConfigClass(useSmartDefaults, defaultMode, shouldDisableIMDS) +{ + LoadS3SpecificConfig(this->profileName); +} + +S3ClientConfiguration::S3ClientConfiguration(const Client::ClientConfiguration& config, + Client::AWSAuthV4Signer::PayloadSigningPolicy iPayloadSigningPolicy, + bool iUseVirtualAddressing, + US_EAST_1_REGIONAL_ENDPOINT_OPTION iUseUSEast1RegionalEndPointOption) + : BaseClientConfigClass(config), + useVirtualAddressing(iUseVirtualAddressing), + useUSEast1RegionalEndPointOption(iUseUSEast1RegionalEndPointOption), + payloadSigningPolicy(iPayloadSigningPolicy) +{ + LoadS3SpecificConfig(this->profileName); +} + + +} // namespace S3 +} // namespace Aws |