@@ -95,6 +95,10 @@ final class S3ClientSettings {
95
95
static final Setting .AffixSetting <Boolean > USE_THROTTLE_RETRIES_SETTING = Setting .affixKeySetting (PREFIX , "use_throttle_retries" ,
96
96
key -> Setting .boolSetting (key , ClientConfiguration .DEFAULT_THROTTLE_RETRIES , Property .NodeScope ));
97
97
98
+ /** Whether the s3 client should use path style access. */
99
+ static final Setting .AffixSetting <Boolean > USE_PATH_STYLE_ACCESS = Setting .affixKeySetting (PREFIX , "path_style_access" ,
100
+ key -> Setting .boolSetting (key , false , Property .NodeScope , Property .Deprecated ));
101
+
98
102
/** Credentials to authenticate with s3. */
99
103
final S3BasicCredentials credentials ;
100
104
@@ -127,9 +131,13 @@ final class S3ClientSettings {
127
131
/** Whether the s3 client should use an exponential backoff retry policy. */
128
132
final boolean throttleRetries ;
129
133
134
+ /** Whether the s3 client should use path style access. */
135
+ final boolean pathStyleAccess ;
136
+
130
137
private S3ClientSettings (S3BasicCredentials credentials , String endpoint , Protocol protocol ,
131
138
String proxyHost , int proxyPort , String proxyUsername , String proxyPassword ,
132
- int readTimeoutMillis , int maxRetries , boolean throttleRetries ) {
139
+ int readTimeoutMillis , int maxRetries , boolean throttleRetries ,
140
+ boolean pathStyleAccess ) {
133
141
this .credentials = credentials ;
134
142
this .endpoint = endpoint ;
135
143
this .protocol = protocol ;
@@ -140,6 +148,7 @@ private S3ClientSettings(S3BasicCredentials credentials, String endpoint, Protoc
140
148
this .readTimeoutMillis = readTimeoutMillis ;
141
149
this .maxRetries = maxRetries ;
142
150
this .throttleRetries = throttleRetries ;
151
+ this .pathStyleAccess = pathStyleAccess ;
143
152
}
144
153
145
154
/**
@@ -162,6 +171,7 @@ S3ClientSettings refine(RepositoryMetaData metadata) {
162
171
getRepoSettingOrDefault (READ_TIMEOUT_SETTING , normalizedSettings , TimeValue .timeValueMillis (readTimeoutMillis )).millis ());
163
172
final int newMaxRetries = getRepoSettingOrDefault (MAX_RETRIES_SETTING , normalizedSettings , maxRetries );
164
173
final boolean newThrottleRetries = getRepoSettingOrDefault (USE_THROTTLE_RETRIES_SETTING , normalizedSettings , throttleRetries );
174
+ final boolean usePathStyleAccess = getRepoSettingOrDefault (USE_PATH_STYLE_ACCESS , normalizedSettings , pathStyleAccess );
165
175
final S3BasicCredentials newCredentials ;
166
176
if (checkDeprecatedCredentials (repoSettings )) {
167
177
newCredentials = loadDeprecatedCredentials (repoSettings );
@@ -183,7 +193,8 @@ S3ClientSettings refine(RepositoryMetaData metadata) {
183
193
proxyPassword ,
184
194
newReadTimeoutMillis ,
185
195
newMaxRetries ,
186
- newThrottleRetries
196
+ newThrottleRetries ,
197
+ usePathStyleAccess
187
198
);
188
199
}
189
200
@@ -270,7 +281,8 @@ static S3ClientSettings getClientSettings(final Settings settings, final String
270
281
proxyPassword .toString (),
271
282
Math .toIntExact (getConfigValue (settings , clientName , READ_TIMEOUT_SETTING ).millis ()),
272
283
getConfigValue (settings , clientName , MAX_RETRIES_SETTING ),
273
- getConfigValue (settings , clientName , USE_THROTTLE_RETRIES_SETTING )
284
+ getConfigValue (settings , clientName , USE_THROTTLE_RETRIES_SETTING ),
285
+ getConfigValue (settings , clientName , USE_PATH_STYLE_ACCESS )
274
286
);
275
287
}
276
288
}
0 commit comments