diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointDelegator.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointDelegator.kt index cac97608f..5d2eca98f 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointDelegator.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointDelegator.kt @@ -33,7 +33,7 @@ interface EndpointDelegator { val defaultProviderSymbol = DefaultEndpointProviderGenerator.getSymbol(ctx.settings) ctx.delegator.useFileWriter(providerSymbol) { - EndpointProviderGenerator(it, providerSymbol, paramsSymbol).render() + EndpointProviderGenerator(it, ctx.settings, providerSymbol, paramsSymbol).render() } if (rules != null) { @@ -49,7 +49,7 @@ interface EndpointDelegator { fun generateEndpointParameters(ctx: ProtocolGenerator.GenerationContext, rules: EndpointRuleSet?) { val paramsSymbol = EndpointParametersGenerator.getSymbol(ctx.settings) ctx.delegator.useFileWriter(paramsSymbol) { - EndpointParametersGenerator(it, rules, paramsSymbol).render() + EndpointParametersGenerator(it, ctx.settings, rules, paramsSymbol).render() } } diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointParametersGenerator.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointParametersGenerator.kt index 34d08ab67..266b695ef 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointParametersGenerator.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointParametersGenerator.kt @@ -22,6 +22,7 @@ private const val DEFAULT_DEPRECATED_MESSAGE = */ class EndpointParametersGenerator( private val writer: KotlinWriter, + private val settings: KotlinSettings, rules: EndpointRuleSet?, private val paramsSymbol: Symbol, ) { @@ -51,7 +52,10 @@ class EndpointParametersGenerator( fun render() { renderDocumentation() // FIXME - this should probably be an interface - writer.withBlock("public class #T private constructor(builder: Builder) {", "}", paramsSymbol) { + writer.withBlock("#L class #T private constructor(builder: Builder) {", "}", + settings.build.visibility.structure, + paramsSymbol + ) { renderFields() renderCompanionObject() write("") diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointProviderGenerator.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointProviderGenerator.kt index c1cc9633c..0415352dd 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointProviderGenerator.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointProviderGenerator.kt @@ -18,6 +18,7 @@ import software.amazon.smithy.kotlin.codegen.model.buildSymbol */ class EndpointProviderGenerator( private val writer: KotlinWriter, + private val settings: KotlinSettings, private val providerSymbol: Symbol, private val paramsSymbol: Symbol, ) { @@ -33,7 +34,8 @@ class EndpointProviderGenerator( fun render() { renderDocumentation() writer.write( - "public fun interface #T: #T<#T>", + "#L fun interface #T: #T<#T>", + settings.build.visibility.structure, providerSymbol, RuntimeTypes.SmithyClient.Endpoints.EndpointProvider, paramsSymbol, diff --git a/codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointParametersGeneratorTest.kt b/codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointParametersGeneratorTest.kt index 476c7c5c8..db585ec37 100644 --- a/codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointParametersGeneratorTest.kt +++ b/codegen/smithy-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/rendering/endpoints/EndpointParametersGeneratorTest.kt @@ -4,6 +4,7 @@ */ package software.amazon.smithy.kotlin.codegen.rendering.endpoints +import software.amazon.smithy.kotlin.codegen.KotlinSettings import software.amazon.smithy.kotlin.codegen.core.KotlinWriter import software.amazon.smithy.kotlin.codegen.model.buildSymbol import software.amazon.smithy.kotlin.codegen.test.TestModelDefault @@ -11,6 +12,7 @@ import software.amazon.smithy.kotlin.codegen.test.assertBalancedBracesAndParens import software.amazon.smithy.kotlin.codegen.test.formatForTest import software.amazon.smithy.kotlin.codegen.test.shouldContainOnlyOnceWithDiff import software.amazon.smithy.model.node.Node +import software.amazon.smithy.model.shapes.ShapeId import software.amazon.smithy.rulesengine.language.EndpointRuleSet import kotlin.test.* @@ -83,7 +85,12 @@ class EndpointParametersGeneratorTest { name = "EndpointParameters" namespace = TestModelDefault.NAMESPACE } - EndpointParametersGenerator(writer, rules, paramsSymbol).render() + val settings = KotlinSettings( + service = ShapeId.from("com.test#Test"), + pkg = KotlinSettings.PackageSettings("name", "version"), + sdkId = "testSdkId", + ) + EndpointParametersGenerator(writer, settings, rules, paramsSymbol).render() generatedClass = writer.toString() }