-
Notifications
You must be signed in to change notification settings - Fork 193
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
Add skeleton for supporting operation level config #2589
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit adds skeleton code for supporting operation level config. The approach is described in #2527, where fluent builders now have a new method, `config_override`, that takes a service config builder
A new generated diff is ready to view.
A new doc preview is ready to view. |
jdisanti
approved these changes
Apr 18, 2023
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.
Looks good! Just some minor questions/comments.
...software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt
Outdated
Show resolved
Hide resolved
...software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt
Outdated
Show resolved
Hide resolved
...software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt
Outdated
Show resolved
Hide resolved
...software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt
Outdated
Show resolved
Hide resolved
pose
approved these changes
Apr 19, 2023
…egen/client/smithy/generators/client/FluentClientGenerator.kt Co-authored-by: John DiSanti <jdisanti@amazon.com>
…egen/client/smithy/generators/client/FluentClientGenerator.kt Co-authored-by: John DiSanti <jdisanti@amazon.com>
…egen/client/smithy/generators/client/FluentClientGenerator.kt Co-authored-by: John DiSanti <jdisanti@amazon.com>
…egen/client/smithy/generators/client/FluentClientGenerator.kt Co-authored-by: John DiSanti <jdisanti@amazon.com>
Velfi
reviewed
Apr 19, 2023
...software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt
Outdated
Show resolved
Hide resolved
Velfi
reviewed
Apr 19, 2023
...software/amazon/smithy/rust/codegen/client/smithy/generators/client/FluentClientGenerator.kt
Show resolved
Hide resolved
Velfi
approved these changes
Apr 19, 2023
A new generated diff is ready to view.
A new doc preview is ready to view. |
This commit addresses #2589 (comment)
This commit addresses #2589 (review). Thanks @Velfi!
This commit addresses #2589 (comment)
A new generated diff is ready to view.
A new doc preview is ready to view. |
unexge
pushed a commit
that referenced
this pull request
Apr 24, 2023
## Motivation and Context This PR adds skeleton code for supporting operation level config behind `enableNewSmithyRuntime`. ## Description The approach is described in #2527, where fluent builders now have a new method, `config_override`, that takes a service config builder. The builder implements the `RuntimePlugin` trait and once `TODO(RuntimePlugins)` is implemented, allows itself to put field values into a config bag within `send_v2`. ## Testing Added a line of code to an ignored test in `sra_test`, which, however, does check compilation. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: Yuki Saito <awsaito@amazon.com> Co-authored-by: John DiSanti <jdisanti@amazon.com>
rcoh
pushed a commit
that referenced
this pull request
Apr 24, 2023
## Motivation and Context This PR adds skeleton code for supporting operation level config behind `enableNewSmithyRuntime`. ## Description The approach is described in #2527, where fluent builders now have a new method, `config_override`, that takes a service config builder. The builder implements the `RuntimePlugin` trait and once `TODO(RuntimePlugins)` is implemented, allows itself to put field values into a config bag within `send_v2`. ## Testing Added a line of code to an ignored test in `sra_test`, which, however, does check compilation. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: Yuki Saito <awsaito@amazon.com> Co-authored-by: John DiSanti <jdisanti@amazon.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jul 1, 2023
…ion (#2814) ## Motivation and Context Implements the actual meat of `config_override` introduced [as a skeleton in the past](#2589). ## Description This PR enables operation-level config via `config_override` on a customizable operation (see [config-override.rs](https://github.com/awslabs/smithy-rs/blob/8105dd46b43854e7909aed82c85223414bc85df5/aws/sdk/integration-tests/s3/tests/config-override.rs) integration tests for example code snippets). The way it's implemented is through `ConfigOverrideRuntimePlugin`. The plugin holds onto two things: a `Builder` passed to `config_override` and a `FrozenLayer` derived from a service config (the latter is primarily for retrieving default values understood by a service config). The plugin then implements the `RuntimePlugin` trait to generate its own `FrozenLayer` that contains operation-level orchestrator components. That `FrozenLayer` 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](https://github.com/awslabs/smithy-rs/blob/8105dd46b43854e7909aed82c85223414bc85df5/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationGenerator.kt#L65-L71)). A couple of things to note: - The size of `ConfigOverrideRuntimePlugin::config` code-generated is getting large. Maybe each customization defines a helper function instead of inlining logic directly in `config` and we let the `config` method call those generated helpers. - The PR does not handle a case where `retry_partition` within `config_override` since it's currently `#[doc(hidden)]`, e.g. ``` client .some_operation() .customize() .await .unwrap() .config_override(Config::builder().retry_partition(/* ... */)) ... ``` ## Testing - Added tests in Kotlin [ConfigOverrideRuntimePluginGeneratorTest.kt](https://github.com/awslabs/smithy-rs/pull/2814/files#diff-04a76a43c2adb3a2ee37443157c68ec6dad77fab2484722b370a7ba14cf02086) and [CredentialCacheConfigTest.kt](https://github.com/awslabs/smithy-rs/pull/2814/files#diff-32246072688cd11391fa10cd9cb38a80ed88b587e95037225dbe9f1a482ebc5d). ~~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 of `config_override`.~~ - Added integration tests [config-override.rs](https://github.com/awslabs/smithy-rs/pull/2814/files#diff-6fd7a1e70b1c3fa3e9c747925f3fc7a6ce0f7b801bd6bc46c54eec44150f5158) ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: Yuki Saito <awsaito@amazon.com>
aws-sdk-rust-ci
pushed a commit
to awslabs/aws-sdk-rust
that referenced
this pull request
Aug 3, 2023
…l configuration (#2814) ## Motivation and Context Implements the actual meat of `config_override` introduced [as a skeleton in the past](smithy-lang/smithy-rs#2589). ## Description This PR enables operation-level config via `config_override` on a customizable operation (see [config-override.rs](https://github.com/awslabs/smithy-rs/blob/8105dd46b43854e7909aed82c85223414bc85df5/aws/sdk/integration-tests/s3/tests/config-override.rs) integration tests for example code snippets). The way it's implemented is through `ConfigOverrideRuntimePlugin`. The plugin holds onto two things: a `Builder` passed to `config_override` and a `FrozenLayer` derived from a service config (the latter is primarily for retrieving default values understood by a service config). The plugin then implements the `RuntimePlugin` trait to generate its own `FrozenLayer` that contains operation-level orchestrator components. That `FrozenLayer` 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](https://github.com/awslabs/smithy-rs/blob/8105dd46b43854e7909aed82c85223414bc85df5/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationGenerator.kt#L65-L71)). A couple of things to note: - The size of `ConfigOverrideRuntimePlugin::config` code-generated is getting large. Maybe each customization defines a helper function instead of inlining logic directly in `config` and we let the `config` method call those generated helpers. - The PR does not handle a case where `retry_partition` within `config_override` since it's currently `#[doc(hidden)]`, e.g. ``` client .some_operation() .customize() .await .unwrap() .config_override(Config::builder().retry_partition(/* ... */)) ... ``` ## Testing - Added tests in Kotlin [ConfigOverrideRuntimePluginGeneratorTest.kt](https://github.com/awslabs/smithy-rs/pull/2814/files#diff-04a76a43c2adb3a2ee37443157c68ec6dad77fab2484722b370a7ba14cf02086) and [CredentialCacheConfigTest.kt](https://github.com/awslabs/smithy-rs/pull/2814/files#diff-32246072688cd11391fa10cd9cb38a80ed88b587e95037225dbe9f1a482ebc5d). ~~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 of `config_override`.~~ - Added integration tests [config-override.rs](https://github.com/awslabs/smithy-rs/pull/2814/files#diff-6fd7a1e70b1c3fa3e9c747925f3fc7a6ce0f7b801bd6bc46c54eec44150f5158) ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: Yuki Saito <awsaito@amazon.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This PR adds skeleton code for supporting operation level config behind
enableNewSmithyRuntime
.Description
The approach is described in #2527, where fluent builders now have a new method,
config_override
, that takes a service config builder. The builder implements theRuntimePlugin
trait and onceTODO(RuntimePlugins)
is implemented, allows itself to put field values into a config bag withinsend_v2
.Testing
Added a line of code to an ignored test in
sra_test
, which, however, does check compilation.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.