AWS: Migrate attribution endpoint (#1838)
* Migrate attribution endpoint and update unit tests
This commit is contained in:
@@ -38,9 +38,8 @@ namespace AWSCore
|
||||
constexpr char AWSAttributionDelaySecondsKey[] = "/Amazon/AWS/Preferences/AWSAttributionDelaySeconds";
|
||||
constexpr char AWSAttributionLastTimeStampKey[] = "/Amazon/AWS/Preferences/AWSAttributionLastTimeStamp";
|
||||
constexpr char AWSAttributionConsentShownKey[] = "/Amazon/AWS/Preferences/AWSAttributionConsentShown";
|
||||
constexpr char AWSAttributionApiId[] = "2zxvvmv8d7";
|
||||
constexpr char AWSAttributionChinaApiId[] = "";
|
||||
constexpr char AWSAttributionApiStage[] = "prod";
|
||||
constexpr char AWSAttributionEndpoint[] = "https://o3deattribution.us-east-1.amazonaws.com";
|
||||
constexpr char AWSAttributionChinaEndpoint[] = "";
|
||||
const int AWSAttributionDefaultDelayInDays = 7;
|
||||
|
||||
AWSAttributionManager::AWSAttributionManager()
|
||||
@@ -253,17 +252,17 @@ namespace AWSCore
|
||||
// Assumption to determine China region is the default profile is set to China region.
|
||||
auto profile_name = Aws::Auth::GetConfigProfileName();
|
||||
Aws::Client::ClientConfiguration clientConfig(profile_name.c_str());
|
||||
AZStd::string apiId = AWSAttributionApiId;
|
||||
|
||||
if (clientConfig.region == Aws::Region::CN_NORTH_1 || clientConfig.region == Aws::Region::CN_NORTHWEST_1)
|
||||
{
|
||||
config->region = Aws::Region::CN_NORTH_1;
|
||||
apiId = AWSAttributionChinaApiId;
|
||||
config->endpointOverride = AWSAttributionChinaEndpoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
config->region = Aws::Region::US_EAST_1;
|
||||
config->endpointOverride = AWSAttributionEndpoint;
|
||||
}
|
||||
|
||||
config->region = Aws::Region::US_WEST_2;
|
||||
config->endpointOverride =
|
||||
AWSResourceMappingUtils::FormatRESTApiUrl(apiId, config->region.value().c_str(), AWSAttributionApiStage).c_str();
|
||||
}
|
||||
|
||||
bool AWSAttributionManager::CheckConsentShown()
|
||||
|
||||
@@ -418,8 +418,8 @@ namespace AWSAttributionUnitTest
|
||||
manager.SetApiEndpointAndRegion(config);
|
||||
|
||||
// THEN
|
||||
ASSERT_TRUE(config->region == Aws::Region::US_WEST_2);
|
||||
ASSERT_TRUE(config->endpointOverride->find("execute-api.us-west-2.amazonaws.com") != Aws::String::npos);
|
||||
ASSERT_TRUE(config->region == Aws::Region::US_EAST_1);
|
||||
ASSERT_TRUE(config->endpointOverride->find("o3deattribution.us-east-1.amazonaws.com") != Aws::String::npos);
|
||||
|
||||
delete config;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user