Unverified Commit 5d088703 authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

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._
parent 2922f561
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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)
+5 −5
Original line number Diff line number Diff line
@@ -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() {
+2 −2
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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()")
                            }
                        }
Loading