Skip to content

Commit

Permalink
include region auth param for sigv4a
Browse files Browse the repository at this point in the history
  • Loading branch information
lucix-aws committed Jan 3, 2024
1 parent 6843058 commit cfb7910
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package software.amazon.smithy.go.codegen.integration.auth;

import java.util.List;
import software.amazon.smithy.aws.traits.auth.SigV4ATrait;
import software.amazon.smithy.aws.traits.auth.SigV4Trait;
import software.amazon.smithy.go.codegen.auth.AuthParameter;
import software.amazon.smithy.go.codegen.integration.GoIntegration;
Expand All @@ -25,20 +26,20 @@
import software.amazon.smithy.utils.ListUtils;

/**
* Code generation for SigV4.
* Code generation for SigV4/SigV4A.
*/
public class SigV4AuthScheme implements GoIntegration {
private boolean isSigV4Service(Model model, ServiceShape service) {
return service.hasTrait(SigV4Trait.class);
private boolean isSigV4XService(Model model, ServiceShape service) {
return service.hasTrait(SigV4Trait.class) || service.hasTrait(SigV4ATrait.class);
}

@Override
public List<RuntimeClientPlugin> getClientPlugins() {
// FUTURE: add default Region client option, scheme definition, and resolver - we need a more structured way of
// suppressing elements of a GoIntegration before we do so, for now those live on the SDK side
// FUTURE: add default Region client option and scheme definitions - we need a more structured way of
// suppressing elements of a GoIntegration before we do so, for now those are registered SDK-side
return ListUtils.of(
RuntimeClientPlugin.builder()
.servicePredicate(this::isSigV4Service)
.servicePredicate(this::isSigV4XService)
.addAuthParameter(AuthParameter.REGION)
.build()
);
Expand Down

0 comments on commit cfb7910

Please sign in to comment.