Class AwsDefaultClientBuilder<BuilderT extends AwsClientBuilder<BuilderT,ClientT>,ClientT>
- java.lang.Object
-
- software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder<BuilderT,ClientT>
-
- software.amazon.awssdk.awscore.client.builder.AwsDefaultClientBuilder<BuilderT,ClientT>
-
- Type Parameters:
BuilderT- The type of builder, for chaining.ClientT- The type of client generated by this builder.
- All Implemented Interfaces:
AwsClientBuilder<BuilderT,ClientT>,SdkClientBuilder<BuilderT,ClientT>,Buildable,SdkBuilder<BuilderT,ClientT>
public abstract class AwsDefaultClientBuilder<BuilderT extends AwsClientBuilder<BuilderT,ClientT>,ClientT> extends SdkDefaultClientBuilder<BuilderT,ClientT> implements AwsClientBuilder<BuilderT,ClientT>
An SDK-internal implementation of the methods inAwsClientBuilder,AwsAsyncClientBuilderandAwsSyncClientBuilder. 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
AwsClientBuilders, this class is not thread safe.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder
SdkDefaultClientBuilder.NonManagedSdkAsyncHttpClient, SdkDefaultClientBuilder.NonManagedSdkHttpClient
-
-
Field Summary
-
Fields inherited from class software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder
clientConfiguration, clientContextParams, overrideConfig
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAwsDefaultClientBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BuilderTcredentialsProvider(IdentityProvider<? extends AwsCredentialsIdentity> identityProvider)Configure the credentials that should be used to authenticate with AWS.BuilderTdefaultsMode(DefaultsMode defaultsMode)Sets theDefaultsModethat will be used to determine how certain default configuration options are resolved in the SDK.BuilderTdualstackEnabled(Boolean dualstackEndpointEnabled)Configure whether the SDK should use the AWS dualstack endpoint.protected SdkClientConfigurationfinalizeChildConfiguration(SdkClientConfiguration configuration)Return a client configuration object, populated with the following chain of priorities.protected SdkClientConfigurationfinalizeServiceConfiguration(SdkClientConfiguration configuration)Optionally overridden by child classes to derive service-specific configuration from the default-applied configuration.BuilderTfipsEnabled(Boolean dualstackEndpointEnabled)Configure whether the SDK should use the AWS fips endpoints.protected SdkClientConfigurationmergeChildDefaults(SdkClientConfiguration configuration)protected SdkClientConfigurationmergeInternalDefaults(SdkClientConfiguration configuration)Optionally overridden by child classes to define internal default configuration.protected SdkClientConfigurationmergeServiceDefaults(SdkClientConfiguration configuration)Optionally overridden by child classes to define service-specific default configuration.BuilderTregion(Region region)Configure the region with which the SDK should communicate.protected abstract StringserviceEndpointPrefix()Implemented by child classes to define the endpoint prefix used when communicating with AWS.protected AttributeMapserviceHttpConfig()Optionally overridden by child classes to define service-specific HTTP configuration defaults.protected abstract StringserviceName()Implemented by child classes to define the service name used to identify the request in things like metrics.voidsetCredentialsProvider(AwsCredentialsProvider credentialsProvider)voidsetCredentialsProvider(IdentityProvider<? extends AwsCredentialsIdentity> identityProvider)voidsetDefaultsMode(DefaultsMode defaultsMode)voidsetDualstackEnabled(Boolean dualstackEndpointEnabled)voidsetFipsEnabled(Boolean fipsEndpointEnabled)protected SdkClientConfigurationsetOverrides(SdkClientConfiguration configuration)Apply the client override configuration to the provided configuration.voidsetRegion(Region region)protected abstract StringsigningName()Implemented by child classes to define the signing-name that should be used when signing requests when communicating with AWS.-
Methods inherited from class software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder
addPlugin, asyncClientConfiguration, asyncConfiguration, build, buildClient, childHttpConfig, childHttpConfig, endpointOverride, httpClient, httpClient, httpClientBuilder, httpClientBuilder, invokePlugins, metricPublishers, overrideConfiguration, overrideConfiguration, plugins, setAsyncConfiguration, setEndpointOverride, setOverrideConfiguration, syncClientConfiguration, thisBuilder
-
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.awscore.client.builder.AwsClientBuilder
credentialsProvider
-
Methods inherited from interface software.amazon.awssdk.utils.builder.SdkBuilder
applyMutation, build
-
Methods inherited from interface software.amazon.awssdk.core.client.builder.SdkClientBuilder
addPlugin, endpointOverride, overrideConfiguration, overrideConfiguration, overrideConfiguration, plugins, putAuthScheme
-
-
-
-
Method Detail
-
serviceEndpointPrefix
protected abstract String serviceEndpointPrefix()
Implemented by child classes to define the endpoint prefix used when communicating with AWS. This constitutes the first part of the URL in the DNS name for the service. Eg. in the endpoint "dynamodb.amazonaws.com", this is the "dynamodb".For standard services, this should match the "endpointPrefix" field in the AWS model.
-
signingName
protected abstract String signingName()
Implemented by child classes to define the signing-name that should be used when signing requests when communicating with AWS.
-
serviceName
protected abstract String serviceName()
Implemented by child classes to define the service name used to identify the request in things like metrics.
-
mergeChildDefaults
protected final SdkClientConfiguration mergeChildDefaults(SdkClientConfiguration configuration)
- Overrides:
mergeChildDefaultsin classSdkDefaultClientBuilder<BuilderT extends AwsClientBuilder<BuilderT,ClientT>,ClientT>
-
mergeServiceDefaults
protected SdkClientConfiguration mergeServiceDefaults(SdkClientConfiguration configuration)
Optionally overridden by child classes to define service-specific default configuration.
-
mergeInternalDefaults
protected SdkClientConfiguration mergeInternalDefaults(SdkClientConfiguration configuration)
Optionally overridden by child classes to define internal default configuration.
-
finalizeChildConfiguration
protected final SdkClientConfiguration finalizeChildConfiguration(SdkClientConfiguration configuration)
Return a client configuration object, populated with the following chain of priorities.- Defaults vended from
DefaultsMode - AWS Global Defaults
- Overrides:
finalizeChildConfigurationin classSdkDefaultClientBuilder<BuilderT extends AwsClientBuilder<BuilderT,ClientT>,ClientT>
- Defaults vended from
-
setOverrides
protected final SdkClientConfiguration setOverrides(SdkClientConfiguration configuration)
Apply the client override configuration to the provided configuration.- Overrides:
setOverridesin classSdkDefaultClientBuilder<BuilderT extends AwsClientBuilder<BuilderT,ClientT>,ClientT>
-
serviceHttpConfig
protected AttributeMap serviceHttpConfig()
Optionally overridden by child classes to define service-specific HTTP configuration defaults.
-
finalizeServiceConfiguration
protected SdkClientConfiguration finalizeServiceConfiguration(SdkClientConfiguration configuration)
Optionally overridden by child classes to derive service-specific configuration from the default-applied configuration.
-
region
public final BuilderT region(Region region)
Description copied from interface:AwsClientBuilderConfigure the region with which the SDK should communicate.If this is not specified, the SDK will attempt to identify the endpoint automatically using the following logic:
- Check the 'aws.region' system property for the region.
- Check the 'AWS_REGION' environment variable for the region.
- Check the {user.home}/.aws/credentials and {user.home}/.aws/config files for the region.
- If running in EC2, check the EC2 metadata service for the region.
If the region is not found in any of the locations above, an exception will be thrown at
SdkBuilder.build()time.- Specified by:
regionin interfaceAwsClientBuilder<BuilderT extends AwsClientBuilder<BuilderT,ClientT>,ClientT>
-
setRegion
public final void setRegion(Region region)
-
dualstackEnabled
public BuilderT dualstackEnabled(Boolean dualstackEndpointEnabled)
Description copied from interface:AwsClientBuilderConfigure whether the SDK should use the AWS dualstack endpoint.If this is not specified, the SDK will attempt to determine whether the dualstack endpoint should be used automatically using the following logic:
- Check the 'aws.useDualstackEndpoint' system property for 'true' or 'false'.
- Check the 'AWS_USE_DUALSTACK_ENDPOINT' environment variable for 'true' or 'false'.
- Check the {user.home}/.aws/credentials and {user.home}/.aws/config files for the 'use_dualstack_endpoint' property set to 'true' or 'false'.
If the setting is not found in any of the locations above, 'false' will be used.
- Specified by:
dualstackEnabledin interfaceAwsClientBuilder<BuilderT extends AwsClientBuilder<BuilderT,ClientT>,ClientT>
-
setDualstackEnabled
public final void setDualstackEnabled(Boolean dualstackEndpointEnabled)
-
fipsEnabled
public BuilderT fipsEnabled(Boolean dualstackEndpointEnabled)
Description copied from interface:AwsClientBuilderConfigure whether the SDK should use the AWS fips endpoints.If this is not specified, the SDK will attempt to determine whether the fips endpoint should be used automatically using the following logic:
- Check the 'aws.useFipsEndpoint' system property for 'true' or 'false'.
- Check the 'AWS_USE_FIPS_ENDPOINT' environment variable for 'true' or 'false'.
- Check the {user.home}/.aws/credentials and {user.home}/.aws/config files for the 'use_fips_endpoint' property set to 'true' or 'false'.
If the setting is not found in any of the locations above, 'false' will be used.
- Specified by:
fipsEnabledin interfaceAwsClientBuilder<BuilderT extends AwsClientBuilder<BuilderT,ClientT>,ClientT>
-
setFipsEnabled
public final void setFipsEnabled(Boolean fipsEndpointEnabled)
-
setCredentialsProvider
public final void setCredentialsProvider(AwsCredentialsProvider credentialsProvider)
-
credentialsProvider
public final BuilderT credentialsProvider(IdentityProvider<? extends AwsCredentialsIdentity> identityProvider)
Description copied from interface:AwsClientBuilderConfigure the credentials that should be used to authenticate with AWS.The default provider will attempt to identify the credentials automatically using the following checks:
- Java System Properties -
aws.accessKeyIdandaws.secretAccessKey - Environment Variables -
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY - Credential profiles file at the default location (~/.aws/credentials) shared by all AWS SDKs and the AWS CLI
- Credentials delivered through the Amazon EC2 container service if AWS_CONTAINER_CREDENTIALS_RELATIVE_URI environment variable is set and security manager has permission to access the variable.
- Instance profile credentials delivered through the Amazon EC2 metadata service
If the credentials are not found in any of the locations above, an exception will be thrown at
SdkBuilder.build()time.The last of
AwsClientBuilder.credentialsProvider(AwsCredentialsProvider)orAwsClientBuilder.credentialsProvider(IdentityProvider)wins.- Specified by:
credentialsProviderin interfaceAwsClientBuilder<BuilderT extends AwsClientBuilder<BuilderT,ClientT>,ClientT>
- Java System Properties -
-
setCredentialsProvider
public final void setCredentialsProvider(IdentityProvider<? extends AwsCredentialsIdentity> identityProvider)
-
defaultsMode
public final BuilderT defaultsMode(DefaultsMode defaultsMode)
Description copied from interface:AwsClientBuilderSets theDefaultsModethat will be used to determine how certain default configuration options are resolved in the SDK.If this is not specified, the SDK will attempt to identify the defaults mode automatically using the following logic:
- Check the "defaults_mode" profile file property.
- Check "aws.defaultsMode" system property.
- Check the "AWS_DEFAULTS_MODE" environment variable.
- Specified by:
defaultsModein interfaceAwsClientBuilder<BuilderT extends AwsClientBuilder<BuilderT,ClientT>,ClientT>- Parameters:
defaultsMode- the defaultsMode to use- Returns:
- This object for method chaining.
- See Also:
DefaultsMode
-
setDefaultsMode
public final void setDefaultsMode(DefaultsMode defaultsMode)
-
-