-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the remaining part of supporting operation level configuration #2814
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good. Some comments on making ServiceRuntimePlugin more efficient, and on testing.
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/CredentialCaches.kt
Outdated
Show resolved
Hide resolved
aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/CredentialCacheConfigTest.kt
Outdated
Show resolved
Hide resolved
aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/CredentialCacheConfigTest.kt
Show resolved
Hide resolved
This commit removes `TODO` for `BuilderBuildExtras` since the section is still needed as long as we have other struct fields in `Config` other than `FrozenLayer`, .e.g. `interceptors`.
This commit updates `config_override`-related unit tests written in Kotlin so that the new way of testing should check the behavior of each trait object retrieved from a config override layer. Previously, the tests were written in a naive way in that it only checks whether the appropriate orchestrator component was inserted into a config override layer when a test calls a certain builder method.
This commit addresses #2814 (comment)
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Great work. Just one suggestion.
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt
Outdated
Show resolved
Hide resolved
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
Implements the actual meat of
config_override
introduced as a skeleton in the past.Description
This PR enables operation-level config via
config_override
on a customizable operation (see config-override.rs integration tests for example code snippets).The way it's implemented is through
ConfigOverrideRuntimePlugin
. The plugin holds onto two things: aBuilder
passed toconfig_override
and aFrozenLayer
derived from a service config (the latter is primarily for retrieving default values understood by a service config). The plugin then implements theRuntimePlugin
trait to generate its ownFrozenLayer
that contains operation-level orchestrator components. ThatFrozenLayer
will then be added to a config bag later in the orchestrator execution in a way that it takes precedence over the client-level configuration (see register_default_runtime_plugins).A couple of things to note:
ConfigOverrideRuntimePlugin::config
code-generated is getting large. Maybe each customization defines a helper function instead of inlining logic directly inconfig
and we let theconfig
method call those generated helpers.retry_partition
withinconfig_override
since it's currently#[doc(hidden)]
, e.g.Testing
These tests are minimal in that they only check if the appropriate orchestrator components are inserted into a config override layer when a user calls a certain builder method as part ofconfig_override
.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.