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

Refactor with smithy client for json protocol non customized services [Work in Progress] #3208

Closed
wants to merge 6 commits into from

Conversation

sbera87
Copy link
Contributor

@sbera87 sbera87 commented Nov 27, 2024

Issue #, if available:

Description of changes:

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -55,6 +55,12 @@ namespace Aws
namespace Endpoint
{
class AWSEndpoint;

struct AWSEndpointResolutionOverrides
Copy link
Contributor

Choose a reason for hiding this comment

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

there is a EndpointUpdateCallback&& endpointCallback, to insert the path segments and set this boolean variable within the generated code

@@ -19,9 +19,11 @@ namespace smithy {
/* note: AuthSchemeOption is not connected with AuthScheme by type system, only by the String of schemeId, this is in accordance with SRA */
public:
AuthSchemeOption(const char* id = nullptr): schemeId(id) {}
AuthSchemeOption(const char* id, bool isStreaming): schemeId(id),isEventStreaming{isStreaming} {}
Copy link
Contributor

Choose a reason for hiding this comment

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

please don't extended base interfaces with implementation details.
Just create a AuthScheme SigV4 EventStreaming.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The way current code is designed otherwise needs way more changes. This minimizes that with default args

@@ -131,12 +139,17 @@ namespace client
Aws::Http::HttpMethod method,
EndpointUpdateCallback&& endpointCallback,
ResponseHandlerFunc&& responseHandler,
std::shared_ptr<Aws::Utils::Threading::Executor> pExecutor) const;
std::shared_ptr<Aws::Utils::Threading::Executor> pExecutor,
Copy link
Contributor

Choose a reason for hiding this comment

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

the same here
I'd try to avoid leaking details to the base client class.
This API will be used by ~400 services, and having 2 extra arguments only for few of them is inconvenient in support.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same reasoning as above, my first attempt was decorator class which necessitated way more changes given the templated design. This was the way i could minimize it

@@ -99,7 +98,10 @@ void AwsSmithyClientBase::MakeRequestAsync(Aws::AmazonWebServiceRequest const* c
Aws::Http::HttpMethod method,
EndpointUpdateCallback&& endpointCallback,
ResponseHandlerFunc&& responseHandler,
std::shared_ptr<Aws::Utils::Threading::Executor> pExecutor) const
std::shared_ptr<Aws::Utils::Threading::Executor> pExecutor,
bool isEventStreamRequest,
Copy link
Contributor

Choose a reason for hiding this comment

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

the same here, I'd try to avoid placing detailed logic in the base Client class.
AwsClient became a god class nobody-knows-how-it-works and nobody-wants-to-touch-it and we would like to try to avoid repeating the same mistake.

@@ -61,4 +61,51 @@ namespace smithy {
Aws::String m_region;
Aws::Client::AWSAuthV4Signer legacySigner;
};

class AWSAuthEventStreamV4Signer : public AwsSignerBase<AwsCredentialIdentityBase> {
Copy link
Contributor

Choose a reason for hiding this comment

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

place it in a separate file, so that 400+ service clients not-using-eventstreams won't have to compile this code.

@sbera87
Copy link
Contributor Author

sbera87 commented Dec 9, 2024

closing this to open another PR with full set of changes + merges

@sbera87 sbera87 closed this Dec 9, 2024
@sbera87 sbera87 deleted the json_smithy branch January 24, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants