Skip to content
Open
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 @@ -160,10 +160,6 @@ public static void validateArn(String arn) {
if (arn.isEmpty()) {
throw new IllegalArgumentException("ARN must not be empty");
}
// specifically throw errors for China
if (arn.contains("aws-cn")) {
throw new IllegalArgumentException("AWS China is temporarily not supported");
}
checkArgument(Pattern.matches(ROLE_ARN_PATTERN, arn), "Invalid role ARN format: %s", arn);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,24 +234,6 @@ public void testGetSubscopedCredsInlinePolicy(String awsPartition) {
});
switch (awsPartition) {
case "aws-cn":
Assertions.assertThatThrownBy(
() ->
new AwsCredentialsStorageIntegration(
AwsStorageConfigurationInfo.builder()
.addAllowedLocation(s3Path(bucket, warehouseKeyPrefix))
.roleARN(roleARN)
.externalId(externalId)
.region(region)
.build(),
stsClient)
.getSubscopedCreds(
EMPTY_REALM_CONFIG,
true,
Set.of(s3Path(bucket, firstPath), s3Path(bucket, secondPath)),
Set.of(s3Path(bucket, firstPath)),
null))
.isInstanceOf(IllegalArgumentException.class);
break;
case AWS_PARTITION:
case "aws-us-gov":
StorageAccessConfig storageAccessConfig =
Expand Down Expand Up @@ -558,24 +540,6 @@ public void testClientRegion(String awsPartition) {
});
switch (awsPartition) {
case "aws-cn":
Assertions.assertThatThrownBy(
() ->
new AwsCredentialsStorageIntegration(
AwsStorageConfigurationInfo.builder()
.addAllowedLocation(s3Path(bucket, warehouseKeyPrefix))
.roleARN(roleARN)
.externalId(externalId)
.region(clientRegion)
.build(),
stsClient)
.getSubscopedCreds(
EMPTY_REALM_CONFIG,
true, /* allowList = true */
Set.of(),
Set.of(),
Optional.empty()))
.isInstanceOf(IllegalArgumentException.class);
break;
case AWS_PARTITION:
case "aws-us-gov":
StorageAccessConfig storageAccessConfig =
Expand Down Expand Up @@ -619,6 +583,7 @@ public void testNoClientRegion(String awsPartition) {
});
switch (awsPartition) {
case AWS_PARTITION:
case "aws-cn":
StorageAccessConfig storageAccessConfig =
new AwsCredentialsStorageIntegration(
AwsStorageConfigurationInfo.builder()
Expand All @@ -637,7 +602,6 @@ public void testNoClientRegion(String awsPartition) {
.isNotEmpty()
.doesNotContainKey(StorageAccessProperty.CLIENT_REGION.getPropertyName());
break;
case "aws-cn":
case "aws-us-gov":
Assertions.assertThatThrownBy(
() ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public void testValidAllowedLocationPrefix() {
}

@ParameterizedTest
@ValueSource(strings = {"", "arn:aws:iam:0123456:role/jdoe", "aws-cn"})
@ValueSource(strings = {"", "arn:aws:iam:0123456:role/jdoe", "arn:aws-cn:iam:0123456:role/jdoe"})
public void testInvalidArn(String roleArn) {
String basedLocation = "s3://externally-owned-bucket";
AwsStorageConfigInfo awsStorageConfigModel =
Expand All @@ -275,11 +275,7 @@ public void testInvalidArn(String roleArn) {
.setStorageConfigInfo(awsStorageConfigModel)
.build();
String expectedMessage =
switch (roleArn) {
case "" -> "ARN must not be empty";
case "aws-cn" -> "AWS China is temporarily not supported";
default -> "Invalid role ARN format: arn:aws:iam:0123456:role/jdoe";
};
roleArn.isEmpty() ? "ARN must not be empty" : "Invalid role ARN format: " + roleArn;
Assertions.assertThatThrownBy(() -> CatalogEntity.fromCatalog(realmConfig, awsCatalog))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage(expectedMessage);
Expand Down