Skip to content
Merged
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 @@ -37,13 +37,11 @@ public abstract class AwsServiceClientConfiguration extends SdkServiceClientConf

private final Region region;
private final IdentityProvider<? extends AwsCredentialsIdentity> credentialsProvider;
private final Map<String, AuthScheme<?>> authSchemes;

protected AwsServiceClientConfiguration(Builder builder) {
super(builder);
this.region = builder.region();
this.credentialsProvider = builder.credentialsProvider();
this.authSchemes = builder.authSchemes();
}

/**
Expand All @@ -61,20 +59,12 @@ public IdentityProvider<? extends AwsCredentialsIdentity> credentialsProvider()
return credentialsProvider;
}

/**
* @return The configured map of auth schemes.
*/
public Map<String, AuthScheme<?>> authSchemes() {
return authSchemes;
}

@Override
public int hashCode() {
int result = 1;
result = 31 * result + super.hashCode();
result = 31 * result + (region != null ? region.hashCode() : 0);
result = 31 * result + (credentialsProvider != null ? credentialsProvider.hashCode() : 0);
result = 31 * result + (authSchemes != null ? authSchemes.hashCode() : 0);
return result;
}

Expand All @@ -86,8 +76,7 @@ public boolean equals(Object o) {

AwsServiceClientConfiguration that = (AwsServiceClientConfiguration) o;
return Objects.equals(region, that.region)
&& Objects.equals(credentialsProvider, that.credentialsProvider)
&& Objects.equals(authSchemes, that.authSchemes);
&& Objects.equals(credentialsProvider, that.credentialsProvider);
}

/**
Expand Down Expand Up @@ -123,28 +112,19 @@ default Builder endpointProvider(EndpointProvider endpointProvider) {
throw new UnsupportedOperationException();
}

/**
* Configure the credentials provider
*/
default Builder credentialsProvider(IdentityProvider<? extends AwsCredentialsIdentity> credentialsProvider) {
throw new UnsupportedOperationException();
}

default IdentityProvider<? extends AwsCredentialsIdentity> credentialsProvider() {
@Override
default Builder putAuthScheme(AuthScheme<?> authScheme) {
throw new UnsupportedOperationException();
}

/**
* Adds the given auth scheme. Replaces the an existing auth scheme with the same id.
* Configure the credentials provider
*/
default Builder putAuthScheme(AuthScheme<?> authScheme) {
default Builder credentialsProvider(IdentityProvider<? extends AwsCredentialsIdentity> credentialsProvider) {
throw new UnsupportedOperationException();
}

/**
* Returns the configured map of auth schemes.
*/
default Map<String, AuthScheme<?>> authSchemes() {
default IdentityProvider<? extends AwsCredentialsIdentity> credentialsProvider() {
throw new UnsupportedOperationException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ default B putRawQueryParameter(String name, String value) {
* @param plugins The list of plugins for this request.
* @return This object for method chaining.
*/
@SdkPreviewApi
B plugins(List<SdkPlugin> plugins);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
package software.amazon.awssdk.core;

import java.net.URI;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.endpoints.EndpointProvider;
import software.amazon.awssdk.http.auth.spi.scheme.AuthScheme;

/**
* Class to expose SDK service client settings to the user, e.g., ClientOverrideConfiguration
Expand All @@ -31,13 +33,14 @@ public abstract class SdkServiceClientConfiguration {

private final ClientOverrideConfiguration overrideConfiguration;
private final URI endpointOverride;

private final EndpointProvider endpointProvider;
private final Map<String, AuthScheme<?>> authSchemes;

protected SdkServiceClientConfiguration(Builder builder) {
this.overrideConfiguration = builder.overrideConfiguration();
this.endpointOverride = builder.endpointOverride();
this.endpointProvider = builder.endpointProvider();
this.authSchemes = builder.authSchemes();
}

/**
Expand Down Expand Up @@ -67,6 +70,12 @@ public Optional<EndpointProvider> endpointProvider() {
return Optional.ofNullable(this.endpointProvider);
}

/**
* @return The configured map of auth schemes.
*/
public Map<String, AuthScheme<?>> authSchemes() {
return authSchemes;
}

@Override
public boolean equals(Object o) {
Expand All @@ -80,14 +89,16 @@ public boolean equals(Object o) {
SdkServiceClientConfiguration serviceClientConfiguration = (SdkServiceClientConfiguration) o;
return Objects.equals(overrideConfiguration, serviceClientConfiguration.overrideConfiguration())
&& Objects.equals(endpointOverride, serviceClientConfiguration.endpointOverride().orElse(null))
&& Objects.equals(endpointProvider, serviceClientConfiguration.endpointProvider().orElse(null));
&& Objects.equals(endpointProvider, serviceClientConfiguration.endpointProvider().orElse(null))
&& Objects.equals(authSchemes, serviceClientConfiguration.authSchemes);
}

@Override
public int hashCode() {
int result = overrideConfiguration != null ? overrideConfiguration.hashCode() : 0;
result = 31 * result + (endpointOverride != null ? endpointOverride.hashCode() : 0);
result = 31 * result + (endpointProvider != null ? endpointProvider.hashCode() : 0);
result = 31 * result + (authSchemes != null ? authSchemes.hashCode() : 0);
return result;
}

Expand Down Expand Up @@ -144,6 +155,20 @@ default Builder endpointProvider(EndpointProvider endpointProvider) {
throw new UnsupportedOperationException();
}

/**
* Adds the given auth scheme. Replaces an existing auth scheme with the same id.
*/
default Builder putAuthScheme(AuthScheme<?> authScheme) {
throw new UnsupportedOperationException();
}

/**
* Returns the configured map of auth schemes.
*/
default Map<String, AuthScheme<?>> authSchemes() {
throw new UnsupportedOperationException();
}

/**
* Build the service client configuration using the configuration on this builder
*/
Expand Down