Skip to content

Commit b889c1e

Browse files
committed
review: PATH_STYLE_ACCESS_DEFAULT, ternary
1 parent fbb91dd commit b889c1e

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsStorageConfigurationInfo.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626
import jakarta.annotation.Nullable;
2727
import java.net.URI;
2828
import java.util.List;
29-
import java.util.Optional;
3029
import java.util.regex.Matcher;
3130
import java.util.regex.Pattern;
3231
import org.apache.polaris.core.storage.PolarisStorageConfigurationInfo;
3332

3433
/** Aws Polaris Storage Configuration information */
3534
public class AwsStorageConfigurationInfo extends PolarisStorageConfigurationInfo {
3635

36+
private static final boolean PATH_STYLE_ACCESS_DEFAULT = false;
37+
3738
// Technically, it should be ^arn:(aws|aws-cn|aws-us-gov):iam::(\d{12}):role/.+$,
3839
@JsonIgnore
3940
public static final String ROLE_ARN_PATTERN = "^arn:(aws|aws-us-gov):iam::(\\d{12}):role/.+$";
@@ -84,15 +85,23 @@ public AwsStorageConfigurationInfo(
8485
this.region = region;
8586
this.endpoint = endpoint;
8687
this.stsEndpoint = stsEndpoint;
87-
this.pathStyleAccess = Optional.ofNullable(pathStyleAccess).orElse(false);
88+
this.pathStyleAccess = pathStyleAccess == null ? PATH_STYLE_ACCESS_DEFAULT : pathStyleAccess;
8889
}
8990

9091
public AwsStorageConfigurationInfo(
9192
@Nonnull StorageType storageType,
9293
@Nonnull List<String> allowedLocations,
9394
@Nonnull String roleARN,
9495
@Nullable String region) {
95-
this(storageType, allowedLocations, roleARN, null, region, null, null, false);
96+
this(
97+
storageType,
98+
allowedLocations,
99+
roleARN,
100+
null,
101+
region,
102+
null,
103+
null,
104+
PATH_STYLE_ACCESS_DEFAULT);
96105
}
97106

98107
public AwsStorageConfigurationInfo(
@@ -101,7 +110,15 @@ public AwsStorageConfigurationInfo(
101110
@Nonnull String roleARN,
102111
@Nullable String externalId,
103112
@Nullable String region) {
104-
this(storageType, allowedLocations, roleARN, externalId, region, null, null, false);
113+
this(
114+
storageType,
115+
allowedLocations,
116+
roleARN,
117+
externalId,
118+
region,
119+
null,
120+
null,
121+
PATH_STYLE_ACCESS_DEFAULT);
105122
}
106123

107124
@Override

0 commit comments

Comments
 (0)