From 6d36d57a97771e1518e2f8d8a4a2a9510b2feb72 Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Fri, 12 Jan 2024 10:56:17 -0500 Subject: [PATCH] Detect newly added SigV4a trait and handle accordingly. --- .../smithy/swift/codegen/AuthSchemeResolverGenerator.kt | 4 ++-- .../swift/codegen/integration/HttpProtocolServiceClient.kt | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/AuthSchemeResolverGenerator.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/AuthSchemeResolverGenerator.kt index 46e6d7f9a..6b0f15059 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/AuthSchemeResolverGenerator.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/AuthSchemeResolverGenerator.kt @@ -59,8 +59,8 @@ class AuthSchemeResolverGenerator { // endpoint resolver's auth scheme resolution to resolve an auth scheme. renderEndpointParamFields(ctx, this) } else { - // If service supports SigV4 auth scheme, it's a special-case for now - change once sigv4a trait is added - // and it becomes possible at model level to notate custom members for a given auth scheme. + // If service supports SigV4/SigV4a auth scheme, it's a special-case for now - change once + // it becomes possible at model level to notate custom members for a given auth scheme. // Region has to be in params in addition to operation string. if (serviceIndex.getEffectiveAuthSchemes(ctx.service).contains(SigV4Trait.ID)) { write("// Region is used for SigV4 auth scheme") diff --git a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HttpProtocolServiceClient.kt b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HttpProtocolServiceClient.kt index 030de1a32..3fbd2d08a 100644 --- a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HttpProtocolServiceClient.kt +++ b/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HttpProtocolServiceClient.kt @@ -5,6 +5,7 @@ package software.amazon.smithy.swift.codegen.integration +import software.amazon.smithy.aws.traits.auth.SigV4ATrait import software.amazon.smithy.aws.traits.auth.SigV4Trait import software.amazon.smithy.codegen.core.Symbol import software.amazon.smithy.model.knowledge.ServiceIndex @@ -45,6 +46,9 @@ open class HttpProtocolServiceClient( if (ServiceIndex(ctx.model).getEffectiveAuthSchemes(ctx.service).contains(SigV4Trait.ID)) { writer.write("modeledAuthSchemes.append(SigV4AuthScheme())") } + if (ServiceIndex(ctx.model).getEffectiveAuthSchemes(ctx.service).contains(SigV4ATrait.ID)) { + writer.write("modeledAuthSchemes.append(SigV4AAuthScheme())") + } writer.write("config.authSchemes = config.authSchemes ?? modeledAuthSchemes") writer.write("self.config = config") }