From f375469ec8992e2ae3c334cbb7037d0e3b3b0876 Mon Sep 17 00:00:00 2001 From: Soumava Bera Date: Tue, 3 Dec 2024 17:05:45 -0500 Subject: [PATCH] changes to support runtime switch between event streaming signer vs regular for the same auth --- .../source/QBusinessClient.cpp | 13 +++++---- .../include/smithy/client/AwsSmithyClient.h | 8 +++++- .../AwsSmithyClientAsyncRequestContext.h | 1 + .../smithy/client/AwsSmithyClientBase.h | 2 ++ .../client/common/AwsSmithyRequestSigning.h | 8 +++--- .../include/smithy/identity/auth/AuthScheme.h | 2 +- .../smithy/identity/auth/AuthSchemeOption.h | 2 ++ .../auth/built-in/BearerTokenAuthScheme.h | 2 +- .../identity/auth/built-in/SigV4AuthScheme.h | 28 +++++++++++++++---- .../auth/built-in/SigV4AuthSchemeOption.h | 1 + .../auth/built-in/SigV4AuthSchemeResolver.h | 7 ++++- .../identity/auth/built-in/SigV4aAuthScheme.h | 2 +- .../smithy/client/AwsSmithyClientBase.cpp | 6 +++- .../smithy/identity/AuthSchemeOption.cpp | 3 +- .../cpp/smithy/SmithyClientSourceInit.vm | 12 ++++---- ...yJsonServiceEventStreamOperationsSource.vm | 1 + .../smithy/SmithyServiceOperationsSource.vm | 6 +++- 17 files changed, 74 insertions(+), 30 deletions(-) diff --git a/generated/src/aws-cpp-sdk-qbusiness/source/QBusinessClient.cpp b/generated/src/aws-cpp-sdk-qbusiness/source/QBusinessClient.cpp index e8f609350b3..cf47e53c7ef 100644 --- a/generated/src/aws-cpp-sdk-qbusiness/source/QBusinessClient.cpp +++ b/generated/src/aws-cpp-sdk-qbusiness/source/QBusinessClient.cpp @@ -113,7 +113,7 @@ QBusinessClient::QBusinessClient(const QBusiness::QBusinessClientConfiguration& endpointProvider ? endpointProvider : Aws::MakeShared(ALLOCATION_TAG), Aws::MakeShared>(ALLOCATION_TAG), { - {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{GetServiceName(), clientConfiguration.region}}, + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{GetServiceName(), clientConfiguration.region, true}}, }) { init(m_clientConfiguration); @@ -129,7 +129,7 @@ QBusinessClient::QBusinessClient(const AWSCredentials& credentials, endpointProvider ? endpointProvider : Aws::MakeShared(ALLOCATION_TAG), Aws::MakeShared>(ALLOCATION_TAG), { - {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, credentials), GetServiceName(), clientConfiguration.region}}, + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, credentials), GetServiceName(), clientConfiguration.region , true}}, }) { init(m_clientConfiguration); @@ -145,7 +145,7 @@ QBusinessClient::QBusinessClient(const std::shared_ptr& endpointProvider ? endpointProvider : Aws::MakeShared(ALLOCATION_TAG), Aws::MakeShared>(ALLOCATION_TAG), { - {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{ Aws::MakeShared(ALLOCATION_TAG, credentialsProvider), GetServiceName(), clientConfiguration.region}} + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{ Aws::MakeShared(ALLOCATION_TAG, credentialsProvider), GetServiceName(), clientConfiguration.region , true}} }) { init(m_clientConfiguration); @@ -160,7 +160,7 @@ QBusinessClient::QBusinessClient(const Client::ClientConfiguration& clientConfig Aws::MakeShared(ALLOCATION_TAG), Aws::MakeShared>(ALLOCATION_TAG), { - {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG), GetServiceName(), clientConfiguration.region}} + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG), GetServiceName(), clientConfiguration.region , true}} }) { init(m_clientConfiguration); @@ -175,7 +175,7 @@ QBusinessClient::QBusinessClient(const AWSCredentials& credentials, Aws::MakeShared(ALLOCATION_TAG), Aws::MakeShared>(ALLOCATION_TAG), { - {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, credentials), GetServiceName(), clientConfiguration.region}} + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, credentials), GetServiceName(), clientConfiguration.region , true}} }) { init(m_clientConfiguration); @@ -190,7 +190,7 @@ QBusinessClient::QBusinessClient(const std::shared_ptr& Aws::MakeShared(ALLOCATION_TAG), Aws::MakeShared>(ALLOCATION_TAG), { - {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, credentialsProvider), GetServiceName(), clientConfiguration.region}} + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, credentialsProvider), GetServiceName(), clientConfiguration.region , true}} }) { init(m_clientConfiguration); @@ -349,6 +349,7 @@ void QBusinessClient::ChatAsync(Model::ChatRequest& request, resolvedEndpoint.SetRfc3986Encoded(endpointOverrides.setRfc3986Encoded); resolvedEndpoint.SetQueryString(endpointOverrides.queryString); }, + true, eventEncoderStream ); if(outcome.IsSuccess()) diff --git a/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClient.h b/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClient.h index c53d189b776..6541d39e43d 100644 --- a/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClient.h +++ b/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClient.h @@ -86,6 +86,11 @@ namespace client else assert(!"Unknown endpoint parameter!"); } + if (ctx.m_isEventStreaming) + { + identityParams.additionalProperties.insert({"isEventStreaming", true}); + } + const auto& serviceParams = ctx.m_pRequest->GetServiceSpecificParameters(); if (serviceParams) { for (const auto& serviceParam : serviceParams->parameterMap) { @@ -125,10 +130,11 @@ namespace client const char* requestName, Aws::Http::HttpMethod method, EndpointUpdateCallback&& endpointCallback, + bool isEventStreamRequest = false, std::shared_ptr eventEncoderStream_sp = nullptr ) const { - auto httpResponseOutcome = MakeRequestSync(request, requestName, method, std::move(endpointCallback), std::move(eventEncoderStream_sp)); + auto httpResponseOutcome = MakeRequestSync(request, requestName, method, std::move(endpointCallback), isEventStreamRequest, std::move(eventEncoderStream_sp)); return m_serializer->Deserialize(std::move(httpResponseOutcome), GetServiceClientName(), requestName); } diff --git a/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientAsyncRequestContext.h b/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientAsyncRequestContext.h index afe6706c982..f765aceb44b 100644 --- a/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientAsyncRequestContext.h +++ b/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientAsyncRequestContext.h @@ -73,6 +73,7 @@ namespace smithy std::shared_ptr m_pExecutor; std::shared_ptr m_interceptorContext; std::shared_ptr m_semaphore; + bool m_isEventStreaming{false}; }; } // namespace client } // namespace smithy diff --git a/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientBase.h b/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientBase.h index d91b3dbfeec..36a25e08dcf 100644 --- a/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientBase.h +++ b/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientBase.h @@ -140,6 +140,7 @@ namespace client EndpointUpdateCallback&& endpointCallback, ResponseHandlerFunc&& responseHandler, std::shared_ptr pExecutor, + bool isEventStreamRequest, std::shared_ptr eventEncoderStream_sp ) const; @@ -147,6 +148,7 @@ namespace client const char* requestName, Aws::Http::HttpMethod method, EndpointUpdateCallback&& endpointCallback, + bool isEventStreamRequest, std::shared_ptr eventEncoderStream_sp) const; protected: diff --git a/src/aws-cpp-sdk-core/include/smithy/client/common/AwsSmithyRequestSigning.h b/src/aws-cpp-sdk-core/include/smithy/client/common/AwsSmithyRequestSigning.h index 1a3290089e6..1ffcbfdacda 100644 --- a/src/aws-cpp-sdk-core/include/smithy/client/common/AwsSmithyRequestSigning.h +++ b/src/aws-cpp-sdk-core/include/smithy/client/common/AwsSmithyRequestSigning.h @@ -141,7 +141,7 @@ namespace smithy } auto identity = std::move(identityResult.GetResultWithOwnership()); - std::shared_ptr signer = authScheme.signer(); + std::shared_ptr signer = authScheme.signer(m_targetAuthSchemeOption.isEventStreaming); if (!signer) { result.emplace(SigningError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, @@ -198,7 +198,7 @@ namespace smithy using IdentityT = typename std::remove_reference::type::IdentityT; using Signer = AwsSignerBase; - std::shared_ptr signer = authScheme.signer(); + std::shared_ptr signer = authScheme.signer(m_targetAuthSchemeOption.isEventStreaming); if (!signer) { AWS_LOGSTREAM_ERROR(AWS_SMITHY_CLIENT_SIGNING_TAG, "Failed to adjust signing clock skew. Signer is null."); @@ -253,13 +253,13 @@ namespace smithy using IdentityT = typename std::remove_reference::type::IdentityT; using Signer = AwsSignerBase; - std::shared_ptr signer = authScheme.signer(); + std::shared_ptr signer = authScheme.signer(m_targetAuthSchemeOption.isEventStreaming); if (!signer) { AWS_LOGSTREAM_ERROR(AWS_SMITHY_CLIENT_SIGNING_TAG, "Failed to adjust signing clock skew. Signer is null."); return; } - //typecast to streaming type + //typecast to streaming type as we know this visitor is for smithy types (std::dynamic_pointer_cast>(m_eventEncoderStreamSp))->SetSigner(signer); } }; diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthScheme.h b/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthScheme.h index f6355d86f35..0bafc0a2492 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthScheme.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthScheme.h @@ -26,6 +26,6 @@ namespace smithy { virtual std::shared_ptr> identityResolver() = 0; - virtual std::shared_ptr> signer() = 0; + virtual std::shared_ptr> signer(bool isEventStreaming = false) = 0; }; } \ No newline at end of file diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthSchemeOption.h b/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthSchemeOption.h index 80ce1401545..373104ae968 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthSchemeOption.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthSchemeOption.h @@ -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} {} virtual ~AuthSchemeOption() = default; const char* schemeId = nullptr; + bool isEventStreaming{false}; PropertyBag virtual identityProperties() const { return PropertyBag{}; }; PropertyBag virtual signerProperties() const { return PropertyBag{}; }; diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/BearerTokenAuthScheme.h b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/BearerTokenAuthScheme.h index 6d05f280b93..4a7a79eab6c 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/BearerTokenAuthScheme.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/BearerTokenAuthScheme.h @@ -50,7 +50,7 @@ class BearerTokenAuthScheme : public AuthScheme return m_identityResolver; } - std::shared_ptr signer() override { return m_signer; } + std::shared_ptr signer(bool) override { return m_signer; } protected: std::shared_ptr m_identityResolver; diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthScheme.h b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthScheme.h index 60317d062b0..115e6ef41c6 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthScheme.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthScheme.h @@ -24,24 +24,33 @@ namespace smithy { using AwsCredentialSignerT = AwsSignerBase; using SigV4AuthSchemeParameters = DefaultAuthSchemeResolverParameters; - //This allows to override the identity resolver + //same authscheme can have two variants for the same scheme id that can be switched + //in between for different operations explicit SigV4AuthScheme(std::shared_ptr identityResolver, const Aws::String& serviceName, - const Aws::String& region) + const Aws::String& region, + bool eventStream = false) : AuthScheme(SIGV4), - m_identityResolver{identityResolver}, + m_identityResolver{identityResolver}, m_signer{Aws::MakeShared("SigV4AuthScheme", serviceName, region)} { + if(eventStream) + { + m_eventStreamSigner = Aws::MakeShared("SigV4AuthScheme", serviceName, region); + assert(m_eventStreamSigner); + } assert(m_identityResolver); assert(m_signer); } //delegate constructor explicit SigV4AuthScheme(const Aws::String& serviceName, - const Aws::String& region) + const Aws::String& region, + bool eventStream = false) : SigV4AuthScheme(Aws::MakeShared("SigV4AuthScheme"), serviceName, - region) + region, + eventStream) { } @@ -52,12 +61,19 @@ namespace smithy { return m_identityResolver; } - std::shared_ptr signer() override + std::shared_ptr signer(bool isEventStreaming) override { + if(isEventStreaming && m_eventStreamSigner) + { + return m_eventStreamSigner; + } + return m_signer; } protected: std::shared_ptr m_identityResolver; std::shared_ptr m_signer; + std::shared_ptr m_eventStreamSigner; }; + } diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthSchemeOption.h b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthSchemeOption.h index f2810a31f34..143645af545 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthSchemeOption.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthSchemeOption.h @@ -11,5 +11,6 @@ namespace smithy { struct SigV4AuthSchemeOption { static SMITHY_API AuthSchemeOption sigV4AuthSchemeOption; + static SMITHY_API AuthSchemeOption sigV4EventStreamingAuthSchemeOption; }; } \ No newline at end of file diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthSchemeResolver.h b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthSchemeResolver.h index 60c825fb7e8..30ac3fe95aa 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthSchemeResolver.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4AuthSchemeResolver.h @@ -18,7 +18,12 @@ namespace smithy { Aws::Vector resolveAuthScheme(const ServiceAuthSchemeParameters& identityProperties) override { - AWS_UNREFERENCED_PARAM(identityProperties); + //AWS_UNREFERENCED_PARAM(identityProperties); + if(identityProperties.additionalProperties.find("isEventStreaming") != identityProperties.additionalProperties.end()) + { + return {SigV4AuthSchemeOption::sigV4EventStreamingAuthSchemeOption}; + } + return {SigV4AuthSchemeOption::sigV4AuthSchemeOption}; } }; diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4aAuthScheme.h b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4aAuthScheme.h index 9a70a5e2a8e..4e52c3013a1 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4aAuthScheme.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4aAuthScheme.h @@ -52,7 +52,7 @@ namespace smithy { return m_identityResolver; } - std::shared_ptr signer() override + std::shared_ptr signer(bool) override { return m_signer; } diff --git a/src/aws-cpp-sdk-core/source/smithy/client/AwsSmithyClientBase.cpp b/src/aws-cpp-sdk-core/source/smithy/client/AwsSmithyClientBase.cpp index 0fce01a89c6..4954a068809 100644 --- a/src/aws-cpp-sdk-core/source/smithy/client/AwsSmithyClientBase.cpp +++ b/src/aws-cpp-sdk-core/source/smithy/client/AwsSmithyClientBase.cpp @@ -99,6 +99,7 @@ void AwsSmithyClientBase::MakeRequestAsync(Aws::AmazonWebServiceRequest const* c EndpointUpdateCallback&& endpointCallback, ResponseHandlerFunc&& responseHandler, std::shared_ptr pExecutor, + bool isEventStreamRequest, std::shared_ptr eventEncoderStreamSp ) const { @@ -131,6 +132,8 @@ void AwsSmithyClientBase::MakeRequestAsync(Aws::AmazonWebServiceRequest const* c pRequestCtx->m_method = method; pRequestCtx->m_retryCount = 0; pRequestCtx->m_invocationId = Aws::Utils::UUID::PseudoRandomUUID(); + pRequestCtx->m_isEventStreaming = isEventStreamRequest; + auto authSchemeOptionOutcome = this->SelectAuthSchemeOption(*pRequestCtx); if (!authSchemeOptionOutcome.IsSuccess()) { @@ -493,6 +496,7 @@ AwsSmithyClientBase::MakeRequestSync(Aws::AmazonWebServiceRequest const * const const char* requestName, Aws::Http::HttpMethod method, EndpointUpdateCallback&& endpointCallback, + bool isEventStreamRequest, std::shared_ptr eventEncoderStream_sp ) const { @@ -507,7 +511,7 @@ AwsSmithyClientBase::MakeRequestSync(Aws::AmazonWebServiceRequest const * const pExecutor->Submit([&]() { - this->MakeRequestAsync(request, requestName, method, std::move(endpointCallback) ,std::move(responseHandler), pExecutor, std::move(eventEncoderStream_sp)); + this->MakeRequestAsync(request, requestName, method, std::move(endpointCallback) ,std::move(responseHandler), pExecutor, isEventStreamRequest, std::move(eventEncoderStream_sp)); }); pExecutor->WaitUntilStopped(); diff --git a/src/aws-cpp-sdk-core/source/smithy/identity/AuthSchemeOption.cpp b/src/aws-cpp-sdk-core/source/smithy/identity/AuthSchemeOption.cpp index 354f61254ca..48d0873536e 100644 --- a/src/aws-cpp-sdk-core/source/smithy/identity/AuthSchemeOption.cpp +++ b/src/aws-cpp-sdk-core/source/smithy/identity/AuthSchemeOption.cpp @@ -8,4 +8,5 @@ using namespace smithy; AuthSchemeOption SigV4AuthSchemeOption::sigV4AuthSchemeOption = AuthSchemeOption("aws.auth#sigv4"); -AuthSchemeOption SigV4aAuthSchemeOption::sigV4aAuthSchemeOption = AuthSchemeOption("aws.auth#sigv4a"); \ No newline at end of file +AuthSchemeOption SigV4aAuthSchemeOption::sigV4aAuthSchemeOption = AuthSchemeOption("aws.auth#sigv4a"); +AuthSchemeOption SigV4AuthSchemeOption::sigV4EventStreamingAuthSchemeOption = AuthSchemeOption("aws.auth#sigv4", true); diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyClientSourceInit.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyClientSourceInit.vm index 35fc81ecdc4..d6d19757452 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyClientSourceInit.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyClientSourceInit.vm @@ -9,7 +9,7 @@ ${className}::${className}(const ${clientConfiguration}& clientConfiguration, Aws::MakeShared>(ALLOCATION_TAG), { #foreach($entry in $AuthSchemeMapEntries) - {${entry}{GetServiceName(), clientConfiguration.region}}, + {${entry}{GetServiceName(), clientConfiguration.region#if($serviceModel.hasStreamingRequestShapes()), true#end}}, #end }) { @@ -27,7 +27,7 @@ ${className}::${className}(const AWSCredentials& credentials, Aws::MakeShared>(ALLOCATION_TAG), { #foreach($entry in $AuthSchemeMapEntries) - {${entry}{Aws::MakeShared(ALLOCATION_TAG, credentials), GetServiceName(), clientConfiguration.region}}, + {${entry}{Aws::MakeShared(ALLOCATION_TAG, credentials), GetServiceName(), clientConfiguration.region#if($serviceModel.hasStreamingRequestShapes()) , true#end}}, #end }) { @@ -45,7 +45,7 @@ ${className}::${className}(const std::shared_ptr& creden Aws::MakeShared>(ALLOCATION_TAG), { #foreach($entry in $AuthSchemeMapEntries) - {${entry}{ Aws::MakeShared(ALLOCATION_TAG, credentialsProvider), GetServiceName(), clientConfiguration.region}} + {${entry}{ Aws::MakeShared(ALLOCATION_TAG, credentialsProvider), GetServiceName(), clientConfiguration.region#if($serviceModel.hasStreamingRequestShapes()) , true#end}} #end }) { @@ -62,7 +62,7 @@ ${className}::${className}(const Client::ClientConfiguration& clientConfiguratio Aws::MakeShared>(ALLOCATION_TAG), { #foreach($entry in $AuthSchemeMapEntries) - {$entry{Aws::MakeShared(ALLOCATION_TAG), GetServiceName(), clientConfiguration.region}} + {$entry{Aws::MakeShared(ALLOCATION_TAG), GetServiceName(), clientConfiguration.region#if($serviceModel.hasStreamingRequestShapes()) , true#end}} #end }) { @@ -79,7 +79,7 @@ ${className}::${className}(const AWSCredentials& credentials, Aws::MakeShared>(ALLOCATION_TAG), { #foreach($entry in $AuthSchemeMapEntries) - {$entry{Aws::MakeShared(ALLOCATION_TAG, credentials), GetServiceName(), clientConfiguration.region}} + {$entry{Aws::MakeShared(ALLOCATION_TAG, credentials), GetServiceName(), clientConfiguration.region#if($serviceModel.hasStreamingRequestShapes()) , true#end}} #end }) { @@ -96,7 +96,7 @@ ${className}::${className}(const std::shared_ptr& creden Aws::MakeShared>(ALLOCATION_TAG), { #foreach($entry in $AuthSchemeMapEntries) - {$entry{Aws::MakeShared(ALLOCATION_TAG, credentialsProvider), GetServiceName(), clientConfiguration.region}} + {$entry{Aws::MakeShared(ALLOCATION_TAG, credentialsProvider), GetServiceName(), clientConfiguration.region#if($serviceModel.hasStreamingRequestShapes()) , true#end}} #end }) { diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyJsonServiceEventStreamOperationsSource.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyJsonServiceEventStreamOperationsSource.vm index b19fc06ec9c..268fc43aa69 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyJsonServiceEventStreamOperationsSource.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyJsonServiceEventStreamOperationsSource.vm @@ -33,6 +33,7 @@ void ${className}::${operation.name}Async(Model::${operation.request.shape.name} JsonOutcome outcome = MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_${operation.http.method}, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { #parse("/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyEndpointClosure.vm") }, + true, eventEncoderStream ); if(outcome.IsSuccess()) diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyServiceOperationsSource.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyServiceOperationsSource.vm index ef6bc323ba2..83a7c2b50b3 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyServiceOperationsSource.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyServiceOperationsSource.vm @@ -18,10 +18,14 @@ ${operation.name}Outcome ${className}::${operation.name}(const ${operation.reque request.SetResponseStreamFactory( [&] { request.GetEventStreamDecoder().Reset(); return Aws::New(ALLOCATION_TAG, request.GetEventStreamDecoder()); } ); -#end + return ${operation.name}Outcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_${operation.http.method}, [&#if($hasEndPointOverrides) , endpointOverrides #end](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { +#parse("/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyEndpointClosure.vm") + },true)); +#else return ${operation.name}Outcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_${operation.http.method}, [&#if($hasEndPointOverrides) , endpointOverrides #end](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { #parse("/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyEndpointClosure.vm") })); +#end }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter,