Class SdkDefaultClientBuilder<B extends SdkClientBuilder<B,C>,C>
- java.lang.Object
-
- software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder<B,C>
-
- Type Parameters:
B- The type of builder, for chaining.C- The type of client generated by this builder.
- All Implemented Interfaces:
SdkClientBuilder<B,C>,software.amazon.awssdk.utils.builder.Buildable,software.amazon.awssdk.utils.builder.SdkBuilder<B,C>
public abstract class SdkDefaultClientBuilder<B extends SdkClientBuilder<B,C>,C> extends Object implements SdkClientBuilder<B,C>
An SDK-internal implementation of the methods inSdkClientBuilder,SdkAsyncClientBuilderandSdkSyncClientBuilder. This implements all methods required by those interfaces, allowing service-specific builders to just implement the configuration they wish to add.By implementing both the sync and async interface's methods, service-specific builders can share code between their sync and async variants without needing one to extend the other. Note: This only defines the methods in the sync and async builder interfaces. It does not implement the interfaces themselves. This is because the sync and async client builder interfaces both require a type-constrained parameter for use in fluent chaining, and a generic type parameter conflict is introduced into the class hierarchy by this interface extending the builder interfaces themselves.
Like all
SdkClientBuilders, this class is not thread safe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSdkDefaultClientBuilder.NonManagedSdkAsyncHttpClientWrapper aroundSdkAsyncHttpClientto prevent it from being closed.static classSdkDefaultClientBuilder.NonManagedSdkHttpClientWrapper aroundSdkHttpClientto prevent it from being closed.
-
Field Summary
Fields Modifier and Type Field Description protected SdkClientConfiguration.BuilderclientConfigurationprotected software.amazon.awssdk.utils.AttributeMap.BuilderclientContextParams
-
Constructor Summary
Constructors Modifier Constructor Description protectedSdkDefaultClientBuilder()protectedSdkDefaultClientBuilder(software.amazon.awssdk.http.SdkHttpClient.Builder defaultHttpClientBuilder, software.amazon.awssdk.http.async.SdkAsyncHttpClient.Builder defaultAsyncHttpClientBuilder)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description BaddPlugin(SdkPlugin plugin)Adds a plugin to the client builder.protected SdkClientConfigurationasyncClientConfiguration()Return a client configuration object, populated with the following chain of priorities.BasyncConfiguration(ClientAsyncConfiguration asyncConfiguration)Cbuild()Build a client using the current state of this builder.protected abstract CbuildClient()Implemented by child classes to create a client using the provided immutable configuration objects.protected software.amazon.awssdk.utils.AttributeMapchildHttpConfig()Deprecated.usechildHttpConfig(SdkClientConfiguration)insteadprotected software.amazon.awssdk.utils.AttributeMapchildHttpConfig(SdkClientConfiguration configuration)Optionally overridden by child implementations to provide implementation-specific default HTTP configuration.BendpointOverride(URI endpointOverride)Configure the endpoint with which the SDK should communicate.protected SdkClientConfigurationfinalizeChildConfiguration(SdkClientConfiguration configuration)Optionally overridden by child implementations to derive implementation-specific configuration from the default-applied configuration.BhttpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient httpClient)BhttpClient(software.amazon.awssdk.http.SdkHttpClient httpClient)BhttpClientBuilder(software.amazon.awssdk.http.async.SdkAsyncHttpClient.Builder httpClientBuilder)BhttpClientBuilder(software.amazon.awssdk.http.SdkHttpClient.Builder httpClientBuilder)protected SdkClientConfigurationinvokePlugins(SdkClientConfiguration config)By default, returns the configuration as-is.protected SdkClientConfigurationmergeChildDefaults(SdkClientConfiguration configuration)Optionally overridden by child implementations to apply implementation-specific default configuration.BmetricPublishers(List<software.amazon.awssdk.metrics.MetricPublisher> metricPublishers)ClientOverrideConfigurationoverrideConfiguration()Retrieve the current override configuration.BoverrideConfiguration(ClientOverrideConfiguration overrideConfig)Specify overrides to the default SDK configuration that should be used for clients created by this builder.List<SdkPlugin>plugins()Returns the list of plugins configured on the client builder.voidsetAsyncConfiguration(ClientAsyncConfiguration asyncConfiguration)voidsetEndpointOverride(URI endpointOverride)voidsetOverrideConfiguration(ClientOverrideConfiguration overrideConfiguration)protected SdkClientConfigurationsetOverrides(SdkClientConfiguration configuration)protected SdkClientConfigurationsyncClientConfiguration()Return a client configuration object, populated with the following chain of priorities.protected BthisBuilder()Return "this" for method chaining.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.core.client.builder.SdkClientBuilder
overrideConfiguration, putAuthScheme
-
-
-
-
Field Detail
-
clientConfiguration
protected final SdkClientConfiguration.Builder clientConfiguration
-
clientContextParams
protected final software.amazon.awssdk.utils.AttributeMap.Builder clientContextParams
-
-
Constructor Detail
-
SdkDefaultClientBuilder
protected SdkDefaultClientBuilder()
-
SdkDefaultClientBuilder
protected SdkDefaultClientBuilder(software.amazon.awssdk.http.SdkHttpClient.Builder defaultHttpClientBuilder, software.amazon.awssdk.http.async.SdkAsyncHttpClient.Builder defaultAsyncHttpClientBuilder)
-
-
Method Detail
-
build
public final C build()
Build a client using the current state of this builder. This is marked final in order to allow this class to add standard "build" logic between all service clients. Service clients are expected to implement thebuildClient()method, that accepts the immutable client configuration generated by this build method.- Specified by:
buildin interfacesoftware.amazon.awssdk.utils.builder.Buildable- Specified by:
buildin interfacesoftware.amazon.awssdk.utils.builder.SdkBuilder<B extends SdkClientBuilder<B,C>,C>
-
buildClient
protected abstract C buildClient()
Implemented by child classes to create a client using the provided immutable configuration objects. The async and sync configurations are not yet immutable. Child classes will need to make them immutable in order to validate them and pass them to the client's constructor.- Returns:
- A client based on the provided configuration.
-
syncClientConfiguration
protected final SdkClientConfiguration syncClientConfiguration()
Return a client configuration object, populated with the following chain of priorities.- Client Configuration Overrides
- Customer Configuration
- Service-Specific Defaults
- Global Defaults
-
asyncClientConfiguration
protected final SdkClientConfiguration asyncClientConfiguration()
Return a client configuration object, populated with the following chain of priorities.- Client Configuration Overrides
- Customer Configuration
- Implementation/Service-Specific Configuration
- Global Default Configuration
-
setOverrides
protected SdkClientConfiguration setOverrides(SdkClientConfiguration configuration)
-
mergeChildDefaults
protected SdkClientConfiguration mergeChildDefaults(SdkClientConfiguration configuration)
Optionally overridden by child implementations to apply implementation-specific default configuration. (eg. AWS's default credentials providers)
-
finalizeChildConfiguration
protected SdkClientConfiguration finalizeChildConfiguration(SdkClientConfiguration configuration)
Optionally overridden by child implementations to derive implementation-specific configuration from the default-applied configuration. (eg. AWS's endpoint, derived from the region).
-
invokePlugins
protected SdkClientConfiguration invokePlugins(SdkClientConfiguration config)
By default, returns the configuration as-is. Classes extending this method will take care of running the plugins and return the updated configuration if plugins are supported.
-
childHttpConfig
protected software.amazon.awssdk.utils.AttributeMap childHttpConfig(SdkClientConfiguration configuration)
Optionally overridden by child implementations to provide implementation-specific default HTTP configuration.
-
childHttpConfig
@Deprecated protected software.amazon.awssdk.utils.AttributeMap childHttpConfig()
Deprecated.usechildHttpConfig(SdkClientConfiguration)insteadOptionally overridden by child implementations to provide implementation-specific default HTTP configuration.
-
endpointOverride
public final B endpointOverride(URI endpointOverride)
Description copied from interface:SdkClientBuilderConfigure the endpoint with which the SDK should communicate.It is important to know that
EndpointProviders and the endpoint override on the client are not mutually exclusive. In all existing cases, the endpoint override is passed as a parameter to the provider and the provider *may* modify it. For example, the S3 provider may add the bucket name as a prefix to the endpoint override for virtual bucket addressing.- Specified by:
endpointOverridein interfaceSdkClientBuilder<B extends SdkClientBuilder<B,C>,C>
-
setEndpointOverride
public final void setEndpointOverride(URI endpointOverride)
-
asyncConfiguration
public final B asyncConfiguration(ClientAsyncConfiguration asyncConfiguration)
-
setAsyncConfiguration
public final void setAsyncConfiguration(ClientAsyncConfiguration asyncConfiguration)
-
overrideConfiguration
public final B overrideConfiguration(ClientOverrideConfiguration overrideConfig)
Description copied from interface:SdkClientBuilderSpecify overrides to the default SDK configuration that should be used for clients created by this builder.- Specified by:
overrideConfigurationin interfaceSdkClientBuilder<B extends SdkClientBuilder<B,C>,C>
-
setOverrideConfiguration
public final void setOverrideConfiguration(ClientOverrideConfiguration overrideConfiguration)
-
overrideConfiguration
public final ClientOverrideConfiguration overrideConfiguration()
Description copied from interface:SdkClientBuilderRetrieve the current override configuration. This allows further overrides across calls. Can be modified by first converting to a builder withClientOverrideConfiguration.toBuilder().- Specified by:
overrideConfigurationin interfaceSdkClientBuilder<B extends SdkClientBuilder<B,C>,C>- Returns:
- The existing override configuration for the builder.
-
httpClient
public final B httpClient(software.amazon.awssdk.http.SdkHttpClient httpClient)
-
httpClientBuilder
public final B httpClientBuilder(software.amazon.awssdk.http.SdkHttpClient.Builder httpClientBuilder)
-
httpClient
public final B httpClient(software.amazon.awssdk.http.async.SdkAsyncHttpClient httpClient)
-
httpClientBuilder
public final B httpClientBuilder(software.amazon.awssdk.http.async.SdkAsyncHttpClient.Builder httpClientBuilder)
-
metricPublishers
public final B metricPublishers(List<software.amazon.awssdk.metrics.MetricPublisher> metricPublishers)
-
addPlugin
public final B addPlugin(SdkPlugin plugin)
Description copied from interface:SdkClientBuilderAdds a plugin to the client builder. The plugins will be invoked when building the client to allow them to change the configuration of the built client.- Specified by:
addPluginin interfaceSdkClientBuilder<B extends SdkClientBuilder<B,C>,C>
-
plugins
public final List<SdkPlugin> plugins()
Description copied from interface:SdkClientBuilderReturns the list of plugins configured on the client builder.- Specified by:
pluginsin interfaceSdkClientBuilder<B extends SdkClientBuilder<B,C>,C>
-
thisBuilder
protected B thisBuilder()
Return "this" for method chaining.
-
-