From 791e8d41072a2e086f16276ad50c68c7b4c6e056 Mon Sep 17 00:00:00 2001 From: John DiSanti Date: Mon, 7 Aug 2023 08:04:59 -0700 Subject: [PATCH] Re-export `RuntimeComponents` in generated clients (#2904) Re-export `RuntimeComponents`, and for generic clients, `RuntimeComponentsBuilder`, so that a direct dependency on `aws-smithy-runtime-api` isn't required to implement custom interceptors or runtime plugins. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --- CHANGELOG.next.toml | 14 +++++++++++++- .../ClientRuntimeTypesReExportGenerator.kt | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index fc4c4c2578..fac4ec6ebd 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -9,4 +9,16 @@ # message = "Fix typos in module documentation for generated crates" # references = ["smithy-rs#920"] # meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client | server | all"} -# author = "rcoh" \ No newline at end of file +# author = "rcoh" + +[[aws-sdk-rust]] +message = "`RuntimeComponents` are now re-exported so that implementing a custom interceptor doens't require directly depending on `aws-smithy-runtime-api`." +references = ["smithy-rs#2904", "aws-sdk-rust#862"] +meta = { "breaking" = false, "tada" = false, "bug" = false } +author = "jdisanti" + +[[smithy-rs]] +message = "`RuntimeComponents` and `RuntimeComponentsBuilder` are now re-exported in generated clients so that implementing a custom interceptor or runtime plugin doens't require directly depending on `aws-smithy-runtime-api`." +references = ["smithy-rs#2904"] +meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client"} +author = "jdisanti" diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientRuntimeTypesReExportGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientRuntimeTypesReExportGenerator.kt index 102400e511..df32d161fd 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientRuntimeTypesReExportGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/ClientRuntimeTypesReExportGenerator.kt @@ -28,10 +28,12 @@ class ClientRuntimeTypesReExportGenerator( """ pub use #{ConfigBag}; pub use #{Interceptor}; + pub use #{RuntimeComponents}; pub use #{SharedInterceptor}; """, "ConfigBag" to RuntimeType.configBag(rc), "Interceptor" to RuntimeType.interceptor(rc), + "RuntimeComponents" to RuntimeType.runtimeComponents(rc), "SharedInterceptor" to RuntimeType.sharedInterceptor(rc), ) @@ -40,9 +42,11 @@ class ClientRuntimeTypesReExportGenerator( """ pub use #{runtime_plugin}::{RuntimePlugin, SharedRuntimePlugin}; pub use #{config_bag}::FrozenLayer; + pub use #{RuntimeComponentsBuilder}; """, "runtime_plugin" to RuntimeType.smithyRuntimeApi(rc).resolve("client::runtime_plugin"), "config_bag" to RuntimeType.smithyTypes(rc).resolve("config_bag"), + "RuntimeComponentsBuilder" to RuntimeType.runtimeComponentsBuilder(rc), ) } }