|
5 | 5 | package aws.sdk.kotlin.codegen.customization.s3 |
6 | 6 |
|
7 | 7 | import aws.sdk.kotlin.codegen.AwsRuntimeTypes |
| 8 | +import software.amazon.smithy.aws.traits.auth.SigV4ATrait |
8 | 9 | import software.amazon.smithy.kotlin.codegen.KotlinSettings |
9 | 10 | import software.amazon.smithy.kotlin.codegen.core.KotlinWriter |
10 | 11 | import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration |
11 | 12 | import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolGenerator |
12 | 13 | import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolMiddleware |
13 | 14 | import software.amazon.smithy.model.Model |
| 15 | +import software.amazon.smithy.model.knowledge.ServiceIndex |
14 | 16 | import software.amazon.smithy.model.shapes.OperationShape |
15 | 17 |
|
16 | 18 | // FIXME: Remove this once sigV4a is supported by default AWS signer |
17 | 19 | /** |
18 | | - * Registers an interceptor for S3 to deal with the default signer not supporting sigV4a |
| 20 | + * Registers an interceptor for sigV4a services to deal with the default signer not supporting sigV4a |
19 | 21 | * See: [aws.sdk.kotlin.runtime.http.interceptors.UnsupportedSigningAlgorithmInterceptor] |
20 | 22 | */ |
21 | 23 | class UnsupportedSigningAlgorithmIntegration : KotlinIntegration { |
22 | 24 | override fun enabledForService(model: Model, settings: KotlinSettings): Boolean = |
23 | | - when (settings.sdkId.lowercase()) { |
24 | | - "s3", "eventbridge", "cloudfront keyvaluestore" -> true |
25 | | - else -> false |
26 | | - } |
| 25 | + ServiceIndex |
| 26 | + .of(model) |
| 27 | + .getAuthSchemes(settings.service) |
| 28 | + .values |
| 29 | + .any { it.javaClass == SigV4ATrait::class.java } |
27 | 30 |
|
28 | 31 | override fun customizeMiddleware( |
29 | 32 | ctx: ProtocolGenerator.GenerationContext, |
|
0 commit comments