-
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
Enable S3 smithy client #3317
base: main
Are you sure you want to change the base?
Enable S3 smithy client #3317
Conversation
dea11b7
to
f0684a4
Compare
@@ -290,18 +460,21 @@ void AwsSmithyClientBase::AttemptOneRequestAsync(std::shared_ptr<AwsSmithyClient | |||
return; | |||
} | |||
|
|||
pRequestCtx->m_interceptorContext->SetTransmitRequest(pRequestCtx->m_httpRequest); | |||
for (const auto& interceptor : m_interceptors) | |||
if (pRequestCtx->m_interceptorContext) |
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.
just added code block under null guard since in requestless cases, this is currently not created in requestless call flow.
This is done to emulate legacy behavior:
with request case:
InterceptorContext context{request}; |
vs
request less case:
HttpResponseOutcome AWSClient::AttemptOneRequest(const std::shared_ptr<Aws::Http::HttpRequest>& httpRequest, |
|
||
|
||
|
||
void AwsSmithyClientBase::MakeRequestAsyncHelper(std::shared_ptr<AwsSmithyClientAsyncRequestContext>& pRequestCtx, |
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 helper abstracts endpoint resolution into a callback and is invoked contextually by different variations of APIs used for backwards compatibilty
3547603
to
f03166d
Compare
Aws::Map<Aws::String, Aws::String> params; | ||
params.emplace("bucketName", bucket); | ||
ServiceSpecificParameters serviceSpecificParameters{params}; | ||
auto serviceParams = Aws::MakeShared<ServiceSpecificParameters>(ALLOCATION_TAG, serviceSpecificParameters); | ||
return AWSClient::GeneratePresignedUrl(endpoint, method, customizedHeaders, expirationInSeconds, Aws::Auth::SIGV4_SIGNER, | ||
nullptr, nullptr, serviceParams); | ||
EndpointUpdateCallback endpointCallback = [&](Aws::Endpoint::AWSEndpoint& endpoint){ |
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.
Changes to resolve endpoint after select auth scheme
Aws::Vector<AuthSchemeOption> authSchemeOptions = m_authSchemeResolver->resolveAuthScheme(identityParams); | ||
Aws::Vector<AuthSchemeOption> authSchemeOptions; | ||
/*for backwards compatibility, signer name override is used to filter auth schemes by id equivalent to legacy signer name*/ | ||
if(ctx.m_signerNameOverride.has_value()) |
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 added to make the backwards compatible api functional.
In legacy client, signer name passed was used to fetch the signer object via
auto signer = GetSignerByName(signerName);
In smithy design, this name passed is simply re-mapped and used to filter desired auth scheme (with requested signer) from list of supported auth schemes
@@ -240,8 +314,141 @@ namespace client | |||
} | |||
return GeneratePresignedUrl(uri, method, signerRegionOverride, signerServiceNameOverride, expirationInSeconds, customizedHeaders, serviceSpecificParameters); | |||
} | |||
|
|||
ResponseT MakeRequest(const Aws::Http::URI& uri, |
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.
Legacy APIs that need to be supported as external clients found to use some variations.
using ClientError = AWSError; | ||
using SigningError = AWSError; | ||
using AWSCoreError = Aws::Client::AWSError<CoreErrors>; | ||
using ClientError = AWSCoreError; |
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.
Needed to ensure backwards compatibility . External clients use AwsError as a templated type
std::shared_ptr<Aws::Utils::Threading::Executor> pExecutor | ||
) const; | ||
|
||
const std::shared_ptr<Aws::Client::AWSErrorMarshaller>& GetErrorMarshaller() const |
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.
Needed as External Users use this
@@ -200,7 +237,7 @@ namespace client | |||
Aws::Vector<std::shared_ptr<smithy::interceptor::Interceptor>> m_interceptors{}; | |||
std::shared_ptr<smithy::client::UserAgentInterceptor> m_userAgentInterceptor; | |||
private: | |||
void UpdateAuthSchemeFromEndpoint(const Aws::Endpoint::AWSEndpoint& endpoint, AuthSchemeOption& authscheme) const; | |||
void UpdateAuthSchemeFromEndpoint(std::shared_ptr<AwsSmithyClientAsyncRequestContext>& pRequestCtx) const; |
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.
Interface updated to facilitate legacy API usage where endpoint may not be available
Issue #, if available:
Description of changes:
This set of changes enables Smithy client for S3 with applicable backwards compatible changes.
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.