Skip to content

Commit 0af2112

Browse files
committed
chore(codegen): do not populate regionHash if partition endpoint is present
1 parent 3df247b commit 0af2112

File tree

1 file changed

+13
-10
lines changed
  • codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen

1 file changed

+13
-10
lines changed

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/EndpointGenerator.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,19 @@ private void loadServiceEndpoints() {
8888
ObjectNode serviceData = partition.getService();
8989
ObjectNode endpointMap = serviceData.getObjectMember("endpoints").orElse(Node.objectNode());
9090

91-
for (Map.Entry<String, Node> entry : endpointMap.getStringMap().entrySet()) {
92-
ObjectNode config = entry.getValue().expectObjectNode();
93-
if (config.containsMember("hostname")) {
94-
// Resolve the hostname.
95-
String hostName = config.expectStringMember("hostname").getValue();
96-
hostName = hostName.replace("{dnsSuffix}", dnsSuffix);
97-
hostName = hostName.replace("{service}", endpointPrefix);
98-
hostName = hostName.replace("{region}", entry.getKey());
99-
config = config.withMember("hostname", hostName);
100-
endpoints.put(entry.getKey(), config);
91+
// If partition endpoint is available, data will be populated in PartitionHash.
92+
if (!partition.getPartitionEndpoint().isPresent()) {
93+
for (Map.Entry<String, Node> entry : endpointMap.getStringMap().entrySet()) {
94+
ObjectNode config = entry.getValue().expectObjectNode();
95+
if (config.containsMember("hostname")) {
96+
// Resolve the hostname.
97+
String hostName = config.expectStringMember("hostname").getValue();
98+
hostName = hostName.replace("{dnsSuffix}", dnsSuffix);
99+
hostName = hostName.replace("{service}", endpointPrefix);
100+
hostName = hostName.replace("{region}", entry.getKey());
101+
config = config.withMember("hostname", hostName);
102+
endpoints.put(entry.getKey(), config);
103+
}
101104
}
102105
}
103106
}

0 commit comments

Comments
 (0)