Skip to content

Commit

Permalink
fix(codegen): fix setting of default signing name (#6487)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe authored Sep 18, 2024
1 parent c43103f commit 108bb99
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ public void addConfigInterfaceFields(
) {
ServiceShape service = settings.getService(model);
if (!isSigV4Service(service) && isAwsService(service)) {
ServiceTrait serviceTrait = service.getTrait(ServiceTrait.class).get();
settings.setDefaultSigningName(
serviceTrait.getArnNamespace()
service.expectTrait(ServiceTrait.class).getArnNamespace()
);
return;
}
Expand All @@ -123,15 +122,9 @@ public void addConfigInterfaceFields(
writer.write("credentialDefaultProvider?: (input: any) => __Provider<__Credentials>;\n");
}

try {
ServiceTrait serviceTrait = service.getTrait(ServiceTrait.class).get();
settings.setDefaultSigningName(
service.getTrait(SigV4Trait.class).map(SigV4Trait::getName)
.orElse(serviceTrait.getArnNamespace())
);
} catch (Exception e) {
LOGGER.warning("Unable to set service default signing name. A SigV4 or Service trait is needed.");
}
settings.setDefaultSigningName(
service.expectTrait(SigV4Trait.class).getName()
);
}

// Only one of AwsAuth or SigV4Auth should be used
Expand Down

0 comments on commit 108bb99

Please sign in to comment.