Skip to content

Commit fe9de53

Browse files
committed
allow any region
1 parent 8834f92 commit fe9de53

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

s3compatapi/src/main/java/com/snowflake/s3compatapitestsuite/compatapi/S3CompatStorageClient.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
import com.amazonaws.AmazonClientException;
77
import com.amazonaws.ClientConfiguration;
88
import com.amazonaws.auth.AWSCredentialsProvider;
9-
import com.amazonaws.regions.Region;
10-
import com.amazonaws.regions.Regions;
9+
import com.amazonaws.regions.RegionUtils;
1110
import com.amazonaws.services.s3.S3ClientOptions;
1211
import com.amazonaws.services.s3.model.*;
1312
import com.snowflake.s3compatapitestsuite.perf.PerfMeasurement;
@@ -70,7 +69,7 @@ private InstrumentedAmazonS3Client createS3Client(
7069
}
7170
if (region != null) {
7271
s3Client.setSignerRegionOverride(region);
73-
s3Client.withRegion(Region.getRegion(Regions.fromName(region)));
72+
s3Client.withRegion(RegionUtils.getRegion(region));
7473
}
7574
s3Client.setEndpoint(endpoint);
7675
// explicitly force using virtual style access for S3
@@ -98,7 +97,7 @@ public String getBucketLocation(String bucketName) {
9897
String correctRegion = ex.getAdditionalDetails().get("Region");
9998
if (correctRegion != null) {
10099
this.s3Client.setSignerRegionOverride(correctRegion);
101-
this.s3Client.setRegion(Region.getRegion(Regions.fromName(correctRegion)));
100+
this.s3Client.setRegion(RegionUtils.getRegion(correctRegion));
102101
return this.s3Client.getBucketLocation(bucketName);
103102
}
104103
}
@@ -398,7 +397,7 @@ public void copyObject(String sourceBucket, String sourceKey, @Nullable String s
398397
@Override
399398
public void setRegion(@Nullable String region) {
400399
try {
401-
this.s3Client.setRegion(Region.getRegion(Regions.fromName(region)));
400+
this.s3Client.setRegion(RegionUtils.getRegion(region));
402401
} catch (AmazonS3Exception ex) {
403402
throw ex;
404403
}

0 commit comments

Comments
 (0)