-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Pre-requisite Changes Enable smithy query + rest-xml clients #3321
base: main
Are you sure you want to change the base?
Conversation
27ab711
to
e788a0f
Compare
c5622a1
to
80a1146
Compare
@@ -176,7 +177,7 @@ protected List<SdkFileEntry> generateClientSourceFile( List<ServiceModel> servic | |||
{ | |||
if(serviceModels.get(index).isUseSmithyClient() && !serviceModels.get(index).hasEventStreamingRequestShapes()) | |||
{ | |||
return GenerateSmithyClientSourceFile(serviceModels.get(index), index); | |||
return GenerateSmithyClientSourceFile(serviceModels.get(index), index, Optional.empty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse base class function
for (int i = 0; i < serviceModels.size(); i++) { | ||
Template template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/queryxml/QueryXmlServiceClientSource.vm", StandardCharsets.UTF_8.name()); | ||
|
||
List<Integer> serviceModelsIndices = IntStream.range(0, serviceModels.size()).boxed().collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor to use base class function to avoid duplicate logic
Template template; | ||
if (serviceModel.isUseSmithyClient()) | ||
{ | ||
template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyClientHeader.vm", StandardCharsets.UTF_8.name()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor to use base class function to avoid duplicate code and logic
@@ -62,7 +63,7 @@ protected List<SdkFileEntry> generateClientSourceFile(List<ServiceModel> service | |||
serviceModelsIndices.stream().forEach(index -> { | |||
if(serviceModels.get(index).isUseSmithyClient()) | |||
{ | |||
smithyClients.add(GenerateSmithyClientSourceFile(serviceModels.get(index), index)); | |||
smithyClients.add(GenerateSmithyClientSourceFile(serviceModels.get(index), index,Optional.empty())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make API reusable, accommodate interface change
@@ -40,6 +40,9 @@ | |||
, "lexv2-runtime" | |||
, "qbusiness" | |||
, "transcribestreaming" | |||
, "s3-crt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In exclusion list because s3 was addressed in separate PR, and S3-crt,s3control pending
@@ -284,6 +284,49 @@ namespace client | |||
return {}; | |||
} | |||
|
|||
Aws::String GeneratePresignedUrl( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a to duplicate this method body?
@@ -100,6 +100,186 @@ namespace client | |||
} | |||
|
|||
AwsLegacyClientT() = default; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah the joys of backwards compatibility
@@ -284,6 +284,49 @@ namespace client | |||
return {}; | |||
} | |||
|
|||
Aws::String GeneratePresignedUrl( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having four generate presigned URL methods seems excessive and that we are creating bloat in this class. can we do something similar to how we did AwsLegacyClientT
and move this into a PresignMixinT
then invoke a single smithy client method?
In fact we already do this on the old client but have it as a signer to look up. lets just add it as a mix in.
else | ||
{ | ||
throw new RuntimeException(String.format("authSchemes '%s'",serviceModel.getAuthSchemes().stream().collect(Collectors.toList()) | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix these trailing params, put them on the same line as everything else, it reads weird
{ | ||
context.put("AuthSchemeResolver", ResolverMapping.get(firstAuthScheme.get())); | ||
context.put("AuthSchemeResolver", "SigV4MultiAuthSchemeResolver"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we hard coding it to sigv4 and no the the first auth scheme? we should be using the first in the list, hard coding it seems wrong
} | ||
else | ||
{ | ||
throw new RuntimeException(String.format("authSchemes '%s'",serviceModel.getAuthSchemes().stream().collect(Collectors.toList()) | ||
)); | ||
Optional<String> firstAuthScheme = serviceModel.getAuthSchemes().stream().filter(entry->ResolverMapping.containsKey(entry)).findFirst(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the third time this has been copied so likely it should be broken off. into its own function
if (serviceModel.isUseSmithyClient()) | ||
{ | ||
template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyClientHeader.vm", StandardCharsets.UTF_8.name()); | ||
if(serviceModel.getAuthSchemes().size() > 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this same block appears all of the place, we need to move it to a single place to avoid code duplicaiton
Issue #, if available:
Description of changes:
This PR includes
Check all that applies:
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.