Remove hybrid runtime modes (#2870)

This PR removes the `both_default_middleware` and
`both_default_orchestrator` runtime modes since they no longer compile,
and there's no easy way to fix them with the divergences between the two
in service config.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
This commit is contained in:
John DiSanti 2023-07-25 12:59:20 -07:00 committed by GitHub
parent 2922f561b0
commit 5d0887034e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 155 additions and 264 deletions

View File

@ -104,7 +104,7 @@ class AwsFluentClientDecorator : ClientCodegenDecorator {
baseGenerator.operationShape,
renderClientCreation = { params ->
rust("let mut ${params.configBuilderName} = ${params.configBuilderName};")
if (codegenContext.smithyRuntimeMode.defaultToOrchestrator) {
if (codegenContext.smithyRuntimeMode.generateOrchestrator) {
// TODO(enableNewSmithyRuntimeLaunch): A builder field could not be accessed directly in the orchestrator
// mode when this code change was made. smithy-rs#2792 will enable us to use getters in builders.
// Make this `set_region` conditional by checking if `config_builder.region().is_none()` once the PR

View File

@ -286,13 +286,13 @@ class AwsPresignedFluentBuilderMethod(
""",
*codegenScope,
"OpError" to section.operationErrorType,
"RawResponseType" to if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
"RawResponseType" to if (codegenContext.smithyRuntimeMode.generateMiddleware) {
RuntimeType.smithyHttp(runtimeConfig).resolve("operation::Response")
} else {
RuntimeType.smithyRuntimeApi(runtimeConfig).resolve("client::orchestrator::HttpResponse")
},
) {
if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
if (codegenContext.smithyRuntimeMode.generateMiddleware) {
renderPresignedMethodBodyMiddleware()
} else {
renderPresignedMethodBody(section)

View File

@ -66,7 +66,7 @@ class CredentialCacheConfig(codegenContext: ClientCodegenContext) : ConfigCustom
override fun section(section: ServiceConfig) = writable {
when (section) {
ServiceConfig.ConfigStruct -> {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate(
"""pub(crate) credentials_cache: #{SharedCredentialsCache},""",
*codegenScope,
@ -75,7 +75,7 @@ class CredentialCacheConfig(codegenContext: ClientCodegenContext) : ConfigCustom
}
ServiceConfig.ConfigImpl -> {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Returns the credentials cache.
@ -99,7 +99,7 @@ class CredentialCacheConfig(codegenContext: ClientCodegenContext) : ConfigCustom
}
ServiceConfig.BuilderStruct ->
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("credentials_cache: #{Option}<#{CredentialsCache}>,", *codegenScope)
}
@ -116,7 +116,7 @@ class CredentialCacheConfig(codegenContext: ClientCodegenContext) : ConfigCustom
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Sets the credentials cache for this service
@ -142,7 +142,7 @@ class CredentialCacheConfig(codegenContext: ClientCodegenContext) : ConfigCustom
}
ServiceConfig.BuilderBuild -> {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
if let Some(credentials_provider) = layer.load::<#{SharedCredentialsProvider}>().cloned() {

View File

@ -80,7 +80,7 @@ class CredentialProviderConfig(codegenContext: ClientCodegenContext) : ConfigCus
override fun section(section: ServiceConfig) = writable {
when (section) {
ServiceConfig.BuilderStruct -> {
if (smithyRuntimeMode.defaultToMiddleware) {
if (smithyRuntimeMode.generateMiddleware) {
rustTemplate("credentials_provider: #{Option}<#{SharedCredentialsProvider}>,", *codegenScope)
}
}
@ -96,7 +96,7 @@ class CredentialProviderConfig(codegenContext: ClientCodegenContext) : ConfigCus
*codegenScope,
)
if (smithyRuntimeMode.defaultToOrchestrator) {
if (smithyRuntimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Sets the credentials provider for this service

View File

@ -141,7 +141,7 @@ fun decoratorForBuiltIn(
override fun loadBuiltInFromServiceConfig(parameter: Parameter, configRef: String): Writable? =
when (parameter.builtIn) {
builtIn.builtIn -> writable {
if (codegenContext.smithyRuntimeMode.defaultToOrchestrator) {
if (codegenContext.smithyRuntimeMode.generateOrchestrator) {
val newtype = configParamNewtype(parameter, name, codegenContext.runtimeConfig)
val symbol = parameter.symbol().mapRustType { t -> t.stripOuter<RustType.Option>() }
rustTemplate(
@ -151,7 +151,7 @@ fun decoratorForBuiltIn(
} else {
rust("$configRef.$name")
}
if (codegenContext.smithyRuntimeMode.defaultToMiddleware && parameter.type == ParameterType.STRING) {
if (codegenContext.smithyRuntimeMode.generateMiddleware && parameter.type == ParameterType.STRING) {
rust(".clone()")
}
}

View File

@ -26,7 +26,7 @@ class HttpConnectorDecorator : ClientCodegenDecorator {
codegenContext: ClientCodegenContext,
baseCustomizations: List<ConfigCustomization>,
): List<ConfigCustomization> =
baseCustomizations.letIf(codegenContext.smithyRuntimeMode.exclusivelyGenerateMiddleware) {
baseCustomizations.letIf(codegenContext.smithyRuntimeMode.generateMiddleware) {
it + HttpConnectorConfigCustomization(codegenContext)
}
}
@ -45,12 +45,12 @@ class HttpConnectorConfigCustomization(
override fun section(section: ServiceConfig): Writable {
return when (section) {
is ServiceConfig.ConfigStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("http_connector: Option<#{HttpConnector}>,", *codegenScope)
}
}
is ServiceConfig.ConfigImpl -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Return an [`HttpConnector`](#{HttpConnector}) to use when making requests, if any.
@ -73,7 +73,7 @@ class HttpConnectorConfigCustomization(
}
}
is ServiceConfig.BuilderStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("http_connector: Option<#{HttpConnector}>,", *codegenScope)
}
}
@ -157,7 +157,7 @@ class HttpConnectorConfigCustomization(
""",
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
pub fn set_http_connector(&mut self, http_connector: #{Option}<impl #{Into}<#{HttpConnector}>>) -> &mut Self {
@ -180,7 +180,7 @@ class HttpConnectorConfigCustomization(
}
}
is ServiceConfig.BuilderBuild -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rust("http_connector: self.http_connector,")
}
}

View File

@ -131,7 +131,7 @@ class RegionDecorator : ClientCodegenDecorator {
override fun loadBuiltInFromServiceConfig(parameter: Parameter, configRef: String): Writable? {
return when (parameter.builtIn) {
Builtins.REGION.builtIn -> writable {
if (codegenContext.smithyRuntimeMode.defaultToOrchestrator) {
if (codegenContext.smithyRuntimeMode.generateOrchestrator) {
rustTemplate(
"$configRef.load::<#{Region}>().map(|r|r.as_ref().to_owned())",
"Region" to region(codegenContext.runtimeConfig).resolve("Region"),
@ -171,12 +171,12 @@ class RegionProviderConfig(codegenContext: ClientCodegenContext) : ConfigCustomi
override fun section(section: ServiceConfig) = writable {
when (section) {
ServiceConfig.ConfigStruct -> {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("pub(crate) region: #{Option}<#{Region}>,", *codegenScope)
}
}
ServiceConfig.ConfigImpl -> {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Returns the AWS region, if it was provided.
@ -200,7 +200,7 @@ class RegionProviderConfig(codegenContext: ClientCodegenContext) : ConfigCustomi
}
ServiceConfig.BuilderStruct -> {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("pub(crate) region: #{Option}<#{Region}>,", *codegenScope)
}
}
@ -227,7 +227,7 @@ class RegionProviderConfig(codegenContext: ClientCodegenContext) : ConfigCustomi
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Sets the AWS region to use when making requests.
@ -253,7 +253,7 @@ class RegionProviderConfig(codegenContext: ClientCodegenContext) : ConfigCustomi
}
ServiceConfig.BuilderBuild -> {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rust("region: self.region,")
}
}

View File

@ -110,7 +110,7 @@ class SigV4SigningConfig(
)
}
ServiceConfig.BuilderBuild -> {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
layer.store_put(#{SigningService}::from_static(${sigV4Trait.name.dq()}));

View File

@ -154,7 +154,7 @@ class UserAgentDecorator : ClientCodegenDecorator {
override fun section(section: ServiceConfig): Writable =
when (section) {
is ServiceConfig.BuilderStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("app_name: #{Option}<#{AppName}>,", *codegenScope)
}
}
@ -174,7 +174,7 @@ class UserAgentDecorator : ClientCodegenDecorator {
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Sets the name of the app that is using the client.
@ -206,7 +206,7 @@ class UserAgentDecorator : ClientCodegenDecorator {
}
is ServiceConfig.BuilderBuild -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rust("layer.store_put(#T.clone());", ClientRustModule.Meta.toType().resolve("API_METADATA"))
} else {
rust("app_name: self.app_name,")
@ -214,13 +214,13 @@ class UserAgentDecorator : ClientCodegenDecorator {
}
is ServiceConfig.ConfigStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("app_name: #{Option}<#{AppName}>,", *codegenScope)
}
}
is ServiceConfig.ConfigImpl -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Returns the name of the app that is using the client, if it was provided.

View File

@ -39,7 +39,7 @@ class DisabledAuthDecorator() : ClientCodegenDecorator {
val optionalOperations = optionalAuth[service.id]!!
return ModelTransformer.create().mapShapes(model) {
if (optionalOperations.contains(it.id) && it is OperationShape) {
if (settings.codegenConfig.enableNewSmithyRuntime.defaultToOrchestrator) {
if (settings.codegenConfig.enableNewSmithyRuntime.generateOrchestrator) {
it.toBuilder().addTrait(OptionalAuthTrait()).build()
} else {
// In middleware, having an empty @auth trait completely disabled

View File

@ -33,7 +33,7 @@ class TimestreamDecorator : ClientCodegenDecorator {
override val order: Byte = -1
private fun applies(codegenContext: ClientCodegenContext): Boolean =
codegenContext.smithyRuntimeMode.defaultToOrchestrator
codegenContext.smithyRuntimeMode.generateOrchestrator
override fun extraSections(codegenContext: ClientCodegenContext): List<AdHocCustomization> =
emptyList<AdHocCustomization>().letIf(applies(codegenContext)) {

View File

@ -50,7 +50,7 @@ class SdkCodegenIntegrationTest {
fun smokeTestSdkCodegen() {
awsSdkIntegrationTest(
model,
defaultToOrchestrator = true,
generateOrchestrator = true,
) { _, _ -> /* it should compile */ }
}
@ -58,7 +58,7 @@ class SdkCodegenIntegrationTest {
fun smokeTestSdkCodegenMiddleware() {
awsSdkIntegrationTest(
model,
defaultToOrchestrator = false,
generateOrchestrator = false,
) { _, _ -> /* it should compile */ }
}
}

View File

@ -48,7 +48,7 @@ internal class CredentialCacheConfigTest {
@Test
fun `config override for credentials`() {
awsSdkIntegrationTest(model, defaultToOrchestrator = true) { clientCodegenContext, rustCrate ->
awsSdkIntegrationTest(model, generateOrchestrator = true) { clientCodegenContext, rustCrate ->
val runtimeConfig = clientCodegenContext.runtimeConfig
val codegenScope = arrayOf(
*RuntimeType.preludeScope,

View File

@ -37,10 +37,10 @@ fun awsTestCodegenContext(model: Model? = null, settings: ClientRustSettings? =
settings = settings ?: testClientRustSettings(runtimeConfig = AwsTestRuntimeConfig),
)
// TODO(enableNewSmithyRuntimeCleanup): Remove defaultToOrchestrator once the runtime switches to the orchestrator
// TODO(enableNewSmithyRuntimeCleanup): Remove generateOrchestrator once the runtime switches to the orchestrator
fun awsSdkIntegrationTest(
model: Model,
defaultToOrchestrator: Boolean = true,
generateOrchestrator: Boolean = true,
test: (ClientCodegenContext, RustCrate) -> Unit = { _, _ -> },
) =
clientIntegrationTest(
@ -62,7 +62,7 @@ fun awsSdkIntegrationTest(
"codegen",
ObjectNode.builder()
.withMember("includeFluentClient", false)
.letIf(defaultToOrchestrator) {
.letIf(generateOrchestrator) {
it.withMember("enableNewSmithyRuntime", StringNode.from("orchestrator"))
}
.build(),

View File

@ -65,8 +65,8 @@ val allCodegenTests = servicesToGenerate.map {
,
"codegen": {
"includeFluentClient": false,
${ ""/* "enableNewSmithyRuntime": "both_default_middleware" */ }
"enableNewSmithyRuntime": "orchestrator"
"enableNewSmithyRuntime": "orchestrator",
"includeEndpointUrlConfig": false
},
"customizationConfig": {
"awsSdk": {

View File

@ -18,8 +18,8 @@ aws-types = { path = "../../../rust-runtime/aws-types" }
criterion = { version = "0.4", features = ["async_tokio"] }
http = "0.2.3"
http-body = "0.4.5"
last-release-smithy-client = { version = "0.55", package = "aws-smithy-client", features = ["test-util", "rustls"] }
last-release-s3 = { version = "0.26", package = "aws-sdk-s3", features = ["test-util"] }
last-release-smithy-client = { version = "0.55.3", package = "aws-smithy-client", features = ["test-util", "rustls"] }
last-release-s3 = { version = "0.28", package = "aws-sdk-s3", features = ["test-util"] }
tokio = { version = "1.23.1", features = ["macros", "test-util", "rt-multi-thread"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.15", features = ["env-filter", "json"] }

View File

@ -6,9 +6,6 @@
#[macro_use]
extern crate criterion;
use aws_sdk_s3 as s3;
use aws_smithy_runtime_api::client::interceptors::InterceptorRegistrar;
use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
use aws_smithy_types::config_bag::ConfigBag;
use criterion::{BenchmarkId, Criterion};
macro_rules! test_connection {
@ -92,7 +89,7 @@ async fn orchestrator(client: &s3::Client) {
.list_objects_v2()
.bucket("test-bucket")
.prefix("prefix~")
.send_orchestrator()
.send()
.await
.expect("successful execution");
}

View File

@ -1,45 +0,0 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
mod util;
use aws_sdk_s3::config::{Credentials, Region};
use aws_sdk_s3::Client;
use aws_smithy_client::dvr;
use aws_smithy_client::dvr::MediaType;
use aws_smithy_client::erase::DynConnector;
use std::time::{Duration, UNIX_EPOCH};
const LIST_BUCKETS_PATH: &str = "test-data/list-objects-v2.json";
#[tokio::test]
async fn sra_test() {
tracing_subscriber::fmt::init();
let conn = dvr::ReplayingConnection::from_file(LIST_BUCKETS_PATH).unwrap();
let config = aws_sdk_s3::Config::builder()
.credentials_provider(Credentials::for_tests())
.region(Region::new("us-east-1"))
.http_connector(DynConnector::new(conn.clone()))
.interceptor(util::TestUserAgentInterceptor)
.build();
let client = Client::from_conf(config);
let fixup = util::FixupPlugin;
let resp = dbg!(
client
.list_objects_v2()
.bucket("test-bucket")
.prefix("prefix~")
.send_orchestrator_with_plugin(Some(fixup))
.await
);
// To regenerate the test:
// conn.dump_to_file("test-data/list-objects-v2.json").unwrap();
let resp = resp.expect("valid e2e test");
assert_eq!(resp.name(), Some("test-bucket"));
conn.full_validate(MediaType::Xml).await.expect("success")
}

View File

@ -78,7 +78,7 @@ object ClientRustModule {
val Endpoint = RustModule.public("endpoint")
// TODO(enableNewSmithyRuntimeCleanup): Just use Config.endpoint directly and delete this function
fun endpoint(codegenContext: ClientCodegenContext): RustModule.LeafModule = if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
fun endpoint(codegenContext: ClientCodegenContext): RustModule.LeafModule = if (codegenContext.smithyRuntimeMode.generateMiddleware) {
Endpoint
} else {
Config.endpoint

View File

@ -74,36 +74,16 @@ data class ClientRustSettings(
// TODO(enableNewSmithyRuntimeCleanup): Remove this mode after switching to the orchestrator
enum class SmithyRuntimeMode {
Middleware, BothDefaultMiddleware, BothDefaultOrchestrator, Orchestrator,
Middleware, Orchestrator,
;
val exclusivelyGenerateMiddleware: Boolean get() = generateMiddleware && !generateOrchestrator
val generateMiddleware: Boolean
get() = when (this) {
Middleware, BothDefaultMiddleware, BothDefaultOrchestrator -> true
else -> false
}
val generateOrchestrator: Boolean
get() = when (this) {
Orchestrator, BothDefaultMiddleware, BothDefaultOrchestrator -> true
else -> false
}
val defaultToMiddleware: Boolean
get() = when (this) {
Middleware, BothDefaultMiddleware -> true
else -> false
}
val defaultToOrchestrator: Boolean get() = !defaultToMiddleware
val generateMiddleware: Boolean get() = this == Middleware
val generateOrchestrator: Boolean get() = this == Orchestrator
companion object {
fun fromString(value: String): SmithyRuntimeMode = when (value) {
"middleware" -> Middleware
"orchestrator" -> Orchestrator
"both_default_middleware" -> BothDefaultMiddleware
"both_default_orchestrator" -> BothDefaultOrchestrator
else -> throw IllegalArgumentException("unknown runtime mode: $value")
}
}
@ -123,7 +103,7 @@ data class ClientCodegenConfig(
val addMessageToErrors: Boolean = defaultAddMessageToErrors,
// TODO(EventStream): [CLEANUP] Remove this property when turning on Event Stream for all services
val eventStreamAllowList: Set<String> = defaultEventStreamAllowList,
// TODO(SmithyRuntime): Remove this once we commit to switch to aws-smithy-runtime and aws-smithy-runtime-api
// TODO(enableNewSmithyRuntimeCleanup): Remove this once we commit to switch to aws-smithy-runtime and aws-smithy-runtime-api
val enableNewSmithyRuntime: SmithyRuntimeMode = defaultEnableNewSmithyRuntime,
/** If true, adds `endpoint_url`/`set_endpoint_url` methods to the service config */
val includeEndpointUrlConfig: Boolean = defaultIncludeEndpointUrlConfig,

View File

@ -189,19 +189,19 @@ private class ApiKeyConfigCustomization(codegenContext: ClientCodegenContext) :
)
}
is ServiceConfig.BuilderBuild -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rust("layer.store_or_unset(self.api_key);")
} else {
rust("api_key: self.api_key,")
}
}
is ServiceConfig.ConfigStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("api_key: #{Option}<#{ApiKey}>,", *codegenScope)
}
}
is ServiceConfig.ConfigImpl -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Returns API key used by the client, if it was provided.

View File

@ -115,13 +115,13 @@ private class HttpConnectorConfigCustomization(
override fun section(section: ServiceConfig): Writable {
return when (section) {
is ServiceConfig.ConfigStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("http_connector: Option<#{HttpConnector}>,", *codegenScope)
}
}
is ServiceConfig.ConfigImpl -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Return the [`SharedHttpConnector`](#{SharedHttpConnector}) to use when making requests, if any.
@ -145,7 +145,7 @@ private class HttpConnectorConfigCustomization(
}
is ServiceConfig.BuilderStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("http_connector: Option<#{HttpConnector}>,", *codegenScope)
}
}
@ -229,7 +229,7 @@ private class HttpConnectorConfigCustomization(
""",
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
pub fn set_http_connector(&mut self, http_connector: Option<impl Into<#{HttpConnector}>>) -> &mut Self {
@ -253,7 +253,7 @@ private class HttpConnectorConfigCustomization(
}
is ServiceConfig.BuilderBuild -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"#{set_connector}(&mut resolver);",
"set_connector" to setConnectorFn(),
@ -264,7 +264,7 @@ private class HttpConnectorConfigCustomization(
}
is ServiceConfig.OperationConfigOverride -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"#{set_connector}(&mut resolver);",
"set_connector" to setConnectorFn(),

View File

@ -51,7 +51,7 @@ class ResiliencyConfigCustomization(private val codegenContext: ClientCodegenCon
writable {
when (section) {
is ServiceConfig.ConfigStruct -> {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate(
"""
retry_config: #{Option}<#{RetryConfig}>,
@ -64,7 +64,7 @@ class ResiliencyConfigCustomization(private val codegenContext: ClientCodegenCon
}
is ServiceConfig.ConfigImpl -> {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Return a reference to the retry configuration contained in this config, if any.
@ -117,7 +117,7 @@ class ResiliencyConfigCustomization(private val codegenContext: ClientCodegenCon
}
is ServiceConfig.BuilderStruct -> {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate(
"""
retry_config: #{Option}<#{RetryConfig}>,
@ -167,7 +167,7 @@ class ResiliencyConfigCustomization(private val codegenContext: ClientCodegenCon
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
pub fn set_retry_config(&mut self, retry_config: #{Option}<#{RetryConfig}>) -> &mut Self {
@ -245,7 +245,7 @@ class ResiliencyConfigCustomization(private val codegenContext: ClientCodegenCon
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
pub fn set_sleep_impl(&mut self, sleep_impl: #{Option}<#{SharedAsyncSleep}>) -> &mut Self {
@ -313,7 +313,7 @@ class ResiliencyConfigCustomization(private val codegenContext: ClientCodegenCon
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
pub fn set_timeout_config(&mut self, timeout_config: #{Option}<#{TimeoutConfig}>) -> &mut Self {
@ -335,7 +335,7 @@ class ResiliencyConfigCustomization(private val codegenContext: ClientCodegenCon
)
}
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
Attribute.DocHidden.render(this)
rustTemplate(
"""
@ -367,7 +367,7 @@ class ResiliencyConfigCustomization(private val codegenContext: ClientCodegenCon
}
is ServiceConfig.BuilderBuild -> {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
let retry_partition = layer.load::<#{RetryPartition}>().cloned().unwrap_or_else(|| #{RetryPartition}::new("${codegenContext.serviceShape.sdkId()}"));

View File

@ -29,7 +29,7 @@ class TimeSourceCustomization(codegenContext: ClientCodegenContext) : ConfigCust
writable {
when (section) {
is ServiceConfig.ConfigStruct -> {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate(
"""
pub(crate) time_source: #{SharedTimeSource},
@ -45,7 +45,7 @@ class TimeSourceCustomization(codegenContext: ClientCodegenContext) : ConfigCust
"pub fn time_source(&self) -> #{Option}<#{SharedTimeSource}>",
*codegenScope,
) {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""self.runtime_components.time_source()""",
*codegenScope,
@ -57,7 +57,7 @@ class TimeSourceCustomization(codegenContext: ClientCodegenContext) : ConfigCust
}
is ServiceConfig.BuilderStruct -> {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate(
"time_source: #{Option}<#{SharedTimeSource}>,",
*codegenScope,
@ -80,7 +80,7 @@ class TimeSourceCustomization(codegenContext: ClientCodegenContext) : ConfigCust
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Sets the time source used for this service
@ -112,7 +112,7 @@ class TimeSourceCustomization(codegenContext: ClientCodegenContext) : ConfigCust
}
ServiceConfig.BuilderBuild -> {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
if self.runtime_components.time_source().is_none() {

View File

@ -45,7 +45,7 @@ internal class EndpointConfigCustomization(
val resolverTrait = "#{SmithyResolver}<#{Params}>"
when (section) {
is ServiceConfig.ConfigStruct -> {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate(
"pub (crate) endpoint_resolver: $sharedEndpointResolver,",
*codegenScope,
@ -54,7 +54,7 @@ internal class EndpointConfigCustomization(
}
is ServiceConfig.ConfigImpl -> {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Returns the endpoint resolver.
@ -78,7 +78,7 @@ internal class EndpointConfigCustomization(
}
is ServiceConfig.BuilderStruct -> {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate(
"endpoint_resolver: #{Option}<$sharedEndpointResolver>,",
*codegenScope,
@ -181,7 +181,7 @@ internal class EndpointConfigCustomization(
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
pub fn set_endpoint_resolver(&mut self, endpoint_resolver: #{Option}<$sharedEndpointResolver>) -> &mut Self {
@ -205,7 +205,7 @@ internal class EndpointConfigCustomization(
}
ServiceConfig.BuilderBuild -> {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"#{set_endpoint_resolver}(&mut resolver);",
"set_endpoint_resolver" to setEndpointResolverFn(),
@ -224,7 +224,7 @@ internal class EndpointConfigCustomization(
}
is ServiceConfig.OperationConfigOverride -> {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"#{set_endpoint_resolver}(&mut resolver);",
"set_endpoint_resolver" to setEndpointResolverFn(),

View File

@ -106,7 +106,7 @@ class EndpointParamsInterceptorGenerator(
val builtInParams = params.toList().filter { it.isBuiltIn }
// first load builtins and their defaults
builtInParams.forEach { param ->
val config = if (codegenContext.smithyRuntimeMode.defaultToOrchestrator) {
val config = if (codegenContext.smithyRuntimeMode.generateOrchestrator) {
"cfg"
} else {
"_config"

View File

@ -204,14 +204,14 @@ class PaginatorGenerator private constructor(
"items_fn" to itemsFn(),
"output_token" to outputTokenLens,
"item_type" to writable {
if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
if (codegenContext.smithyRuntimeMode.generateMiddleware) {
rustTemplate("#{Result}<#{Output}, #{SdkError}<#{Error}>>", *codegenScope)
} else {
rustTemplate("#{Result}<#{Output}, #{SdkError}<#{Error}, #{HttpResponse}>>", *codegenScope)
}
},
"orchestrate" to writable {
if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
if (codegenContext.smithyRuntimeMode.generateMiddleware) {
rustTemplate(
"""
{
@ -237,7 +237,7 @@ class PaginatorGenerator private constructor(
}
},
"runtime_plugin_init" to writable {
if (codegenContext.smithyRuntimeMode.defaultToOrchestrator) {
if (codegenContext.smithyRuntimeMode.generateOrchestrator) {
rustTemplate(
"""
let runtime_plugins = #{operation}::operation_runtime_plugins(
@ -317,7 +317,7 @@ class PaginatorGenerator private constructor(
paginationInfo.itemsMemberPath,
),
"item_type" to writable {
if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
if (codegenContext.smithyRuntimeMode.generateMiddleware) {
rustTemplate("#{Result}<${itemType()}, #{SdkError}<#{Error}>>", *codegenScope)
} else {
rustTemplate("#{Result}<${itemType()}, #{SdkError}<#{Error}, #{HttpResponse}>>", *codegenScope)

View File

@ -374,7 +374,7 @@ fun renderCustomizableOperationSend(codegenContext: ClientCodegenContext, generi
""",
*codegenScope,
)
} else if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
} else if (codegenContext.smithyRuntimeMode.generateMiddleware) {
writer.rustTemplate(
"""
impl#{combined_generics_decl:W} CustomizableOperation#{combined_generics_decl:W}

View File

@ -347,7 +347,7 @@ class FluentClientGenerator(
}
""",
*preludeScope,
"RawResponseType" to if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
"RawResponseType" to if (codegenContext.smithyRuntimeMode.generateMiddleware) {
RuntimeType.smithyHttp(runtimeConfig).resolve("operation::Response")
} else {
RuntimeType.smithyRuntimeApi(runtimeConfig).resolve("client::orchestrator::HttpResponse")
@ -437,36 +437,7 @@ class FluentClientGenerator(
generics.toRustGenerics(),
),
)
rustTemplate(
"""
// This function will go away in the near future. Do not rely on it.
##[doc(hidden)]
pub async fn customize_middleware(self) -> #{Result}<
#{CustomizableOperation}#{customizable_op_type_params:W},
#{SdkError}<#{OperationError}>
> #{send_bounds:W} {
let handle = self.handle.clone();
let operation = self.inner.build().map_err(#{SdkError}::construction_failure)?
.make_operation(&handle.conf)
.await
.map_err(#{SdkError}::construction_failure)?;
#{Ok}(#{CustomizableOperation} { handle, operation })
}
// This function will go away in the near future. Do not rely on it.
##[doc(hidden)]
pub async fn send_middleware(self) -> #{Result}<#{OperationOutput}, #{SdkError}<#{OperationError}>>
#{send_bounds:W} {
let op = self.inner.build().map_err(#{SdkError}::construction_failure)?
.make_operation(&self.handle.conf)
.await
.map_err(#{SdkError}::construction_failure)?;
self.handle.client.call(op).await
}
""",
*middlewareScope,
)
if (smithyRuntimeMode.defaultToMiddleware) {
if (smithyRuntimeMode.generateMiddleware) {
rustTemplate(
"""
/// Sends the request and returns the response.
@ -479,7 +450,11 @@ class FluentClientGenerator(
/// set when configuring the client.
pub async fn send(self) -> #{Result}<#{OperationOutput}, #{SdkError}<#{OperationError}>>
#{send_bounds:W} {
self.send_middleware().await
let op = self.inner.build().map_err(#{SdkError}::construction_failure)?
.make_operation(&self.handle.conf)
.await
.map_err(#{SdkError}::construction_failure)?;
self.handle.client.call(op).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being
@ -488,7 +463,12 @@ class FluentClientGenerator(
#{CustomizableOperation}#{customizable_op_type_params:W},
#{SdkError}<#{OperationError}>
> #{send_bounds:W} {
self.customize_middleware().await
let handle = self.handle.clone();
let operation = self.inner.build().map_err(#{SdkError}::construction_failure)?
.make_operation(&handle.conf)
.await
.map_err(#{SdkError}::construction_failure)?;
#{Ok}(#{CustomizableOperation} { handle, operation })
}
""",
*middlewareScope,
@ -511,45 +491,7 @@ class FluentClientGenerator(
.resolve("internal::SendResult"),
"SdkError" to RuntimeType.sdkError(runtimeConfig),
)
rustTemplate(
"""
##[doc(hidden)]
pub async fn send_orchestrator(self) -> #{Result}<#{OperationOutput}, #{SdkError}<#{OperationError}, #{HttpResponse}>> {
let input = self.inner.build().map_err(#{SdkError}::construction_failure)?;
let runtime_plugins = #{Operation}::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
#{Operation}::orchestrate(&runtime_plugins, input).await
}
##[doc(hidden)]
// TODO(enableNewSmithyRuntimeCleanup): Remove `async` once we switch to orchestrator
pub async fn customize_orchestrator(
self,
) -> #{CustomizableOperation}<
#{OperationOutput},
#{OperationError},
>
{
#{CustomizableOperation} {
customizable_send: #{Box}::new(move |config_override| {
#{Box}::pin(async {
self.config_override(config_override)
.send_orchestrator()
.await
})
}),
config_override: None,
interceptors: vec![],
runtime_plugins: vec![],
}
}
""",
*orchestratorScope,
)
if (smithyRuntimeMode.defaultToOrchestrator) {
if (smithyRuntimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Sends the request and returns the response.
@ -561,7 +503,13 @@ class FluentClientGenerator(
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(self) -> #{Result}<#{OperationOutput}, #{SdkError}<#{OperationError}, #{HttpResponse}>> {
self.send_orchestrator().await
let input = self.inner.build().map_err(#{SdkError}::construction_failure)?;
let runtime_plugins = #{Operation}::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
#{Operation}::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being
@ -577,7 +525,18 @@ class FluentClientGenerator(
#{SdkError}<#{OperationError}>,
>
{
#{Ok}(self.customize_orchestrator().await)
#{Ok}(#{CustomizableOperation} {
customizable_send: #{Box}::new(move |config_override| {
#{Box}::pin(async {
self.config_override(config_override)
.send()
.await
})
}),
config_override: None,
interceptors: vec![],
runtime_plugins: vec![],
})
}
""",
*orchestratorScope,

View File

@ -29,13 +29,13 @@ class IdempotencyTokenProviderCustomization(codegenContext: ClientCodegenContext
override fun section(section: ServiceConfig): Writable {
return when (section) {
is ServiceConfig.ConfigStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("pub (crate) idempotency_token_provider: #{IdempotencyTokenProvider},", *codegenScope)
}
}
ServiceConfig.ConfigImpl -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Returns a copy of the idempotency token provider.
@ -63,7 +63,7 @@ class IdempotencyTokenProviderCustomization(codegenContext: ClientCodegenContext
}
ServiceConfig.BuilderStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rustTemplate("idempotency_token_provider: #{Option}<#{IdempotencyTokenProvider}>,", *codegenScope)
}
}
@ -80,7 +80,7 @@ class IdempotencyTokenProviderCustomization(codegenContext: ClientCodegenContext
*codegenScope,
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
/// Sets the idempotency token provider to use for service calls that require tokens.
@ -106,7 +106,7 @@ class IdempotencyTokenProviderCustomization(codegenContext: ClientCodegenContext
}
ServiceConfig.BuilderBuild -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
if !resolver.is_set::<#{IdempotencyTokenProvider}>() {

View File

@ -196,7 +196,7 @@ fun standardConfigParam(param: ConfigParam, codegenContext: ClientCodegenContext
override fun section(section: ServiceConfig): Writable {
return when (section) {
ServiceConfig.ConfigStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
docsOrFallback(param.getterDocs)
val t = when (param.optional) {
true -> param.type.makeOptional()
@ -207,7 +207,7 @@ fun standardConfigParam(param: ConfigParam, codegenContext: ClientCodegenContext
}
ServiceConfig.BuilderStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rust("${param.name}: #T,", param.type.makeOptional())
}
}
@ -224,7 +224,7 @@ fun standardConfigParam(param: ConfigParam, codegenContext: ClientCodegenContext
)
docsOrFallback(param.setterDocs)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
pub fn set_${param.name}(&mut self, ${param.name}: Option<#{T}>) -> &mut Self {
@ -249,7 +249,7 @@ fun standardConfigParam(param: ConfigParam, codegenContext: ClientCodegenContext
}
ServiceConfig.BuilderBuild -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
val default = "".letIf(!param.optional) { ".unwrap_or_default() " }
rust("${param.name}: self.${param.name}$default,")
}
@ -334,7 +334,7 @@ class ServiceConfigGenerator(
Attribute(Attribute.derive(RuntimeType.Debug)).render(writer)
}
writer.rustBlock("pub struct Config") {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
// Both `config` and `cloneable` are the same config, but the cloneable one
@ -353,7 +353,7 @@ class ServiceConfigGenerator(
}
}
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
// Custom implementation for Debug so we don't need to enforce Debug down the chain
writer.rustBlock("impl std::fmt::Debug for Config") {
writer.rustTemplate(
@ -374,7 +374,7 @@ class ServiceConfigGenerator(
pub fn builder() -> Builder { Builder::default() }
""",
)
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
writer.rustTemplate(
"""
/// Converts this config back into a builder so that it can be tweaked.
@ -394,13 +394,13 @@ class ServiceConfigGenerator(
}
writer.docs("Builder for creating a `Config`.")
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
Attribute(Attribute.derive(RuntimeType.Clone, RuntimeType.Default)).render(writer)
} else {
Attribute(Attribute.derive(RuntimeType.Clone, RuntimeType.Debug)).render(writer)
}
writer.rustBlock("pub struct Builder") {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
pub(crate) config: #{CloneableLayer},
@ -415,7 +415,7 @@ class ServiceConfigGenerator(
}
}
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
// Custom implementation for Debug so we don't need to enforce Debug down the chain
writer.rustBlock("impl std::fmt::Debug for Builder") {
writer.rustTemplate(
@ -498,7 +498,7 @@ class ServiceConfigGenerator(
}
docs("Builds a [`Config`].")
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rust("##[allow(unused_mut)]")
rustBlock("pub fn build(mut self) -> Config") {
rustTemplate(

View File

@ -70,7 +70,7 @@ class DefaultProtocolTestGenerator(
override val operationShape: OperationShape,
private val renderClientCreation: RustWriter.(ClientCreationParams) -> Unit = { params ->
if (params.codegenContext.smithyRuntimeMode.defaultToMiddleware) {
if (params.codegenContext.smithyRuntimeMode.generateMiddleware) {
rustTemplate(
"""
let smithy_client = #{Builder}::new()
@ -347,7 +347,7 @@ class DefaultProtocolTestGenerator(
""",
RT.sdkBody(runtimeConfig = rc),
)
if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
if (codegenContext.smithyRuntimeMode.generateMiddleware) {
rust(
"let mut op_response = #T::new(http_response);",
RT.operationModule(rc).resolve("Response"),
@ -397,7 +397,7 @@ class DefaultProtocolTestGenerator(
val errorSymbol = codegenContext.symbolProvider.symbolForOperationError(operationShape)
val errorVariant = codegenContext.symbolProvider.toSymbol(expectedShape).name
rust("""let parsed = parsed.expect_err("should be error response");""")
if (codegenContext.smithyRuntimeMode.defaultToOrchestrator) {
if (codegenContext.smithyRuntimeMode.generateOrchestrator) {
rustTemplate(
"""let parsed: &#{Error} = parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();""",
"Error" to codegenContext.symbolProvider.symbolForOperationError(operationShape),
@ -410,7 +410,7 @@ class DefaultProtocolTestGenerator(
rust("panic!(\"wrong variant: Got: {:?}. Expected: {:?}\", parsed, expected_output);")
}
} else {
if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
if (codegenContext.smithyRuntimeMode.generateMiddleware) {
rust("let parsed = parsed.unwrap();")
} else {
rustTemplate(

View File

@ -31,12 +31,12 @@ fun stubConfigCustomization(name: String, codegenContext: ClientCodegenContext):
override fun section(section: ServiceConfig): Writable = writable {
when (section) {
ServiceConfig.ConfigStruct -> {
if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
if (codegenContext.smithyRuntimeMode.generateMiddleware) {
rust("_$name: u64,")
}
}
ServiceConfig.ConfigImpl -> {
if (codegenContext.smithyRuntimeMode.defaultToOrchestrator) {
if (codegenContext.smithyRuntimeMode.generateOrchestrator) {
rustTemplate(
"""
##[allow(missing_docs)]
@ -61,12 +61,12 @@ fun stubConfigCustomization(name: String, codegenContext: ClientCodegenContext):
}
}
ServiceConfig.BuilderStruct -> {
if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
if (codegenContext.smithyRuntimeMode.generateMiddleware) {
rust("_$name: Option<u64>,")
}
}
ServiceConfig.BuilderImpl -> {
if (codegenContext.smithyRuntimeMode.defaultToOrchestrator) {
if (codegenContext.smithyRuntimeMode.generateOrchestrator) {
rustTemplate(
"""
/// docs!
@ -93,7 +93,7 @@ fun stubConfigCustomization(name: String, codegenContext: ClientCodegenContext):
}
}
ServiceConfig.BuilderBuild -> {
if (codegenContext.smithyRuntimeMode.defaultToMiddleware) {
if (codegenContext.smithyRuntimeMode.generateMiddleware) {
rust(
"""
_$name: self._$name.unwrap_or(123),

View File

@ -57,7 +57,7 @@ class HttpAuthDecoratorTest {
.build_dyn();
let client = $moduleName::Client::with_config(smithy_client, config);
let _ = client.some_operation()
.send_orchestrator()
.send()
.await
.expect("success");
connector.assert_requests_match(&[]);
@ -91,7 +91,7 @@ class HttpAuthDecoratorTest {
.build_dyn();
let client = $moduleName::Client::with_config(smithy_client, config);
let _ = client.some_operation()
.send_orchestrator()
.send()
.await
.expect("success");
connector.assert_requests_match(&[]);
@ -136,7 +136,7 @@ class HttpAuthDecoratorTest {
.build_dyn();
let client = $moduleName::Client::with_config(smithy_client, config);
let _ = client.some_operation()
.send_orchestrator()
.send()
.await
.expect("success");
connector.assert_requests_match(&[]);
@ -182,7 +182,7 @@ class HttpAuthDecoratorTest {
.build_dyn();
let client = $moduleName::Client::with_config(smithy_client, config);
let _ = client.some_operation()
.send_orchestrator()
.send()
.await
.expect("success");
connector.assert_requests_match(&[]);
@ -228,7 +228,7 @@ class HttpAuthDecoratorTest {
.build_dyn();
let client = $moduleName::Client::with_config(smithy_client, config);
let _ = client.some_operation()
.send_orchestrator()
.send()
.await
.expect("success");
connector.assert_requests_match(&[]);
@ -274,7 +274,7 @@ class HttpAuthDecoratorTest {
.build_dyn();
let client = $moduleName::Client::with_config(smithy_client, config);
let _ = client.some_operation()
.send_orchestrator()
.send()
.await
.expect("success");
connector.assert_requests_match(&[]);
@ -316,7 +316,7 @@ class HttpAuthDecoratorTest {
.build_dyn();
let client = $moduleName::Client::with_config(smithy_client, config);
let _ = client.some_operation()
.send_orchestrator()
.send()
.await
.expect("success");
connector.assert_requests_match(&[]);

View File

@ -41,7 +41,7 @@ class ClientContextConfigCustomizationTest {
val smithyRuntimeMode = SmithyRuntimeMode.fromString(smithyRuntimeModeStr)
val context = testClientCodegenContext(model).withSmithyRuntimeMode(smithyRuntimeMode)
project.unitTest {
if (smithyRuntimeMode.defaultToOrchestrator) {
if (smithyRuntimeMode.generateOrchestrator) {
rustTemplate(
"""
use #{RuntimePlugin};
@ -74,7 +74,7 @@ class ClientContextConfigCustomizationTest {
}
// unset fields
project.unitTest {
if (smithyRuntimeMode.defaultToOrchestrator) {
if (smithyRuntimeMode.generateOrchestrator) {
rustTemplate(
"""
use #{RuntimePlugin};

View File

@ -96,13 +96,13 @@ internal class ServiceConfigGeneratorTest {
return when (section) {
ServiceConfig.ConfigStructAdditionalDocs -> emptySection
ServiceConfig.ConfigStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rust("config_field: u64,")
}
}
ServiceConfig.ConfigImpl -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
##[allow(missing_docs)]
@ -128,12 +128,12 @@ internal class ServiceConfigGeneratorTest {
}
ServiceConfig.BuilderStruct -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rust("config_field: Option<u64>")
}
}
ServiceConfig.BuilderImpl -> writable {
if (runtimeMode.defaultToOrchestrator) {
if (runtimeMode.generateOrchestrator) {
rustTemplate(
"""
##[allow(missing_docs)]
@ -150,7 +150,7 @@ internal class ServiceConfigGeneratorTest {
}
}
ServiceConfig.BuilderBuild -> writable {
if (runtimeMode.defaultToMiddleware) {
if (runtimeMode.generateMiddleware) {
rust("config_field: self.config_field.unwrap_or_default(),")
}
}
@ -170,7 +170,7 @@ internal class ServiceConfigGeneratorTest {
val project = TestWorkspace.testProject(symbolProvider)
project.withModule(ClientRustModule.config) {
sut.render(this)
if (smithyRuntimeMode.defaultToOrchestrator) {
if (smithyRuntimeMode.generateOrchestrator) {
unitTest(
"set_config_fields",
"""