Skip to content

Per-client configuration - #3987

Merged
averyk22 merged 3 commits into
release/1.12from
per-client-config-1.12
Nov 19, 2026
Merged

averyk22 merged 3 commits into
release/1.12from
per-client-config-1.12

Conversation

@averyk22

@averyk22 averyk22 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

** Look at the first commit during review, second commit is all the generated files (too many of them)

  • ClientConfiguration keeps only settings every service shares; the 12 service-specific options move to generated per-service configurations, chosen from each service's endpoint rules and model (ServiceModel.getSupportedClientOptions)
  • Clients can no longer be built from the shared ClientConfiguration; an explicit XClientConfiguration(const ClientConfiguration&) seeds a service config from shared settings
  • Remove legacy client constructors and OverrideEndpoint (S3Crt unchanged )

Issue #, if available:

Description of changes:

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@averyk22
averyk22 force-pushed the per-client-config-1.12 branch from 84c91d7 to e95feb2 Compare November 13, 2026 15:34
@averyk22
averyk22 requested a review from sbiscigl November 13, 2026 15:42

@sbiscigl sbiscigl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core of this is right, and we should keep it. That's removing the legacy constructors, making the converting constructor explicit, generating a configuration for every service, and no longer setting UseFIPS and UseDualStack on every client.

Where it runs into trouble is how service options reach the base client.

An object should be correct when its constructor finishes. Right now the base client is built with default checksum, chunking and Expect header settings, and ApplyServiceOptions patches them afterward. So every client depends on a second call to be right, and a client that misses the call has no way to know. S3CrtClient misses it. It now ignores checksumConfig, disableExpectHeader and the chunking settings for requests that don't go through the CRT, and before this PR the constructor read them.

Don't pay for what you don't use. The options left ClientConfiguration, but core still knows about all of them. ClientConfiguration.h now has ServiceClientOptions, ChecksumConfig, the chunk size constant and a loader for each option. Every client also still builds checksum and chunking interceptors, even when its service has no checksum operations.

Following both principles leads to one change. The service's configuration builds the interceptors its service needs, and the base asks for them once, in its constructor. ClientConfiguration already supplies the retry strategy and executor this way through configFactories.

The Swift SDK already works this way. Its service configurations carry interceptor providers, and the generated operations add the service's own interceptors, like the flexible checksum one only on operations that have checksums.

// Today. The base starts with defaults, and the generated client patches it.
S3Client(config) : AWSClient(config) {
  ApplyServiceOptions(GetServiceClientOptions(config));
}

// Suggested. The configuration builds what its service needs, and the base asks once.
struct S3ClientConfiguration : GenericClientConfiguration {
  Interceptors CreateInterceptors(const CreateInterceptorsRequest& request) const override {
    return {ChecksumInterceptor(...), ChunkingInterceptor(...), ExpectHeaderInterceptor(...)};
  }
};

AWSClient(const ClientConfiguration& config) : m_interceptors(config.CreateInterceptors({*m_httpClient})) {}

DynamoDB has no checksum or streaming operations, so its configuration builds none of these.

Once the configuration owns this, the base doesn't need to know any service's options. It runs the interceptors it's given, and the service decides what those are.

With that, ApplyServiceOptions, ServiceClientOptions, GetServiceClientOptions and the core loaders go away, and ClientConfiguration.h doesn't gain anything.

@averyk22
averyk22 force-pushed the per-client-config-1.12 branch from 7e864b4 to 1c7ae38 Compare November 17, 2026 21:07
Aws::String accountId;
Aws::String accountIdEndpointMode;
struct CreateInterceptorsRequest {
std::shared_ptr<Aws::Http::HttpClient> httpClient;

@averyk22 averyk22 Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RequestCompressionInterceptor holds the HTTP client because AddCompressedContentBodyToRequest needs it and interceptors doesn't get the client's members. Before, compression
borrowed the base client's m_httpClient. I can make it a weak_ptr
if you'd rather it not share ownership.

AWS_CORE_API RequestCompressionConfig LoadRequestCompressionConfigFromEnvOrProfile(const Aws::String& profileName);
AWS_CORE_API ChecksumConfig LoadChecksumConfigFromEnvOrProfile(const Aws::String& profileName);
AWS_CORE_API Aws::Vector<Aws::String> LoadSigV4aSigningRegionSetFromEnvOrProfile(const Aws::String& profileName);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loaders that were just a lookup through
LoadConfigFromEnvOrProfile (useFIPS, useDualStack,
accountIdEndpointMode) are now generated inline in each
service's configuration, and loaders with real logic (checksum,
request compression, SigV4a region set) stay shared next to the
feature that uses them (ChecksumConfig.h, RequestCompression.h, SigV4aSigningRegionSet.h) so that logic isn't copied into every
service.

if (resolvedNonEmptyAccountId && m_serviceOptions.accountId.empty()) {
endpointParameters.emplace_back("AccountId", resolvedAccountId.value(), Aws::Endpoint::EndpointParameter::ParameterOrigin::OPERATION_CONTEXT);
}
// Services whose endpoint rules take AccountId add it in their generated GetContextEndpointParameters override.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "use the credentials' account ID unless accountId is
configured" rule moved out of core into a generated
GetContextEndpointParameters override, emitted only for services
whose endpoint rules take AccountId (only 4 services).

const Aws::String& serviceName,
const Aws::String& region)
const Aws::String& region,
const Aws::Vector<Aws::String>& signingRegionSet = {})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signingRegionSet is now a defaulted constructor parameter on
AwsSigV4aSigner and SigV4aAuthScheme, so a generated client
passes its configured sigV4aSigningRegionSet to the signer once,
when it builds the auth scheme. i can also add a separate overload constructor

#foreach($entry in $AuthSchemeMapEntries)
#if($entry.contains("smithy::BearerTokenAuthScheme") && $serviceModel.metadata.signingName == "bedrock")
{${entry}{Aws::MakeShared<${metadata.classNamePrefix}AwsBearerTokenIdentityResolver>("BearerTokenAuthScheme", clientConfiguration.ResolveCredentialProviderConfig()), GetServiceName(), clientConfiguration.region}},
#elseif($entry.contains("smithy::SigV4aAuthScheme") && $serviceModel.supportedClientOptions.contains("sigV4aSigningRegionSet"))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For services that have sigV4aSigningRegionSet (among smithy
clients, only STS), the generated constructors now pass
clientConfiguration.sigV4aSigningRegionSet to
SigV4aAuthScheme, so the signer gets the configured region set
once, when the client is built, instead of
UpdateAuthSchemeFromEndpoint copying it from
ServiceClientOptions on every request. not sure if this is the correct way to do it?

}
}

#if($serviceModel.supportedClientOptions.contains("accountId"))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "add the credentials' account ID as the AccountId endpoint
parameter unless accountId is configured" rule moved out of
AwsSmithyClientT::GetContextEndpointParametersImpl into this
generated override, emitted only for services that have
accountId (among smithy clients, only DynamoDB).

@averyk22
averyk22 force-pushed the per-client-config-1.12 branch from 8cdef1a to 8ef69f7 Compare November 18, 2026 20:46
* Default aws-chunked buffer size for services that upload streams.
* Used by those services' configurations (awsChunkedBufferSize).
*/
static const size_t DEFAULT_AWS_CHUNKED_BUFFER_SIZE = 64UL * 1024;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having a header for just a numerical constant seems a little off, could this be move to a cpp file?


Aws::Client::RequestCompressionConfig Aws::Client::LoadRequestCompressionConfigFromEnvOrProfile(const Aws::String& profileName)
{
static const char DISABLE_REQUEST_COMPRESSION_ENV_VAR[] = "DISABLE_REQUEST_COMPRESSION";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move to anonymous namespace in the cpp instead of static local to the function

@averyk22
averyk22 force-pushed the per-client-config-1.12 branch from 8ef69f7 to 371d114 Compare November 18, 2026 21:15
…tions

Core, code generator and hand-written test changes:
- Each service client is built from its own service-specific configuration.
- Build each service's interceptors from its configuration at client construction.
- Smoke tests: only set useFIPS/useDualStack when enabled.
- Performance tests: build S3 and DynamoDB clients from their own configuration.
- AwsConfigTest: check endpoint parameters without GetParameter() on a missing name.
- S3 integration tests: set ARN region and MRAP options on the config.
- Fix MSVC C4459: drop shadowing CLIENT_CONFIG_TAG in RequestCompression.cpp.
- Add dualstack to the cspell dictionary.
- Keep request compression and aws-chunked buffer defaults out of installed headers
  (anonymous-namespace constants in the .cpp; drop ChunkingConfig.h).
@averyk22
averyk22 force-pushed the per-client-config-1.12 branch from 371d114 to 059ddd5 Compare November 19, 2026 14:13
@averyk22
averyk22 merged commit adf260d into release/1.12 Nov 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants