@@ -3,8 +3,13 @@ package software.amazon.smithy.kotlin.codegen.rendering.smoketests
33import software.amazon.smithy.codegen.core.Symbol
44import software.amazon.smithy.kotlin.codegen.core.*
55import software.amazon.smithy.kotlin.codegen.integration.SectionId
6+ import software.amazon.smithy.kotlin.codegen.integration.SectionKey
67import software.amazon.smithy.kotlin.codegen.model.getTrait
78import software.amazon.smithy.kotlin.codegen.model.hasTrait
9+ import software.amazon.smithy.kotlin.codegen.rendering.endpoints.EndpointParametersGenerator
10+ import software.amazon.smithy.kotlin.codegen.rendering.endpoints.EndpointProviderGenerator
11+ import software.amazon.smithy.kotlin.codegen.rendering.smoketests.SmokeTestUriValue.EndpointParameters
12+ import software.amazon.smithy.kotlin.codegen.rendering.smoketests.SmokeTestUriValue.EndpointProvider
813import software.amazon.smithy.kotlin.codegen.rendering.util.format
914import software.amazon.smithy.kotlin.codegen.utils.dq
1015import software.amazon.smithy.kotlin.codegen.utils.toCamelCase
@@ -18,7 +23,21 @@ object SmokeTestsRunner : SectionId
1823object SmokeTestAdditionalEnvVars : SectionId
1924object SmokeTestDefaultConfig : SectionId
2025object SmokeTestRegionDefault : SectionId
26+ object SmokeTestUseDualStackKey : SectionId
27+ object SmokeTestSigv4aRegionSetKey : SectionId
28+ object SmokeTestSigv4aRegionSetValue : SectionId
29+ object SmokeTestAccountIdBasedRoutingKey : SectionId
30+ object SmokeTestAccountIdBasedRoutingValue : SectionId
2131object SmokeTestHttpEngineOverride : SectionId
32+ object SmokeTestUseAccelerateKey : SectionId
33+ object SmokeTestUseMultiRegionAccessPointsKey : SectionId
34+ object SmokeTestUseMultiRegionAccessPointsValue : SectionId
35+ object SmokeTestUseGlobalEndpoint : SectionId
36+ object SmokeTestUriKey : SectionId
37+ object SmokeTestUriValue : SectionId {
38+ val EndpointProvider : SectionKey <Symbol > = SectionKey (" EndpointProvider" )
39+ val EndpointParameters : SectionKey <Symbol > = SectionKey (" EndpointParameters" )
40+ }
2241
2342const val SKIP_TAGS = " AWS_SMOKE_TEST_SKIP_TAGS"
2443const val SERVICE_FILTER = " AWS_SMOKE_TEST_SERVICE_IDS"
@@ -31,10 +50,11 @@ class SmokeTestsRunnerGenerator(
3150 ctx : CodegenContext ,
3251) {
3352 private val model = ctx.model
34- private val sdkId = ctx.settings.sdkId
53+ private val settings = ctx.settings
54+ private val sdkId = settings.sdkId
3555 private val symbolProvider = ctx.symbolProvider
36- private val service = symbolProvider.toSymbol(model.expectShape(ctx. settings.service))
37- private val operations = ctx. model.topDownOperations(ctx. settings.service).filter { it.hasTrait<SmokeTestsTrait >() }
56+ private val service = symbolProvider.toSymbol(model.expectShape(settings.service))
57+ private val operations = model.topDownOperations(settings.service).filter { it.hasTrait<SmokeTestsTrait >() }
3858
3959 internal fun render () {
4060 writer.declareSection(SmokeTestsRunner ) {
@@ -108,12 +128,72 @@ class SmokeTestsRunnerGenerator(
108128 writer.withInlineBlock(" #L {" , " }" , service) {
109129 if (testCase.vendorParams.isPresent) {
110130 testCase.vendorParams.get().members.forEach { vendorParam ->
111- if (vendorParam.key.value == " region" ) {
112- writeInline(" #L = " , vendorParam.key.value.toCamelCase())
113- declareSection(SmokeTestRegionDefault )
114- write(" #L" , vendorParam.value.format())
115- } else {
116- write(" #L = #L" , vendorParam.key.value.toCamelCase(), vendorParam.value.format())
131+ when (vendorParam.key.value) {
132+ " region" -> {
133+ writeInline(" #L = " , vendorParam.key.value.toCamelCase())
134+ declareSection(SmokeTestRegionDefault )
135+ write(" #L" , vendorParam.value.format())
136+ }
137+ " sigv4aRegionSet" -> {
138+ declareSection(SmokeTestSigv4aRegionSetKey ) {
139+ writeInline(" #L" , vendorParam.key.value.toCamelCase())
140+ }
141+ writeInline(" = " )
142+ declareSection(SmokeTestSigv4aRegionSetValue ) {
143+ write(" #L" , vendorParam.value.format())
144+ }
145+ }
146+ " uri" -> {
147+ declareSection(SmokeTestUriKey ) {
148+ writeInline(" #L" , vendorParam.key.value.toCamelCase())
149+ }
150+ writeInline(" = " )
151+ declareSection(
152+ SmokeTestUriValue ,
153+ mapOf (
154+ EndpointProvider to EndpointProviderGenerator .getSymbol(settings),
155+ EndpointParameters to EndpointParametersGenerator .getSymbol(settings),
156+ ),
157+ ) {
158+ write(" #L" , vendorParam.value.format())
159+ }
160+ }
161+ " useDualstack" -> {
162+ declareSection(SmokeTestUseDualStackKey ) {
163+ writeInline(" #L" , vendorParam.key.value.toCamelCase())
164+ }
165+ write(" = #L" , vendorParam.value.format())
166+ }
167+ " useAccountIdRouting" -> {
168+ declareSection(SmokeTestAccountIdBasedRoutingKey ) {
169+ writeInline(" #L" , vendorParam.key.value.toCamelCase())
170+ }
171+ writeInline(" = " )
172+ declareSection(SmokeTestAccountIdBasedRoutingValue ) {
173+ write(" #L" , vendorParam.value.format())
174+ }
175+ }
176+ " useAccelerate" -> {
177+ declareSection(SmokeTestUseAccelerateKey ) {
178+ writeInline(" #L" , vendorParam.key.value.toCamelCase())
179+ }
180+ write(" = #L" , vendorParam.value.format())
181+ }
182+ " useMultiRegionAccessPoints" -> {
183+ declareSection(SmokeTestUseMultiRegionAccessPointsKey ) {
184+ writeInline(" #L" , vendorParam.key.value.toCamelCase())
185+ }
186+ writeInline(" = " )
187+ declareSection(SmokeTestUseMultiRegionAccessPointsValue ) {
188+ write(" #L" , vendorParam.value.format())
189+ }
190+ }
191+ " useGlobalEndpoint" -> {
192+ declareSection(SmokeTestUseGlobalEndpoint ) {
193+ write(" #L = #L" , vendorParam.key.value.toCamelCase(), vendorParam.value.format())
194+ }
195+ }
196+ else -> write(" #L = #L" , vendorParam.key.value.toCamelCase(), vendorParam.value.format())
117197 }
118198 }
119199 } else {
0 commit comments