Skip to content

Commit

Permalink
Detect newly added SigV4a trait and handle accordingly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sichan Yoo committed Jan 12, 2024
1 parent e196e56 commit 6d36d57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit 6d36d57

Please sign in to comment.