Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ namespace Aws

STSAssumeRoleWithWebIdentityResult GetAssumeRoleWithWebIdentityCredentials(const STSAssumeRoleWithWebIdentityRequest& request);

const Aws::String& GetEndpoint() const { return m_endpoint; }

private:
Aws::String m_endpoint;
};
Expand Down
20 changes: 18 additions & 2 deletions src/aws-cpp-sdk-core/source/internal/AWSHttpResourceClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,13 @@ namespace Aws
{
SetErrorMarshaller(Aws::MakeUnique<Aws::Client::XmlErrorMarshaller>(STS_RESOURCE_CLIENT_LOG_TAG));

if (!clientConfiguration.endpointOverride.empty())
{
m_endpoint = clientConfiguration.endpointOverride;
AWS_LOGSTREAM_INFO(STS_RESOURCE_CLIENT_LOG_TAG, "Creating STS ResourceClient with overridden endpoint: " << m_endpoint);
return;
}

Aws::StringStream ss;
if (clientConfiguration.scheme == Aws::Http::Scheme::HTTP)
{
Expand All @@ -567,10 +574,19 @@ namespace Aws
static const int CN_NORTHWEST_1_HASH = Aws::Utils::HashingUtils::HashString(Aws::Region::CN_NORTHWEST_1);
auto hash = Aws::Utils::HashingUtils::HashString(clientConfiguration.region.c_str());

ss << "sts." << clientConfiguration.region << ".amazonaws.com";
ss << "sts." << clientConfiguration.region << ".amazonaws.";
if (hash == CN_NORTH_1_HASH || hash == CN_NORTHWEST_1_HASH)
{
ss << ".cn";
ss << "com.cn";
}
else if (clientConfiguration.region.rfind("eusc-", 0) == 0)
{
// AWS European Sovereign Cloud regions use the .amazonaws.eu suffix.
ss << "eu";
}
else
{
ss << "com";
}

m_endpoint = ss.str();
Expand Down
Loading