Skip to content

Commit 49831b7

Browse files
Dianna's buildClient work, and misc
1 parent eee2585 commit 49831b7

File tree

7 files changed

+297
-189
lines changed

7 files changed

+297
-189
lines changed

gradle/verification-metadata.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4810,6 +4810,11 @@
48104810
<sha256 value="556463b8c353408d93feab74719d141fcfda7fd3d7b7d1ad3a8a548b7cc2982d" origin="Generated by Gradle"/>
48114811
</artifact>
48124812
</component>
4813+
<component group="software.amazon.awssdk" name="sts" version="2.30.38">
4814+
<artifact name="sts-2.30.38.jar">
4815+
<sha256 value="29a4eb10332893b17a59f81c9d5b3fbf5caa8a386479f9edf5e81b9b8961af63" origin="Generated by Gradle"/>
4816+
</artifact>
4817+
</component>
48134818
<component group="software.amazon.awssdk" name="third-party-jackson-core" version="2.30.38">
48144819
<artifact name="third-party-jackson-core-2.30.38.jar">
48154820
<sha256 value="979215cd78fe0b4abfa7465e6400b29ed90ced24d76323e87b6717195f0214af" origin="Generated by Gradle"/>

modules/repository-s3/build.gradle

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@ esplugin {
2020

2121
dependencies {
2222
// TODO NOMERGE sort alphabetically
23-
implementation "software.amazon.awssdk:s3:${versions.awsv2sdk}"
24-
implementation "software.amazon.awssdk:utils:${versions.awsv2sdk}"
23+
implementation "software.amazon.awssdk:apache-client:${versions.awsv2sdk}"
24+
implementation "software.amazon.awssdk:auth:${versions.awsv2sdk}"
2525
implementation "software.amazon.awssdk:aws-core:${versions.awsv2sdk}"
26-
implementation "software.amazon.awssdk:sdk-core:${versions.awsv2sdk}"
27-
implementation "software.amazon.awssdk:regions:${versions.awsv2sdk}"
28-
implementation "software.amazon.awssdk:metrics-spi:${versions.awsv2sdk}"
2926
implementation "software.amazon.awssdk:aws-xml-protocol:${versions.awsv2sdk}"
3027
implementation "software.amazon.awssdk:http-client-spi:${versions.awsv2sdk}"
31-
implementation "software.amazon.awssdk:auth:${versions.awsv2sdk}"
3228
implementation "software.amazon.awssdk:identity-spi:${versions.awsv2sdk}"
29+
implementation "software.amazon.awssdk:metrics-spi:${versions.awsv2sdk}"
30+
implementation "software.amazon.awssdk:regions:${versions.awsv2sdk}"
31+
implementation "software.amazon.awssdk:s3:${versions.awsv2sdk}"
32+
implementation "software.amazon.awssdk:sdk-core:${versions.awsv2sdk}"
33+
implementation "software.amazon.awssdk:services:${versions.awsv2sdk}"
34+
implementation "software.amazon.awssdk:sts:${versions.awsv2sdk}"
35+
implementation "software.amazon.awssdk:utils:${versions.awsv2sdk}"
3336

3437
implementation "org.apache.httpcomponents:httpclient:${versions.httpclient}"
3538

@@ -71,7 +74,20 @@ restResources {
7174
}
7275

7376
tasks.named("dependencyLicenses").configure {
74-
mapping from: 's3', to: 'aws-sdk-2'
77+
mapping from: 'apache-client', to: 'aws-sdk-2'
78+
mapping from: 'auth', to: 'aws-sdk-2'
79+
mapping from: 'aws-xml-protocol', to: 'aws-sdk-2'
80+
mapping from: 'aws-core', to: 'aws-sdk-2'
81+
mapping from: 'http-client-spi', to: 'aws-sdk-2'
82+
mapping from: 'identity-spi', to: 'aws-sdk-2'
83+
mapping from: 'identity-spi', to: 'aws-sdk-2'
84+
mapping from: 'metrics-spi', to: 'aws-sdk-2'
85+
mapping from: 'regions', to: 'aws-sdk-2'
86+
mapping from: 's3', to: 'aws-sdk-2'
87+
mapping from: 'sdk-core', to: 'aws-sdk-2'
88+
mapping from: 'services', to: 'aws-sdk-2'
89+
mapping from: 'sts', to: 'aws-sdk-2'
90+
mapping from: 'utils', to: 'aws-sdk-2'
7591
}
7692

7793
esplugin.bundleSpec.from('config/repository-s3') {

modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ final class S3ClientSettings {
143143
static final Setting.AffixSetting<Boolean> USE_THROTTLE_RETRIES_SETTING = Setting.affixKeySetting(
144144
PREFIX,
145145
"use_throttle_retries",
146-
key -> Setting.boolSetting(key, Defaults.THROTTLE_RETRIES, Property.NodeScope)
146+
key -> Setting.boolSetting(key, Defaults.THROTTLE_RETRIES, Property.NodeScope, Property.Deprecated)
147147
);
148148

149149
/** Whether the s3 client should use path style access. */
@@ -157,7 +157,7 @@ final class S3ClientSettings {
157157
static final Setting.AffixSetting<Boolean> DISABLE_CHUNKED_ENCODING = Setting.affixKeySetting(
158158
PREFIX,
159159
"disable_chunked_encoding",
160-
key -> Setting.boolSetting(key, false, Property.NodeScope)
160+
key -> Setting.boolSetting(key, false, Property.NodeScope, Property.Deprecated)
161161
);
162162

163163
/** An override for the s3 region to use for signing requests. */
@@ -167,11 +167,26 @@ final class S3ClientSettings {
167167
key -> Setting.simpleString(key, Property.NodeScope)
168168
);
169169

170+
public enum AwsSignerOverrideType {
171+
// AWS SDK V1 Signer types.
172+
// Supported for upgrade compatibility, ultimately converted to a V2 equivalent.
173+
// Note: AWS4UnsignedPayloadSignerType is no longer supported, there is no equivalent in V2 short of a custom signer.
174+
// Note: QueryStringSigner is deprecated in V2, thus not given support.
175+
AWS4SignerType, // -> Aws4Signer
176+
AWS3SignerType, // -> AwsS3V4Signer
177+
NoOpSignerType, // -> NoOpSigner
178+
179+
// AWS SDK V2 Signer types
180+
Aws4Signer,
181+
AwsS3V4Signer,
182+
NoOpSigner;
183+
};
184+
170185
/** An override for the signer to use. */
171-
static final Setting.AffixSetting<String> SIGNER_OVERRIDE = Setting.affixKeySetting(
186+
static final Setting.AffixSetting<AwsSignerOverrideType> SIGNER_OVERRIDE = Setting.affixKeySetting(
172187
PREFIX,
173188
"signer_override",
174-
key -> Setting.simpleString(key, Property.NodeScope)
189+
key -> Setting.enumSetting(AwsSignerOverrideType.class, key, AwsSignerOverrideType.Aws4Signer, Property.NodeScope)
175190
);
176191

177192
/** Credentials to authenticate with s3. */
@@ -207,19 +222,19 @@ final class S3ClientSettings {
207222
final int maxRetries;
208223

209224
/** Whether the s3 client should use an exponential backoff retry policy. */
210-
final boolean throttleRetries;
225+
final boolean throttleRetries; // TODO: remove, no longer supported in v2
211226

212227
/** Whether the s3 client should use path style access. */
213228
final boolean pathStyleAccess;
214229

215230
/** Whether chunked encoding should be disabled or not. */
216-
final boolean disableChunkedEncoding;
231+
final boolean disableChunkedEncoding; // TODO: deprecated in V2, remove. Encoding can be disabled by setting an HTTP endpoint, I think?
217232

218233
/** Region to use for signing requests or empty string to use default. */
219234
final String region;
220235

221236
/** Signer override to use or empty string to use default. */
222-
final String signerOverride;
237+
final AwsSignerOverrideType signerOverride; // TODO: document somewhat breaking change
223238

224239
private S3ClientSettings(
225240
AwsCredentials credentials,
@@ -236,7 +251,7 @@ private S3ClientSettings(
236251
boolean pathStyleAccess,
237252
boolean disableChunkedEncoding,
238253
String region,
239-
String signerOverride
254+
AwsSignerOverrideType signerOverride
240255
) {
241256
this.credentials = credentials;
242257
this.endpoint = endpoint;
@@ -291,7 +306,7 @@ S3ClientSettings refine(Settings repositorySettings) {
291306
newCredentials = credentials;
292307
}
293308
final String newRegion = getRepoSettingOrDefault(REGION, normalizedSettings, region);
294-
final String newSignerOverride = getRepoSettingOrDefault(SIGNER_OVERRIDE, normalizedSettings, signerOverride);
309+
final AwsSignerOverrideType newSignerOverride = getRepoSettingOrDefault(SIGNER_OVERRIDE, normalizedSettings, signerOverride);
295310
if (Objects.equals(endpoint, newEndpoint)
296311
&& Objects.equals(proxyHost, newProxyHost)
297312
&& proxyPort == newProxyPort

0 commit comments

Comments
 (0)