From 108bb991927df4a9645545fc6fcb2648682f83ff Mon Sep 17 00:00:00 2001 From: George Fu Date: Wed, 18 Sep 2024 11:44:34 -0400 Subject: [PATCH] fix(codegen): fix setting of default signing name (#6487) --- .../aws/typescript/codegen/AddAwsAuthPlugin.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPlugin.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPlugin.java index b46382eb378e2..025a52ab2f7f7 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPlugin.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPlugin.java @@ -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; } @@ -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