Skip to content

Commit d76bf4a

Browse files
committed
Updating to use all regions defined for each service in endpoints.json
1 parent 117e245 commit d76bf4a

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

codegen-lite/src/main/java/software/amazon/awssdk/codegen/lite/regions/ServiceMetadataGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ private CodeBlock regionsField(Partitions partitions) {
130130
partitions.getPartitions()
131131
.stream()
132132
.filter(p -> p.getServices().containsKey(service))
133-
.forEach(p -> regions.addAll(p.getRegions().keySet()));
133+
.forEach(p -> regions.addAll(p.getServices().get(service).getEndpoints().keySet()));
134134

135135
for (int i = 0; i < regions.size(); i++) {
136-
builder.add("$T.$L", regionClass, regions.get(i).replace("-", "_").toUpperCase(Locale.US));
136+
builder.add("$T.of($S)", regionClass, regions.get(i));
137137
if (i != regions.size() - 1) {
138138
builder.add(",");
139139
}

codegen-lite/src/test/resources/software/amazon/awssdk/codegen/lite/regions/s3-service-metadata.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ public final class S3ServiceMetadata implements ServiceMetadata {
2424
.put("us-west-2", "s3.us-west-2.amazonaws.com").put("fips-us-gov-west-1", "s3-fips-us-gov-west-1.amazonaws.com")
2525
.put("us-gov-west-1", "s3.us-gov-west-1.amazonaws.com").build();
2626

27-
private static final List<Region> REGIONS = Collections
28-
.unmodifiableList(Arrays.asList(Region.AP_NORTHEAST_1, Region.AP_NORTHEAST_2, Region.AP_SOUTH_1,
29-
Region.AP_SOUTHEAST_1, Region.AP_SOUTHEAST_2, Region.CA_CENTRAL_1, Region.EU_CENTRAL_1, Region.EU_WEST_1,
30-
Region.EU_WEST_2, Region.EU_WEST_3, Region.SA_EAST_1, Region.US_EAST_1, Region.US_EAST_2, Region.US_WEST_1,
31-
Region.US_WEST_2, Region.CN_NORTH_1, Region.CN_NORTHWEST_1, Region.US_GOV_WEST_1));
27+
private static final List<Region> REGIONS = Collections.unmodifiableList(Arrays.asList(Region.of("ap-northeast-1"),
28+
Region.of("ap-northeast-2"), Region.of("ap-south-1"), Region.of("ap-southeast-1"), Region.of("ap-southeast-2"),
29+
Region.of("ca-central-1"), Region.of("eu-central-1"), Region.of("eu-west-1"), Region.of("eu-west-2"),
30+
Region.of("eu-west-3"), Region.of("s3-external-1"), Region.of("sa-east-1"), Region.of("us-east-1"),
31+
Region.of("us-east-2"), Region.of("us-west-1"), Region.of("us-west-2"), Region.of("cn-north-1"),
32+
Region.of("cn-northwest-1"), Region.of("fips-us-gov-west-1"), Region.of("us-gov-west-1")));
3233

3334
private static final Map<String, String> SIGNING_REGION_OVERRIDES = ImmutableMap.<String, String> builder()
3435
.put("s3-external-1", "us-east-1").put("fips-us-gov-west-1", "us-gov-west-1").build();

0 commit comments

Comments
 (0)