Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(codegen): fix setting of default signing name #6487

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be allowed because if there is no sigv4 trait, the method already returned on line 110, and name is required in the trait.

}

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