Skip to content

Commit 195bf79

Browse files
authored
Move putAuthScheme to SdkClientBuilder (#4551)
1 parent 55b9d34 commit 195bf79

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed

core/aws-core/src/main/java/software/amazon/awssdk/awscore/client/builder/AwsClientBuilder.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
2020
import software.amazon.awssdk.awscore.defaultsmode.DefaultsMode;
2121
import software.amazon.awssdk.core.client.builder.SdkClientBuilder;
22-
import software.amazon.awssdk.http.auth.spi.scheme.AuthScheme;
2322
import software.amazon.awssdk.identity.spi.AwsCredentialsIdentity;
2423
import software.amazon.awssdk.identity.spi.IdentityProvider;
2524
import software.amazon.awssdk.regions.Region;
@@ -149,15 +148,4 @@ default BuilderT defaultsMode(DefaultsMode defaultsMode) {
149148
* <p>If the setting is not found in any of the locations above, 'false' will be used.
150149
*/
151150
BuilderT fipsEnabled(Boolean fipsEndpointEnabled);
152-
153-
/**
154-
* Configure this client with an additional auth scheme, or replace one already on the client.
155-
*
156-
* <p>By default, the SDK will only know about default auth schemes that ship with the service. If you want to modify those
157-
* existing auth schemes or add a custom one (you select with a custom auth scheme resolver), you can add that new auth
158-
* scheme with this method.
159-
*/
160-
default BuilderT putAuthScheme(AuthScheme<?> authScheme) {
161-
throw new UnsupportedOperationException();
162-
}
163151
}

core/aws-core/src/test/java/software/amazon/awssdk/awscore/client/builder/DefaultAwsClientBuilderTest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import static software.amazon.awssdk.awscore.client.config.AwsClientOption.SIGNING_REGION;
2828
import static software.amazon.awssdk.core.client.config.SdkAdvancedClientOption.SIGNER;
2929

30-
import com.google.common.collect.ImmutableSet;
3130
import java.beans.BeanInfo;
3231
import java.beans.Introspector;
3332
import java.beans.PropertyDescriptor;
@@ -36,7 +35,6 @@
3635
import java.time.Duration;
3736
import java.util.Arrays;
3837
import java.util.Optional;
39-
import java.util.Set;
4038
import org.junit.Before;
4139
import org.junit.Test;
4240
import org.junit.runner.RunWith;
@@ -221,10 +219,6 @@ public void explicitAsyncHttpClientProvided_ClientIsNotManagedBySdk() {
221219

222220
@Test
223221
public void clientBuilderFieldsHaveBeanEquivalents() throws Exception {
224-
// Mutating properties might not have bean equivalents. This is probably fine, since very few customers require
225-
// bean-equivalent methods and it's not clear what they'd expect them to be named anyway. Ignore these methods for now.
226-
Set<String> NON_BEAN_EQUIVALENT_METHODS = ImmutableSet.of("putAuthScheme", "addPlugin");
227-
228222
AwsClientBuilder<TestClientBuilder, TestClient> builder = testClientBuilder();
229223

230224
BeanInfo beanInfo = Introspector.getBeanInfo(builder.getClass());
@@ -233,10 +227,6 @@ public void clientBuilderFieldsHaveBeanEquivalents() throws Exception {
233227
Arrays.stream(clientBuilderMethods).filter(m -> !m.isSynthetic()).forEach(builderMethod -> {
234228
String propertyName = builderMethod.getName();
235229

236-
if (NON_BEAN_EQUIVALENT_METHODS.contains(propertyName)) {
237-
return;
238-
}
239-
240230
Optional<PropertyDescriptor> propertyForMethod =
241231
Arrays.stream(beanInfo.getPropertyDescriptors())
242232
.filter(property -> property.getName().equals(propertyName))

core/sdk-core/src/main/java/software/amazon/awssdk/core/client/builder/SdkClientBuilder.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import software.amazon.awssdk.core.SdkPlugin;
2222
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
2323
import software.amazon.awssdk.endpoints.EndpointProvider;
24+
import software.amazon.awssdk.http.auth.spi.scheme.AuthScheme;
2425
import software.amazon.awssdk.utils.builder.SdkBuilder;
2526

2627
/**
@@ -65,6 +66,17 @@ default B overrideConfiguration(Consumer<ClientOverrideConfiguration.Builder> ov
6566
*/
6667
B endpointOverride(URI endpointOverride);
6768

69+
/**
70+
* Configure this client with an additional auth scheme, or replace one already on the client.
71+
*
72+
* <p>By default, the SDK will only know about default auth schemes that ship with the service. If you want to modify those
73+
* existing auth schemes or add a custom one (you select with a custom auth scheme resolver), you can add that new auth
74+
* scheme with this method.
75+
*/
76+
default B putAuthScheme(AuthScheme<?> authScheme) {
77+
throw new UnsupportedOperationException();
78+
}
79+
6880
/**
6981
* Adds a plugin to the client builder. The plugins will be invoked when building the client to allow them to change the
7082
* configuration of the built client.

core/sdk-core/src/test/java/software/amazon/awssdk/core/client/builder/DefaultClientBuilderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public void explicitAsyncHttpClientProvided_ClientIsNotManagedBySdk() {
371371
public void clientBuilderFieldsHaveBeanEquivalents() throws Exception {
372372
// Mutating properties might not have bean equivalents. This is probably fine, since very few customers require
373373
// bean-equivalent methods and it's not clear what they'd expect them to be named anyway. Ignore these methods for now.
374-
Set<String> NON_BEAN_EQUIVALENT_METHODS = ImmutableSet.of("addPlugin");
374+
Set<String> NON_BEAN_EQUIVALENT_METHODS = ImmutableSet.of("addPlugin", "putAuthScheme");
375375
SdkClientBuilder<TestClientBuilder, TestClient> builder = testClientBuilder();
376376

377377
BeanInfo beanInfo = Introspector.getBeanInfo(builder.getClass());

0 commit comments

Comments
 (0)