diff --git a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3Client.h b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3Client.h index 8fe5227452d..6881aef7a3c 100644 --- a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3Client.h +++ b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3Client.h @@ -4,14 +4,22 @@ */ #pragma once + #include #include -#include #include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include + +#include + + // TODO: temporary fix for naming conflicts on Windows. #ifdef _WIN32 @@ -32,6 +40,7 @@ namespace Aws static const char SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY[] = "x-amz-server-side-encryption-customer-key"; static const char SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5[] = "x-amz-server-side-encryption-customer-key-MD5"; } // SS3Headers + AWS_S3_API extern const char SERVICE_NAME[]; //max expiration for presigned urls in s3 is 7 days. static const unsigned MAX_EXPIRATION_SECONDS = 7 * 24 * 60 * 60; @@ -39,12 +48,20 @@ namespace Aws /** *

*/ - class AWS_S3_API S3Client : public Aws::Client::AWSXMLClient, public Aws::Client::ClientWithAsyncTemplateMethods + class AWS_S3_API S3Client : public smithy::client::AwsSmithyClientT, + Aws::Crt::Variant, + S3EndpointProviderBase, + smithy::client::XmlOutcomeSerializer, + smithy::client::XmlOutcome, + Aws::Client::S3ErrorMarshaller>, + Aws::Client::ClientWithAsyncTemplateMethods { public: - typedef Aws::Client::AWSXMLClient BASECLASS; static const char* GetServiceName(); static const char* GetAllocationTag(); + inline const char* GetServiceClientName() const override { return "S3"; } typedef S3ClientConfiguration ClientConfigurationType; typedef S3EndpointProvider EndpointProviderType; @@ -6973,8 +6990,7 @@ namespace Aws private: friend class Aws::Client::ClientWithAsyncTemplateMethods; void init(const S3ClientConfiguration& clientConfiguration); - S3ClientConfiguration m_clientConfiguration; - std::shared_ptr m_endpointProvider; + }; } // namespace S3 diff --git a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ClientConfiguration.h b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ClientConfiguration.h index bde93de4a45..0ec8ba1367f 100644 --- a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ClientConfiguration.h +++ b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ClientConfiguration.h @@ -62,6 +62,10 @@ namespace Aws IdentityProviderSupplier identityProviderSupplier = [](const S3Client &client) -> std::shared_ptr { return Aws::MakeShared("S3ClientConfiguration", client); }; + using SmithyIdentityProviderSupplier = std::function (const S3Client &)>; + SmithyIdentityProviderSupplier smithyIdentityProviderSupplier = [](const S3Client &client) -> std::shared_ptr { + return Aws::MakeShared("S3ClientConfiguration", client); + }; private: void LoadS3SpecificConfig(const Aws::String& profileName); }; diff --git a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressAuthSchemeResolver.h b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressAuthSchemeResolver.h new file mode 100644 index 00000000000..118e9b3a9ed --- /dev/null +++ b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressAuthSchemeResolver.h @@ -0,0 +1,64 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include + +namespace Aws { +namespace S3 { + class AWS_S3_API S3ExpressAuthSchemeResolver : public smithy::SigV4MultiAuthSchemeResolver{ + + public: + Aws::Vector resolveAuthScheme(const ServiceAuthSchemeParameters& identityProperties) override + { + //pack endpoint params from identityProperties + Aws::Endpoint::EndpointParameters epParams; + + for (auto& identParam : identityProperties.additionalProperties) { + if (identParam.second.template holds_alternative()) + { + epParams.emplace_back(Aws::Endpoint::EndpointParameter(identParam.first, identParam.second.template get())); + } + if (identParam.second.template holds_alternative()) + { + epParams.emplace_back(Aws::Endpoint::EndpointParameter(identParam.first ,identParam.second.template get())); + } + } + + //resolve endpoint first time to fetch auth schemes + if(m_endpointProviderForAuth) + { + auto epResolutionOutcome = m_endpointProviderForAuth->ResolveEndpoint(epParams); + if (epResolutionOutcome.IsSuccess()) + { + auto endpoint = std::move(epResolutionOutcome.GetResultWithOwnership()); + if (endpoint.GetAttributes()) + { + auto authSchemeName = endpoint.GetAttributes()->authScheme.GetName(); + if(strcmp(authSchemeName.c_str(),Aws::Auth::ASYMMETRIC_SIGV4_SIGNER) == 0) + { + return {smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption}; + } + else if(strcmp(authSchemeName.c_str(),Aws::Auth::SIGV4_SIGNER) == 0) + { + return {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption}; + } + else if(strcmp(authSchemeName.c_str(), S3::S3_EXPRESS_SIGNER_NAME) == 0) + { + return {S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption}; + } + } + } + } + + return {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption}; + } + }; +} +} diff --git a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressIdentityProvider.h b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressIdentityProvider.h index 014134629f9..919f4a47bf4 100644 --- a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressIdentityProvider.h +++ b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressIdentityProvider.h @@ -8,11 +8,12 @@ #include #include #include -#include -#include #include +#include +#include #include #include +#include namespace Aws { namespace Http { @@ -21,80 +22,155 @@ namespace Aws { namespace S3 { class S3Client; - class S3ExpressIdentityProvider: public smithy::IdentityResolverBase { - public: - explicit S3ExpressIdentityProvider(const S3Client &s3Client) : m_s3Client(s3Client) {} - - virtual S3ExpressIdentity + class AWS_S3_API S3ExpressIdentityProvider : public smithy::IdentityResolverBase { + public: + explicit S3ExpressIdentityProvider(const S3Client& s3Client); + ResolveIdentityFutureOutcome getIdentity( + const IdentityProperties& identityProperties, + const AdditionalParameters& additionalParameters) override; + + virtual S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) = 0; - ResolveIdentityFutureOutcome - getIdentity(const IdentityProperties& identityProperties, const AdditionalParameters& additionalParameters) override; - S3ExpressIdentity - getIdentity(const Aws::String &bucketName); + protected: + + S3ExpressIdentity GetCredentialsFromBucket(const Aws::String& bucketName) const; - virtual ~S3ExpressIdentityProvider() {} + private: + const Aws::S3::S3Client& m_s3Client; + mutable std::mutex m_bucketNameMapMutex; + Aws::Map> m_bucketNameMutex; - protected: - std::shared_ptr GetMutexForBucketName(const Aws::String& bucketName); - - private: - const S3Client &m_s3Client; - mutable std::mutex m_bucketNameMapMutex; - Aws::Map> m_bucketNameMutex; + protected: + std::shared_ptr GetMutexForBucketName(const Aws::String& bucketName); + }; + + + class AWS_S3_API DefaultS3ExpressIdentityProvider : public S3ExpressIdentityProvider { + public: + explicit DefaultS3ExpressIdentityProvider(const S3Client& s3Client); + explicit DefaultS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache); + DefaultS3ExpressIdentityProvider(const DefaultS3ExpressIdentityProvider& other) = delete; + DefaultS3ExpressIdentityProvider(DefaultS3ExpressIdentityProvider&& other) noexcept = delete; + DefaultS3ExpressIdentityProvider& operator=(const DefaultS3ExpressIdentityProvider& other) = delete; + DefaultS3ExpressIdentityProvider& operator=(DefaultS3ExpressIdentityProvider&& other) noexcept = delete; + virtual ~DefaultS3ExpressIdentityProvider() override = default; + S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) override; + + private: + mutable std::shared_ptr> m_credentialsCache; }; - class DefaultS3ExpressIdentityProvider : public S3ExpressIdentityProvider { - public: - explicit DefaultS3ExpressIdentityProvider(const S3Client &m_s3Client); - - DefaultS3ExpressIdentityProvider(const S3Client &s3Client, - std::shared_ptr> credentialsCache); - - DefaultS3ExpressIdentityProvider(const DefaultS3ExpressIdentityProvider& other) = delete; - DefaultS3ExpressIdentityProvider(DefaultS3ExpressIdentityProvider&& other) noexcept = delete; - DefaultS3ExpressIdentityProvider& operator=(const DefaultS3ExpressIdentityProvider& other) = delete; - DefaultS3ExpressIdentityProvider& operator=(DefaultS3ExpressIdentityProvider&& other) noexcept = delete; - - virtual ~DefaultS3ExpressIdentityProvider() override = default; - - S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) override; + class AWS_S3_API DefaultAsyncS3ExpressIdentityProvider : public S3ExpressIdentityProvider { + public: + explicit DefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, + std::chrono::minutes refreshPeriod = std::chrono::minutes(1)); + + explicit DefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache, + std::chrono::minutes refreshPeriod = std::chrono::minutes(1)); + + DefaultAsyncS3ExpressIdentityProvider(const DefaultAsyncS3ExpressIdentityProvider& other) = delete; + DefaultAsyncS3ExpressIdentityProvider(DefaultAsyncS3ExpressIdentityProvider&& other) noexcept = delete; + DefaultAsyncS3ExpressIdentityProvider& operator=( + const DefaultAsyncS3ExpressIdentityProvider& other) = delete; + DefaultAsyncS3ExpressIdentityProvider& operator=(DefaultAsyncS3ExpressIdentityProvider&& other) noexcept = delete; + virtual ~DefaultAsyncS3ExpressIdentityProvider() override; + S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) override; + + private: + void refreshIdentities(std::chrono::minutes refreshPeriod); + void threadSafeKeyInsert(const Aws::String& key); + bool threadSafeKeyHas(const Aws::String& key); + void threadSafeKeyEmpty(); + + mutable std::shared_ptr> m_credentialsCache; + Aws::Set m_keysUsed; + mutable std::mutex m_keysUsedMutex; + mutable bool m_shouldStopBackgroundRefresh; + Aws::UniquePtr m_backgroundRefreshThread; + mutable std::mutex m_shutDownMutex; + mutable std::condition_variable m_shutdownCondition; + }; - private: - mutable std::shared_ptr> m_credentialsCache; + /*------ Smithy version -----*/ + class AWS_S3_API SmithyS3ExpressIdentityProvider : public smithy::IdentityResolverBase { + public: + explicit SmithyS3ExpressIdentityProvider(const S3Client& s3Client); + ResolveIdentityFutureOutcome getIdentity( + const IdentityProperties& identityProperties, + const AdditionalParameters& additionalParameters) override; + + protected: + + virtual smithy::AwsCredentialIdentity GetS3ExpressAwsIdentity(const std::shared_ptr &serviceSpecificParameters) = 0; + smithy::AwsCredentialIdentity GetCredentialsFromBucket(const Aws::String& bucketName) const; + + private: + const Aws::S3::S3Client& m_s3Client; + mutable std::mutex m_bucketNameMapMutex; + Aws::Map> m_bucketNameMutex; + + protected: + std::shared_ptr GetMutexForBucketName(const Aws::String& bucketName); }; - class DefaultAsyncS3ExpressIdentityProvider : public S3ExpressIdentityProvider { - public: - explicit DefaultAsyncS3ExpressIdentityProvider(const S3Client &m_s3Client, - std::chrono::minutes refreshPeriod = std::chrono::minutes(1)); - - DefaultAsyncS3ExpressIdentityProvider(const S3Client &s3Client, - std::shared_ptr> credentialsCache, - std::chrono::minutes refreshPeriod = std::chrono::minutes(1)); - - DefaultAsyncS3ExpressIdentityProvider(const DefaultAsyncS3ExpressIdentityProvider& other) = delete; - DefaultAsyncS3ExpressIdentityProvider(DefaultAsyncS3ExpressIdentityProvider&& other) noexcept = delete; - DefaultAsyncS3ExpressIdentityProvider& operator=(const DefaultAsyncS3ExpressIdentityProvider& other) = delete; - DefaultAsyncS3ExpressIdentityProvider& operator=(DefaultAsyncS3ExpressIdentityProvider&& other) noexcept = delete; - - virtual ~DefaultAsyncS3ExpressIdentityProvider() override; - - S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) override; - - private: - void refreshIdentities(std::chrono::minutes refreshPeriod); - void threadSafeKeyInsert(const Aws::String& key); - bool threadSafeKeyHas(const Aws::String& key); - void threadSafeKeyEmpty(); - - mutable std::shared_ptr> m_credentialsCache; - Aws::Set m_keysUsed; - mutable std::mutex m_keysUsedMutex; - mutable bool m_shouldStopBackgroundRefresh; - Aws::UniquePtr m_backgroundRefreshThread; - mutable std::mutex m_shutDownMutex; - mutable std::condition_variable m_shutdownCondition; + class AWS_S3_API SmithyDefaultS3ExpressIdentityProvider : public SmithyS3ExpressIdentityProvider { + public: + explicit SmithyDefaultS3ExpressIdentityProvider(const S3Client& s3Client); + explicit SmithyDefaultS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache); + SmithyDefaultS3ExpressIdentityProvider(const SmithyDefaultS3ExpressIdentityProvider& other) = delete; + SmithyDefaultS3ExpressIdentityProvider(SmithyDefaultS3ExpressIdentityProvider&& other) noexcept = delete; + SmithyDefaultS3ExpressIdentityProvider& operator=(const SmithyDefaultS3ExpressIdentityProvider& other) = delete; + SmithyDefaultS3ExpressIdentityProvider& operator=(SmithyDefaultS3ExpressIdentityProvider&& other) noexcept = delete; + virtual ~SmithyDefaultS3ExpressIdentityProvider() override = default; + + protected: + smithy::AwsCredentialIdentity GetS3ExpressAwsIdentity(const std::shared_ptr &serviceSpecificParameters) override; + + private: + mutable std::shared_ptr> m_credentialsCache; + }; + + class AWS_S3_API SmithyDefaultAsyncS3ExpressIdentityProvider : public SmithyS3ExpressIdentityProvider { + public: + explicit SmithyDefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, + std::chrono::minutes refreshPeriod = std::chrono::minutes(1)); + + explicit SmithyDefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache, + std::chrono::minutes refreshPeriod = std::chrono::minutes(1)); + + SmithyDefaultAsyncS3ExpressIdentityProvider(const SmithyDefaultAsyncS3ExpressIdentityProvider& other) = delete; + SmithyDefaultAsyncS3ExpressIdentityProvider(SmithyDefaultAsyncS3ExpressIdentityProvider&& other) noexcept = delete; + SmithyDefaultAsyncS3ExpressIdentityProvider& operator=( + const SmithyDefaultAsyncS3ExpressIdentityProvider& other) = delete; + SmithyDefaultAsyncS3ExpressIdentityProvider& operator=(SmithyDefaultAsyncS3ExpressIdentityProvider&& other) noexcept = delete; + virtual ~SmithyDefaultAsyncS3ExpressIdentityProvider() override; + protected: + smithy::AwsCredentialIdentity GetS3ExpressAwsIdentity(const std::shared_ptr &serviceSpecificParameters) override; + + private: + void refreshIdentities(std::chrono::minutes refreshPeriod); + void threadSafeKeyInsert(const Aws::String& key); + bool threadSafeKeyHas(const Aws::String& key); + void threadSafeKeyEmpty(); + + mutable std::shared_ptr> m_credentialsCache; + Aws::Set m_keysUsed; + mutable std::mutex m_keysUsedMutex; + mutable bool m_shouldStopBackgroundRefresh; + Aws::UniquePtr m_backgroundRefreshThread; + mutable std::mutex m_shutDownMutex; + mutable std::condition_variable m_shutdownCondition; }; } -} +} \ No newline at end of file diff --git a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigV4AuthScheme.h b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigV4AuthScheme.h new file mode 100644 index 00000000000..58c2683bea3 --- /dev/null +++ b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigV4AuthScheme.h @@ -0,0 +1,54 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include +#include +#include +#include + +namespace Aws { +namespace S3 { + constexpr char SIGV4_EXPRESS[] = "sigv4-s3express"; + + class AWS_S3_API S3ExpressSigV4AuthScheme : public smithy::AuthScheme< smithy::AwsCredentialIdentityBase> + { + public: + using AwsCredentialIdentityResolverT = smithy::IdentityResolverBase; + using AwsCredentialSignerT = smithy::AwsSignerBase; + using S3ExpressSigV4AuthSchemeParameters = smithy::DefaultAuthSchemeResolverParameters; + + explicit S3ExpressSigV4AuthScheme(std::shared_ptr identityResolver, + const Aws::String& serviceName, + const Aws::String& region, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy, + bool urlEscapePath) + : AuthScheme(SIGV4_EXPRESS), + m_identityResolver{identityResolver}, + m_signer{Aws::MakeShared>("S3ExpressSigV4AuthScheme", serviceName, region, policy, urlEscapePath)} + { + assert(m_identityResolver); + assert(m_signer); + } + + virtual ~S3ExpressSigV4AuthScheme() = default; + + std::shared_ptr identityResolver() override + { + return m_identityResolver; + } + + std::shared_ptr signer() override + { + return m_signer; + } + protected: + std::shared_ptr m_identityResolver; + std::shared_ptr m_signer; + }; +} +} diff --git a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigV4AuthSchemeOption.h b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigV4AuthSchemeOption.h new file mode 100644 index 00000000000..f5fe328e907 --- /dev/null +++ b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigV4AuthSchemeOption.h @@ -0,0 +1,23 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#pragma once + +#include +#include + +namespace Aws { +namespace S3 { + + struct AWS_S3_API S3ExpressSigV4AuthSchemeOption + { + static smithy::AuthSchemeOption s3ExpressSigV4AuthSchemeOption; + static smithy::AuthSchemeOption GetS3ExpressSigV4AuthSchemeOption() { + return s3ExpressSigV4AuthSchemeOption; + } + + }; +} +} diff --git a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigner.h b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigner.h index 0268ea42671..906f9c8ee9b 100644 --- a/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigner.h +++ b/generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigner.h @@ -12,10 +12,78 @@ #include #include #include +#include +#include +#include namespace Aws { - namespace S3 { - class AWS_S3_API S3ExpressSigner : public Aws::Client::AWSAuthV4Signer { +namespace S3 { + extern AWS_S3_API const char *S3_EXPRESS_SIGNER_NAME; + +namespace { + template + struct IsValidS3ExpressSigner : std::false_type {}; + + template <> + struct IsValidS3ExpressSigner : std::true_type {}; + + template <> + struct IsValidS3ExpressSigner : std::true_type {}; +} + + //Ensuring S3 Express Signer can use Sigv4 or Sigv4a signing algorithm + template + class S3ExpressSignerBase : public std::enable_if::value, BASECLASS>::type + { + public: + using SigningFutureOutcome = typename BASECLASS::SigningFutureOutcome; + using SigningProperties = typename BASECLASS::SigningProperties; + using SigningError = typename BASECLASS::SigningError; + explicit S3ExpressSignerBase(const Aws::String& serviceName, const Aws::String& region) + : BASECLASS(serviceName, region) + { + } + + explicit S3ExpressSignerBase(const Aws::String& serviceName, const Aws::String& region, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy, bool escapeUrl) + : BASECLASS(serviceName, region, policy, escapeUrl) + { + } + + template + explicit S3ExpressSignerBase(Args&&... args) + : BASECLASS(std::forward(args)...) + { + } + + + SigningFutureOutcome sign(std::shared_ptr httpRequest, const smithy::AwsCredentialIdentityBase& identity, SigningProperties properties) override; + + SigningFutureOutcome presign(std::shared_ptr httpRequest, const smithy::AwsCredentialIdentityBase& identity, SigningProperties properties, const Aws::String& region, const Aws::String& serviceName, long long expirationTimeInSeconds) override; + + protected: + + + inline bool hasRequestId(const Aws::String &requestId) const { + std::lock_guard lock(m_requestProcessing); + return m_requestsProcessing.find(requestId) != m_requestsProcessing.end(); + } + + inline void putRequestId(const Aws::String &requestId) const { + std::lock_guard lock(m_requestProcessing); + m_requestsProcessing.insert(requestId); + } + + inline void deleteRequestId(const Aws::String &requestId) const { + std::lock_guard lock(m_requestProcessing); + m_requestsProcessing.erase(requestId); + } + + mutable std::set m_requestsProcessing; + mutable std::mutex m_requestProcessing; + }; + + + class AWS_S3_API S3ExpressSigner : public Aws::Client::AWSAuthV4Signer { public: S3ExpressSigner(std::shared_ptr S3ExpressIdentityProvider, const std::shared_ptr &credentialsProvider, @@ -69,6 +137,7 @@ namespace Aws { const Aws::String m_serviceName; const Aws::String m_region; const Aws::String m_endpoint; - }; - } + }; + +} } diff --git a/generated/src/aws-cpp-sdk-s3/source/S3Client.cpp b/generated/src/aws-cpp-sdk-s3/source/S3Client.cpp index 0134be223a8..fd57d7f41c2 100644 --- a/generated/src/aws-cpp-sdk-s3/source/S3Client.cpp +++ b/generated/src/aws-cpp-sdk-s3/source/S3Client.cpp @@ -17,6 +17,9 @@ #include #include #include +#include +#include +#include #include #include @@ -121,7 +124,12 @@ #include #include #include -#include +#include +#include +#include +#include +#include +#include #include @@ -149,184 +157,191 @@ namespace Aws const char* S3Client::GetServiceName() {return SERVICE_NAME;} const char* S3Client::GetAllocationTag() {return ALLOCATION_TAG;} -S3Client::S3Client(const S3Client &rhs) : - BASECLASS(rhs.m_clientConfiguration, - Aws::MakeShared(ALLOCATION_TAG, - rhs.GetCredentialsProvider(), - rhs.m_clientConfiguration.identityProviderSupplier(*this), - SERVICE_NAME, - Aws::Region::ComputeSignerRegion(rhs.m_clientConfiguration.region), - rhs.m_clientConfiguration.payloadSigningPolicy, - /*doubleEncodeValue*/ false), - Aws::MakeShared(ALLOCATION_TAG)), - Aws::Client::ClientWithAsyncTemplateMethods(), - m_clientConfiguration(rhs.m_clientConfiguration), - m_endpointProvider(rhs.m_endpointProvider) {} +S3Client::S3Client(const S3::S3ClientConfiguration& clientConfiguration, + std::shared_ptr endpointProvider) : + AwsSmithyClientT(clientConfiguration, + GetServiceName(), + "S3", + Aws::Http::CreateHttpClient(clientConfiguration), + Aws::MakeShared(ALLOCATION_TAG), + endpointProvider ? endpointProvider : Aws::MakeShared(ALLOCATION_TAG), + Aws::MakeShared(ALLOCATION_TAG), + { + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG); + return { + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, + {S3::S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption.schemeId, S3::S3ExpressSigV4AuthScheme{clientConfiguration.smithyIdentityProviderSupplier(*this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, + {smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption.schemeId, smithy::SigV4aAuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, + }; + }() + }) +{} + +S3Client::S3Client(const AWSCredentials& credentials, + std::shared_ptr endpointProvider, + const S3::S3ClientConfiguration& clientConfiguration) : + AwsSmithyClientT(clientConfiguration, + GetServiceName(), + "S3", + Aws::Http::CreateHttpClient(clientConfiguration), + Aws::MakeShared(ALLOCATION_TAG), + endpointProvider ? endpointProvider : Aws::MakeShared(ALLOCATION_TAG), + Aws::MakeShared(ALLOCATION_TAG), + { + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG, credentials ); + return { + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, + {S3::S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption.schemeId, S3::S3ExpressSigV4AuthScheme{clientConfiguration.smithyIdentityProviderSupplier(*this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, + {smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption.schemeId, smithy::SigV4aAuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, + }; + }() + }) +{} + +S3Client::S3Client(const std::shared_ptr& credentialsProvider, + std::shared_ptr endpointProvider, + const S3::S3ClientConfiguration& clientConfiguration) : + AwsSmithyClientT(clientConfiguration, + GetServiceName(), + "S3", + Aws::Http::CreateHttpClient(clientConfiguration), + Aws::MakeShared(ALLOCATION_TAG), + endpointProvider ? endpointProvider : Aws::MakeShared(ALLOCATION_TAG), + Aws::MakeShared(ALLOCATION_TAG), + { + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG, credentialsProvider ); + return { + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, + {S3::S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption.schemeId, S3::S3ExpressSigV4AuthScheme{clientConfiguration.smithyIdentityProviderSupplier(*this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, + {smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption.schemeId, smithy::SigV4aAuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, + }; + }() + }) +{} + +/* Legacy constructors due deprecation */ +S3Client::S3Client(const Client::ClientConfiguration& clientConfiguration, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signPayloads /*= Never*/, + bool useVirtualAddressing /*= true*/, + Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption): + AwsSmithyClientT( + S3::S3ClientConfiguration{clientConfiguration, signPayloads, useVirtualAddressing, USEast1RegionalEndPointOption}, + GetServiceName(), + "S3", + Aws::Http::CreateHttpClient(clientConfiguration), + Aws::MakeShared(ALLOCATION_TAG), + Aws::MakeShared(ALLOCATION_TAG), + Aws::MakeShared(ALLOCATION_TAG), + { + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG); + return { + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, + {S3::S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption.schemeId, S3::S3ExpressSigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, + {smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption.schemeId, smithy::SigV4aAuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, + }; + }() + }) +{} + +S3Client::S3Client( + const Aws::Auth::AWSCredentials& credentials, + const Client::ClientConfiguration& clientConfiguration, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signPayloads /*= Never*/, + bool useVirtualAddressing /*= true*/, + Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption): + AwsSmithyClientT( + S3::S3ClientConfiguration{clientConfiguration, signPayloads, useVirtualAddressing, USEast1RegionalEndPointOption}, + GetServiceName(), + "S3", + Aws::Http::CreateHttpClient(clientConfiguration), + Aws::MakeShared(ALLOCATION_TAG), + Aws::MakeShared(ALLOCATION_TAG), + Aws::MakeShared(ALLOCATION_TAG), + { + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG, credentials ); + return { + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, + {S3::S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption.schemeId, S3::S3ExpressSigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, + {smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption.schemeId, smithy::SigV4aAuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, + }; + }() + }) +{} + +S3Client::S3Client( + const std::shared_ptr& credentialsProvider, + const Client::ClientConfiguration& clientConfiguration, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signPayloads /*= Never*/, + bool useVirtualAddressing /*= true*/, + Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption): + AwsSmithyClientT( + S3::S3ClientConfiguration{clientConfiguration, signPayloads, useVirtualAddressing, USEast1RegionalEndPointOption}, + GetServiceName(), + "S3", + Aws::Http::CreateHttpClient(clientConfiguration), + Aws::MakeShared(ALLOCATION_TAG), + Aws::MakeShared(ALLOCATION_TAG), + Aws::MakeShared(ALLOCATION_TAG), + { + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG, credentialsProvider ); + return { + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, + {S3::S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption.schemeId, S3::S3ExpressSigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, + {smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption.schemeId, smithy::SigV4aAuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, + }; + }() + }) +{} S3Client& S3Client::operator=(const S3Client &rhs) { if (&rhs == this) { return *this; } - BASECLASS::operator=(rhs); - m_signerProvider = Aws::MakeShared(ALLOCATION_TAG, - rhs.GetCredentialsProvider(), - rhs.m_clientConfiguration.identityProviderSupplier(*this), - SERVICE_NAME, - Aws::Region::ComputeSignerRegion(rhs.m_clientConfiguration.region), - rhs.m_clientConfiguration.payloadSigningPolicy, - /*doubleEncodeValue*/ false); - m_clientConfiguration = rhs.m_clientConfiguration; - m_endpointProvider = rhs.m_endpointProvider; - init(m_clientConfiguration); + AwsSmithyClientT::operator=(rhs); + m_authSchemes = + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG); + return { + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}}, + {S3::S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption.schemeId, S3::S3ExpressSigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}}, + {smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption.schemeId, smithy::SigV4aAuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}}, + }; + }(); return *this; } -S3Client::S3Client(S3Client &&rhs) noexcept : - BASECLASS(rhs.m_clientConfiguration, - Aws::MakeShared(ALLOCATION_TAG, - rhs.GetCredentialsProvider(), - rhs.m_clientConfiguration.identityProviderSupplier(*this), - SERVICE_NAME, - Aws::Region::ComputeSignerRegion(rhs.m_clientConfiguration.region), - rhs.m_clientConfiguration.payloadSigningPolicy, - /*doubleEncodeValue*/ false), - Aws::MakeShared(ALLOCATION_TAG)), - Aws::Client::ClientWithAsyncTemplateMethods(), - m_clientConfiguration(std::move(rhs.m_clientConfiguration)), - m_endpointProvider(std::move(rhs.m_endpointProvider)) {} S3Client& S3Client::operator=(S3Client &&rhs) noexcept { if (&rhs == this) { return *this; } - BASECLASS::operator=(std::move(rhs)); - m_signerProvider = Aws::MakeShared(ALLOCATION_TAG, - rhs.GetCredentialsProvider(), - rhs.m_clientConfiguration.identityProviderSupplier(*this), - SERVICE_NAME, - Aws::Region::ComputeSignerRegion(rhs.m_clientConfiguration.region), - rhs.m_clientConfiguration.payloadSigningPolicy, - /*doubleEncodeValue*/ false); - m_clientConfiguration = std::move(rhs.m_clientConfiguration); - m_endpointProvider = std::move(rhs.m_endpointProvider); - init(m_clientConfiguration); + AwsSmithyClientT::operator=(std::move(rhs)); return *this; } +/* copy/move constructors */ +S3Client::S3Client(const S3Client &rhs) : + AwsSmithyClientT(rhs),Aws::Client::ClientWithAsyncTemplateMethods() { + m_authSchemes = + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG); + return { + {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption.schemeId, smithy::SigV4AuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}}, + {S3::S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption.schemeId, S3::S3ExpressSigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}}, + {smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption.schemeId, smithy::SigV4aAuthScheme{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}}, + }; + }(); + } -S3Client::S3Client(const S3::S3ClientConfiguration& clientConfiguration, - std::shared_ptr endpointProvider) : - BASECLASS(clientConfiguration, - Aws::MakeShared(ALLOCATION_TAG, - Aws::MakeShared(ALLOCATION_TAG), - clientConfiguration.identityProviderSupplier(*this), - SERVICE_NAME, - Aws::Region::ComputeSignerRegion(clientConfiguration.region), - clientConfiguration.payloadSigningPolicy, - /*doubleEncodeValue*/ false), - Aws::MakeShared(ALLOCATION_TAG)), - m_clientConfiguration(clientConfiguration), - m_endpointProvider(endpointProvider ? std::move(endpointProvider) : Aws::MakeShared(ALLOCATION_TAG)) -{ - init(m_clientConfiguration); -} - -S3Client::S3Client(const AWSCredentials& credentials, - std::shared_ptr endpointProvider, - const S3::S3ClientConfiguration& clientConfiguration) : - BASECLASS(clientConfiguration, - Aws::MakeShared(ALLOCATION_TAG, - Aws::MakeShared(ALLOCATION_TAG, credentials), - clientConfiguration.identityProviderSupplier(*this), - SERVICE_NAME, - Aws::Region::ComputeSignerRegion(clientConfiguration.region), - clientConfiguration.payloadSigningPolicy, - /*doubleEncodeValue*/ false), - Aws::MakeShared(ALLOCATION_TAG)), - m_clientConfiguration(clientConfiguration), - m_endpointProvider(endpointProvider ? std::move(endpointProvider) : Aws::MakeShared(ALLOCATION_TAG)) -{ - init(m_clientConfiguration); -} - -S3Client::S3Client(const std::shared_ptr& credentialsProvider, - std::shared_ptr endpointProvider, - const S3::S3ClientConfiguration& clientConfiguration) : - BASECLASS(clientConfiguration, - Aws::MakeShared(ALLOCATION_TAG, - credentialsProvider, - clientConfiguration.identityProviderSupplier(*this), - SERVICE_NAME, - Aws::Region::ComputeSignerRegion(clientConfiguration.region), - clientConfiguration.payloadSigningPolicy, - /*doubleEncodeValue*/ false), - Aws::MakeShared(ALLOCATION_TAG)), - m_clientConfiguration(clientConfiguration), - m_endpointProvider(endpointProvider ? std::move(endpointProvider) : Aws::MakeShared(ALLOCATION_TAG)) -{ - init(m_clientConfiguration); -} - - /* Legacy constructors due deprecation */ - S3Client::S3Client(const Client::ClientConfiguration& clientConfiguration, - Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signPayloads /*= Never*/, - bool useVirtualAddressing /*= true*/, - Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption) : - BASECLASS(clientConfiguration, - Aws::MakeShared(ALLOCATION_TAG, - Aws::MakeShared(ALLOCATION_TAG), - Aws::MakeShared(ALLOCATION_TAG, *this), - SERVICE_NAME, - Aws::Region::ComputeSignerRegion(clientConfiguration.region), - signPayloads, - /*doubleEncodeValue*/ false), - Aws::MakeShared(ALLOCATION_TAG)), - m_clientConfiguration(clientConfiguration, signPayloads, useVirtualAddressing, USEast1RegionalEndPointOption), - m_endpointProvider(Aws::MakeShared(ALLOCATION_TAG)) -{ - init(m_clientConfiguration); -} - -S3Client::S3Client(const AWSCredentials& credentials, - const Client::ClientConfiguration& clientConfiguration, - Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signPayloads /*= Never*/, - bool useVirtualAddressing /*= true*/, - Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption) : - BASECLASS(clientConfiguration, - Aws::MakeShared(ALLOCATION_TAG, - Aws::MakeShared(ALLOCATION_TAG, credentials), - Aws::MakeShared(ALLOCATION_TAG, *this), - SERVICE_NAME, - Aws::Region::ComputeSignerRegion(clientConfiguration.region), - signPayloads, - /*doubleEncodeValue*/ false), - Aws::MakeShared(ALLOCATION_TAG)), - m_clientConfiguration(clientConfiguration, signPayloads, useVirtualAddressing, USEast1RegionalEndPointOption), - m_endpointProvider(Aws::MakeShared(ALLOCATION_TAG)) -{ - init(m_clientConfiguration); -} - -S3Client::S3Client(const std::shared_ptr& credentialsProvider, - const Client::ClientConfiguration& clientConfiguration, - Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signPayloads /*= Never*/, - bool useVirtualAddressing /*= true*/, - Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption) : - BASECLASS(clientConfiguration, - Aws::MakeShared(ALLOCATION_TAG, - credentialsProvider, - Aws::MakeShared(ALLOCATION_TAG, *this), - SERVICE_NAME, - Aws::Region::ComputeSignerRegion(clientConfiguration.region), - signPayloads, - /*doubleEncodeValue*/ false), - Aws::MakeShared(ALLOCATION_TAG)), - m_clientConfiguration(clientConfiguration, signPayloads, useVirtualAddressing, USEast1RegionalEndPointOption), - m_endpointProvider(Aws::MakeShared(ALLOCATION_TAG)) -{ - init(m_clientConfiguration); -} +S3Client::S3Client(S3Client &&rhs) noexcept : + AwsSmithyClientT(std::move(rhs)) {} +/* End of legacy constructors due deprecation */ - /* End of legacy constructors due deprecation */ S3Client::~S3Client() { ShutdownSdkClient(this, -1); @@ -337,27 +352,11 @@ std::shared_ptr& S3Client::accessEndpointProvider() return m_endpointProvider; } -void S3Client::init(const S3::S3ClientConfiguration& config) -{ - AWSClient::SetServiceClientName("S3"); - if (!m_clientConfiguration.executor) { - if (!m_clientConfiguration.configFactories.executorCreateFn()) { - AWS_LOGSTREAM_FATAL(ALLOCATION_TAG, "Failed to initialize client: config is missing Executor or executorCreateFn"); - m_isInitialized = false; - return; - } - m_clientConfiguration.executor = m_clientConfiguration.configFactories.executorCreateFn(); - } - AWS_CHECK_PTR(SERVICE_NAME, m_endpointProvider); - m_endpointProvider->InitBuiltInParameters(config); -} - void S3Client::OverrideEndpoint(const Aws::String& endpoint) { - AWS_CHECK_PTR(SERVICE_NAME, m_endpointProvider); - m_endpointProvider->OverrideEndpoint(endpoint); + AWS_CHECK_PTR(SERVICE_NAME, m_endpointProvider); + m_endpointProvider->OverrideEndpoint(endpoint); } - AbortMultipartUploadOutcome S3Client::AbortMultipartUpload(const AbortMultipartUploadRequest& request) const { AWS_OPERATION_GUARD(AbortMultipartUpload); @@ -377,30 +376,25 @@ AbortMultipartUploadOutcome S3Client::AbortMultipartUpload(const AbortMultipartU AWS_LOGSTREAM_ERROR("AbortMultipartUpload", "Required field: UploadId, is not set"); return AbortMultipartUploadOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [UploadId]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, AbortMultipartUpload, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, AbortMultipartUpload, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, AbortMultipartUpload, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> AbortMultipartUploadOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, AbortMultipartUpload, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + [&]()-> AbortMultipartUploadOutcome { + return AbortMultipartUploadOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments(request.GetKey()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return AbortMultipartUploadOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -426,30 +420,25 @@ CompleteMultipartUploadOutcome S3Client::CompleteMultipartUpload(const CompleteM AWS_LOGSTREAM_ERROR("CompleteMultipartUpload", "Required field: UploadId, is not set"); return CompleteMultipartUploadOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [UploadId]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, CompleteMultipartUpload, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, CompleteMultipartUpload, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, CompleteMultipartUpload, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> CompleteMultipartUploadOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, CompleteMultipartUpload, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + [&]()-> CompleteMultipartUploadOutcome { + return CompleteMultipartUploadOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments(request.GetKey()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return CompleteMultipartUploadOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_POST)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -475,30 +464,25 @@ CopyObjectOutcome S3Client::CopyObject(const CopyObjectRequest& request) const AWS_LOGSTREAM_ERROR("CopyObject", "Required field: Key, is not set"); return CopyObjectOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, CopyObject, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, CopyObject, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, CopyObject, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> CopyObjectOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, CopyObject, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + [&]()-> CopyObjectOutcome { + return CopyObjectOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments(request.GetKey()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return CopyObjectOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -530,29 +514,25 @@ CreateBucketOutcome S3Client::CreateBucket(const CreateBucketRequest& request) c AWS_LOGSTREAM_ERROR("CreateBucket", "Required field: Bucket, is not set"); return CreateBucketOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, CreateBucket, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, CreateBucket, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, CreateBucket, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> CreateBucketOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, CreateBucket, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> CreateBucketOutcome { + return CreateBucketOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return CreateBucketOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -568,32 +548,28 @@ CreateBucketMetadataTableConfigurationOutcome S3Client::CreateBucketMetadataTabl AWS_LOGSTREAM_ERROR("CreateBucketMetadataTableConfiguration", "Required field: Bucket, is not set"); return CreateBucketMetadataTableConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, CreateBucketMetadataTableConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, CreateBucketMetadataTableConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, CreateBucketMetadataTableConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> CreateBucketMetadataTableConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, CreateBucketMetadataTableConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> CreateBucketMetadataTableConfigurationOutcome { + return CreateBucketMetadataTableConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?metadataTable"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return CreateBucketMetadataTableConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_POST)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -614,33 +590,28 @@ CreateMultipartUploadOutcome S3Client::CreateMultipartUpload(const CreateMultipa AWS_LOGSTREAM_ERROR("CreateMultipartUpload", "Required field: Key, is not set"); return CreateMultipartUploadOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, CreateMultipartUpload, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, CreateMultipartUpload, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, CreateMultipartUpload, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> CreateMultipartUploadOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, CreateMultipartUpload, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> CreateMultipartUploadOutcome { + return CreateMultipartUploadOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?uploads"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return CreateMultipartUploadOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_POST)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -656,32 +627,28 @@ CreateSessionOutcome S3Client::CreateSession(const CreateSessionRequest& request AWS_LOGSTREAM_ERROR("CreateSession", "Required field: Bucket, is not set"); return CreateSessionOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, CreateSession, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, CreateSession, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, CreateSession, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> CreateSessionOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, CreateSession, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> CreateSessionOutcome { + return CreateSessionOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?session"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return CreateSessionOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -697,29 +664,25 @@ DeleteBucketOutcome S3Client::DeleteBucket(const DeleteBucketRequest& request) c AWS_LOGSTREAM_ERROR("DeleteBucket", "Required field: Bucket, is not set"); return DeleteBucketOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucket, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucket, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucket, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucket, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketOutcome { + return DeleteBucketOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -740,32 +703,28 @@ DeleteBucketAnalyticsConfigurationOutcome S3Client::DeleteBucketAnalyticsConfigu AWS_LOGSTREAM_ERROR("DeleteBucketAnalyticsConfiguration", "Required field: Id, is not set"); return DeleteBucketAnalyticsConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketAnalyticsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketAnalyticsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketAnalyticsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketAnalyticsConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketAnalyticsConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketAnalyticsConfigurationOutcome { + return DeleteBucketAnalyticsConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?analytics"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketAnalyticsConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -781,32 +740,28 @@ DeleteBucketCorsOutcome S3Client::DeleteBucketCors(const DeleteBucketCorsRequest AWS_LOGSTREAM_ERROR("DeleteBucketCors", "Required field: Bucket, is not set"); return DeleteBucketCorsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketCors, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketCors, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketCors, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketCorsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketCors, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketCorsOutcome { + return DeleteBucketCorsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?cors"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketCorsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -822,32 +777,28 @@ DeleteBucketEncryptionOutcome S3Client::DeleteBucketEncryption(const DeleteBucke AWS_LOGSTREAM_ERROR("DeleteBucketEncryption", "Required field: Bucket, is not set"); return DeleteBucketEncryptionOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketEncryption, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketEncryption, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketEncryption, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketEncryptionOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketEncryption, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketEncryptionOutcome { + return DeleteBucketEncryptionOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?encryption"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketEncryptionOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -868,32 +819,28 @@ DeleteBucketIntelligentTieringConfigurationOutcome S3Client::DeleteBucketIntelli AWS_LOGSTREAM_ERROR("DeleteBucketIntelligentTieringConfiguration", "Required field: Id, is not set"); return DeleteBucketIntelligentTieringConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketIntelligentTieringConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketIntelligentTieringConfigurationOutcome { + return DeleteBucketIntelligentTieringConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?intelligent-tiering"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketIntelligentTieringConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -914,32 +861,28 @@ DeleteBucketInventoryConfigurationOutcome S3Client::DeleteBucketInventoryConfigu AWS_LOGSTREAM_ERROR("DeleteBucketInventoryConfiguration", "Required field: Id, is not set"); return DeleteBucketInventoryConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketInventoryConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketInventoryConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketInventoryConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketInventoryConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketInventoryConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketInventoryConfigurationOutcome { + return DeleteBucketInventoryConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?inventory"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketInventoryConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -955,32 +898,28 @@ DeleteBucketLifecycleOutcome S3Client::DeleteBucketLifecycle(const DeleteBucketL AWS_LOGSTREAM_ERROR("DeleteBucketLifecycle", "Required field: Bucket, is not set"); return DeleteBucketLifecycleOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketLifecycle, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketLifecycle, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketLifecycle, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketLifecycleOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketLifecycle, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketLifecycleOutcome { + return DeleteBucketLifecycleOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?lifecycle"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketLifecycleOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -996,32 +935,28 @@ DeleteBucketMetadataTableConfigurationOutcome S3Client::DeleteBucketMetadataTabl AWS_LOGSTREAM_ERROR("DeleteBucketMetadataTableConfiguration", "Required field: Bucket, is not set"); return DeleteBucketMetadataTableConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketMetadataTableConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketMetadataTableConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketMetadataTableConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketMetadataTableConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketMetadataTableConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketMetadataTableConfigurationOutcome { + return DeleteBucketMetadataTableConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?metadataTable"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketMetadataTableConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1042,32 +977,28 @@ DeleteBucketMetricsConfigurationOutcome S3Client::DeleteBucketMetricsConfigurati AWS_LOGSTREAM_ERROR("DeleteBucketMetricsConfiguration", "Required field: Id, is not set"); return DeleteBucketMetricsConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketMetricsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketMetricsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketMetricsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketMetricsConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketMetricsConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketMetricsConfigurationOutcome { + return DeleteBucketMetricsConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?metrics"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketMetricsConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1083,32 +1014,28 @@ DeleteBucketOwnershipControlsOutcome S3Client::DeleteBucketOwnershipControls(con AWS_LOGSTREAM_ERROR("DeleteBucketOwnershipControls", "Required field: Bucket, is not set"); return DeleteBucketOwnershipControlsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketOwnershipControls, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketOwnershipControls, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketOwnershipControls, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketOwnershipControlsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketOwnershipControls, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketOwnershipControlsOutcome { + return DeleteBucketOwnershipControlsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?ownershipControls"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketOwnershipControlsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1124,32 +1051,28 @@ DeleteBucketPolicyOutcome S3Client::DeleteBucketPolicy(const DeleteBucketPolicyR AWS_LOGSTREAM_ERROR("DeleteBucketPolicy", "Required field: Bucket, is not set"); return DeleteBucketPolicyOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketPolicy, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketPolicy, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketPolicy, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketPolicyOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketPolicy, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketPolicyOutcome { + return DeleteBucketPolicyOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?policy"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketPolicyOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1165,32 +1088,28 @@ DeleteBucketReplicationOutcome S3Client::DeleteBucketReplication(const DeleteBuc AWS_LOGSTREAM_ERROR("DeleteBucketReplication", "Required field: Bucket, is not set"); return DeleteBucketReplicationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketReplication, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketReplication, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketReplication, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketReplicationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketReplication, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketReplicationOutcome { + return DeleteBucketReplicationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?replication"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketReplicationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1206,32 +1125,28 @@ DeleteBucketTaggingOutcome S3Client::DeleteBucketTagging(const DeleteBucketTaggi AWS_LOGSTREAM_ERROR("DeleteBucketTagging", "Required field: Bucket, is not set"); return DeleteBucketTaggingOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketTaggingOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketTagging, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketTaggingOutcome { + return DeleteBucketTaggingOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?tagging"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketTaggingOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1247,32 +1162,28 @@ DeleteBucketWebsiteOutcome S3Client::DeleteBucketWebsite(const DeleteBucketWebsi AWS_LOGSTREAM_ERROR("DeleteBucketWebsite", "Required field: Bucket, is not set"); return DeleteBucketWebsiteOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteBucketWebsite, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteBucketWebsite, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteBucketWebsite, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteBucketWebsiteOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteBucketWebsite, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteBucketWebsiteOutcome { + return DeleteBucketWebsiteOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?website"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteBucketWebsiteOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1293,30 +1204,25 @@ DeleteObjectOutcome S3Client::DeleteObject(const DeleteObjectRequest& request) c AWS_LOGSTREAM_ERROR("DeleteObject", "Required field: Key, is not set"); return DeleteObjectOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteObject, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteObject, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteObject, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteObjectOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteObject, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + [&]()-> DeleteObjectOutcome { + return DeleteObjectOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments(request.GetKey()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteObjectOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1337,33 +1243,28 @@ DeleteObjectTaggingOutcome S3Client::DeleteObjectTagging(const DeleteObjectTaggi AWS_LOGSTREAM_ERROR("DeleteObjectTagging", "Required field: Key, is not set"); return DeleteObjectTaggingOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteObjectTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteObjectTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteObjectTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteObjectTaggingOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteObjectTagging, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteObjectTaggingOutcome { + return DeleteObjectTaggingOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?tagging"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteObjectTaggingOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1379,32 +1280,28 @@ DeleteObjectsOutcome S3Client::DeleteObjects(const DeleteObjectsRequest& request AWS_LOGSTREAM_ERROR("DeleteObjects", "Required field: Bucket, is not set"); return DeleteObjectsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeleteObjects, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeleteObjects, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeleteObjects, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeleteObjectsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeleteObjects, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeleteObjectsOutcome { + return DeleteObjectsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?delete"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeleteObjectsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_POST)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1420,32 +1317,28 @@ DeletePublicAccessBlockOutcome S3Client::DeletePublicAccessBlock(const DeletePub AWS_LOGSTREAM_ERROR("DeletePublicAccessBlock", "Required field: Bucket, is not set"); return DeletePublicAccessBlockOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, DeletePublicAccessBlock, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, DeletePublicAccessBlock, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, DeletePublicAccessBlock, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> DeletePublicAccessBlockOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, DeletePublicAccessBlock, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> DeletePublicAccessBlockOutcome { + return DeletePublicAccessBlockOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_DELETE, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?publicAccessBlock"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return DeletePublicAccessBlockOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_DELETE)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1461,32 +1354,28 @@ GetBucketAccelerateConfigurationOutcome S3Client::GetBucketAccelerateConfigurati AWS_LOGSTREAM_ERROR("GetBucketAccelerateConfiguration", "Required field: Bucket, is not set"); return GetBucketAccelerateConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketAccelerateConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketAccelerateConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketAccelerateConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketAccelerateConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketAccelerateConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketAccelerateConfigurationOutcome { + return GetBucketAccelerateConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?accelerate"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketAccelerateConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1502,32 +1391,28 @@ GetBucketAclOutcome S3Client::GetBucketAcl(const GetBucketAclRequest& request) c AWS_LOGSTREAM_ERROR("GetBucketAcl", "Required field: Bucket, is not set"); return GetBucketAclOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketAclOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketAcl, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketAclOutcome { + return GetBucketAclOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?acl"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketAclOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1548,32 +1433,28 @@ GetBucketAnalyticsConfigurationOutcome S3Client::GetBucketAnalyticsConfiguration AWS_LOGSTREAM_ERROR("GetBucketAnalyticsConfiguration", "Required field: Id, is not set"); return GetBucketAnalyticsConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketAnalyticsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketAnalyticsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketAnalyticsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketAnalyticsConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketAnalyticsConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketAnalyticsConfigurationOutcome { + return GetBucketAnalyticsConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?analytics"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketAnalyticsConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1589,32 +1470,28 @@ GetBucketCorsOutcome S3Client::GetBucketCors(const GetBucketCorsRequest& request AWS_LOGSTREAM_ERROR("GetBucketCors", "Required field: Bucket, is not set"); return GetBucketCorsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketCors, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketCors, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketCors, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketCorsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketCors, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketCorsOutcome { + return GetBucketCorsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?cors"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketCorsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1630,32 +1507,28 @@ GetBucketEncryptionOutcome S3Client::GetBucketEncryption(const GetBucketEncrypti AWS_LOGSTREAM_ERROR("GetBucketEncryption", "Required field: Bucket, is not set"); return GetBucketEncryptionOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketEncryption, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketEncryption, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketEncryption, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketEncryptionOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketEncryption, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketEncryptionOutcome { + return GetBucketEncryptionOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?encryption"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketEncryptionOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1676,32 +1549,28 @@ GetBucketIntelligentTieringConfigurationOutcome S3Client::GetBucketIntelligentTi AWS_LOGSTREAM_ERROR("GetBucketIntelligentTieringConfiguration", "Required field: Id, is not set"); return GetBucketIntelligentTieringConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketIntelligentTieringConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketIntelligentTieringConfigurationOutcome { + return GetBucketIntelligentTieringConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?intelligent-tiering"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketIntelligentTieringConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1722,32 +1591,28 @@ GetBucketInventoryConfigurationOutcome S3Client::GetBucketInventoryConfiguration AWS_LOGSTREAM_ERROR("GetBucketInventoryConfiguration", "Required field: Id, is not set"); return GetBucketInventoryConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketInventoryConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketInventoryConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketInventoryConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketInventoryConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketInventoryConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketInventoryConfigurationOutcome { + return GetBucketInventoryConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?inventory"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketInventoryConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1763,32 +1628,28 @@ GetBucketLifecycleConfigurationOutcome S3Client::GetBucketLifecycleConfiguration AWS_LOGSTREAM_ERROR("GetBucketLifecycleConfiguration", "Required field: Bucket, is not set"); return GetBucketLifecycleConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketLifecycleConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketLifecycleConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketLifecycleConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketLifecycleConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketLifecycleConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketLifecycleConfigurationOutcome { + return GetBucketLifecycleConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?lifecycle"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketLifecycleConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1804,32 +1665,28 @@ GetBucketLocationOutcome S3Client::GetBucketLocation(const GetBucketLocationRequ AWS_LOGSTREAM_ERROR("GetBucketLocation", "Required field: Bucket, is not set"); return GetBucketLocationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketLocation, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketLocation, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketLocation, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketLocationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketLocation, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketLocationOutcome { + return GetBucketLocationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?location"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketLocationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1845,32 +1702,28 @@ GetBucketLoggingOutcome S3Client::GetBucketLogging(const GetBucketLoggingRequest AWS_LOGSTREAM_ERROR("GetBucketLogging", "Required field: Bucket, is not set"); return GetBucketLoggingOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketLogging, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketLogging, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketLogging, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketLoggingOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketLogging, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketLoggingOutcome { + return GetBucketLoggingOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?logging"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketLoggingOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1886,32 +1739,28 @@ GetBucketMetadataTableConfigurationOutcome S3Client::GetBucketMetadataTableConfi AWS_LOGSTREAM_ERROR("GetBucketMetadataTableConfiguration", "Required field: Bucket, is not set"); return GetBucketMetadataTableConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketMetadataTableConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketMetadataTableConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketMetadataTableConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketMetadataTableConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketMetadataTableConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketMetadataTableConfigurationOutcome { + return GetBucketMetadataTableConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?metadataTable"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketMetadataTableConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1932,32 +1781,28 @@ GetBucketMetricsConfigurationOutcome S3Client::GetBucketMetricsConfiguration(con AWS_LOGSTREAM_ERROR("GetBucketMetricsConfiguration", "Required field: Id, is not set"); return GetBucketMetricsConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketMetricsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketMetricsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketMetricsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketMetricsConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketMetricsConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketMetricsConfigurationOutcome { + return GetBucketMetricsConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?metrics"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketMetricsConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -1973,32 +1818,28 @@ GetBucketNotificationConfigurationOutcome S3Client::GetBucketNotificationConfigu AWS_LOGSTREAM_ERROR("GetBucketNotificationConfiguration", "Required field: Bucket, is not set"); return GetBucketNotificationConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketNotificationConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketNotificationConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketNotificationConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketNotificationConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketNotificationConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketNotificationConfigurationOutcome { + return GetBucketNotificationConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?notification"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketNotificationConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2014,32 +1855,28 @@ GetBucketOwnershipControlsOutcome S3Client::GetBucketOwnershipControls(const Get AWS_LOGSTREAM_ERROR("GetBucketOwnershipControls", "Required field: Bucket, is not set"); return GetBucketOwnershipControlsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketOwnershipControls, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketOwnershipControls, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketOwnershipControls, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketOwnershipControlsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketOwnershipControls, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketOwnershipControlsOutcome { + return GetBucketOwnershipControlsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?ownershipControls"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketOwnershipControlsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2055,32 +1892,28 @@ GetBucketPolicyOutcome S3Client::GetBucketPolicy(const GetBucketPolicyRequest& r AWS_LOGSTREAM_ERROR("GetBucketPolicy", "Required field: Bucket, is not set"); return GetBucketPolicyOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketPolicy, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketPolicy, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketPolicy, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketPolicyOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketPolicy, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketPolicyOutcome { + return GetBucketPolicyOutcome(MakeRequestWithUnparsedResponse(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?policy"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketPolicyOutcome(MakeRequestWithUnparsedResponse(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2096,32 +1929,28 @@ GetBucketPolicyStatusOutcome S3Client::GetBucketPolicyStatus(const GetBucketPoli AWS_LOGSTREAM_ERROR("GetBucketPolicyStatus", "Required field: Bucket, is not set"); return GetBucketPolicyStatusOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketPolicyStatus, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketPolicyStatus, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketPolicyStatus, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketPolicyStatusOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketPolicyStatus, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketPolicyStatusOutcome { + return GetBucketPolicyStatusOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?policyStatus"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketPolicyStatusOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2137,32 +1966,28 @@ GetBucketReplicationOutcome S3Client::GetBucketReplication(const GetBucketReplic AWS_LOGSTREAM_ERROR("GetBucketReplication", "Required field: Bucket, is not set"); return GetBucketReplicationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketReplication, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketReplication, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketReplication, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketReplicationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketReplication, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketReplicationOutcome { + return GetBucketReplicationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?replication"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketReplicationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2178,32 +2003,28 @@ GetBucketRequestPaymentOutcome S3Client::GetBucketRequestPayment(const GetBucket AWS_LOGSTREAM_ERROR("GetBucketRequestPayment", "Required field: Bucket, is not set"); return GetBucketRequestPaymentOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketRequestPayment, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketRequestPayment, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketRequestPayment, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketRequestPaymentOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketRequestPayment, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketRequestPaymentOutcome { + return GetBucketRequestPaymentOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?requestPayment"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketRequestPaymentOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2219,32 +2040,28 @@ GetBucketTaggingOutcome S3Client::GetBucketTagging(const GetBucketTaggingRequest AWS_LOGSTREAM_ERROR("GetBucketTagging", "Required field: Bucket, is not set"); return GetBucketTaggingOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketTaggingOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketTagging, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketTaggingOutcome { + return GetBucketTaggingOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?tagging"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketTaggingOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2260,32 +2077,28 @@ GetBucketVersioningOutcome S3Client::GetBucketVersioning(const GetBucketVersioni AWS_LOGSTREAM_ERROR("GetBucketVersioning", "Required field: Bucket, is not set"); return GetBucketVersioningOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketVersioning, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketVersioning, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketVersioning, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketVersioningOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketVersioning, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketVersioningOutcome { + return GetBucketVersioningOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?versioning"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketVersioningOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2301,32 +2114,28 @@ GetBucketWebsiteOutcome S3Client::GetBucketWebsite(const GetBucketWebsiteRequest AWS_LOGSTREAM_ERROR("GetBucketWebsite", "Required field: Bucket, is not set"); return GetBucketWebsiteOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetBucketWebsite, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetBucketWebsite, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetBucketWebsite, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetBucketWebsiteOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetBucketWebsite, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetBucketWebsiteOutcome { + return GetBucketWebsiteOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?website"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetBucketWebsiteOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2347,30 +2156,25 @@ GetObjectOutcome S3Client::GetObject(const GetObjectRequest& request) const AWS_LOGSTREAM_ERROR("GetObject", "Required field: Key, is not set"); return GetObjectOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetObject, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetObject, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetObject, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetObjectOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetObject, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + [&]()-> GetObjectOutcome { + return GetObjectOutcome(MakeRequestWithUnparsedResponse(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments(request.GetKey()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetObjectOutcome(MakeRequestWithUnparsedResponse(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2407,33 +2211,28 @@ GetObjectAclOutcome S3Client::GetObjectAcl(const GetObjectAclRequest& request) c AWS_LOGSTREAM_ERROR("GetObjectAcl", "Required field: Key, is not set"); return GetObjectAclOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetObjectAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetObjectAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetObjectAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetObjectAclOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetObjectAcl, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetObjectAclOutcome { + return GetObjectAclOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?acl"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetObjectAclOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2459,33 +2258,28 @@ GetObjectAttributesOutcome S3Client::GetObjectAttributes(const GetObjectAttribut AWS_LOGSTREAM_ERROR("GetObjectAttributes", "Required field: ObjectAttributes, is not set"); return GetObjectAttributesOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [ObjectAttributes]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetObjectAttributes, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetObjectAttributes, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetObjectAttributes, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetObjectAttributesOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetObjectAttributes, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetObjectAttributesOutcome { + return GetObjectAttributesOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?attributes"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetObjectAttributesOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2506,33 +2300,28 @@ GetObjectLegalHoldOutcome S3Client::GetObjectLegalHold(const GetObjectLegalHoldR AWS_LOGSTREAM_ERROR("GetObjectLegalHold", "Required field: Key, is not set"); return GetObjectLegalHoldOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetObjectLegalHold, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetObjectLegalHold, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetObjectLegalHold, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetObjectLegalHoldOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetObjectLegalHold, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetObjectLegalHoldOutcome { + return GetObjectLegalHoldOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?legal-hold"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetObjectLegalHoldOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2548,32 +2337,28 @@ GetObjectLockConfigurationOutcome S3Client::GetObjectLockConfiguration(const Get AWS_LOGSTREAM_ERROR("GetObjectLockConfiguration", "Required field: Bucket, is not set"); return GetObjectLockConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetObjectLockConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetObjectLockConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetObjectLockConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetObjectLockConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetObjectLockConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetObjectLockConfigurationOutcome { + return GetObjectLockConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?object-lock"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetObjectLockConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2594,33 +2379,28 @@ GetObjectRetentionOutcome S3Client::GetObjectRetention(const GetObjectRetentionR AWS_LOGSTREAM_ERROR("GetObjectRetention", "Required field: Key, is not set"); return GetObjectRetentionOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetObjectRetention, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetObjectRetention, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetObjectRetention, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetObjectRetentionOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetObjectRetention, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetObjectRetentionOutcome { + return GetObjectRetentionOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?retention"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetObjectRetentionOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2641,33 +2421,28 @@ GetObjectTaggingOutcome S3Client::GetObjectTagging(const GetObjectTaggingRequest AWS_LOGSTREAM_ERROR("GetObjectTagging", "Required field: Key, is not set"); return GetObjectTaggingOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetObjectTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetObjectTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetObjectTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetObjectTaggingOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetObjectTagging, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetObjectTaggingOutcome { + return GetObjectTaggingOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?tagging"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetObjectTaggingOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2688,33 +2463,28 @@ GetObjectTorrentOutcome S3Client::GetObjectTorrent(const GetObjectTorrentRequest AWS_LOGSTREAM_ERROR("GetObjectTorrent", "Required field: Key, is not set"); return GetObjectTorrentOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetObjectTorrent, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetObjectTorrent, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetObjectTorrent, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetObjectTorrentOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetObjectTorrent, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetObjectTorrentOutcome { + return GetObjectTorrentOutcome(MakeRequestWithUnparsedResponse(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?torrent"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetObjectTorrentOutcome(MakeRequestWithUnparsedResponse(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2730,32 +2500,28 @@ GetPublicAccessBlockOutcome S3Client::GetPublicAccessBlock(const GetPublicAccess AWS_LOGSTREAM_ERROR("GetPublicAccessBlock", "Required field: Bucket, is not set"); return GetPublicAccessBlockOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, GetPublicAccessBlock, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, GetPublicAccessBlock, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, GetPublicAccessBlock, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> GetPublicAccessBlockOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, GetPublicAccessBlock, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> GetPublicAccessBlockOutcome { + return GetPublicAccessBlockOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?publicAccessBlock"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return GetPublicAccessBlockOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2771,29 +2537,25 @@ HeadBucketOutcome S3Client::HeadBucket(const HeadBucketRequest& request) const AWS_LOGSTREAM_ERROR("HeadBucket", "Required field: Bucket, is not set"); return HeadBucketOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, HeadBucket, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, HeadBucket, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, HeadBucket, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> HeadBucketOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, HeadBucket, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> HeadBucketOutcome { + return HeadBucketOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_HEAD, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return HeadBucketOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_HEAD)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2814,30 +2576,25 @@ HeadObjectOutcome S3Client::HeadObject(const HeadObjectRequest& request) const AWS_LOGSTREAM_ERROR("HeadObject", "Required field: Key, is not set"); return HeadObjectOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, HeadObject, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, HeadObject, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, HeadObject, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> HeadObjectOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, HeadObject, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + [&]()-> HeadObjectOutcome { + return HeadObjectOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_HEAD, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments(request.GetKey()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return HeadObjectOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_HEAD)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2853,32 +2610,28 @@ ListBucketAnalyticsConfigurationsOutcome S3Client::ListBucketAnalyticsConfigurat AWS_LOGSTREAM_ERROR("ListBucketAnalyticsConfigurations", "Required field: Bucket, is not set"); return ListBucketAnalyticsConfigurationsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListBucketAnalyticsConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListBucketAnalyticsConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListBucketAnalyticsConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListBucketAnalyticsConfigurationsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListBucketAnalyticsConfigurations, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> ListBucketAnalyticsConfigurationsOutcome { + return ListBucketAnalyticsConfigurationsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?analytics"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return ListBucketAnalyticsConfigurationsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2894,32 +2647,28 @@ ListBucketIntelligentTieringConfigurationsOutcome S3Client::ListBucketIntelligen AWS_LOGSTREAM_ERROR("ListBucketIntelligentTieringConfigurations", "Required field: Bucket, is not set"); return ListBucketIntelligentTieringConfigurationsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListBucketIntelligentTieringConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListBucketIntelligentTieringConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListBucketIntelligentTieringConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListBucketIntelligentTieringConfigurationsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListBucketIntelligentTieringConfigurations, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> ListBucketIntelligentTieringConfigurationsOutcome { + return ListBucketIntelligentTieringConfigurationsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?intelligent-tiering"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return ListBucketIntelligentTieringConfigurationsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2935,32 +2684,28 @@ ListBucketInventoryConfigurationsOutcome S3Client::ListBucketInventoryConfigurat AWS_LOGSTREAM_ERROR("ListBucketInventoryConfigurations", "Required field: Bucket, is not set"); return ListBucketInventoryConfigurationsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListBucketInventoryConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListBucketInventoryConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListBucketInventoryConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListBucketInventoryConfigurationsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListBucketInventoryConfigurations, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> ListBucketInventoryConfigurationsOutcome { + return ListBucketInventoryConfigurationsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?inventory"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return ListBucketInventoryConfigurationsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -2976,32 +2721,28 @@ ListBucketMetricsConfigurationsOutcome S3Client::ListBucketMetricsConfigurations AWS_LOGSTREAM_ERROR("ListBucketMetricsConfigurations", "Required field: Bucket, is not set"); return ListBucketMetricsConfigurationsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListBucketMetricsConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListBucketMetricsConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListBucketMetricsConfigurations, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListBucketMetricsConfigurationsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListBucketMetricsConfigurations, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> ListBucketMetricsConfigurationsOutcome { + return ListBucketMetricsConfigurationsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?metrics"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return ListBucketMetricsConfigurationsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3012,22 +2753,18 @@ ListBucketsOutcome S3Client::ListBuckets(const ListBucketsRequest& request) cons { AWS_OPERATION_GUARD(ListBuckets); AWS_OPERATION_CHECK_PTR(m_endpointProvider, ListBuckets, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE); - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListBuckets, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListBuckets, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListBuckets, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListBucketsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListBuckets, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - return ListBucketsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]()-> ListBucketsOutcome { + return ListBucketsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3038,22 +2775,18 @@ ListDirectoryBucketsOutcome S3Client::ListDirectoryBuckets(const ListDirectoryBu { AWS_OPERATION_GUARD(ListDirectoryBuckets); AWS_OPERATION_CHECK_PTR(m_endpointProvider, ListDirectoryBuckets, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE); - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListDirectoryBuckets, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListDirectoryBuckets, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListDirectoryBuckets, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListDirectoryBucketsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListDirectoryBuckets, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - return ListDirectoryBucketsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]()-> ListDirectoryBucketsOutcome { + return ListDirectoryBucketsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3069,32 +2802,28 @@ ListMultipartUploadsOutcome S3Client::ListMultipartUploads(const ListMultipartUp AWS_LOGSTREAM_ERROR("ListMultipartUploads", "Required field: Bucket, is not set"); return ListMultipartUploadsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListMultipartUploads, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListMultipartUploads, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListMultipartUploads, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListMultipartUploadsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListMultipartUploads, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> ListMultipartUploadsOutcome { + return ListMultipartUploadsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?uploads"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return ListMultipartUploadsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3110,32 +2839,28 @@ ListObjectVersionsOutcome S3Client::ListObjectVersions(const ListObjectVersionsR AWS_LOGSTREAM_ERROR("ListObjectVersions", "Required field: Bucket, is not set"); return ListObjectVersionsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListObjectVersions, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListObjectVersions, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListObjectVersions, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListObjectVersionsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListObjectVersions, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> ListObjectVersionsOutcome { + return ListObjectVersionsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?versions"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return ListObjectVersionsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3151,29 +2876,25 @@ ListObjectsOutcome S3Client::ListObjects(const ListObjectsRequest& request) cons AWS_LOGSTREAM_ERROR("ListObjects", "Required field: Bucket, is not set"); return ListObjectsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListObjects, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListObjects, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListObjects, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListObjectsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListObjects, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> ListObjectsOutcome { + return ListObjectsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return ListObjectsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3189,32 +2910,28 @@ ListObjectsV2Outcome S3Client::ListObjectsV2(const ListObjectsV2Request& request AWS_LOGSTREAM_ERROR("ListObjectsV2", "Required field: Bucket, is not set"); return ListObjectsV2Outcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListObjectsV2, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListObjectsV2, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListObjectsV2, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListObjectsV2Outcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListObjectsV2, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> ListObjectsV2Outcome { + return ListObjectsV2Outcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?list-type=2"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return ListObjectsV2Outcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3240,30 +2957,25 @@ ListPartsOutcome S3Client::ListParts(const ListPartsRequest& request) const AWS_LOGSTREAM_ERROR("ListParts", "Required field: UploadId, is not set"); return ListPartsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [UploadId]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, ListParts, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ListParts, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, ListParts, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> ListPartsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, ListParts, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + [&]()-> ListPartsOutcome { + return ListPartsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_GET, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments(request.GetKey()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return ListPartsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_GET)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3279,32 +2991,28 @@ PutBucketAccelerateConfigurationOutcome S3Client::PutBucketAccelerateConfigurati AWS_LOGSTREAM_ERROR("PutBucketAccelerateConfiguration", "Required field: Bucket, is not set"); return PutBucketAccelerateConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketAccelerateConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketAccelerateConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketAccelerateConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketAccelerateConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketAccelerateConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketAccelerateConfigurationOutcome { + return PutBucketAccelerateConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?accelerate"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketAccelerateConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3320,32 +3028,28 @@ PutBucketAclOutcome S3Client::PutBucketAcl(const PutBucketAclRequest& request) c AWS_LOGSTREAM_ERROR("PutBucketAcl", "Required field: Bucket, is not set"); return PutBucketAclOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketAclOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketAcl, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketAclOutcome { + return PutBucketAclOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?acl"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketAclOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3366,32 +3070,28 @@ PutBucketAnalyticsConfigurationOutcome S3Client::PutBucketAnalyticsConfiguration AWS_LOGSTREAM_ERROR("PutBucketAnalyticsConfiguration", "Required field: Id, is not set"); return PutBucketAnalyticsConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketAnalyticsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketAnalyticsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketAnalyticsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketAnalyticsConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketAnalyticsConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketAnalyticsConfigurationOutcome { + return PutBucketAnalyticsConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?analytics"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketAnalyticsConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3407,32 +3107,28 @@ PutBucketCorsOutcome S3Client::PutBucketCors(const PutBucketCorsRequest& request AWS_LOGSTREAM_ERROR("PutBucketCors", "Required field: Bucket, is not set"); return PutBucketCorsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketCors, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketCors, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketCors, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketCorsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketCors, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketCorsOutcome { + return PutBucketCorsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?cors"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketCorsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3448,32 +3144,28 @@ PutBucketEncryptionOutcome S3Client::PutBucketEncryption(const PutBucketEncrypti AWS_LOGSTREAM_ERROR("PutBucketEncryption", "Required field: Bucket, is not set"); return PutBucketEncryptionOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketEncryption, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketEncryption, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketEncryption, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketEncryptionOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketEncryption, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketEncryptionOutcome { + return PutBucketEncryptionOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?encryption"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketEncryptionOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3494,32 +3186,28 @@ PutBucketIntelligentTieringConfigurationOutcome S3Client::PutBucketIntelligentTi AWS_LOGSTREAM_ERROR("PutBucketIntelligentTieringConfiguration", "Required field: Id, is not set"); return PutBucketIntelligentTieringConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketIntelligentTieringConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketIntelligentTieringConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketIntelligentTieringConfigurationOutcome { + return PutBucketIntelligentTieringConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?intelligent-tiering"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketIntelligentTieringConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3540,32 +3228,28 @@ PutBucketInventoryConfigurationOutcome S3Client::PutBucketInventoryConfiguration AWS_LOGSTREAM_ERROR("PutBucketInventoryConfiguration", "Required field: Id, is not set"); return PutBucketInventoryConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketInventoryConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketInventoryConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketInventoryConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketInventoryConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketInventoryConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketInventoryConfigurationOutcome { + return PutBucketInventoryConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?inventory"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketInventoryConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3581,32 +3265,28 @@ PutBucketLifecycleConfigurationOutcome S3Client::PutBucketLifecycleConfiguration AWS_LOGSTREAM_ERROR("PutBucketLifecycleConfiguration", "Required field: Bucket, is not set"); return PutBucketLifecycleConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketLifecycleConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketLifecycleConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketLifecycleConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketLifecycleConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketLifecycleConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketLifecycleConfigurationOutcome { + return PutBucketLifecycleConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?lifecycle"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketLifecycleConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3622,32 +3302,28 @@ PutBucketLoggingOutcome S3Client::PutBucketLogging(const PutBucketLoggingRequest AWS_LOGSTREAM_ERROR("PutBucketLogging", "Required field: Bucket, is not set"); return PutBucketLoggingOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketLogging, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketLogging, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketLogging, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketLoggingOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketLogging, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketLoggingOutcome { + return PutBucketLoggingOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?logging"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketLoggingOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3668,32 +3344,28 @@ PutBucketMetricsConfigurationOutcome S3Client::PutBucketMetricsConfiguration(con AWS_LOGSTREAM_ERROR("PutBucketMetricsConfiguration", "Required field: Id, is not set"); return PutBucketMetricsConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Id]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketMetricsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketMetricsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketMetricsConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketMetricsConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketMetricsConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketMetricsConfigurationOutcome { + return PutBucketMetricsConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?metrics"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketMetricsConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3709,32 +3381,28 @@ PutBucketNotificationConfigurationOutcome S3Client::PutBucketNotificationConfigu AWS_LOGSTREAM_ERROR("PutBucketNotificationConfiguration", "Required field: Bucket, is not set"); return PutBucketNotificationConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketNotificationConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketNotificationConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketNotificationConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketNotificationConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketNotificationConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketNotificationConfigurationOutcome { + return PutBucketNotificationConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?notification"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketNotificationConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3750,32 +3418,28 @@ PutBucketOwnershipControlsOutcome S3Client::PutBucketOwnershipControls(const Put AWS_LOGSTREAM_ERROR("PutBucketOwnershipControls", "Required field: Bucket, is not set"); return PutBucketOwnershipControlsOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketOwnershipControls, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketOwnershipControls, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketOwnershipControls, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketOwnershipControlsOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketOwnershipControls, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketOwnershipControlsOutcome { + return PutBucketOwnershipControlsOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?ownershipControls"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketOwnershipControlsOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3791,32 +3455,28 @@ PutBucketPolicyOutcome S3Client::PutBucketPolicy(const PutBucketPolicyRequest& r AWS_LOGSTREAM_ERROR("PutBucketPolicy", "Required field: Bucket, is not set"); return PutBucketPolicyOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketPolicy, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketPolicy, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketPolicy, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketPolicyOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketPolicy, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketPolicyOutcome { + return PutBucketPolicyOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?policy"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketPolicyOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3832,32 +3492,28 @@ PutBucketReplicationOutcome S3Client::PutBucketReplication(const PutBucketReplic AWS_LOGSTREAM_ERROR("PutBucketReplication", "Required field: Bucket, is not set"); return PutBucketReplicationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketReplication, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketReplication, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketReplication, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketReplicationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketReplication, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketReplicationOutcome { + return PutBucketReplicationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?replication"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketReplicationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3873,32 +3529,28 @@ PutBucketRequestPaymentOutcome S3Client::PutBucketRequestPayment(const PutBucket AWS_LOGSTREAM_ERROR("PutBucketRequestPayment", "Required field: Bucket, is not set"); return PutBucketRequestPaymentOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketRequestPayment, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketRequestPayment, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketRequestPayment, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketRequestPaymentOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketRequestPayment, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketRequestPaymentOutcome { + return PutBucketRequestPaymentOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?requestPayment"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketRequestPaymentOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3914,32 +3566,28 @@ PutBucketTaggingOutcome S3Client::PutBucketTagging(const PutBucketTaggingRequest AWS_LOGSTREAM_ERROR("PutBucketTagging", "Required field: Bucket, is not set"); return PutBucketTaggingOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketTaggingOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketTagging, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketTaggingOutcome { + return PutBucketTaggingOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?tagging"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketTaggingOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3955,32 +3603,28 @@ PutBucketVersioningOutcome S3Client::PutBucketVersioning(const PutBucketVersioni AWS_LOGSTREAM_ERROR("PutBucketVersioning", "Required field: Bucket, is not set"); return PutBucketVersioningOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketVersioning, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketVersioning, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketVersioning, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketVersioningOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketVersioning, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketVersioningOutcome { + return PutBucketVersioningOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?versioning"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketVersioningOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -3996,32 +3640,28 @@ PutBucketWebsiteOutcome S3Client::PutBucketWebsite(const PutBucketWebsiteRequest AWS_LOGSTREAM_ERROR("PutBucketWebsite", "Required field: Bucket, is not set"); return PutBucketWebsiteOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutBucketWebsite, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutBucketWebsite, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutBucketWebsite, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutBucketWebsiteOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutBucketWebsite, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutBucketWebsiteOutcome { + return PutBucketWebsiteOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?website"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutBucketWebsiteOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4042,30 +3682,25 @@ PutObjectOutcome S3Client::PutObject(const PutObjectRequest& request) const AWS_LOGSTREAM_ERROR("PutObject", "Required field: Key, is not set"); return PutObjectOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutObject, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutObject, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutObject, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutObjectOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutObject, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + [&]()-> PutObjectOutcome { + return PutObjectOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments(request.GetKey()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutObjectOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4102,33 +3737,28 @@ PutObjectAclOutcome S3Client::PutObjectAcl(const PutObjectAclRequest& request) c AWS_LOGSTREAM_ERROR("PutObjectAcl", "Required field: Key, is not set"); return PutObjectAclOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutObjectAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutObjectAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutObjectAcl, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutObjectAclOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutObjectAcl, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutObjectAclOutcome { + return PutObjectAclOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?acl"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutObjectAclOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4149,33 +3779,28 @@ PutObjectLegalHoldOutcome S3Client::PutObjectLegalHold(const PutObjectLegalHoldR AWS_LOGSTREAM_ERROR("PutObjectLegalHold", "Required field: Key, is not set"); return PutObjectLegalHoldOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutObjectLegalHold, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutObjectLegalHold, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutObjectLegalHold, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutObjectLegalHoldOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutObjectLegalHold, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutObjectLegalHoldOutcome { + return PutObjectLegalHoldOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?legal-hold"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutObjectLegalHoldOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4191,32 +3816,28 @@ PutObjectLockConfigurationOutcome S3Client::PutObjectLockConfiguration(const Put AWS_LOGSTREAM_ERROR("PutObjectLockConfiguration", "Required field: Bucket, is not set"); return PutObjectLockConfigurationOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutObjectLockConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutObjectLockConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutObjectLockConfiguration, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutObjectLockConfigurationOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutObjectLockConfiguration, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutObjectLockConfigurationOutcome { + return PutObjectLockConfigurationOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?object-lock"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutObjectLockConfigurationOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4237,33 +3858,28 @@ PutObjectRetentionOutcome S3Client::PutObjectRetention(const PutObjectRetentionR AWS_LOGSTREAM_ERROR("PutObjectRetention", "Required field: Key, is not set"); return PutObjectRetentionOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutObjectRetention, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutObjectRetention, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutObjectRetention, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutObjectRetentionOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutObjectRetention, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutObjectRetentionOutcome { + return PutObjectRetentionOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?retention"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutObjectRetentionOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4284,33 +3900,28 @@ PutObjectTaggingOutcome S3Client::PutObjectTagging(const PutObjectTaggingRequest AWS_LOGSTREAM_ERROR("PutObjectTagging", "Required field: Key, is not set"); return PutObjectTaggingOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutObjectTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutObjectTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutObjectTagging, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutObjectTaggingOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutObjectTagging, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutObjectTaggingOutcome { + return PutObjectTaggingOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?tagging"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutObjectTaggingOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4326,32 +3937,28 @@ PutPublicAccessBlockOutcome S3Client::PutPublicAccessBlock(const PutPublicAccess AWS_LOGSTREAM_ERROR("PutPublicAccessBlock", "Required field: Bucket, is not set"); return PutPublicAccessBlockOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Bucket]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, PutPublicAccessBlock, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, PutPublicAccessBlock, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, PutPublicAccessBlock, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> PutPublicAccessBlockOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, PutPublicAccessBlock, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> PutPublicAccessBlockOutcome { + return PutPublicAccessBlockOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; ss.str("?publicAccessBlock"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return PutPublicAccessBlockOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + AWS_UNREFERENCED_PARAM(resolvedEndpoint); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4372,33 +3979,28 @@ RestoreObjectOutcome S3Client::RestoreObject(const RestoreObjectRequest& request AWS_LOGSTREAM_ERROR("RestoreObject", "Required field: Key, is not set"); return RestoreObjectOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, RestoreObject, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, RestoreObject, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, RestoreObject, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> RestoreObjectOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, RestoreObject, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> RestoreObjectOutcome { + return RestoreObjectOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?restore"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return RestoreObjectOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_POST)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4419,36 +4021,31 @@ SelectObjectContentOutcome S3Client::SelectObjectContent(SelectObjectContentRequ AWS_LOGSTREAM_ERROR("SelectObjectContent", "Required field: Key, is not set"); return SelectObjectContentOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [Key]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, SelectObjectContent, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, SelectObjectContent, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, SelectObjectContent, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> SelectObjectContentOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, SelectObjectContent, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); + [&]()-> SelectObjectContentOutcome { + request.SetResponseStreamFactory( + [&] { request.GetEventStreamDecoder().Reset(); return Aws::New(ALLOCATION_TAG, request.GetEventStreamDecoder()); } + ); + return SelectObjectContentOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { Aws::StringStream ss; - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + resolvedEndpoint.AddPathSegments(request.GetKey()); ss.str("?select&select-type=2"); - endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + resolvedEndpoint.SetQueryString(ss.str()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - request.SetResponseStreamFactory( - [&] { request.GetEventStreamDecoder().Reset(); return Aws::New(ALLOCATION_TAG, request.GetEventStreamDecoder()); } - ); - return SelectObjectContentOutcome(MakeRequestWithEventStream(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_POST)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4479,30 +4076,25 @@ UploadPartOutcome S3Client::UploadPart(const UploadPartRequest& request) const AWS_LOGSTREAM_ERROR("UploadPart", "Required field: UploadId, is not set"); return UploadPartOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [UploadId]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, UploadPart, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, UploadPart, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, UploadPart, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> UploadPartOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, UploadPart, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + [&]()-> UploadPartOutcome { + return UploadPartOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments(request.GetKey()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return UploadPartOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4538,30 +4130,25 @@ UploadPartCopyOutcome S3Client::UploadPartCopy(const UploadPartCopyRequest& requ AWS_LOGSTREAM_ERROR("UploadPartCopy", "Required field: UploadId, is not set"); return UploadPartCopyOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [UploadId]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, UploadPartCopy, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, UploadPartCopy, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, UploadPartCopy, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> UploadPartCopyOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, UploadPartCopy, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - endpointResolutionOutcome.GetResult().AddPathSegments(request.GetKey()); + [&]()-> UploadPartCopyOutcome { + return UploadPartCopyOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_PUT, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments(request.GetKey()); request.SetServiceSpecificParameters( - [&]() -> std::shared_ptr { - Aws::Map params; - params.emplace("bucketName", request.GetBucket()); - ServiceSpecificParameters serviceSpecificParameters{params}; - return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - }()); - return UploadPartCopyOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT)); + [&]() -> std::shared_ptr { + Aws::Map params; + params.emplace("bucketName", request.GetBucket()); + ServiceSpecificParameters serviceSpecificParameters{params}; + return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + }()); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4582,25 +4169,18 @@ WriteGetObjectResponseOutcome S3Client::WriteGetObjectResponse(const WriteGetObj AWS_LOGSTREAM_ERROR("WriteGetObjectResponse", "Required field: RequestToken, is not set"); return WriteGetObjectResponseOutcome(Aws::Client::AWSError(S3Errors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [RequestToken]", false)); } - AWS_OPERATION_CHECK_PTR(m_telemetryProvider, WriteGetObjectResponse, CoreErrors, CoreErrors::NOT_INITIALIZED); - auto tracer = m_telemetryProvider->getTracer(this->GetServiceClientName(), {}); - auto meter = m_telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, WriteGetObjectResponse, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); AWS_OPERATION_CHECK_PTR(meter, WriteGetObjectResponse, CoreErrors, CoreErrors::NOT_INITIALIZED); auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), - {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, - smithy::components::tracing::SpanKind::CLIENT); + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); return TracingUtils::MakeCallWithTiming( - [&]()-> WriteGetObjectResponseOutcome { - auto endpointResolutionOutcome = TracingUtils::MakeCallWithTiming( - [&]() -> ResolveEndpointOutcome { return m_endpointProvider->ResolveEndpoint(request.GetEndpointContextParams()); }, - TracingUtils::SMITHY_CLIENT_ENDPOINT_RESOLUTION_METRIC, - *meter, - {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); - AWS_OPERATION_CHECK_SUCCESS(endpointResolutionOutcome, WriteGetObjectResponse, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE, endpointResolutionOutcome.GetError().GetMessage()); - auto addPrefixErr = endpointResolutionOutcome.GetResult().AddPrefixIfMissing("" + request.GetRequestRoute() + "."); - AWS_CHECK(SERVICE_NAME, !addPrefixErr, addPrefixErr->GetMessage(), WriteGetObjectResponseOutcome(addPrefixErr.value())); - endpointResolutionOutcome.GetResult().AddPathSegments("/WriteGetObjectResponse"); - return WriteGetObjectResponseOutcome(MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_POST)); + [&]()-> WriteGetObjectResponseOutcome { + return WriteGetObjectResponseOutcome(MakeRequestDeserialize(&request, request.GetServiceRequestName(), Aws::Http::HttpMethod::HTTP_POST, [&](Aws::Endpoint::AWSEndpoint& resolvedEndpoint) -> void { + resolvedEndpoint.AddPathSegments("/WriteGetObjectResponse"); + })); }, TracingUtils::SMITHY_CLIENT_DURATION_METRIC, *meter, @@ -4641,8 +4221,7 @@ Aws::String S3Client::GeneratePresignedUrl(const Aws::String& bucket, params.emplace("bucketName", bucket); ServiceSpecificParameters serviceSpecificParameters{params}; auto serviceParams = Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); - return AWSClient::GeneratePresignedUrl(endpoint, method, customizedHeaders, expirationInSeconds, Aws::Auth::SIGV4_SIGNER, - nullptr, nullptr, serviceParams); + return AwsSmithyClientT::GeneratePresignedUrl(endpoint, method, {}, {}, expirationInSeconds, customizedHeaders, serviceParams); } Aws::String S3Client::GeneratePresignedUrlWithSSES3(const Aws::String& bucket, diff --git a/generated/src/aws-cpp-sdk-s3/source/S3ExpressIdentityProvider.cpp b/generated/src/aws-cpp-sdk-s3/source/S3ExpressIdentityProvider.cpp index cc32f9010e2..6d4552f13cf 100644 --- a/generated/src/aws-cpp-sdk-s3/source/S3ExpressIdentityProvider.cpp +++ b/generated/src/aws-cpp-sdk-s3/source/S3ExpressIdentityProvider.cpp @@ -7,7 +7,7 @@ #include #include #include - +#include #include #include @@ -15,16 +15,18 @@ using namespace Aws::S3; using namespace Aws::Utils; using namespace Aws::Http; using namespace std::chrono; +using namespace smithy; using CacheValueType = typename Aws::Utils::Cache::Value; +using SmithyCacheValueType = typename Aws::Utils::Cache::Value; +namespace{ const char S3_EXPRESS_IDENTITY_PROVIDER[] = "S3ExpressIdentityProvider"; const int DEFAULT_CACHE_SIZE = 100; +} +S3ExpressIdentityProvider::S3ExpressIdentityProvider(const S3Client& s3Client) : m_s3Client(s3Client){} -smithy::IdentityResolverBase::ResolveIdentityFutureOutcome -S3ExpressIdentityProvider::getIdentity( - const IdentityProperties& identityProperties, - const AdditionalParameters& additionalParameters) -{ +S3ExpressIdentityProvider::ResolveIdentityFutureOutcome S3ExpressIdentityProvider::getIdentity( + const IdentityProperties& identityProperties, const AdditionalParameters& additionalParameters){ const auto params = Aws::MakeShared(S3_EXPRESS_IDENTITY_PROVIDER); for (const auto& paramMap: {identityProperties, additionalParameters}) { @@ -43,166 +45,346 @@ S3ExpressIdentityProvider::getIdentity( return {}; }); } - auto identity = GetS3ExpressIdentity(params); - return Aws::MakeUnique(S3_EXPRESS_IDENTITY_PROVIDER, std::move(identity)); -} -S3ExpressIdentity S3ExpressIdentityProvider::getIdentity(const Aws::String &bucketName) { - auto outcome = m_s3Client.CreateSession(Model::CreateSessionRequest().WithBucket(bucketName)); - // If we fail the connect call return empty credentials and log an error message. - if (!outcome.IsSuccess()) { - AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "Failed to make S3Express Connect Call") - return {"", "", "", {}}; - } - auto result = outcome.GetResult(); - const auto &credentials = result.GetCredentials(); - // if expiry is present, use it, otherwise default to 5 minutes expiry - auto expiry = [&]() -> Aws::Utils::DateTime { - if (credentials.ExpirationHasBeenSet()) { - return credentials.GetExpiration(); - } - return Aws::Utils::DateTime::Now() + minutes(5); - }(); - return {credentials.GetAccessKeyId(), - credentials.GetSecretAccessKey(), - credentials.GetSessionToken(), - expiry}; -} - -std::shared_ptr -S3ExpressIdentityProvider::GetMutexForBucketName(const Aws::String &bucketName) { - std::lock_guard lock(m_bucketNameMapMutex); - auto it = m_bucketNameMutex.find(bucketName); - if (it != m_bucketNameMutex.end()) { - return it->second; - } - auto bucketMutex = Aws::MakeShared(S3_EXPRESS_IDENTITY_PROVIDER); - m_bucketNameMutex.emplace(bucketName, bucketMutex); - return bucketMutex; + auto s3ExpressIdentity = GetS3ExpressIdentity(params); + + auto identity = Aws::MakeUnique("DefaultAwsCredentialIdentityResolver", s3ExpressIdentity.getAccessKeyId(), s3ExpressIdentity.getSecretKeyId(), + s3ExpressIdentity.getSessionToken() , + s3ExpressIdentity.getExpiration()); + + return ResolveIdentityFutureOutcome(std::move(identity)); } +std::shared_ptr S3ExpressIdentityProvider::GetMutexForBucketName(const Aws::String& bucketName) { + std::lock_guard lock(m_bucketNameMapMutex); + auto it = m_bucketNameMutex.find(bucketName); + if (it != m_bucketNameMutex.end()) { + return it->second; + } + auto bucketMutex = Aws::MakeShared(S3_EXPRESS_IDENTITY_PROVIDER); + m_bucketNameMutex.emplace(bucketName, bucketMutex); + return bucketMutex; +} -Aws::S3::DefaultS3ExpressIdentityProvider::DefaultS3ExpressIdentityProvider(const S3Client &s3Client) : - DefaultS3ExpressIdentityProvider(s3Client, - Aws::MakeShared>(S3_EXPRESS_IDENTITY_PROVIDER, - DEFAULT_CACHE_SIZE)) { - +S3ExpressIdentity S3ExpressIdentityProvider::GetCredentialsFromBucket(const Aws::String& bucketName) const { + auto outcome = m_s3Client.CreateSession(Model::CreateSessionRequest().WithBucket(bucketName)); + // If we fail the connect call return empty credentials and log an error message. + if (!outcome.IsSuccess()) { + AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "Failed to make S3Express Connect Call") + return {"", "", {""}, {}}; + } + auto result = outcome.GetResult(); + const auto &credentials = result.GetCredentials(); + // if expiry is present, use it, otherwise default to 5 minutes expiry + auto expiry = [&]() -> Aws::Utils::DateTime { + if (credentials.ExpirationHasBeenSet()) { + return credentials.GetExpiration(); + } + return Aws::Utils::DateTime::Now() + minutes(5); + }(); + return {credentials.GetAccessKeyId(), + credentials.GetSecretAccessKey(), + credentials.GetSessionToken(), + expiry}; } -Aws::S3::DefaultS3ExpressIdentityProvider::DefaultS3ExpressIdentityProvider( - const S3Client &s3Client, - std::shared_ptr> credentialsCache) : - S3ExpressIdentityProvider(s3Client), - m_credentialsCache(std::move(credentialsCache)) { +DefaultS3ExpressIdentityProvider::DefaultS3ExpressIdentityProvider(const S3Client& s3Client) + : S3ExpressIdentityProvider{s3Client}, m_credentialsCache{Aws::MakeShared>(S3_EXPRESS_IDENTITY_PROVIDER, + DEFAULT_CACHE_SIZE)}{} -} +DefaultS3ExpressIdentityProvider::DefaultS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache) + : S3ExpressIdentityProvider{s3Client}, m_credentialsCache{credentialsCache} {} -S3ExpressIdentity DefaultS3ExpressIdentityProvider::GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) { +S3ExpressIdentity DefaultS3ExpressIdentityProvider::GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) +{ auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName"); if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) { AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call") - return {"", "", "", {}}; + return {"", "", {""}, {}}; } std::lock_guard lock(*GetMutexForBucketName(bucketNameIter->second)); S3ExpressIdentity identity; auto isInCache = m_credentialsCache->Get(bucketNameIter->second, identity); - if (!isInCache || identity.getExpiration() - minutes(1) < Aws::Utils::DateTime::Now()) { - identity = S3ExpressIdentityProvider::getIdentity(bucketNameIter->second); - m_credentialsCache->Put(bucketNameIter->second, - identity, - std::chrono::milliseconds(identity.getExpiration().Millis() - Aws::Utils::DateTime::Now().Millis())); + if (!isInCache || (identity.expiration().has_value() && (identity.expiration().value() - minutes(1) < Aws::Utils::DateTime::Now())) ) { + identity = S3ExpressIdentityProvider::GetCredentialsFromBucket(bucketNameIter->second); + if (identity.expiration().has_value()) { + m_credentialsCache->Put(bucketNameIter->second, + identity, + std::chrono::milliseconds(identity.expiration().value().Millis() - Aws::Utils::DateTime::Now().Millis())); + } } return identity; } -Aws::S3::DefaultAsyncS3ExpressIdentityProvider::DefaultAsyncS3ExpressIdentityProvider( - const S3Client &s3Client, - std::chrono::minutes refreshPeriod) : - DefaultAsyncS3ExpressIdentityProvider(s3Client, - Aws::MakeShared>(S3_EXPRESS_IDENTITY_PROVIDER, - DEFAULT_CACHE_SIZE), - refreshPeriod) { +DefaultAsyncS3ExpressIdentityProvider::DefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, std::chrono::minutes refreshPeriod) + : DefaultAsyncS3ExpressIdentityProvider(s3Client, + Aws::MakeShared>( + S3_EXPRESS_IDENTITY_PROVIDER, DEFAULT_CACHE_SIZE), + refreshPeriod) {} + +DefaultAsyncS3ExpressIdentityProvider::DefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, std::shared_ptr> credentialsCache, + std::chrono::minutes refreshPeriod) + : S3ExpressIdentityProvider(s3Client), m_credentialsCache(std::move(credentialsCache)) { + // Start a thread to background refresh the keys currently in the cache. + m_shouldStopBackgroundRefresh = false; + m_backgroundRefreshThread = Aws::MakeUnique( + S3_EXPRESS_IDENTITY_PROVIDER, std::thread(&DefaultAsyncS3ExpressIdentityProvider::refreshIdentities, this, refreshPeriod)); } -Aws::S3::DefaultAsyncS3ExpressIdentityProvider::DefaultAsyncS3ExpressIdentityProvider( - const S3Client &s3Client, - std::shared_ptr> credentialsCache, - std::chrono::minutes refreshPeriod) : - S3ExpressIdentityProvider(s3Client), - m_credentialsCache(std::move(credentialsCache)) { - // Start a thread to background refresh the keys currently in the cache. - m_shouldStopBackgroundRefresh = false; - m_backgroundRefreshThread = Aws::MakeUnique(S3_EXPRESS_IDENTITY_PROVIDER, - std::thread(&DefaultAsyncS3ExpressIdentityProvider::refreshIdentities, - this, - refreshPeriod)); +DefaultAsyncS3ExpressIdentityProvider::~DefaultAsyncS3ExpressIdentityProvider(){ + { + std::unique_lock lock(m_shutDownMutex); + m_shouldStopBackgroundRefresh = true; + m_shutdownCondition.notify_all(); + } + m_backgroundRefreshThread->join(); } -DefaultAsyncS3ExpressIdentityProvider::~DefaultAsyncS3ExpressIdentityProvider() { - { - std::unique_lock lock(m_shutDownMutex); - m_shouldStopBackgroundRefresh = true; - m_shutdownCondition.notify_all(); - } - m_backgroundRefreshThread->join(); +S3ExpressIdentity DefaultAsyncS3ExpressIdentityProvider::GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters){ + auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName"); + if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) { + AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call") + return {"", "", {""}, {}}; + } + threadSafeKeyInsert(bucketNameIter->second); + std::lock_guard lock(*GetMutexForBucketName(bucketNameIter->second)); + S3ExpressIdentity identity; + auto isInCache = m_credentialsCache->Get(bucketNameIter->second, identity); + if (!isInCache || (identity.expiration().has_value() && (identity.expiration().value() - minutes(1) < Aws::Utils::DateTime::Now())) ) { + identity = S3ExpressIdentityProvider::GetCredentialsFromBucket(bucketNameIter->second); + if (identity.expiration().has_value()) { + m_credentialsCache->Put(bucketNameIter->second, + identity, + std::chrono::milliseconds(identity.expiration().value().Millis() - Aws::Utils::DateTime::Now().Millis())); + } + } + return identity; +} + +void DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyEmpty() { + std::lock_guard lock(m_keysUsedMutex); + m_keysUsed.clear(); +} + +bool DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyHas(const Aws::String& key) { + std::lock_guard lock(m_keysUsedMutex); + return m_keysUsed.find(key) != m_keysUsed.end(); +} + +void DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyInsert(const Aws::String& key) { + std::lock_guard lock(m_keysUsedMutex); + m_keysUsed.insert(key); } void DefaultAsyncS3ExpressIdentityProvider::refreshIdentities(std::chrono::minutes refreshPeriod) { - auto filterUnusedKeys = [&](const Aws::String &bucketName, const CacheValueType &valueType) -> bool { - std::lock_guard lock(*GetMutexForBucketName(bucketName)); - AWS_UNREFERENCED_PARAM(valueType); - return !threadSafeKeyHas(bucketName); - }; - auto refreshIdentityWhenCloseToExpiry = [&](const Aws::String &bucketName, - const CacheValueType &valueType) -> CacheValueType { - std::lock_guard lock(*GetMutexForBucketName(bucketName)); - if (duration_cast(refreshPeriod).count() < valueType.val.getExpiration().Millis() && - valueType.val.getExpiration() - refreshPeriod < Aws::Utils::DateTime::Now()) { - auto updatedIdentity = this->S3ExpressIdentityProvider::getIdentity(bucketName); - return {updatedIdentity.getExpiration(), updatedIdentity}; - } - return valueType; - }; - std::unique_lock lock(m_shutDownMutex); - while (!m_shouldStopBackgroundRefresh) { - m_credentialsCache->Filter(filterUnusedKeys); - m_credentialsCache->Transform(refreshIdentityWhenCloseToExpiry); - threadSafeKeyEmpty(); - m_shutdownCondition.wait_for(lock, refreshPeriod, [this] { return m_shouldStopBackgroundRefresh; }); + auto filterUnusedKeys = [&](const Aws::String &bucketName, const CacheValueType &valueType) -> bool { + std::lock_guard lock(*GetMutexForBucketName(bucketName)); + AWS_UNREFERENCED_PARAM(valueType); + return !threadSafeKeyHas(bucketName); + }; + auto refreshIdentityWhenCloseToExpiry = [&](const Aws::String &bucketName, + const CacheValueType &valueType) -> CacheValueType { + std::lock_guard lock(*GetMutexForBucketName(bucketName)); + if ((!valueType.val.expiration().has_value()) || + (duration_cast(refreshPeriod).count() < valueType.val.expiration().value().Millis() && + valueType.val.expiration().value() - refreshPeriod < Aws::Utils::DateTime::Now())) { + auto updatedIdentity = this->S3ExpressIdentityProvider::GetCredentialsFromBucket(bucketName); + return {updatedIdentity.expiration().value(), updatedIdentity}; + } + return valueType; + }; + std::unique_lock lock(m_shutDownMutex); + while (!m_shouldStopBackgroundRefresh) { + m_credentialsCache->Filter(filterUnusedKeys); + m_credentialsCache->Transform(refreshIdentityWhenCloseToExpiry); + threadSafeKeyEmpty(); + m_shutdownCondition.wait_for(lock, refreshPeriod, [this] { return m_shouldStopBackgroundRefresh; }); + } +} + +/* Smithy version */ +SmithyS3ExpressIdentityProvider::SmithyS3ExpressIdentityProvider(const S3Client& s3Client) : m_s3Client(s3Client){} + + +SmithyS3ExpressIdentityProvider::ResolveIdentityFutureOutcome SmithyS3ExpressIdentityProvider::getIdentity( + const IdentityProperties& identityProperties, const AdditionalParameters& additionalParameters){ + const auto params = Aws::MakeShared(S3_EXPRESS_IDENTITY_PROVIDER); + for (const auto& paramMap: {identityProperties, additionalParameters}) + { + TransformAndInsert, String>(paramMap, + params->parameterMap, + [](const Aws::Crt::Variant& value) -> Aws::String + { + if (value.holds_alternative()) + { + return value.get() ? "true" : "false"; + } + if (value.holds_alternative()) + { + return value.get(); + } + return {}; + }); } + + auto identity = Aws::MakeUnique("DefaultAwsCredentialIdentityResolver", GetS3ExpressAwsIdentity(params)); + + return ResolveIdentityFutureOutcome(std::move(identity)); } -S3ExpressIdentity DefaultAsyncS3ExpressIdentityProvider::GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) { + +std::shared_ptr SmithyS3ExpressIdentityProvider::GetMutexForBucketName(const Aws::String& bucketName) { + std::lock_guard lock(m_bucketNameMapMutex); + auto it = m_bucketNameMutex.find(bucketName); + if (it != m_bucketNameMutex.end()) { + return it->second; + } + auto bucketMutex = Aws::MakeShared(S3_EXPRESS_IDENTITY_PROVIDER); + m_bucketNameMutex.emplace(bucketName, bucketMutex); + return bucketMutex; +} + +AwsCredentialIdentity SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(const Aws::String& bucketName) const { + auto outcome = m_s3Client.CreateSession(Model::CreateSessionRequest().WithBucket(bucketName)); + // If we fail the connect call return empty credentials and log an error message. + if (!outcome.IsSuccess()) { + AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "Failed to make S3Express Connect Call") + return {"", "", {""}, {}}; + } + auto result = outcome.GetResult(); + const auto &credentials = result.GetCredentials(); + // if expiry is present, use it, otherwise default to 5 minutes expiry + auto expiry = [&]() -> Aws::Utils::DateTime { + if (credentials.ExpirationHasBeenSet()) { + return credentials.GetExpiration(); + } + return Aws::Utils::DateTime::Now() + minutes(5); + }(); + return {credentials.GetAccessKeyId(), + credentials.GetSecretAccessKey(), + credentials.GetSessionToken(), + expiry}; +} + + +SmithyDefaultS3ExpressIdentityProvider::SmithyDefaultS3ExpressIdentityProvider(const S3Client& s3Client) + : SmithyS3ExpressIdentityProvider{s3Client}, m_credentialsCache{Aws::MakeShared>(S3_EXPRESS_IDENTITY_PROVIDER, + DEFAULT_CACHE_SIZE)}{} + +SmithyDefaultS3ExpressIdentityProvider::SmithyDefaultS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache) + : SmithyS3ExpressIdentityProvider{s3Client}, m_credentialsCache{credentialsCache} {} + +AwsCredentialIdentity SmithyDefaultS3ExpressIdentityProvider::GetS3ExpressAwsIdentity(const std::shared_ptr &serviceSpecificParameters) { auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName"); if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) { AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call") - return {"", "", "", {}}; + return {"", "", {""}, {}}; } - threadSafeKeyInsert(bucketNameIter->second); std::lock_guard lock(*GetMutexForBucketName(bucketNameIter->second)); - S3ExpressIdentity identity; + AwsCredentialIdentity identity; auto isInCache = m_credentialsCache->Get(bucketNameIter->second, identity); - if (!isInCache) { - identity = S3ExpressIdentityProvider::getIdentity(bucketNameIter->second); - m_credentialsCache->Put(bucketNameIter->second, - identity, - std::chrono::milliseconds(identity.getExpiration().Millis() - Aws::Utils::DateTime::Now().Millis())); + if (!isInCache || (identity.expiration().has_value() && (identity.expiration().value() - minutes(1) < Aws::Utils::DateTime::Now())) ) { + identity = SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(bucketNameIter->second); + if (identity.expiration().has_value()) { + m_credentialsCache->Put(bucketNameIter->second, + identity, + std::chrono::milliseconds(identity.expiration().value().Millis() - Aws::Utils::DateTime::Now().Millis())); + } } return identity; } -void DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyEmpty() { - std::lock_guard lock(m_keysUsedMutex); - m_keysUsed.clear(); +SmithyDefaultAsyncS3ExpressIdentityProvider::SmithyDefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, std::chrono::minutes refreshPeriod) + : SmithyDefaultAsyncS3ExpressIdentityProvider(s3Client, + Aws::MakeShared>( + S3_EXPRESS_IDENTITY_PROVIDER, DEFAULT_CACHE_SIZE), + refreshPeriod) {} + +SmithyDefaultAsyncS3ExpressIdentityProvider::SmithyDefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, std::shared_ptr> credentialsCache, + std::chrono::minutes refreshPeriod) + : SmithyS3ExpressIdentityProvider(s3Client), m_credentialsCache(std::move(credentialsCache)) { + // Start a thread to background refresh the keys currently in the cache. + m_shouldStopBackgroundRefresh = false; + m_backgroundRefreshThread = Aws::MakeUnique( + S3_EXPRESS_IDENTITY_PROVIDER, std::thread(&SmithyDefaultAsyncS3ExpressIdentityProvider::refreshIdentities, this, refreshPeriod)); +} + +SmithyDefaultAsyncS3ExpressIdentityProvider::~SmithyDefaultAsyncS3ExpressIdentityProvider(){ + { + std::unique_lock lock(m_shutDownMutex); + m_shouldStopBackgroundRefresh = true; + m_shutdownCondition.notify_all(); + } + m_backgroundRefreshThread->join(); } -bool DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyHas(const Aws::String &key) { - std::lock_guard lock(m_keysUsedMutex); - return m_keysUsed.find(key) != m_keysUsed.end(); +AwsCredentialIdentity SmithyDefaultAsyncS3ExpressIdentityProvider::GetS3ExpressAwsIdentity(const std::shared_ptr &serviceSpecificParameters){ + auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName"); + if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) { + AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call") + return {"", "", {""}, {}}; + } + threadSafeKeyInsert(bucketNameIter->second); + std::lock_guard lock(*GetMutexForBucketName(bucketNameIter->second)); + AwsCredentialIdentity identity; + auto isInCache = m_credentialsCache->Get(bucketNameIter->second, identity); + if (!isInCache || (identity.expiration().has_value() && (identity.expiration().value() - minutes(1) < Aws::Utils::DateTime::Now())) ) { + identity = SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(bucketNameIter->second); + if (identity.expiration().has_value()) { + m_credentialsCache->Put(bucketNameIter->second, + identity, + std::chrono::milliseconds(identity.expiration().value().Millis() - Aws::Utils::DateTime::Now().Millis())); + } + } + return identity; } -void DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyInsert(const Aws::String &key) { - std::lock_guard lock(m_keysUsedMutex); - m_keysUsed.insert(key); +void SmithyDefaultAsyncS3ExpressIdentityProvider::threadSafeKeyEmpty() { + std::lock_guard lock(m_keysUsedMutex); + m_keysUsed.clear(); } + +bool SmithyDefaultAsyncS3ExpressIdentityProvider::threadSafeKeyHas(const Aws::String& key) { + std::lock_guard lock(m_keysUsedMutex); + return m_keysUsed.find(key) != m_keysUsed.end(); +} + +void SmithyDefaultAsyncS3ExpressIdentityProvider::threadSafeKeyInsert(const Aws::String& key) { + std::lock_guard lock(m_keysUsedMutex); + m_keysUsed.insert(key); +} + +void SmithyDefaultAsyncS3ExpressIdentityProvider::refreshIdentities(std::chrono::minutes refreshPeriod) { + auto filterUnusedKeys = [&](const Aws::String &bucketName, const SmithyCacheValueType &valueType) -> bool { + std::lock_guard lock(*GetMutexForBucketName(bucketName)); + AWS_UNREFERENCED_PARAM(valueType); + return !threadSafeKeyHas(bucketName); + }; + auto refreshIdentityWhenCloseToExpiry = [&](const Aws::String &bucketName, + const SmithyCacheValueType &valueType) -> SmithyCacheValueType { + std::lock_guard lock(*GetMutexForBucketName(bucketName)); + if ((!valueType.val.expiration().has_value()) || + (duration_cast(refreshPeriod).count() < valueType.val.expiration().value().Millis() && + valueType.val.expiration().value() - refreshPeriod < Aws::Utils::DateTime::Now())) { + auto updatedIdentity = this->SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(bucketName); + return {updatedIdentity.expiration().value(), updatedIdentity}; + } + return valueType; + }; + std::unique_lock lock(m_shutDownMutex); + while (!m_shouldStopBackgroundRefresh) { + m_credentialsCache->Filter(filterUnusedKeys); + m_credentialsCache->Transform(refreshIdentityWhenCloseToExpiry); + threadSafeKeyEmpty(); + m_shutdownCondition.wait_for(lock, refreshPeriod, [this] { return m_shouldStopBackgroundRefresh; }); + } +} \ No newline at end of file diff --git a/generated/src/aws-cpp-sdk-s3/source/S3ExpressSigV4AuthSchemeOption.cpp b/generated/src/aws-cpp-sdk-s3/source/S3ExpressSigV4AuthSchemeOption.cpp new file mode 100644 index 00000000000..a3f5243c6bd --- /dev/null +++ b/generated/src/aws-cpp-sdk-s3/source/S3ExpressSigV4AuthSchemeOption.cpp @@ -0,0 +1,13 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include +namespace Aws { +namespace S3 { + +AWS_S3_API smithy::AuthSchemeOption S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption = smithy::AuthSchemeOption("sigv4-s3express"); + +} +} diff --git a/generated/src/aws-cpp-sdk-s3/source/S3ExpressSigner.cpp b/generated/src/aws-cpp-sdk-s3/source/S3ExpressSigner.cpp index 14341b17043..f6f0de782c0 100644 --- a/generated/src/aws-cpp-sdk-s3/source/S3ExpressSigner.cpp +++ b/generated/src/aws-cpp-sdk-s3/source/S3ExpressSigner.cpp @@ -17,7 +17,7 @@ using namespace Aws::Config; using namespace Aws::Environment; using namespace Aws::Utils; -static const char *S3_EXPRESS_SIGNER_NAME = "S3ExpressSigner"; +AWS_S3_API const char *Aws::S3::S3_EXPRESS_SIGNER_NAME = "S3ExpressSigner"; static const char *S3_EXPRESS_HEADER = "x-amz-s3session-token"; static const char *S3_EXPRESS_QUERY_PARAM = "X-Amz-S3session-Token"; static const char *S3_EXPRESS_SERVICE_NAME = "s3express"; @@ -95,3 +95,51 @@ Aws::Auth::AWSCredentials S3ExpressSigner::GetCredentials(const std::shared_ptr< auto identity = m_S3ExpressIdentityProvider->GetS3ExpressIdentity(serviceSpecificParameters); return {identity.getAccessKeyId(), identity.getSecretKeyId()}; } + +template +typename S3ExpressSignerBase::SigningFutureOutcome S3ExpressSignerBase::sign(std::shared_ptr httpRequest, const smithy::AwsCredentialIdentityBase& identity, S3ExpressSignerBase::SigningProperties properties) +{ + const auto requestId = Aws::GetWithDefault(httpRequest->GetServiceSpecificParameters()->parameterMap, + Aws::String("dedupeId"), + Aws::String(Aws::Utils::UUID::RandomUUID())); + if(hasRequestId(requestId)) { + return SigningError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, "", "Refusing to sign request more than once", + false /*retryable*/); + } + + if(!identity.sessionToken().has_value()) { + return SigningError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, "", "No session token present", + false /*retryable*/); + } + putRequestId(requestId); + httpRequest->SetHeaderValue(S3_EXPRESS_HEADER, identity.sessionToken().value()); + auto idCopy = smithy::AwsCredentialIdentity{identity.accessKeyId(), identity.secretAccessKey(), {}, identity.expiration()}; + auto isSigned = BASECLASS::sign(httpRequest, idCopy, properties); + deleteRequestId(requestId); + return SigningFutureOutcome(std::move(httpRequest)); +} + +template +typename S3ExpressSignerBase::SigningFutureOutcome S3ExpressSignerBase::presign(std::shared_ptr httpRequest, const smithy::AwsCredentialIdentityBase& identity, S3ExpressSignerBase::SigningProperties properties, const Aws::String& region, const Aws::String& serviceName, long long expirationTimeInSeconds) +{ + const auto requestId = Aws::GetWithDefault(httpRequest->GetServiceSpecificParameters()->parameterMap, + Aws::String("dedupeId"), + Aws::String(Aws::Utils::UUID::RandomUUID())); + if(hasRequestId(requestId)) { + return SigningError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, "", "Refusing to sign request more than once", + false /*retryable*/); + } + if(!identity.sessionToken().has_value()) { + return SigningError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, "", "No session token present", + false /*retryable*/); + } + putRequestId(requestId); + httpRequest->AddQueryStringParameter(S3_EXPRESS_QUERY_PARAM, identity.sessionToken().value()); + auto isSigned = BASECLASS::presign(httpRequest, identity, properties, region, serviceName, expirationTimeInSeconds); + deleteRequestId(requestId); + return SigningFutureOutcome(std::move(httpRequest)); + +} + + +template class Aws::S3::S3ExpressSignerBase; \ No newline at end of file diff --git a/generated/src/aws-cpp-sdk-s3/source/S3ExpressSignerProvider.cpp b/generated/src/aws-cpp-sdk-s3/source/S3ExpressSignerProvider.cpp index 5ec13ec73ff..88bd043618a 100644 --- a/generated/src/aws-cpp-sdk-s3/source/S3ExpressSignerProvider.cpp +++ b/generated/src/aws-cpp-sdk-s3/source/S3ExpressSignerProvider.cpp @@ -21,12 +21,12 @@ Aws::Auth::S3ExpressSignerProvider::S3ExpressSignerProvider( region, signingPolicy, urlEscapePath) { - m_signers.emplace_back(Aws::MakeShared(CLASS_TAG, + m_signers.emplace_back(std::static_pointer_cast(Aws::MakeShared(CLASS_TAG, S3ExpressIdentityProvider, credentialsProvider, serviceName.c_str(), region, signingPolicy, urlEscapePath, - AWSSigningAlgorithm::SIGV4)); + AWSSigningAlgorithm::SIGV4))); } \ No newline at end of file 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 9a1933e9e85..ebed0544c80 100644 --- a/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClient.h +++ b/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClient.h @@ -23,6 +23,7 @@ #include #include #include +#include namespace smithy { namespace client @@ -80,7 +81,7 @@ namespace client } AwsSmithyClientT& operator=(const AwsSmithyClientT& other) - { + { if(this != &other) { AwsSmithyClientBase::deepCopy(Aws::MakeUnique(ServiceNameT, other.m_clientConfiguration), @@ -107,6 +108,7 @@ namespace client protected: void initClient() { m_endpointProvider->InitBuiltInParameters(m_clientConfiguration); + m_authSchemeResolver->Init(m_clientConfiguration); } inline const char* GetServiceClientName() const override { return m_serviceName.c_str(); } @@ -150,6 +152,7 @@ namespace client } } } + Aws::Vector authSchemeOptions = m_authSchemeResolver->resolveAuthScheme(identityParams); auto authSchemeOptionIt = std::find_if(authSchemeOptions.begin(), authSchemeOptions.end(), @@ -162,7 +165,7 @@ namespace client if (authSchemeOptionIt != authSchemeOptions.end()) { return SelectAuthSchemeOptionOutcome(*authSchemeOptionIt); } - return AWSError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, + return Aws::Client::AWSError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, "", "Failed to select an auth scheme", false/*retryable*/); @@ -186,7 +189,7 @@ namespace client auto httpResponseOutcome = MakeRequestSync(request, requestName, method, std::move(endpointCallback)); return m_serializer->Deserialize(std::move(httpResponseOutcome), GetServiceClientName(), requestName); } - + Aws::String GeneratePresignedUrl(const Aws::Http::URI& uri, Aws::Http::HttpMethod method, const Aws::String& region, @@ -211,7 +214,35 @@ namespace client return {}; } - ServiceClientConfigurationT& m_clientConfiguration; + + Aws::String GeneratePresignedUrl(const Aws::Endpoint::AWSEndpoint& endpoint, + Aws::Http::HttpMethod method, + const Aws::String& region, + const Aws::String& serviceName, + long long expirationInSeconds, + const Aws::Http::HeaderValueCollection& customizedHeaders, + const std::shared_ptr serviceSpecificParameters) const + { + const Aws::Http::URI& uri = endpoint.GetURI(); + auto signerRegionOverride = region; + auto signerServiceNameOverride = serviceName; + //signer name is needed for some identity resolvers + if (endpoint.GetAttributes()) { + if (endpoint.GetAttributes()->authScheme.GetSigningRegion()) { + signerRegionOverride = endpoint.GetAttributes()->authScheme.GetSigningRegion()->c_str(); + } + if (endpoint.GetAttributes()->authScheme.GetSigningRegionSet()) { + signerRegionOverride = endpoint.GetAttributes()->authScheme.GetSigningRegionSet()->c_str(); + } + if (endpoint.GetAttributes()->authScheme.GetSigningName()) { + signerServiceNameOverride = endpoint.GetAttributes()->authScheme.GetSigningName()->c_str(); + } + } + return GeneratePresignedUrl(uri, method, signerRegionOverride, signerServiceNameOverride, expirationInSeconds, customizedHeaders, serviceSpecificParameters); + } + + protected: + ServiceClientConfigurationT m_clientConfiguration; std::shared_ptr m_endpointProvider{}; std::shared_ptr m_authSchemeResolver{}; Aws::UnorderedMap m_authSchemes{}; 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 2ab12f15edc..8b43819fb35 100644 --- a/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientBase.h +++ b/src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientBase.h @@ -20,7 +20,7 @@ #include #include #include - +#include #include namespace Aws @@ -83,6 +83,9 @@ namespace client using ResponseHandlerFunc = std::function; using SelectAuthSchemeOptionOutcome = Aws::Utils::Outcome; using ResolveEndpointOutcome = Aws::Utils::Outcome; + using StreamOutcome = Aws::Utils::Outcome, AWSError >; + using ResolveEndpointFunctionType = std::function; + AwsSmithyClientBase(Aws::UniquePtr&& clientConfig, Aws::String serviceName, @@ -94,7 +97,7 @@ namespace client m_serviceUserAgentName(std::move(serviceUserAgentName)), m_httpClient(std::move(httpClient)), m_errorMarshaller(std::move(errorMarshaller)), - m_interceptors{Aws::MakeShared("AwsSmithyClientBase")} + m_interceptors{Aws::MakeShared("AwsSmithyClientBase", *m_clientConfig)} { baseInit(); } @@ -110,7 +113,7 @@ namespace client m_serviceUserAgentName(std::move(serviceUserAgentName)), m_httpClient(std::move(httpClient)), m_errorMarshaller(std::move(errorMarshaller)), - m_interceptors{Aws::MakeShared("AwsSmithyClientBase")} + m_interceptors{Aws::MakeShared("AwsSmithyClientBase", *m_clientConfig)} { AWS_UNREFERENCED_PARAM(other); baseCopyInit(); @@ -135,6 +138,13 @@ namespace client Aws::Http::HttpMethod method, EndpointUpdateCallback&& endpointCallback) const; + StreamOutcome MakeRequestWithUnparsedResponse(Aws::AmazonWebServiceRequest const * const request, + const char* requestName, + Aws::Http::HttpMethod method, + EndpointUpdateCallback&& endpointCallback + ) const; + void AppendToUserAgent(const Aws::String& valueToAppend); + protected: void deepCopy(Aws::UniquePtr&& clientConfig, const Aws::String& serviceName, @@ -176,6 +186,7 @@ namespace client inline virtual const char* GetServiceClientName() const { return m_serviceName.c_str(); } inline virtual const std::shared_ptr& GetHttpClient() { return m_httpClient; } virtual void DisableRequestProcessing(); + virtual void EnableRequestProcessing(); virtual ResolveEndpointOutcome ResolveEndpoint(const Aws::Endpoint::EndpointParameters& endpointParameters, EndpointUpdateCallback&& epCallback) const = 0; virtual SelectAuthSchemeOptionOutcome SelectAuthSchemeOption(const AwsSmithyClientAsyncRequestContext& ctx) const = 0; @@ -189,6 +200,9 @@ namespace client std::shared_ptr m_httpClient; std::shared_ptr m_errorMarshaller; Aws::Vector> m_interceptors{}; + std::shared_ptr m_userAgentInterceptor; + private: + void UpdateAuthSchemeFromEndpoint(const Aws::Endpoint::AWSEndpoint& endpoint, AuthSchemeOption& authscheme) const; }; } // namespace client } // namespace smithy 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 f5f0fc3b5c6..2154141fa11 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 @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -56,7 +57,6 @@ namespace smithy return SignWithAuthScheme(std::move(HTTPRequest), authScheme, authSchemeOption); } - static SigningOutcome PreSignRequest(std::shared_ptr httpRequest, const AuthSchemeOption& authSchemeOption, const Aws::UnorderedMap& authSchemes, @@ -64,7 +64,7 @@ namespace smithy const Aws::String& serviceName, long long expirationTimeInSeconds) { - + auto authSchemeIt = authSchemes.find(authSchemeOption.schemeId); if (authSchemeIt == authSchemes.end()) { @@ -145,7 +145,19 @@ namespace smithy return; } - auto identityResult = identityResolver->getIdentity(m_targetAuthSchemeOption.identityProperties(), m_targetAuthSchemeOption.identityProperties()); + //relay service params in additional properties which will be relevant in credential resolution + // example: bucket Name + Aws::UnorderedMap> additonalIdentityProperties; + const auto& serviceSpecificParameters = m_httpRequest->GetServiceSpecificParameters(); + if(serviceSpecificParameters) + { + for(const auto& propPair : serviceSpecificParameters->parameterMap) + { + additonalIdentityProperties.emplace(propPair.first,Aws::Crt::Variant{propPair.second} ); + } + } + + auto identityResult = identityResolver->getIdentity(m_targetAuthSchemeOption.identityProperties(), additonalIdentityProperties); if (!identityResult.IsSuccess()) { @@ -205,7 +217,6 @@ namespace smithy "Auth scheme provided a nullptr identityResolver", false /*retryable*/)); return; } - auto identityResult = identityResolver->getIdentity(m_targetAuthSchemeOption.identityProperties(), m_targetAuthSchemeOption.identityProperties()); 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..f9a286efe29 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 @@ -23,8 +23,24 @@ namespace smithy { const char* schemeId = nullptr; - PropertyBag virtual identityProperties() const { return PropertyBag{}; }; - PropertyBag virtual signerProperties() const { return PropertyBag{}; }; + PropertyBag virtual identityProperties() const { return m_identityProperties; }; + PropertyBag virtual signerProperties() const { return m_signerProperties; }; + void putIdentityProperty( const Aws::String& key,const Aws::Crt::Variant& value) { + auto it = m_identityProperties.emplace(key, value); + if(!it.second) { + it.first->second = value; + } + }; + void putSignerProperty( const Aws::String& key,const Aws::Crt::Variant& value) { + auto it = m_signerProperties.emplace(key, value); + if(!it.second) { + it.first->second = value; + } + }; EndpointParameters virtual endpointParameters() const { return EndpointParameters{}; }; + + private: + PropertyBag m_identityProperties; + PropertyBag m_signerProperties; }; } \ No newline at end of file diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthSchemeResolverBase.h b/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthSchemeResolverBase.h index d7c572e119b..e2e7a8349b0 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthSchemeResolverBase.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/auth/AuthSchemeResolverBase.h @@ -10,6 +10,7 @@ #include #include + namespace smithy { /** * A base interface for code-generated interfaces for passing in the data required for determining the @@ -29,10 +30,15 @@ namespace smithy { }; - template + template class AuthSchemeResolverBase { public: + + virtual void Init(const ClientConfigT& config) { + AWS_UNREFERENCED_PARAM(config); + } + using ServiceAuthSchemeParameters = ServiceAuthSchemeParametersT; virtual ~AuthSchemeResolverBase() = default; 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 661b5c71df3..fd35a02b965 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 @@ -36,6 +36,20 @@ namespace smithy { assert(m_signer); } + //delegate constructor + explicit SigV4AuthScheme(std::shared_ptr identityResolver, + const Aws::String& serviceName, + const Aws::String& region, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy, + bool urlEscapePath) + : AuthScheme(SIGV4), + m_identityResolver{identityResolver}, + m_signer{Aws::MakeShared("SigV4AuthScheme", serviceName, region, policy, urlEscapePath)} + { + assert(m_identityResolver); + assert(m_signer); + } + //delegate constructor explicit SigV4AuthScheme(const Aws::String& serviceName, const Aws::String& region) @@ -45,6 +59,19 @@ namespace smithy { { } + //For legacy constructors, signing requires additonal input parameters + explicit SigV4AuthScheme(const Aws::String& serviceName, + const Aws::String& region, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy, + bool urlEscapePath) + : SigV4AuthScheme(Aws::MakeShared("SigV4AuthScheme"), + serviceName, + region, + policy, + urlEscapePath) + { + } + virtual ~SigV4AuthScheme() = default; std::shared_ptr identityResolver() override diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4MultiAuthResolver.h b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4MultiAuthResolver.h new file mode 100644 index 00000000000..02507ec63fe --- /dev/null +++ b/src/aws-cpp-sdk-core/include/smithy/identity/auth/built-in/SigV4MultiAuthResolver.h @@ -0,0 +1,72 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +namespace smithy { + template + class SigV4MultiAuthSchemeResolver : public AuthSchemeResolverBase + { + private: + public: + + void Init(const ClientConfigType& config) override{ + m_endpointProviderForAuth = Aws::MakeShared("SigV4MultiAuthSchemeResolver"); + m_endpointProviderForAuth->InitBuiltInParameters(config); + } + + using ServiceAuthSchemeParameters = ServiceAuthSchemeParametersT; + virtual ~SigV4MultiAuthSchemeResolver() = default; + + Aws::Vector resolveAuthScheme(const ServiceAuthSchemeParameters& identityProperties) override + { + //pack endpoint params from identityProperties + Aws::Endpoint::EndpointParameters epParams; + + for (auto& identParam : identityProperties.additionalProperties) { + if (identParam.second.template holds_alternative()) + { + epParams.emplace_back(Aws::Endpoint::EndpointParameter(identParam.first, identParam.second.template get())); + } + if (identParam.second.template holds_alternative()) + { + epParams.emplace_back(Aws::Endpoint::EndpointParameter(identParam.first ,identParam.second.template get())); + } + } + + //resolve endpoint first time to fetch auth schemes + if (m_endpointProviderForAuth) { + auto epResolutionOutcome = m_endpointProviderForAuth->ResolveEndpoint(epParams); + if (epResolutionOutcome.IsSuccess()) + { + auto endpoint = std::move(epResolutionOutcome.GetResultWithOwnership()); + if (endpoint.GetAttributes()) + { + auto authSchemeName = endpoint.GetAttributes()->authScheme.GetName(); + if(strcmp(authSchemeName.c_str(),Aws::Auth::ASYMMETRIC_SIGV4_SIGNER) == 0) + { + return {SigV4aAuthSchemeOption::sigV4aAuthSchemeOption}; + } + else if(strcmp(authSchemeName.c_str(),Aws::Auth::SIGV4_SIGNER) == 0) + { + return {SigV4AuthSchemeOption::sigV4AuthSchemeOption}; + } + } + } + } + + return {SigV4AuthSchemeOption::sigV4AuthSchemeOption}; + } + protected: + std::shared_ptr m_endpointProviderForAuth; + }; +} \ No newline at end of file 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..07cc730ba6d 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 @@ -41,10 +41,15 @@ namespace smithy { : SigV4aAuthScheme(Aws::MakeShared("SigV4aAuthScheme"), serviceName, region) { assert(m_identityResolver); - assert(m_signer); } + //legacy constructors + explicit SigV4aAuthScheme(std::shared_ptr identityResolver, const Aws::String& serviceName, const Aws::String& region, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy, bool urlEscape) + : AuthScheme(SIGV4A), + m_identityResolver{identityResolver}, + m_signer{Aws::MakeShared("SigV4aAuthScheme", serviceName, region, policy, urlEscape)}{} + virtual ~SigV4aAuthScheme() = default; std::shared_ptr identityResolver() override diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/identity/AwsCredentialIdentity.h b/src/aws-cpp-sdk-core/include/smithy/identity/identity/AwsCredentialIdentity.h index 9767ec8d461..ec6b478937b 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/identity/AwsCredentialIdentity.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/identity/AwsCredentialIdentity.h @@ -21,6 +21,8 @@ namespace smithy { Aws::Crt::Optional sessionToken() const override; Aws::Crt::Optional expiration() const override; + AwsCredentialIdentity() = default; + protected: Aws::String m_accessKeyId; Aws::String m_secretAccessKey; diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/resolver/built-in/AwsCredentialsProviderIdentityResolver.h b/src/aws-cpp-sdk-core/include/smithy/identity/resolver/built-in/AwsCredentialsProviderIdentityResolver.h index 35ded383886..a829b5c5009 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/resolver/built-in/AwsCredentialsProviderIdentityResolver.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/resolver/built-in/AwsCredentialsProviderIdentityResolver.h @@ -14,7 +14,7 @@ namespace smithy class AwsCredentialsProviderIdentityResolver : public AwsCredentialIdentityResolver { public: - using SigV4AuthSchemeParameters = DefaultAuthSchemeResolverParameters; + using SigV4AuthSchemeParameters = smithy::DefaultAuthSchemeResolverParameters; explicit AwsCredentialsProviderIdentityResolver(const std::shared_ptr credentialsProvider) : m_credentialsProvider(credentialsProvider) diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/resolver/built-in/SimpleAwsCredentialIdentityResolver.h b/src/aws-cpp-sdk-core/include/smithy/identity/resolver/built-in/SimpleAwsCredentialIdentityResolver.h index 89cb5077397..10ff28dd083 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/resolver/built-in/SimpleAwsCredentialIdentityResolver.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/resolver/built-in/SimpleAwsCredentialIdentityResolver.h @@ -5,16 +5,16 @@ #pragma once #include - #include #include +#include namespace smithy { class SimpleAwsCredentialIdentityResolver : public AwsCredentialIdentityResolver { public: - using SigV4AuthSchemeParameters = DefaultAuthSchemeResolverParameters; + using SigV4AuthSchemeParameters = smithy::DefaultAuthSchemeResolverParameters; explicit SimpleAwsCredentialIdentityResolver(const Aws::Auth::AWSCredentials& credentials) : m_credentials(credentials) diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SigV4Signer.h b/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SigV4Signer.h index 8c150b77b09..8d434753210 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SigV4Signer.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SigV4Signer.h @@ -10,6 +10,8 @@ #include #include +#include +#include namespace smithy { /** @@ -26,6 +28,15 @@ namespace smithy { legacySigner(nullptr, serviceName.c_str(), region, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Always) { } + /* + For legacy constructors, this is needed + */ + explicit AwsSigV4Signer(const Aws::String& serviceName, const Aws::String& region, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy, bool urlEscapePath) + : m_serviceName(serviceName), + m_region(region), + legacySigner(nullptr, serviceName.c_str(), region, policy, urlEscapePath) + { + } SigningFutureOutcome sign(std::shared_ptr httpRequest, const AwsCredentialIdentityBase& identity, SigningProperties properties) override { @@ -41,13 +52,18 @@ namespace smithy { return {identity.accessKeyId(), identity.secretAccessKey()}; }(); - - auto signPayloadIt = properties.find("SignPayload"); bool signPayload = signPayloadIt != properties.end() ? signPayloadIt->second.get() == "true" : false; + auto signerRegionOverrideIt = properties.find(smithy::SIGNER_REGION_PROPERTY); + auto region = signerRegionOverrideIt != properties.end() ? signerRegionOverrideIt->second.get().c_str() : m_region.c_str(); + + auto signerServiceNameOverrideIt = properties.find(smithy::SIGNER_SERVICE_NAME); + auto svcName = signerServiceNameOverrideIt != properties.end() ? signerServiceNameOverrideIt->second.get().c_str() : m_serviceName.c_str(); + + assert(httpRequest); - bool success = legacySigner.SignRequestWithCreds(*httpRequest, legacyCreds, m_region.c_str(), m_serviceName.c_str(), signPayload); + bool success = legacySigner.SignRequestWithCreds(*httpRequest, legacyCreds, region, svcName, signPayload); if (success) { return SigningFutureOutcome(std::move(httpRequest)); @@ -76,9 +92,22 @@ namespace smithy { false /*retryable*/)); } - virtual ~AwsSigV4Signer() {}; protected: + + // strictly for backward compatibility + explicit AwsSigV4Signer(const std::shared_ptr &credentialsProvider, const Aws::String& serviceName, const Aws::String& region, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy, + bool urlEscapePath, Aws::Auth::AWSSigningAlgorithm signingAlgorithm ) + : m_serviceName(serviceName), + m_region(region), + legacySigner(credentialsProvider, serviceName.c_str(), region, policy, urlEscapePath, signingAlgorithm) + { + } + + const Aws::Client::AWSAuthV4Signer& getLegacySigner() const { + return legacySigner; + } + Aws::String m_serviceName; Aws::String m_region; Aws::Client::AWSAuthV4Signer legacySigner; diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SigV4aSigner.h b/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SigV4aSigner.h index 2c5e5b6d756..cf5b9ac44d8 100644 --- a/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SigV4aSigner.h +++ b/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SigV4aSigner.h @@ -16,6 +16,8 @@ #include #include #include +#include +#include namespace smithy { static const char* UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD"; @@ -31,21 +33,33 @@ namespace smithy { class AwsSigV4aSigner : public AwsSignerBase { public: - using SigV4aAuthSchemeParameters = smithy::DefaultAuthSchemeResolverParameters; + using SigV4aAuthSchemeParameters = DefaultAuthSchemeResolverParameters; explicit AwsSigV4aSigner(const Aws::String& serviceName, const Aws::String& region) : m_serviceName(serviceName), m_region(region) { } + //for legacy constructors + explicit AwsSigV4aSigner(const Aws::String& serviceName, const Aws::String& region, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy) + : m_serviceName(serviceName), m_region(region), m_policy(Aws::MakeShared("AwsSigV4aSigner", policy)) + { + } + + explicit AwsSigV4aSigner(const Aws::String& serviceName, const Aws::String& region, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy, bool urlEscape) + : m_serviceName(serviceName), m_region(region), m_policy(Aws::MakeShared("AwsSigV4aSigner", policy)), m_urlEscape{urlEscape} + { + } + SigningFutureOutcome sign(std::shared_ptr httpRequest, const AwsCredentialIdentityBase& identity, SigningProperties properties) override { - return sign(httpRequest, identity, properties, m_region, m_serviceName, m_expirationTimeInSeconds); + return sign(httpRequest, identity, properties, m_region, m_serviceName, m_expirationTimeInSeconds, Aws::Crt::Auth::SignatureType::HttpRequestViaHeaders); } SigningFutureOutcome presign(std::shared_ptr httpRequest, const AwsCredentialIdentityBase& identity, SigningProperties properties, const Aws::String& region, const Aws::String& serviceName, long long expirationTimeInSeconds) override { Aws::String signingRegion = !region.empty() ? region : m_region; Aws::String signingServiceName = !serviceName.empty() ? serviceName : m_serviceName; + Aws::Crt::Auth::SignatureType signatureType = Aws::Crt::Auth::SignatureType::HttpRequestViaQueryParams; const auto credentials = [&identity]() -> Aws::Auth::AWSCredentials { if(identity.sessionToken().has_value() && identity.expiration().has_value()) @@ -64,7 +78,7 @@ namespace smithy { { return SigningFutureOutcome(std::move(httpRequest)) ; } - return sign(httpRequest, identity, properties, signingRegion, signingServiceName, expirationTimeInSeconds); + return sign(httpRequest, identity, properties, signingRegion, signingServiceName, expirationTimeInSeconds, signatureType); } virtual ~AwsSigV4aSigner() {}; @@ -72,14 +86,17 @@ namespace smithy { bool createAwsSigningConfig( std::shared_ptr& crtCredentials, - const Aws::Http::HttpRequest& request, + const Aws::Http::HttpRequest& request, + const Aws::String& serviceName, + const Aws::String& region, Aws::Crt::Auth::AwsSigningConfig& awsSigningConfig, - bool signBody) const + bool signBody, + Aws::Crt::Auth::SignatureType signatureType) const { awsSigningConfig.SetSigningAlgorithm(static_cast(Aws::Auth::AWSSigningAlgorithm::ASYMMETRIC_SIGV4)); - awsSigningConfig.SetSignatureType(m_signatureType); - awsSigningConfig.SetRegion(m_region.c_str()); - awsSigningConfig.SetService(m_region.c_str()); + awsSigningConfig.SetSignatureType(signatureType); + awsSigningConfig.SetRegion(serviceName.c_str()); + awsSigningConfig.SetService(region.c_str()); awsSigningConfig.SetSigningTimepoint(GetSigningTimestamp().UnderlyingTimestamp()); awsSigningConfig.SetUseDoubleUriEncode(m_urlEscape); awsSigningConfig.SetShouldNormalizeUriPath(true); @@ -90,7 +107,7 @@ namespace smithy { Aws::String headerKey(reinterpret_cast(name->ptr), name->len); return unsignedHeaders->find(Aws::Utils::StringUtils::ToLower(headerKey.c_str())) == unsignedHeaders->cend(); }); - if (m_signatureType == Aws::Crt::Auth::SignatureType::HttpRequestViaHeaders) + if (signatureType == Aws::Crt::Auth::SignatureType::HttpRequestViaHeaders) { Aws::String payloadHash(UNSIGNED_PAYLOAD); if(signBody || request.GetUri().GetScheme() != Aws::Http::Scheme::HTTPS) @@ -114,9 +131,9 @@ namespace smithy { awsSigningConfig.SetSignedBodyValue(payloadHash.c_str()); awsSigningConfig.SetSignedBodyHeader(m_includeSha256HashHeader ? Aws::Crt::Auth::SignedBodyHeaderType::XAmzContentSha256 : Aws::Crt::Auth::SignedBodyHeaderType::None); } - else if (m_signatureType == Aws::Crt::Auth::SignatureType::HttpRequestViaQueryParams) + else if (signatureType == Aws::Crt::Auth::SignatureType::HttpRequestViaQueryParams) { - if (ServiceRequireUnsignedPayload(m_serviceName)) + if (ServiceRequireUnsignedPayload(serviceName)) { awsSigningConfig.SetSignedBodyValue(UNSIGNED_PAYLOAD); } @@ -135,16 +152,44 @@ namespace smithy { return true; } -SigningFutureOutcome sign(std::shared_ptr httpRequest, const AwsCredentialIdentityBase& identity, SigningProperties properties, const Aws::String& regionOverride, const Aws::String& serviceName, long long expirationTimeInSeconds) + + SigningFutureOutcome sign(std::shared_ptr httpRequest, const AwsCredentialIdentityBase& identity, SigningProperties properties, const Aws::String& region, const Aws::String& svcName, long long expirationTimeInSeconds, + Aws::Crt::Auth::SignatureType signatureType) { + assert(httpRequest); + assert(identity.expiration().has_value()); + + const auto legacyCreds = [&identity]() -> Aws::Auth::AWSCredentials { + if(identity.sessionToken().has_value() && identity.expiration().has_value()) + { + return {identity.accessKeyId(), identity.secretAccessKey(), *identity.sessionToken(), *identity.expiration()}; + } + if(identity.sessionToken().has_value()) + { + return {identity.accessKeyId(), identity.secretAccessKey(), *identity.sessionToken()}; + } + return {identity.accessKeyId(), identity.secretAccessKey()}; + }(); auto signPayloadIt = properties.find("SignPayload"); bool signPayload = signPayloadIt != properties.end() ? signPayloadIt->second.get() == "true" : false; - assert(httpRequest); - assert(identity.expiration().has_value()); + auto signerRegionOverrideIt = properties.find(smithy::SIGNER_REGION_PROPERTY); + auto regionOverride = signerRegionOverrideIt != properties.end() ? signerRegionOverrideIt->second.get().c_str() : region.c_str(); + + auto signerServiceNameOverrideIt = properties.find(smithy::SIGNER_SERVICE_NAME); + auto serviceName = signerServiceNameOverrideIt != properties.end() ? signerServiceNameOverrideIt->second.get().c_str() : svcName.c_str(); auto &request = *httpRequest; + + //don't sign anonymous requests + if (legacyCreds.GetAWSAccessKeyId().empty() || legacyCreds.GetAWSSecretKey().empty()) + { + return SigningFutureOutcome(std::move(httpRequest)); + } + + httpRequest->SetSigningAccessKey(legacyCreds.GetAWSAccessKeyId()); + httpRequest->SetSigningRegion(regionOverride); auto crtCredentials = Aws::MakeShared(v4AsymmetricLogTag, Aws::Crt::ByteCursorFromCString(identity.accessKeyId().c_str()), @@ -154,7 +199,7 @@ SigningFutureOutcome sign(std::shared_ptr httpRequest, const AwsCre Aws::Crt::Auth::AwsSigningConfig awsSigningConfig; - bool success = createAwsSigningConfig(crtCredentials, request, awsSigningConfig, signPayload); + bool success = createAwsSigningConfig(crtCredentials, request, serviceName, regionOverride, awsSigningConfig, signPayload, signatureType); if(!success) { @@ -163,8 +208,8 @@ SigningFutureOutcome sign(std::shared_ptr httpRequest, const AwsCre return SigningError(Aws::Client::CoreErrors::MEMORY_ALLOCATION, "", "Failed to get Auth configuration", false); } - awsSigningConfig.SetRegion(regionOverride.c_str()); - awsSigningConfig.SetService(serviceName.c_str()); + awsSigningConfig.SetRegion(regionOverride); + awsSigningConfig.SetService(serviceName); awsSigningConfig.SetExpirationInSeconds(expirationTimeInSeconds); std::shared_ptr crtHttpRequest = request.ToCrtHttpRequest(); @@ -175,13 +220,13 @@ SigningFutureOutcome sign(std::shared_ptr httpRequest, const AwsCre bool processed = false; //producer function sigv4HttpRequestSigner->SignRequest(crtHttpRequest, awsSigningConfig, - [&request, &success, &errorMessage, &processed, this](const std::shared_ptr& signedCrtHttpRequest, int errorCode) { + [&request, &success, &errorMessage, &processed, this, signatureType](const std::shared_ptr& signedCrtHttpRequest, int errorCode) { std::unique_lock lock(m_mutex); m_cv.wait(lock, [&]{ return !processed; }); success = (errorCode == AWS_ERROR_SUCCESS); if (success) { - if (m_signatureType == Aws::Crt::Auth::SignatureType::HttpRequestViaHeaders) + if (signatureType == Aws::Crt::Auth::SignatureType::HttpRequestViaHeaders) { for (size_t i = 0; i < signedCrtHttpRequest->GetHeaderCount(); i++) { @@ -190,7 +235,7 @@ SigningFutureOutcome sign(std::shared_ptr httpRequest, const AwsCre Aws::String(reinterpret_cast(httpHeader->value.ptr), httpHeader->value.len)); } } - else if (m_signatureType == Aws::Crt::Auth::SignatureType::HttpRequestViaQueryParams) + else if (signatureType == Aws::Crt::Auth::SignatureType::HttpRequestViaQueryParams) { Aws::Http::URI newPath(reinterpret_cast(signedCrtHttpRequest->GetPath()->ptr)); request.GetUri().SetQueryString(newPath.GetQueryString()); @@ -239,12 +284,13 @@ SigningFutureOutcome sign(std::shared_ptr httpRequest, const AwsCre Aws::String m_serviceName; Aws::String m_region; + std::shared_ptr m_policy; //params that can be exposed later long long m_expirationTimeInSeconds{0}; const bool m_includeSha256HashHeader{true}; const bool m_urlEscape{true}; const Aws::Set m_unsignedHeaders{USER_AGENT,X_AMZN_TRACE_ID}; - const Aws::Crt::Auth::SignatureType m_signatureType{Aws::Crt::Auth::SignatureType::HttpRequestViaQueryParams}; + const Aws::Crt::Auth::SignatureType m_signatureType{Aws::Crt::Auth::SignatureType::HttpRequestViaHeaders}; std::condition_variable m_cv; std::mutex m_mutex; }; diff --git a/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SignerProperties.h b/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SignerProperties.h new file mode 100644 index 00000000000..ac8aa60c36d --- /dev/null +++ b/src/aws-cpp-sdk-core/include/smithy/identity/signer/built-in/SignerProperties.h @@ -0,0 +1,10 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +namespace smithy { + extern SMITHY_API const char *SIGNER_REGION_PROPERTY; + extern SMITHY_API const char *SIGNER_SERVICE_NAME; +} 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 4fa9933044b..0b059488393 100644 --- a/src/aws-cpp-sdk-core/source/smithy/client/AwsSmithyClientBase.cpp +++ b/src/aws-cpp-sdk-core/source/smithy/client/AwsSmithyClientBase.cpp @@ -17,6 +17,10 @@ #include "aws/core/utils/threading/Executor.h" #include "aws/core/utils/threading/SameThreadExecutor.h" #include "smithy/tracing/TracingUtils.h" +#include +#include +#include +#include using namespace smithy::client; using namespace smithy::interceptor; @@ -24,6 +28,11 @@ using namespace smithy::components::tracing; static const char AWS_SMITHY_CLIENT_LOG[] = "AwsSmithyClient"; +namespace smithy { + SMITHY_API const char *SIGNER_REGION_PROPERTY = "signerRegionOverride"; + SMITHY_API const char *SIGNER_SERVICE_NAME = "signerServiceNameOverride"; +} + namespace { void AddHeadersToRequest(const std::shared_ptr& httpRequest, const Aws::Http::HeaderValueCollection& headerValues) @@ -59,10 +68,11 @@ void AwsSmithyClientBase::baseInit() { createFromFactories(m_clientConfig->readRateLimiter, m_clientConfig->configFactories.readRateLimiterCreateFn); createFromFactories(m_clientConfig->telemetryProvider, m_clientConfig->configFactories.telemetryProviderCreateFn); if (m_clientConfig && m_clientConfig->retryStrategy) { - m_interceptors.emplace_back(Aws::MakeShared(AWS_SMITHY_CLIENT_LOG, + m_userAgentInterceptor = Aws::MakeShared(AWS_SMITHY_CLIENT_LOG, *m_clientConfig, m_clientConfig->retryStrategy->GetStrategyName(), - m_serviceUserAgentName)); + m_serviceUserAgentName); + m_interceptors.emplace_back(m_userAgentInterceptor); } } @@ -73,10 +83,11 @@ void AwsSmithyClientBase::baseCopyInit() { createFromFactoriesIfPresent(m_clientConfig->readRateLimiter, m_clientConfig->configFactories.readRateLimiterCreateFn); createFromFactoriesIfPresent(m_clientConfig->telemetryProvider, m_clientConfig->configFactories.telemetryProviderCreateFn); if (m_clientConfig && m_clientConfig->retryStrategy) { - m_interceptors.emplace_back(Aws::MakeShared(AWS_SMITHY_CLIENT_LOG, + m_userAgentInterceptor = Aws::MakeShared(AWS_SMITHY_CLIENT_LOG, *m_clientConfig, m_clientConfig->retryStrategy->GetStrategyName(), - m_serviceUserAgentName)); + m_serviceUserAgentName); + m_interceptors.emplace_back(m_userAgentInterceptor); } } @@ -109,6 +120,8 @@ AwsSmithyClientBase::BuildHttpRequest(const std::shared_ptrGetHeaders()); AddHeadersToRequest(httpRequest, pRequest->GetAdditionalCustomHeaders()); + httpRequest->SetHasEventStreamResponse(pRequest->HasEventStreamResponse()); + if (pRequest->IsEventStreamRequest()) { httpRequest->SetEventStreamRequest(true); @@ -165,7 +178,6 @@ void AwsSmithyClientBase::MakeRequestAsync(Aws::AmazonWebServiceRequest const* c } ); return; } - pRequestCtx->m_responseHandler = std::move(responseHandler); pRequestCtx->m_pExecutor = pExecutor; pRequestCtx->m_pRequest = request; if (requestName) @@ -192,13 +204,20 @@ void AwsSmithyClientBase::MakeRequestAsync(Aws::AmazonWebServiceRequest const* c auto epResolutionOutcome = this->ResolveEndpoint(std::move(epParams), std::move(endpointCallback)); if (!epResolutionOutcome.IsSuccess()) { - pExecutor->Submit([epResolutionOutcome, responseHandler]() mutable + auto epOutcome = ResolveEndpointOutcome(Aws::Client::AWSError{ + Aws::Client::CoreErrors::ENDPOINT_RESOLUTION_FAILURE, + epResolutionOutcome.GetError().GetExceptionName(), + epResolutionOutcome.GetError().GetMessage(), + false}); + + pExecutor->Submit([epOutcome, responseHandler]() mutable { - responseHandler(std::move(epResolutionOutcome)); + responseHandler(std::move(epOutcome)); } ); return; } pRequestCtx->m_endpoint = std::move(epResolutionOutcome.GetResultWithOwnership()); + if (!Aws::Utils::IsValidHost(pRequestCtx->m_endpoint.GetURI().GetAuthority())) { AWS_LOGSTREAM_ERROR(AWS_SMITHY_CLIENT_LOG, "Invalid DNS Label found in URI host"); @@ -212,10 +231,31 @@ void AwsSmithyClientBase::MakeRequestAsync(Aws::AmazonWebServiceRequest const* c pRequestCtx->m_requestInfo.attempt = 1; pRequestCtx->m_requestInfo.maxAttempts = 0; pRequestCtx->m_interceptorContext = Aws::MakeShared(AWS_SMITHY_CLIENT_LOG, *request); - + pRequestCtx->m_responseHandler = std::move(responseHandler); AttemptOneRequestAsync(std::move(pRequestCtx)); } +void AwsSmithyClientBase::UpdateAuthSchemeFromEndpoint(const Aws::Endpoint::AWSEndpoint& endpoint, smithy::AuthSchemeOption& authscheme) const +{ + //Overrides from endpoint + if (endpoint.GetAttributes()) { + auto authschemeName = endpoint.GetAttributes()->authScheme.GetName(); + if (endpoint.GetAttributes()->authScheme.GetSigningRegion()) { + auto signerRegionOverride = endpoint.GetAttributes()->authScheme.GetSigningRegion(); + authscheme.putSignerProperty(smithy::SIGNER_REGION_PROPERTY, Aws::Crt::Variant(Aws::String(signerRegionOverride->c_str()))); + } + if (endpoint.GetAttributes()->authScheme.GetSigningRegionSet()) { + auto signerRegionOverride = endpoint.GetAttributes()->authScheme.GetSigningRegionSet(); + authscheme.putSignerProperty(smithy::SIGNER_REGION_PROPERTY, Aws::Crt::Variant(Aws::String(signerRegionOverride->c_str()))); + } + if (endpoint.GetAttributes()->authScheme.GetSigningName()) { + auto signerServiceNameOverride = endpoint.GetAttributes()->authScheme.GetSigningName(); + authscheme.putSignerProperty(smithy::SIGNER_SERVICE_NAME, Aws::Crt::Variant(Aws::String(signerServiceNameOverride->c_str()))); + } + } +} + + /*HttpResponseOutcome*/ void AwsSmithyClientBase::AttemptOneRequestAsync(std::shared_ptr pRequestCtx) const { @@ -227,6 +267,9 @@ void AwsSmithyClientBase::AttemptOneRequestAsync(std::shared_ptrm_responseHandler; auto pExecutor = pRequestCtx->m_pExecutor; + //This is extracted here so that on retry with correct region, signer region override is honored + UpdateAuthSchemeFromEndpoint(pRequestCtx->m_endpoint, pRequestCtx->m_authSchemeOption); + TracingUtils::MakeCallWithTiming( [&]() -> void { pRequestCtx->m_httpRequest = BuildHttpRequest(pRequestCtx, pRequestCtx->m_endpoint.GetURI(), pRequestCtx->m_method); @@ -361,15 +404,23 @@ void AwsSmithyClientBase::HandleAsyncReply(std::shared_ptrm_pRequest && - pRequestCtx->m_pRequest->HasEmbeddedError(httpResponse->GetResponseBody(), httpResponse->GetHeaders()); - if (Utils::DoesResponseGenerateError(httpResponse) || hasEmbeddedError) + auto hasEmbeddedError = [&]() { + return pRequestCtx->m_pRequest && + pRequestCtx->m_pRequest->HasEmbeddedError(httpResponse->GetResponseBody(), httpResponse->GetHeaders()); + }; + if (Utils::DoesResponseGenerateError(httpResponse)) { AWS_LOGSTREAM_DEBUG(AWS_SMITHY_CLIENT_LOG, "Request returned error. Attempting to generate appropriate error codes from response"); assert(m_errorMarshaller); auto error = m_errorMarshaller->BuildAWSError(httpResponse); return HttpResponseOutcome(std::move(error)); } + else if (hasEmbeddedError()) { + AWS_LOGSTREAM_DEBUG(AWS_SMITHY_CLIENT_LOG, "Response has embedded errors"); + + auto error = m_errorMarshaller->Marshall(*httpResponse); + return HttpResponseOutcome(std::move(error) ); + } AWS_LOGSTREAM_DEBUG(AWS_SMITHY_CLIENT_LOG, "Request returned successful response."); return HttpResponseOutcome(std::move(httpResponse)); } (); @@ -494,7 +545,7 @@ void AwsSmithyClientBase::HandleAsyncReply(std::shared_ptrExtractEndpoint(outcome.GetError()); - if (newEndpoint.empty()) { + if (!newEndpoint.empty()) { Aws::Http::URI newUri = pRequestCtx->m_endpoint.GetURI(); newUri.SetAuthority(newEndpoint); pRequestCtx->m_endpoint.SetURI(newUri); @@ -552,3 +603,32 @@ void AwsSmithyClientBase::DisableRequestProcessing() { m_httpClient->DisableRequestProcessing(); } + +void AwsSmithyClientBase::EnableRequestProcessing() +{ + m_httpClient->EnableRequestProcessing(); +} + +AwsSmithyClientBase::StreamOutcome AwsSmithyClientBase::MakeRequestWithUnparsedResponse(Aws::AmazonWebServiceRequest const * const request, + const char* requestName, + Aws::Http::HttpMethod method, + EndpointUpdateCallback&& endpointCallback + ) const +{ + auto httpResponseOutcome = MakeRequestSync(request, requestName, method, std::move(endpointCallback)); + + if (httpResponseOutcome.IsSuccess()) + { + return StreamOutcome(Aws::AmazonWebServiceResult( + httpResponseOutcome.GetResult()->SwapResponseStreamOwnership(), + httpResponseOutcome.GetResult()->GetHeaders(), httpResponseOutcome.GetResult()->GetResponseCode())); + } + + return StreamOutcome(std::move(httpResponseOutcome)); +} + +void AwsSmithyClientBase::AppendToUserAgent(const Aws::String& valueToAppend) +{ + assert(m_userAgentInterceptor); + m_userAgentInterceptor->AddLegacyFeaturesToUserAgent(valueToAppend); +} \ No newline at end of file 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..db145fc1931 100644 --- a/src/aws-cpp-sdk-core/source/smithy/identity/AuthSchemeOption.cpp +++ b/src/aws-cpp-sdk-core/source/smithy/identity/AuthSchemeOption.cpp @@ -4,8 +4,7 @@ */ #include #include - 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"); diff --git a/tests/aws-cpp-sdk-core-tests/smithy/client/SmithyClientTest.cpp b/tests/aws-cpp-sdk-core-tests/smithy/client/SmithyClientTest.cpp index 32e6bb80fb6..bcffb8115c6 100644 --- a/tests/aws-cpp-sdk-core-tests/smithy/client/SmithyClientTest.cpp +++ b/tests/aws-cpp-sdk-core-tests/smithy/client/SmithyClientTest.cpp @@ -305,7 +305,7 @@ TEST_F(SmithyClientTest, testSigV4a) { EXPECT_EQ(res2.IsSuccess(), true); - EXPECT_TRUE(res2.GetResult()->GetSigningAccessKey().empty()); + EXPECT_TRUE(!res2.GetResult()->GetSigningAccessKey().empty()); EXPECT_FALSE(res2.GetResult()->GetUri().GetURIString(true).empty()); diff --git a/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp b/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp index c4675b441f3..64a5ef341af 100644 --- a/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp +++ b/tests/aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp @@ -150,13 +150,37 @@ namespace long CalculateDelayBeforeNextRetry(const AWSError&, long) const override { return 0; } }; + class S3TestClient : public S3Client + { + public: + template + explicit S3TestClient(ARGS... args) : S3Client(std::forward(args)...) {} + + S3TestClient(const S3TestClient&) = default; + S3TestClient(S3TestClient&&) noexcept = default; + S3TestClient& operator=(const S3TestClient&) = default; + S3TestClient& operator=(S3TestClient&&) noexcept = default; + + void DisableRequestProcessing() + { + S3Client::DisableRequestProcessing(); + } + + void EnableRequestProcessing() + { + S3Client::EnableRequestProcessing(); + } + + ~S3TestClient(){} + }; + class BucketAndObjectOperationTest : public Aws::Testing::AwsCppSdkGTestSuite { - protected: - std::shared_ptr Client; - std::shared_ptr globalClient; - std::shared_ptr oregonClient; - std::shared_ptr retryClient; + protected: + std::shared_ptr Client; + std::shared_ptr globalClient; + std::shared_ptr oregonClient; + std::shared_ptr retryClient; std::shared_ptr ClientFactory; std::shared_ptr m_HttpClient; std::shared_ptr Limiter; @@ -188,22 +212,21 @@ namespace config.proxyPort = PROXY_PORT; } - Client = Aws::MakeShared(ALLOCATION_TAG, - Aws::MakeShared(ALLOCATION_TAG), config, + Client = Aws::MakeShared(ALLOCATION_TAG, Aws::MakeShared(ALLOCATION_TAG), config, AWSAuthV4Signer::PayloadSigningPolicy::Never /*signPayloads*/, true /*useVirtualAddressing*/, Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION::LEGACY); config.region = Aws::Region::AWS_GLOBAL; - globalClient = Aws::MakeShared(ALLOCATION_TAG, + globalClient = Aws::MakeShared(ALLOCATION_TAG, Aws::MakeShared(ALLOCATION_TAG), config, AWSAuthV4Signer::PayloadSigningPolicy::Never /*signPayloads*/, true /*useVirtualAddressing*/); config.region = Aws::Region::US_WEST_2; config.useDualStack = true; - oregonClient = Aws::MakeShared(ALLOCATION_TAG, + oregonClient = Aws::MakeShared(ALLOCATION_TAG, Aws::MakeShared(ALLOCATION_TAG), config, AWSAuthV4Signer::PayloadSigningPolicy::Never /*signPayloads*/, true /*useVirtualAddressing*/); m_HttpClient = Aws::Http::CreateHttpClient(config); config.retryStrategy = Aws::MakeShared(ALLOCATION_TAG); - retryClient = Aws::MakeShared(ALLOCATION_TAG, + retryClient = Aws::MakeShared(ALLOCATION_TAG, Aws::MakeShared(ALLOCATION_TAG), config, AWSAuthV4Signer::PayloadSigningPolicy::Never /*signPayloads*/, true /*useVirtualAddressing*/); // Using client side monitoring for endpoint override testing. @@ -280,7 +303,7 @@ namespace ASSERT_STREQ(ss.str().c_str(), outcome.GetResult().GetETag().c_str()); } - static void TagTestBucket(const Aws::String& bucketName, const std::shared_ptr& client) { + static void TagTestBucket(const Aws::String& bucketName, const std::shared_ptr& client) { ASSERT_TRUE(!bucketName.empty()); ASSERT_TRUE(client); @@ -293,11 +316,11 @@ namespace tagging.AddTagSet(tag); taggingRequest.SetTagging(tagging); - auto taggingOutcome = CallOperationWithUnconditionalRetry(client.get(), &Aws::S3::S3Client::PutBucketTagging, taggingRequest); + auto taggingOutcome = CallOperationWithUnconditionalRetry(client.get(), &S3TestClient::PutBucketTagging, taggingRequest); AWS_ASSERT_SUCCESS(taggingOutcome); } - bool WaitForBucketToPropagate(const Aws::String& bucketName, std::shared_ptr& client) + bool WaitForBucketToPropagate(const Aws::String& bucketName, std::shared_ptr& client) { if (!client) { @@ -365,7 +388,7 @@ namespace return false; } - CreateBucketOutcome CreateBucket(const CreateBucketRequest& request, std::shared_ptr client = nullptr) + CreateBucketOutcome CreateBucket(const CreateBucketRequest& request, std::shared_ptr client = nullptr) { if (!client) { @@ -433,7 +456,7 @@ namespace DeleteBucketRequest deleteBucketRequest; deleteBucketRequest.SetBucket(bucketName); - auto deleteBucketOutcome = CallOperationWithUnconditionalRetry(Client.get(), &Aws::S3::S3Client::DeleteBucket, deleteBucketRequest); + auto deleteBucketOutcome = CallOperationWithUnconditionalRetry(Client.get(), &S3TestClient::DeleteBucket, deleteBucketRequest); AWS_EXPECT_SUCCESS(deleteBucketOutcome); } } @@ -2387,7 +2410,7 @@ namespace } } - TEST_F(BucketAndObjectOperationTest, TestNullBody) { + TEST_F(BucketAndObjectOperationTest, TestEmptyBody) { const Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); @@ -2404,115 +2427,119 @@ namespace PutObjectRequest putObjectRequest; putObjectRequest.SetBucket(fullBucketName); - putObjectRequest.SetKey("sbiscigl_was_here_null"); + putObjectRequest.SetKey("sbiscigl_was_here"); PutObjectOutcome putObjectOutcome = Client->PutObject(putObjectRequest); AWS_ASSERT_SUCCESS(putObjectOutcome); } - TEST_F(BucketAndObjectOperationTest, TestEmptyBody) { - const Aws::String fullBucketName = CalculateBucketName(BASE_PUT_OBJECTS_BUCKET_NAME.c_str()); - SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); + TEST_F(BucketAndObjectOperationTest, PutObjectChecksum) { + struct ChecksumTestCase { + std::function chucksumRequestMutator; + HttpResponseCode responseCode; + String body; + }; + const String fullBucketName = CalculateBucketName(BASE_CHECKSUMS_BUCKET_NAME.c_str()); + SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); CreateBucketRequest createBucketRequest; createBucketRequest.SetBucket(fullBucketName); createBucketRequest.SetACL(BucketCannedACL::private_); - CreateBucketOutcome createBucketOutcome = CreateBucket(createBucketRequest); AWS_ASSERT_SUCCESS(createBucketOutcome); - const CreateBucketResult& createBucketResult = createBucketOutcome.GetResult(); - ASSERT_TRUE(!createBucketResult.GetLocation().empty()); - ASSERT_TRUE(WaitForBucketToPropagate(fullBucketName, Client)); - TagTestBucket(fullBucketName, Client); - - PutObjectRequest putObjectRequest; - putObjectRequest.SetBucket(fullBucketName); - putObjectRequest.SetKey("sbiscigl_was_here_empty"); - putObjectRequest.SetBody(Aws::MakeShared(ALLOCATION_TAG, "")); - PutObjectOutcome putObjectOutcome = Client->PutObject(putObjectRequest); - AWS_ASSERT_SUCCESS(putObjectOutcome); - } - - TEST_F(BucketAndObjectOperationTest, PutObjectChecksum) { - struct ChecksumTestCase { - std::function chucksumRequestMutator; - HttpResponseCode responseCode; - String body; - }; - - const String fullBucketName = CalculateBucketName(BASE_CHECKSUMS_BUCKET_NAME.c_str()); - SCOPED_TRACE(Aws::String("FullBucketName ") + fullBucketName); - CreateBucketRequest createBucketRequest; - createBucketRequest.SetBucket(fullBucketName); - createBucketRequest.SetACL(BucketCannedACL::private_); - CreateBucketOutcome createBucketOutcome = CreateBucket(createBucketRequest); - AWS_ASSERT_SUCCESS(createBucketOutcome); - Vector testCases{ - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32).WithChecksumCRC32("Just runnin' scared each place we go"); - }, - HttpResponseCode::BAD_REQUEST, "Just runnin' scared each place we go"}, - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC64NVME) - .WithChecksumCRC64NVME("Just runnin' scared each place we go"); - }, - HttpResponseCode::BAD_REQUEST, "Just runnin' scared each place we go"}, - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32).WithChecksumCRC32("Just runnin' scared each place we go"); - }, - HttpResponseCode::BAD_REQUEST, "Just runnin' scared each place we go"}, - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::SHA1).WithChecksumSHA1("So afraid that he might show"); - }, - HttpResponseCode::BAD_REQUEST, "So afraid that he might show"}, - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::SHA256).WithChecksumSHA256("Yeah, runnin' scared, what would I do"); - }, - HttpResponseCode::BAD_REQUEST, "Yeah, runnin' scared, what would I do"}, - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32C).WithChecksumCRC32C("If he came back and wanted you?"); - }, - HttpResponseCode::BAD_REQUEST, "If he came back and wanted you?"}, - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32) - .WithChecksumCRC32(HashingUtils::Base64Encode(HashingUtils::CalculateCRC32("Runnin' scared, you love him so"))); - }, - HttpResponseCode::OK, "Runnin' scared, you love him so"}, - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC64NVME) - .WithChecksumCRC64NVME(HashingUtils::Base64Encode(HashingUtils::CalculateCRC64("Runnin' scared, you love him so"))); - }, - HttpResponseCode::OK, "Runnin' scared, you love him so"}, - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::SHA1) - .WithChecksumSHA1(HashingUtils::Base64Encode(HashingUtils::CalculateSHA1("Just runnin' scared, afraid to lose"))); - }, - HttpResponseCode::OK, "Just runnin' scared, afraid to lose"}, - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::SHA256) - .WithChecksumSHA256( - HashingUtils::Base64Encode(HashingUtils::CalculateSHA256("If he came back, which one would you choose?"))); - }, - HttpResponseCode::OK, "If he came back, which one would you choose?"}, - {[](PutObjectRequest request) -> PutObjectRequest { - return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32C) - .WithChecksumCRC32C(HashingUtils::Base64Encode(HashingUtils::CalculateCRC32C("Then all at once he was standing there"))); - }, - HttpResponseCode::OK, "Then all at once he was standing there"}}; + Vector testCases{ + { + [](PutObjectRequest request) -> PutObjectRequest { + return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32).WithChecksumCRC32("Just runnin' scared each place we go"); + }, + HttpResponseCode::BAD_REQUEST, + "Just runnin' scared each place we go" + }, + { + [](PutObjectRequest request) -> PutObjectRequest { + return request.WithChecksumAlgorithm(ChecksumAlgorithm::SHA1).WithChecksumSHA1("So afraid that he might show"); + }, + HttpResponseCode::BAD_REQUEST, + "So afraid that he might show" + }, + { + [](PutObjectRequest request) -> PutObjectRequest { + return request.WithChecksumAlgorithm(ChecksumAlgorithm::SHA256).WithChecksumSHA256("Yeah, runnin' scared, what would I do"); + }, + HttpResponseCode::BAD_REQUEST, + "Yeah, runnin' scared, what would I do" + }, + { + [](PutObjectRequest request) -> PutObjectRequest { + return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32C).WithChecksumCRC32C("If he came back and wanted you?"); + }, + HttpResponseCode::BAD_REQUEST, + "If he came back and wanted you?" + }, + { + [](PutObjectRequest request) -> PutObjectRequest { + return request.WithContentMD5("Just runnin' scared, feelin' low"); + }, + HttpResponseCode::BAD_REQUEST, + "Just runnin' scared, feelin' low", + }, + { + [](PutObjectRequest request) -> PutObjectRequest { + return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32) + .WithChecksumCRC32(HashingUtils::Base64Encode(HashingUtils::CalculateCRC32("Runnin' scared, you love him so"))); + }, + HttpResponseCode::OK, + "Runnin' scared, you love him so" + }, + { + [](PutObjectRequest request) -> PutObjectRequest { + return request.WithChecksumAlgorithm(ChecksumAlgorithm::SHA1) + .WithChecksumSHA1(HashingUtils::Base64Encode(HashingUtils::CalculateSHA1("Just runnin' scared, afraid to lose"))); + }, + HttpResponseCode::OK, + "Just runnin' scared, afraid to lose" + }, + { + [](PutObjectRequest request) -> PutObjectRequest { + return request.WithChecksumAlgorithm(ChecksumAlgorithm::SHA256) + .WithChecksumSHA256(HashingUtils::Base64Encode(HashingUtils::CalculateSHA256("If he came back, which one would you choose?"))); + }, + HttpResponseCode::OK, + "If he came back, which one would you choose?" + }, + { + [](PutObjectRequest request) -> PutObjectRequest { + return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32C) + .WithChecksumCRC32C(HashingUtils::Base64Encode(HashingUtils::CalculateCRC32C("Then all at once he was standing there"))); + }, + HttpResponseCode::OK, + "Then all at once he was standing there" + }, + { + [](PutObjectRequest request) -> PutObjectRequest { + return request.WithContentMD5(HashingUtils::Base64Encode(HashingUtils::CalculateMD5("So sure of himself, his head in the air"))); + }, + HttpResponseCode::OK, + "So sure of himself, his head in the air" + } + }; - for (const auto& testCase : testCases) { - auto request = testCase.chucksumRequestMutator(PutObjectRequest().WithBucket(fullBucketName).WithKey("RunningScared")); - std::shared_ptr body = - Aws::MakeShared(ALLOCATION_TAG, testCase.body, std::ios_base::in | std::ios_base::binary); - request.SetBody(body); - const auto response = Client->PutObject(request); - if (!response.IsSuccess()) { - ASSERT_EQ(testCase.responseCode, response.GetError().GetResponseCode()); - } else { - ASSERT_EQ(testCase.responseCode, HttpResponseCode::OK); - ASSERT_TRUE(response.IsSuccess()); + for (const auto&testCase: testCases) { + auto request = testCase.chucksumRequestMutator(PutObjectRequest() + .WithBucket(fullBucketName) + .WithKey("RunningScared")); + std::shared_ptr body = Aws::MakeShared(ALLOCATION_TAG, + testCase.body, + std::ios_base::in | std::ios_base::binary); + request.SetBody(body); + const auto response = Client->PutObject(request); + if (!response.IsSuccess()) { + ASSERT_EQ(testCase.responseCode, response.GetError().GetResponseCode()); + } else { + ASSERT_EQ(testCase.responseCode, HttpResponseCode::OK); + ASSERT_TRUE(response.IsSuccess()); + } } - } } TEST_F(BucketAndObjectOperationTest, PutObjectChecksumWithGuarunteedChunkedObject) { @@ -2532,8 +2559,6 @@ namespace Vector testCases{ {[](PutObjectRequest request) -> PutObjectRequest { return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32); }, Aws::String(1024 * 1024, 'e')}, - {[](PutObjectRequest request) -> PutObjectRequest { return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC64NVME); }, - Aws::String(1024 * 1024, 'e')}, {[](PutObjectRequest request) -> PutObjectRequest { return request.WithChecksumAlgorithm(ChecksumAlgorithm::CRC32C); }, Aws::String(1024 * 1024, 'l')}, {[](PutObjectRequest request) -> PutObjectRequest { return request.WithChecksumAlgorithm(ChecksumAlgorithm::SHA1); }, @@ -2580,36 +2605,32 @@ namespace } TEST_F(BucketAndObjectOperationTest, TestHeaderResponse) { - ClientConfiguration configuration; - configuration.region = "us-east-1"; - configuration.enableHttpClientTrace = true; - std::shared_ptr client = Aws::MakeShared("test",configuration); - - const String fullBucketName = CalculateBucketName(BASE_CONTENT_ENCODING_BUCKET_NAME.c_str()); - CreateBucketRequest createBucketRequest; - createBucketRequest.SetBucket(fullBucketName); - createBucketRequest.SetACL(BucketCannedACL::private_); - CreateBucketOutcome createBucketOutcome = CreateBucket(createBucketRequest,client); - AWS_EXPECT_SUCCESS(createBucketOutcome); - - Aws::S3::Model::GetObjectRequest request; - request.SetBucket(fullBucketName); - request.SetKey("one_object_that_does_not_exist_in_the_bucket"); // <== we should get 404 when calling GetResponseCode - request.SetHeadersReceivedEventHandler ( - [] ( - const Aws::Http::HttpRequest * , - Aws::Http::HttpResponse * response - ) { - ::std::cout << "response headers received: " - << response->GetResponseCode ( ) - << ::std::endl; - EXPECT_EQ(response->GetResponseCode(), Aws::Http::HttpResponseCode::NOT_FOUND ); - } - ); - - Aws::S3::Model::GetObjectOutcome outcome = - client->GetObject(request); - EXPECT_FALSE(outcome.IsSuccess()); - + ClientConfiguration configuration; + configuration.region = "us-east-1"; + configuration.enableHttpClientTrace = true; + std::shared_ptr client = Aws::MakeShared("test",configuration); + const String fullBucketName = CalculateBucketName(BASE_CONTENT_ENCODING_BUCKET_NAME.c_str()); + CreateBucketRequest createBucketRequest; + createBucketRequest.SetBucket(fullBucketName); + createBucketRequest.SetACL(BucketCannedACL::private_); + CreateBucketOutcome createBucketOutcome = CreateBucket(createBucketRequest,client); + AWS_EXPECT_SUCCESS(createBucketOutcome); + Aws::S3::Model::GetObjectRequest request; + request.SetBucket(fullBucketName); + request.SetKey("one_object_that_does_not_exist_in_the_bucket"); // <== we should get 404 when calling GetResponseCode + request.SetHeadersReceivedEventHandler ( + [] ( + const Aws::Http::HttpRequest * , + Aws::Http::HttpResponse * response + ) { + ::std::cout << "response headers received: " + << response->GetResponseCode ( ) + << ::std::endl; + EXPECT_EQ(response->GetResponseCode(), Aws::Http::HttpResponseCode::NOT_FOUND ); + } + ); + Aws::S3::Model::GetObjectOutcome outcome = + client->GetObject(request); + EXPECT_FALSE(outcome.IsSuccess()); } -} +} \ No newline at end of file diff --git a/tests/aws-cpp-sdk-s3-integration-tests/S3ExpressTest.cpp b/tests/aws-cpp-sdk-s3-integration-tests/S3ExpressTest.cpp index 14952fc02d1..6b65a1af90b 100644 --- a/tests/aws-cpp-sdk-s3-integration-tests/S3ExpressTest.cpp +++ b/tests/aws-cpp-sdk-s3-integration-tests/S3ExpressTest.cpp @@ -33,6 +33,9 @@ #include #include #include +#include +#include +#include #ifdef _WIN32 #pragma warning(disable: 4127) @@ -55,9 +58,12 @@ namespace { class S3ExpressTest : public Aws::Testing::AwsCppSdkGTestSuite { public: - CreateBucketOutcome CreateBucket(const Aws::String &bucketName = randomString() + S3_EXPRESS_SUFFIX) { + + CreateBucketOutcome CreateBucket(std::shared_ptr client_sp , + const Aws::String &bucketName) + { bucketsToCleanup.push_back(bucketName); - CreateBucketOutcome outcome = client->CreateBucket(CreateBucketRequest() + CreateBucketOutcome outcome = client_sp->CreateBucket(CreateBucketRequest() .WithBucket(bucketName) .WithCreateBucketConfiguration(CreateBucketConfiguration() .WithLocation(LocationInfo() @@ -74,10 +80,19 @@ namespace { } return outcome; + } + + CreateBucketOutcome CreateBucket(const Aws::String &bucketName = randomString() + S3_EXPRESS_SUFFIX) { + + return CreateBucket( client, bucketName); + } + + DeleteBucketOutcome DeleteBucket(std::shared_ptr client_sp , const Aws::String &bucketName) { + return client_sp->DeleteBucket(DeleteBucketRequest().WithBucket(bucketName)); } DeleteBucketOutcome DeleteBucket(const Aws::String &bucketName) { - return client->DeleteBucket(DeleteBucketRequest().WithBucket(bucketName)); + return DeleteBucket(client ,bucketName); } HeadBucketOutcome HeadBucket(const Aws::String &bucketName) { @@ -114,13 +129,18 @@ namespace { return client->DeleteBucketPolicy(DeleteBucketPolicyRequest().WithBucket(bucketName)); } - PutObjectOutcome PutObject(const Aws::String &bucketName, const Aws::String &keyName) { + PutObjectOutcome PutObject( std::shared_ptr client_sp, const Aws::String &bucketName, const Aws::String &keyName) { auto request = PutObjectRequest().WithBucket(bucketName).WithKey(keyName); std::shared_ptr inputData = Aws::MakeShared(ALLOCATION_TAG, "I'll take a quiet life a handshake of carbon monoxide", std::ios_base::in | std::ios_base::binary); request.SetBody(inputData); - return client->PutObject(request); + return client_sp->PutObject(request); + } + + PutObjectOutcome PutObject(const Aws::String &bucketName, const Aws::String &keyName) { + + return PutObject(client, bucketName, keyName); } ListObjectsV2Outcome ListObjectsV2(const Aws::String &bucketName) { @@ -260,43 +280,47 @@ namespace { .WithBucket(bucketName).WithKey(keyName) .WithUploadId(createOutcome.GetResult().GetUploadId())); } - - void EmptyBucketUtil(const Aws::Vector &buckets) { + void EmptyBucketUtil(std::shared_ptr client_sp , const Aws::Vector &buckets) { for (const auto&bucket: buckets) { auto bucketExists = HeadBucket(bucket); if (!bucketExists.IsSuccess()) { continue; } - auto objects = client->ListObjectsV2(ListObjectsV2Request().WithBucket(bucket)); + auto objects = client_sp->ListObjectsV2(ListObjectsV2Request().WithBucket(bucket)); AWS_EXPECT_SUCCESS(objects); while (objects.GetResult().GetIsTruncated() || !objects.GetResult().GetContents().empty()) { for (const auto&object: objects.GetResult().GetContents()) { DeleteObject(bucket, object.GetKey()); } - objects = client->ListObjectsV2(ListObjectsV2Request() + objects = client_sp->ListObjectsV2(ListObjectsV2Request() .WithBucket(bucket) .WithContinuationToken(objects.GetResult().GetContinuationToken())); } - auto uploads = client->ListMultipartUploads(ListMultipartUploadsRequest(). + auto uploads = client_sp->ListMultipartUploads(ListMultipartUploadsRequest(). WithBucket(bucket)); AWS_EXPECT_SUCCESS(uploads); while (uploads.GetResult().GetIsTruncated() || !uploads.GetResult().GetUploads().empty()) { for (const auto&upload: uploads.GetResult().GetUploads()) { - auto abortMPU = client->AbortMultipartUpload(AbortMultipartUploadRequest() + auto abortMPU = client_sp->AbortMultipartUpload(AbortMultipartUploadRequest() .WithBucket(bucket) .WithKey(upload.GetKey()) .WithUploadId(upload.GetUploadId())); AWS_EXPECT_SUCCESS(abortMPU); } - uploads = client->ListMultipartUploads(ListMultipartUploadsRequest().WithBucket(bucket)); + uploads = client_sp->ListMultipartUploads(ListMultipartUploadsRequest().WithBucket(bucket)); } - auto outcome = client->DeleteBucket(DeleteBucketRequest().WithBucket(bucket)); + auto outcome = client_sp->DeleteBucket(DeleteBucketRequest().WithBucket(bucket)); if (!outcome.IsSuccess()) { std::cout << "Failed to delete bucket: " << outcome.GetError().GetMessage() << "\n"; } } } + + void EmptyBucketUtil(const Aws::Vector &buckets) { + EmptyBucketUtil(client,buckets ); + } + protected: void SetUp() override { S3ClientConfiguration configuration; @@ -483,4 +507,133 @@ namespace { const auto response = client->PutObject(request); AWS_EXPECT_SUCCESS(response); } + + + class MyIdentityProvider : public S3ExpressIdentityProvider { + public: + explicit MyIdentityProvider(const S3Client& client):S3ExpressIdentityProvider(client) {} + ~MyIdentityProvider() override = default; + + S3ExpressIdentity GetS3ExpressIdentity( + const std::shared_ptr& + ) override + { + return S3ExpressIdentity{"access_key", + "secret_key", + "sessions_token", + DateTime::Now()}; + } + + ResolveIdentityFutureOutcome getIdentity( + const IdentityProperties& , + const AdditionalParameters& ) override + { + return Aws::MakeUnique("log", + "access_key", + "secret_key", + "sessions_token", + DateTime::Now()); + } + }; + + TEST_F(S3ExpressTest, ExpressSignerBackwardCompatibilityCompilation) + { + MyIdentityProvider identityProvider(*client); + + } + +class TestSmithyDefaultS3ExpressIdentityProvider : public SmithyDefaultS3ExpressIdentityProvider + { + public: + TestSmithyDefaultS3ExpressIdentityProvider(const S3Client& s3Client):SmithyDefaultS3ExpressIdentityProvider(s3Client){} + + + smithy::AwsCredentialIdentity GetS3ExpressAwsIdentity(const std::shared_ptr &) override + { + return m_creds; + } + + smithy::AwsCredentialIdentity m_creds{ + Aws::String("demo_access_key"), + Aws::String("demo_secret_key"), + Aws::String("demo_sessions_token"), + DateTime::Now() + }; + + }; + + + class S3TestClient : public S3Client { + public: + template + explicit S3TestClient(ARGS... args) : S3Client(std::forward(args)...) { + overrideIdentityProvider(); + } + + S3TestClient(const S3TestClient&) = default; + S3TestClient(S3TestClient&&) noexcept = default; + S3TestClient& operator=(const S3TestClient&) = default; + S3TestClient& operator=(S3TestClient&&) noexcept = default; + + virtual ~S3TestClient() = default; + + smithy::AwsCredentialIdentity getCreds() { + + for(auto& auth : m_authSchemes) { + if(auth.first == S3::S3ExpressSigV4AuthSchemeOption::GetS3ExpressSigV4AuthSchemeOption().schemeId) + { + smithy::IdentityResolverBase::IdentityProperties props; + auto tmp = auth.second.get(); + auto outcome = tmp.identityResolver()->getIdentity(props,props); + + return smithy::AwsCredentialIdentity(outcome.GetResult()->accessKeyId(), outcome.GetResult()->secretAccessKey(), outcome.GetResult()->sessionToken(), + outcome.GetResult()->expiration()); + + } + } + return smithy::AwsCredentialIdentity{}; + + } + private: + FRIEND_TEST(S3ExpressTest, ExpressSignerBackwardCompatibility); + + void overrideIdentityProvider() + { + for(auto& auth : m_authSchemes) + { + if(auth.first == S3::S3ExpressSigV4AuthSchemeOption::GetS3ExpressSigV4AuthSchemeOption().schemeId) + { + + auth.second = S3::S3ExpressSigV4AuthScheme{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}; + + ///auth.second.get().identityResolver() = Aws::MakeShared("TestSmithyDefaultS3ExpressIdentityProvider", *this); + + break; + } + } + } + + + }; + + TEST_F(S3ExpressTest, TestAuthschemeCopy) { + S3ClientConfiguration configuration; + configuration.region = "us-east-1"; + configuration.enableHttpClientTrace = true; + auto testclient = Aws::MakeShared(ALLOCATION_TAG, configuration); + ASSERT_TRUE(testclient->getCreds().accessKeyId() == "demo_access_key"); + auto cpy = *testclient; + ASSERT_TRUE(cpy.getCreds().accessKeyId() == ""); + } + + TEST_F(S3ExpressTest, ExpressSignerBackwardCompatibilitySupplier) + { + S3ClientConfiguration configuration{}; + configuration.identityProviderSupplier = + [](const S3Client &clientref) -> std::shared_ptr { + return Aws::MakeShared("log_tag", clientref); + }; + S3Client testclient{configuration}; + } + } diff --git a/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp b/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp index c7692d6d864..5b426178abe 100644 --- a/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp +++ b/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp @@ -282,9 +282,11 @@ TEST_F(S3UnitTest, S3EmbeddedErrorTestNonOKResponse) { _mockHttpClient->AddResponseToReturn(mockResponse); - auto endpointResolutionOutcome = _s3Client->accessEndpointProvider()->ResolveEndpoint(request.GetEndpointContextParams()); - - const auto response = std::static_pointer_cast(_s3Client)->Aws::Client::AWSXMLClient::MakeRequest(request, endpointResolutionOutcome.GetResult(), Aws::Http::HttpMethod::HTTP_PUT, "dummy"); + const auto response = _s3Client->MakeRequestDeserialize(&request, + request.GetServiceRequestName(), + Aws::Http::HttpMethod::HTTP_PUT, + [](Aws::Endpoint::AWSEndpoint&) -> void {} + ); EXPECT_TRUE(response.GetError().GetExceptionName() == "InvalidAction"); diff --git a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/domainmodels/codegeneration/ServiceModel.java b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/domainmodels/codegeneration/ServiceModel.java index 56c8ad2e699..a7c7a51c405 100644 --- a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/domainmodels/codegeneration/ServiceModel.java +++ b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/domainmodels/codegeneration/ServiceModel.java @@ -90,4 +90,5 @@ public Operation getOperationForRequestShapeName(String requestShapeName) { ClientContextParams clientContextParams; boolean useSmithyClient; List authSchemes; + String rawEndpointRules; } diff --git a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/CppClientGenerator.java b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/CppClientGenerator.java index 8e1c40274e3..0b03f2c8a44 100644 --- a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/CppClientGenerator.java +++ b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/CppClientGenerator.java @@ -20,6 +20,10 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; @@ -782,7 +786,8 @@ protected SdkFileEntry GenerateLegacyClientSourceFile(final ServiceModel service "aws.auth#sigv4", "smithy::SigV4AuthScheme", "aws.auth#sigv4a", "smithy::SigV4aAuthScheme", "bearer", "smithy::BearerTokenAuthScheme", - "v4", "smithy::SigV4AuthScheme" + "v4","smithy::SigV4AuthScheme", + "sigv4-s3express","S3::S3ExpressSigV4AuthScheme" ); protected String mapAuthSchemes(final String authSchemeName) { @@ -795,9 +800,10 @@ protected String mapAuthSchemes(final String authSchemeName) { private static final Map SchemeIdMapping = ImmutableMap.of( "aws.auth#sigv4", "smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption", - "aws.auth#sigv4a", "smithy::SigV4AuthSchemeOption::sigV4aAuthSchemeOption", + "aws.auth#sigv4a", "smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption", "bearer", "smithy::BearerTokenAuthSchemeOption::bearerTokenAuthSchemeOption", - "v4", "smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption" + "v4", "smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption", + "sigv4-s3express", "S3::S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption" ); private static final Map ResolverMapping = ImmutableMap.of( @@ -809,12 +815,17 @@ protected String mapAuthSchemes(final String authSchemeName) { private static final String SchemeMapFormat = "%s.schemeId, %s"; - private List createAuthSchemeMapEntries(final ServiceModel serviceModel) { - return serviceModel.getAuthSchemes().stream() + protected List createAuthSchemeMapEntries(final ServiceModel serviceModel) { + return getSupportedAuthSchemes(serviceModel).stream() .map(authScheme -> String.format(SchemeMapFormat, SchemeIdMapping.get(authScheme), AuthSchemeMapping.get(authScheme))) .collect(Collectors.toList()); } + protected List getSupportedAuthSchemes(final ServiceModel serviceModel) { + return serviceModel.getAuthSchemes().stream() + .collect(Collectors.toList()); + } + private void addRequestlessRequestObjectS(final ServiceModel serviceModel) { serviceModel.getOperations().values().stream() .filter(operation -> !operation.hasRequest() || operation.getRequest().getShape().getMembers().values().stream().noneMatch(ShapeMember::isRequired)) @@ -836,4 +847,105 @@ private void addRequestlessRequestObjectS(final ServiceModel serviceModel) { requestlessOperations.add(operation.getName()); }); } + + //dfs + protected static void findNestedField(JsonElement element, String targetField, List results) { + if (element == null || element.isJsonNull()) { + return; + } + + if (element.isJsonObject()) { + JsonObject obj = element.getAsJsonObject(); + + if (obj.has(targetField)) { + JsonElement targetElement = obj.get(targetField); + + results.add(targetElement); + //assumption is target field wont contain internal target fields + return; + } + + //recurse + obj.entrySet().stream().forEach(entry -> { + findNestedField(entry.getValue(), targetField, results); + }); + + } else if (element.isJsonArray()) { + element.getAsJsonArray().forEach(entry -> + { + findNestedField(entry, targetField, results); + }); + } + } + + protected void updateAuthSchemesFromEndpointRules(ServiceModel serviceModel, String rawjson) + { + if(rawjson == null || rawjson.isEmpty()) + { + return; + } + + List authschemes = new ArrayList<>(serviceModel.getAuthSchemes()); + Set authSchemeSet = new HashSet<>(authschemes); + + // parse the JSON into a JsonElement tree + JsonElement jsonElement = JsonParser.parseString(rawjson); + + // search for the "authSchemes" field in endpoint rules recursively to get all authschemes + List authSchemes = new ArrayList<>(); + findNestedField(jsonElement, "authSchemes", authSchemes); + // Extract authschemes + authSchemes.stream() + .filter(entry -> entry.isJsonArray()) // Check if the element is a JsonArray + .map(JsonElement::getAsJsonArray) // Convert to JsonArray + .forEach(arrelem -> { + arrelem.forEach(entry -> { // Iterate over each element in the JsonArray + // Array element with key "name" has the auth scheme name as value + if (entry.isJsonObject() && entry.getAsJsonObject().has("name")) { + JsonElement elem = entry.getAsJsonObject().get("name"); + if (elem.isJsonPrimitive() && elem.getAsJsonPrimitive().isString()) { + String authscheme = elem.getAsJsonPrimitive().getAsString(); + if (AuthSchemeNameMapping.containsKey(authscheme)) { + authscheme = AuthSchemeNameMapping.get(authscheme); + } + if (!authSchemeSet.contains(authscheme)) { + authschemes.add(authscheme); + authSchemeSet.add(authscheme); + } + } + } + }); + }); + serviceModel.setAuthSchemes(authschemes); + } + + + protected void updateAuthSchemesFromOperations(ServiceModel serviceModel) + { + List authschemes = new ArrayList<>(serviceModel.getAuthSchemes()); + Set authSchemeSet = new HashSet<>(authschemes); + + serviceModel.getOperations().values().forEach(operation -> { + if (operation.getAuth() == null) { + return; + } + operation.getAuth().forEach(authScheme -> { + if(AuthSchemeNameMapping.containsKey(authScheme)) { + authScheme = AuthSchemeNameMapping.get(authScheme); + } + // only add if it's not already present in the authSchemeSet + if (!authSchemeSet.contains(authScheme)) { + serviceModel.getAuthSchemes().add(authScheme); + authSchemeSet.add(authScheme); + } + }); + }); + serviceModel.setAuthSchemes(authschemes); + } + //auth schemes can be named differently in endpoints/operations, this is a mapping + private static final Map AuthSchemeNameMapping = ImmutableMap.of( + "v4", "aws.auth#sigv4", + "sigv4", "aws.auth#sigv4", + "sigv4a","aws.auth#sigv4a" + ); } diff --git a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/s3/S3RestXmlCppClientGenerator.java b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/s3/S3RestXmlCppClientGenerator.java index d10f24360cd..bd9edf319ef 100644 --- a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/s3/S3RestXmlCppClientGenerator.java +++ b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/s3/S3RestXmlCppClientGenerator.java @@ -195,6 +195,11 @@ public S3RestXmlCppClientGenerator() throws Exception { @Override public SdkFileEntry[] generateSourceFiles(ServiceModel serviceModel) throws Exception { + if(serviceModel.isUseSmithyClient()) + { + updateAuthSchemesFromEndpointRules(serviceModel, serviceModel.getRawEndpointRules()); + updateAuthSchemesFromOperations(serviceModel); + } // Add ID2 and RequestId to GetObjectResult hackGetObjectOutputResponse(serviceModel); @@ -335,7 +340,7 @@ public SdkFileEntry[] generateSourceFiles(ServiceModel serviceModel) throws Exce member.setChecksumMember(true); member.setChecksumEnumMember(CHECKSUM_MEMBERS_ENUMS.get(member.getShape().getName())); })); - + return Stream.concat(generateS3ExpressFiles(serviceModel).stream(), Arrays.stream(super.generateSourceFiles(serviceModel))) .toArray(SdkFileEntry[]::new); @@ -438,10 +443,21 @@ protected void addExpiresCustomization(ServiceModel serviceModel) { @Override protected SdkFileEntry generateClientHeaderFile(final ServiceModel serviceModel) throws Exception { - Template template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/S3ClientHeader.vm"); + Template template; + if (serviceModel.isUseSmithyClient()) + { + template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ClientHeader.vm"); + } + else + { + template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/S3ClientHeader.vm"); + } VelocityContext context = createContext(serviceModel); context.put("CppViewHelper", CppViewHelper.class); + context.put("AuthSchemeResolver", "SigV4MultiAuthSchemeResolver"); + context.put("AuthSchemeVariants", serviceModel.getAuthSchemes().stream().map(this::mapAuthSchemes).collect(Collectors.joining(","))); + String fileName = String.format("include/aws/%s/%sClient.h", serviceModel.getMetadata().getProjectName(), serviceModel.getMetadata().getClassNamePrefix()); @@ -453,8 +469,15 @@ protected SdkFileEntry generateClientHeaderFile(final ServiceModel serviceModel) protected List generateClientSourceFile(final List serviceModels) throws Exception { List sourceFiles = new ArrayList<>(); for (int i = 0; i < serviceModels.size(); i++) { - Template template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/S3ClientSource.vm"); - + Template template; + if (serviceModels.get(i).isUseSmithyClient()) + { + template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ClientSource.vm"); + } + else + { + template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/S3ClientSource.vm"); + } Map templateOverride = new HashMap<>(); if ("S3-CRT".equalsIgnoreCase(serviceModels.get(i).getMetadata().getProjectName())) { templateOverride.put("ServiceClientSourceInit_template", @@ -462,7 +485,11 @@ protected List generateClientSourceFile(final List s } VelocityContext context = createContext(serviceModels.get(i)); context.put("CppViewHelper", CppViewHelper.class); - context.put("TemplateOverride", templateOverride); + context.put("TemplateOverride", templateOverride); + context.put("AuthSchemeResolver", "S3ExpressAuthSchemeResolver"); + context.put("AuthSchemeMapEntries", createAuthSchemeMapEntries(serviceModels.get(i))); + context.put("AuthSchemes", getSupportedAuthSchemes(serviceModels.get(i))); + context.put("AuthSchemeVariants", serviceModels.get(i).getAuthSchemes().stream().map(this::mapAuthSchemes).collect(Collectors.joining(","))); final String fileName; if (i == 0) { @@ -494,6 +521,29 @@ private List generateS3ExpressFiles(final ServiceModel serviceMode Pair.of("source/S3CrtIdentityProviderAdapter.cpp", String.format(vmFilePrefixFormat, "S3CrtIdentityProviderAdapterSource.vm")))) .orElse(Stream.of()); + if (serviceModel.isUseSmithyClient()) + { + return Stream.concat( + Stream.of( + Pair.of(includePath + "S3ExpressIdentity.h", String.format(vmFilePrefixFormat, "S3ExpressIdentityHeader.vm")), + Pair.of(includePath + "S3ExpressIdentityProvider.h", String.format(vmFilePrefixFormat, "SmithyS3ExpressIdentityProviderHeader.vm")), + Pair.of(includePath + "S3ExpressSigner.h", String.format(vmFilePrefixFormat, "SmithyS3ExpressSignerHeader.vm")), + Pair.of(includePath + "S3ExpressSignerProvider.h", String.format(vmFilePrefixFormat, "S3ExpressSignerProviderHeader.vm")), + Pair.of(includePath + "S3ExpressSigV4AuthScheme.h", String.format(vmFilePrefixFormat, "SmithyS3ExpressSigV4AuthSchemeHeader.vm")), + Pair.of(includePath + "S3ExpressSigV4AuthSchemeOption.h", String.format(vmFilePrefixFormat, "SmithyS3ExpressSigV4AuthSchemeOptionHeader.vm")), + Pair.of(includePath + "S3ExpressAuthSchemeResolver.h", String.format(vmFilePrefixFormat, "SmithyS3ExpressAuthSchemeResolverHeader.vm")), + Pair.of("source/S3ExpressSigV4AuthSchemeOption.cpp", String.format(vmFilePrefixFormat, "SmithyS3ExpressSigV4AuthSchemeOptionSource.vm")), + Pair.of("source/S3ExpressIdentityProvider.cpp", String.format(vmFilePrefixFormat, "SmithyS3ExpressIdentityProviderSource.vm")), + Pair.of("source/S3ExpressSigner.cpp", String.format(vmFilePrefixFormat, "SmithyS3ExpressSignerSource.vm")), + Pair.of("source/S3ExpressSignerProvider.cpp", String.format(vmFilePrefixFormat, "SmithyS3ExpressSignerProviderSource.vm"))), + crtAdapters) + .map(codeGenPair -> makeFile(velocityEngine.getTemplate(codeGenPair.getValue()), + context, + codeGenPair.getKey(), + true)) + .collect(Collectors.toList()); + } + return Stream.concat( Stream.of(Pair.of(includePath + "S3ExpressIdentity.h", String.format(vmFilePrefixFormat, "S3ExpressIdentityHeader.vm")), Pair.of(includePath + "S3ExpressIdentityProvider.h", String.format(vmFilePrefixFormat, "S3ExpressIdentityProviderHeader.vm")), diff --git a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/transform/C2jModelToGeneratorModelTransformer.java b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/transform/C2jModelToGeneratorModelTransformer.java index 396f0f37d77..1a74c98b4bb 100644 --- a/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/transform/C2jModelToGeneratorModelTransformer.java +++ b/tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/transform/C2jModelToGeneratorModelTransformer.java @@ -196,6 +196,7 @@ public ServiceModel convert() { shortenedRules += "\0"; serviceModel.setEndpointRules(shortenedRules); } + serviceModel.setRawEndpointRules(c2jServiceModel.getEndpointRules() ); serviceModel.setEndpointRuleSetModel(c2jServiceModel.getEndpointRuleSetModel()); serviceModel.setEndpointTests(c2jServiceModel.getEndpointTests()); serviceModel.setClientContextParams(c2jServiceModel.getClientContextParams()); diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/ServiceClientSourceHeaders.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/ServiceClientSourceHeaders.vm index 1b3c36ee2bd..9a27fdb14e0 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/ServiceClientSourceHeaders.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/ServiceClientSourceHeaders.vm @@ -32,7 +32,16 @@ #end #end #if($serviceModel.metadata.serviceId == "S3") +#if(!$serviceModel.isUseSmithyClient()) \#include +#else +\#include +\#include +\#include +\#include +\#include +\#include +#end #end #if($serviceModel.metadata.namespace == "S3Crt") \#include diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/common/ServiceClientConfigurationHeader.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/common/ServiceClientConfigurationHeader.vm index 1b5e00a5ea4..c353eb698fd 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/common/ServiceClientConfigurationHeader.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/common/ServiceClientConfigurationHeader.vm @@ -131,6 +131,12 @@ namespace ${rootNamespace} IdentityProviderSupplier identityProviderSupplier = [](const ${metadata.classNamePrefix}Client &client) -> std::shared_ptr { return Aws::MakeShared("${metadata.classNamePrefix}ClientConfiguration", client); }; +#if($serviceModel.isUseSmithyClient()) + using SmithyIdentityProviderSupplier = std::function (const ${metadata.classNamePrefix}Client &)>; + SmithyIdentityProviderSupplier smithyIdentityProviderSupplier = [](const ${metadata.classNamePrefix}Client &client) -> std::shared_ptr { + return Aws::MakeShared("${metadata.classNamePrefix}ClientConfiguration", client); + }; +#end #end #if($metadata.hasEndpointDiscoveryTrait) diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ClientHeader.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ClientHeader.vm new file mode 100644 index 00000000000..1b35ae5efff --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ClientHeader.vm @@ -0,0 +1,320 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +#set($metadata = $serviceModel.metadata) +#set($rootNamespace = $serviceModel.namespace) +#set($serviceNamespace = $metadata.namespace) +#set($className = "${metadata.classNamePrefix}Client") +#if($serviceModel.metadata.protocol == "json" || $serviceModel.metadata.protocol == "rest-json" || $serviceModel.metadata.protocol == "application-json") +#set($serializer = "JsonOutcomeSerializer") +#set($serializerOutcome = "JsonOutcome") +#elseif($serviceModel.metadata.protocol == "rest-xml" || $serviceModel.metadata.protocol == "query") +#set($serializer = "XmlOutcomeSerializer") +#set($serializerOutcome = "XmlOutcome") +#end +#set($serviceConfiguration = "Aws::" + ${serviceNamespace} + "::" + ${metadata.classNamePrefix} + "ClientConfiguration") +#pragma once + +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include + +#if($serviceNamespace == "S3Crt") +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +#else +\#include +#end + + +#set($signPayloadsOptional = true) +#set($virtualAddressingSupported = true) +#set($arnEndpointSupported = true) +#set($USEast1RegionalEndpointArgString = ", Aws::$serviceNamespace::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption = Aws::$serviceNamespace::US_EAST_1_REGIONAL_ENDPOINT_OPTION::NOT_SET") + +#if($serviceNamespace == "S3Crt") +struct aws_s3_client; +#end +// TODO: temporary fix for naming conflicts on Windows. +#ifdef _WIN32 +#ifdef GetObject +#undef GetObject +#endif +#endif + +namespace ${rootNamespace} +{ + namespace ${metadata.namespace} + { + namespace SSEHeaders + { + static const char SERVER_SIDE_ENCRYPTION[] = "x-amz-server-side-encryption"; + static const char SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID[] = "x-amz-server-side-encryption-aws-kms-key-id"; + static const char SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM[] = "x-amz-server-side-encryption-customer-algorithm"; + static const char SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY[] = "x-amz-server-side-encryption-customer-key"; + static const char SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5[] = "x-amz-server-side-encryption-customer-key-MD5"; + } // SS3Headers + ${CppViewHelper.computeExportValue($metadata.classNamePrefix)} extern const char SERVICE_NAME[]; +#if(!$serviceModel.endpointRules) + + // Get endpoint, signer region and signer service name after computing the endpoint. + struct ComputeEndpointResult + { + ComputeEndpointResult(const Aws::String& endpointName = {}, const Aws::String& region = {}, const Aws::String& serviceName = {}, const Aws::String signer = Aws::Auth::SIGV4_SIGNER) : + endpoint(endpointName), signerRegion(region), signerServiceName(serviceName), signerName(signer) {} + + Aws::String endpoint; + Aws::String signerRegion; + Aws::String signerServiceName; + Aws::String signerName; + }; + + typedef Aws::Utils::Outcome> ComputeEndpointOutcome; +#end + + //max expiration for presigned urls in s3 is 7 days. + static const unsigned MAX_EXPIRATION_SECONDS = 7 * 24 * 60 * 60; +#if($serviceNamespace == "S3Crt") + + class S3ExpressIdentityProvider; +#end + +#if($serviceModel.documentation) + /** + * ${serviceModel.documentation} + */ +#end +#if(!$serviceModel.endpointRules) + enum class US_EAST_1_REGIONAL_ENDPOINT_OPTION + { + NOT_SET, + LEGACY, //stands for using global endpoint for us-east-1, + REGIONAL //stands for using regional endpoint for us-east-1 + }; +#end +#set($finalClass = " final") +#if($serviceModel.enableVirtualOperations) +#set($finalClass = "") +#end + class ${CppViewHelper.computeExportValue($metadata.classNamePrefix)} ${className}${finalClass} : public smithy::client::AwsSmithyClientT<${rootNamespace}::${serviceNamespace}::SERVICE_NAME, + ${serviceConfiguration}, + smithy::${AuthSchemeResolver}<${metadata.classNamePrefix}EndpointProvider, ${serviceConfiguration}>, + ${rootNamespace}::Crt::Variant<${AuthSchemeVariants}>, + ${metadata.classNamePrefix}EndpointProviderBase, + smithy::client::$serializer, + smithy::client::$serializerOutcome, + Aws::Client::${metadata.classNamePrefix}ErrorMarshaller>, + Aws::Client::ClientWithAsyncTemplateMethods<${className}> + { + public: + static const char* GetServiceName(); + static const char* GetAllocationTag(); + inline const char* GetServiceClientName() const override { return "${metadata.serviceId}"; } + +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/ServiceClientHeaderConfigTypeDeclarations.vm") +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/ServiceClientHeaderConstructors.vm") +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/ServiceClientHeaderOperations.vm") + + Aws::String GeneratePresignedUrl(const Aws::String& bucket, + const Aws::String& key, + Aws::Http::HttpMethod method, + uint64_t expirationInSeconds = MAX_EXPIRATION_SECONDS); + + Aws::String GeneratePresignedUrl(const Aws::String& bucket, + const Aws::String& key, + Aws::Http::HttpMethod method, + const Http::HeaderValueCollection& customizedHeaders, + uint64_t expirationInSeconds = MAX_EXPIRATION_SECONDS); + + /** + * Server Side Encryption Headers and Algorithm + * Method Algorithm Required Headers + * SSE-S3 AES256 x-amz-server-side-encryption:AES256 + * SSE-KMS aws:kms x-amz-server-side--encryption:aws:kms, x-amz-server-side-encryption-aws-kms-key-id: + * SS3-C AES256 x-amz-server-side-encryption-customer-algorithm:AES256, x-amz-server-side-encryption-customer-key:, x-amz-server-side-encryption-customer-key-MD5: + */ + /** + * Generate presigned URL with Sever Side Encryption(SSE) and with S3 managed keys. + * https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html (algo: AES256) + */ + Aws::String GeneratePresignedUrlWithSSES3(const Aws::String& bucket, + const Aws::String& key, + Aws::Http::HttpMethod method, + uint64_t expirationInSeconds = MAX_EXPIRATION_SECONDS); + /** + * Generate presigned URL with Sever Side Encryption(SSE) and with S3 managed keys. + * https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html (algo: AES256) + * Header: "x-amz-server-side-encryption" will be added internally, don't customize it. + */ + Aws::String GeneratePresignedUrlWithSSES3(const Aws::String& bucket, + const Aws::String& key, + Aws::Http::HttpMethod method, + Http::HeaderValueCollection customizedHeaders, + uint64_t expirationInSeconds = MAX_EXPIRATION_SECONDS); + + /** + * Generate presigned URL with Server Side Encryption(SSE) and with KMS master key id. + * if kmsMasterKeyId is empty, we will end up use the default one generated by KMS for you. You can find it via AWS IAM console, it's the one aliased as "aws/s3". + * https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html (algo: aws:kms) + */ + Aws::String GeneratePresignedUrlWithSSEKMS(const Aws::String& bucket, + const Aws::String& key, + Aws::Http::HttpMethod method, + const Aws::String& kmsMasterKeyId = "", + uint64_t expirationInSeconds = MAX_EXPIRATION_SECONDS); + /** + * Generate presigned URL with Server Side Encryption(SSE) and with KMS master key id. + * if kmsMasterKeyId is empty, we will end up use the default one generated by KMS for you. You can find it via AWS IAM console, it's the one aliased as "aws/s3". + * https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html (algo: aws:kms) + * Headers: "x-amz-server-side-encryption" and "x-amz-server-side-encryption-aws-kms-key-id" will be added internally, don't customize them. + */ + Aws::String GeneratePresignedUrlWithSSEKMS(const Aws::String& bucket, + const Aws::String& key, + Aws::Http::HttpMethod method, + Http::HeaderValueCollection customizedHeaders, + const Aws::String& kmsMasterKeyId = "", + uint64_t expirationInSeconds = MAX_EXPIRATION_SECONDS); + + /** + * Generate presigned URL with Sever Side Encryption(SSE) and with customer supplied Key. + * https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html (algo: AES256) + */ + Aws::String GeneratePresignedUrlWithSSEC(const Aws::String& bucket, + const Aws::String& key, + Aws::Http::HttpMethod method, + const Aws::String& base64EncodedAES256Key, + uint64_t expirationInSeconds = MAX_EXPIRATION_SECONDS); + /** + * Generate presigned URL with Sever Side Encryption(SSE) and with customer supplied Key. + * https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html (algo: AES256) + * Headers: "x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key" and "x-amz-server-side-encryption-customer-key-MD5" will be added internally, don't customize them. + */ + Aws::String GeneratePresignedUrlWithSSEC(const Aws::String& bucket, + const Aws::String& key, + Aws::Http::HttpMethod method, + Http::HeaderValueCollection customizedHeaders, + const Aws::String& base64EncodedAES256Key, + uint64_t expirationInSeconds = MAX_EXPIRATION_SECONDS); + + + virtual bool MultipartUploadSupported() const; + + void OverrideEndpoint(const Aws::String& endpoint); +#if($serviceModel.endpointRules) + std::shared_ptr<${metadata.classNamePrefix}EndpointProviderBase>& accessEndpointProvider(); +#end + +#if($serviceNamespace == "S3Crt") + + struct CrtRequestCallbackUserData { + const S3CrtClient *s3CrtClient; + GetObjectResponseReceivedHandler getResponseHandler; + PutObjectResponseReceivedHandler putResponseHandler; + CopyObjectResponseReceivedHandler copyResponseHandler; + std::shared_ptr asyncCallerContext; + const Aws::AmazonWebServiceRequest *originalRequest; + std::shared_ptr request; + std::shared_ptr response; + std::shared_ptr crtHttpRequest; + Aws::UniquePtr checksumConfig; + }; + + Aws::Client::XmlOutcome GenerateXmlOutcome(const std::shared_ptr& response) const; + Aws::Client::StreamOutcome GenerateStreamOutcome(const std::shared_ptr& response) const; + +#end + private: + friend class Aws::Client::ClientWithAsyncTemplateMethods<${className}>; +#if($serviceNamespace == "S3Crt") + void init(const S3Crt::ClientConfiguration& clientConfiguration, + const std::shared_ptr credentialsProvider); + + struct CrtClientShutdownCallbackDataWrapper { + void *data; + std::function fn; + std::shared_ptr clientShutdownSem; + }; + + static void CrtClientShutdownCallback(void *data); + void CancelCrtRequestAsync(aws_s3_meta_request *meta_request) const; + static int S3CrtRequestHeadersCallback(aws_s3_meta_request *meta_request, const struct aws_http_headers *headers, int response_status, void *user_data); + static int S3CrtRequestGetBodyCallback(struct aws_s3_meta_request *meta_request, const struct aws_byte_cursor *body, uint64_t range_start, void *user_data); + static void S3CrtRequestProgressCallback(struct aws_s3_meta_request *meta_request, const struct aws_s3_meta_request_progress *progress, void *user_data); + static void S3CrtRequestFinishCallback(struct aws_s3_meta_request *meta_request, const struct aws_s3_meta_request_result *meta_request_result, void *user_data); + + void InitCrtEndpointFromUri(aws_uri &endpoint_uri, const Aws::Http::URI &uri) const; + + void InitCommonCrtRequestOption(CrtRequestCallbackUserData *userData, + aws_s3_meta_request_options *options, + const Aws::AmazonWebServiceRequest *request, + const Aws::Http::URI &uri, Aws::Http::HttpMethod method) const; +#else +#if(!$serviceModel.endpointRules) + void init(const Aws::Client::ClientConfiguration& clientConfiguration); +#else + void init(const ${metadata.classNamePrefix}ClientConfiguration& clientConfiguration); +#end +#end +#if(!$serviceModel.endpointRules) + void Load${metadata.classNamePrefix}SpecificConfig(const Aws::String& profile); + ComputeEndpointOutcome ComputeEndpointString(const Aws::String& bucket) const; + ComputeEndpointOutcome ComputeEndpointString() const; + ComputeEndpointOutcome ComputeEndpointStringWithServiceName(const Aws::String& serviceNameOverride = "") const; + + Aws::String m_baseUri; + Aws::String m_scheme; + bool m_enableHostPrefixInjection = false; + Aws::String m_configScheme; +#end##-#if(!$serviceModel.endpointRules) +#if($serviceModel.endpointRules) +#if($serviceNamespace == "S3Crt") + ${metadata.classNamePrefix}::ClientConfiguration m_clientConfiguration; +#end +#end +#if($serviceNamespace == "S3Crt") + struct aws_s3_client* m_s3CrtClient = {}; + struct aws_signing_config_aws m_s3CrtSigningConfig = {}; + struct CrtClientShutdownCallbackDataWrapper m_wrappedData = {}; + std::shared_ptr m_clientShutdownSem; + std::shared_ptr m_credProvider; + std::shared_ptr m_crtCredProvider; +#end +#if(!$serviceModel.endpointRules) + bool m_useVirtualAddressing = false; + bool m_useDualStack = false; + bool m_useArnRegion = false; + bool m_disableMultiRegionAccessPoints = false; + bool m_useCustomEndpoint = false; +#end##-#if(!$serviceModel.endpointRules) +#if($metadata.hasEndpointDiscoveryTrait) + mutable Aws::Utils::ConcurrentCache m_endpointsCache; +#if(!$serviceModel.endpointRules) + bool m_enableEndpointDiscovery = false; +#end +#end + +#if(!$serviceModel.endpointRules) + ${rootNamespace}::$serviceNamespace::US_EAST_1_REGIONAL_ENDPOINT_OPTION m_USEast1RegionalEndpointOption = ${rootNamespace}::$serviceNamespace::US_EAST_1_REGIONAL_ENDPOINT_OPTION::NOT_SET; +#end +#if($serviceNamespace == "S3Crt") + std::shared_ptr m_identityProvider; + S3CrtIdentityProviderUserData m_identityProviderUserData{m_identityProvider}; +#end + }; + + } // namespace ${metadata.namespace} +} // namespace ${rootNamespace} diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ClientSource.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ClientSource.vm new file mode 100644 index 00000000000..33e4cb5a817 --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ClientSource.vm @@ -0,0 +1,358 @@ +#set($signPayloadsOptional = true) +#set($virtualAddressingSupported = true) +#set($arnEndpointSupported = true) +#set($vpcEndpointSupported = true) +#set($multiRegionAccessPointSupported = true) +#set($serviceNamespace = $serviceModel.metadata.namespace) +#set($USEast1RegionalEndpointArgString = ", Aws::${serviceNamespace}::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption") +#set($USEast1RegionalEndpointInitString = ", m_USEast1RegionalEndpointOption(USEast1RegionalEndPointOption)") +#if(!$serviceModel.endpointRules) +#set($AdditionalServiceSpecificConfigLoadString = "Load${serviceNamespace}SpecificConfig(config.profileName);") +#end +#set($ForRegionExtraArgsString = ", m_USEast1RegionalEndpointOption == Aws::${serviceNamespace}::US_EAST_1_REGIONAL_ENDPOINT_OPTION::REGIONAL") +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyRestXmlServiceClientSource.vm") + +#if(!${onlyGeneratedOperations}) +#if(!$serviceModel.endpointRules) +static const char US_EAST_1_REGIONAL_ENDPOINT_ENV_VAR[] = "AWS_S3_US_EAST_1_REGIONAL_ENDPOINT"; +static const char US_EAST_1_REGIONAL_ENDPOINT_CONFIG_VAR[] = "s3_us_east_1_regional_endpoint"; +static const char S3_USE_ARN_REGION_ENVIRONMENT_VARIABLE[] = "AWS_S3_USE_ARN_REGION"; +static const char S3_USE_ARN_REGION_CONFIG_FILE_OPTION[] = "s3_use_arn_region"; +static const char S3_DISABLE_MULTIREGION_ACCESS_POINTS_ENV_VAR[] = "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS"; +static const char S3_DISABLE_MULTIREGION_ACCESS_POINTS_CONFIG_VAR[] = "s3_disable_multiregion_access_points"; + +void ${className}::Load${metadata.classNamePrefix}SpecificConfig(const Aws::String& profile) +{ + if (m_USEast1RegionalEndpointOption == Aws::${serviceNamespace}::US_EAST_1_REGIONAL_ENDPOINT_OPTION::NOT_SET) + { + Aws::String option = Aws::Environment::GetEnv(US_EAST_1_REGIONAL_ENDPOINT_ENV_VAR); + if (option.empty()) + { + option = Aws::Config::GetCachedConfigValue(profile, US_EAST_1_REGIONAL_ENDPOINT_CONFIG_VAR); + } + + if (Aws::Utils::StringUtils::ToLower(option.c_str()) == "legacy") + { + m_USEast1RegionalEndpointOption = Aws::${serviceNamespace}::US_EAST_1_REGIONAL_ENDPOINT_OPTION::LEGACY; + } + else // defaults is regional + { + m_USEast1RegionalEndpointOption = Aws::${serviceNamespace}::US_EAST_1_REGIONAL_ENDPOINT_OPTION::REGIONAL; + } + } + + Aws::String s3UseArnRegion = Aws::Environment::GetEnv(S3_USE_ARN_REGION_ENVIRONMENT_VARIABLE); + if (s3UseArnRegion.empty()) + { + s3UseArnRegion = Aws::Config::GetCachedConfigValue(profile, S3_USE_ARN_REGION_CONFIG_FILE_OPTION); + } + + if (s3UseArnRegion == "true") + { + m_useArnRegion = true; + } + else + { + if (!s3UseArnRegion.empty() && s3UseArnRegion != "false") + { + AWS_LOGSTREAM_WARN("${className}", "AWS_S3_USE_ARN_REGION in environment variables or s3_use_arn_region in config file" + << "should either be true of false if specified, otherwise turn off this flag by default."); + } + m_useArnRegion = false; + } + + Aws::String s3DisableMultiRegionAccessPoints = Aws::Environment::GetEnv(S3_DISABLE_MULTIREGION_ACCESS_POINTS_ENV_VAR); + if (s3DisableMultiRegionAccessPoints.empty()) + { + s3DisableMultiRegionAccessPoints = Aws::Config::GetCachedConfigValue(profile, S3_DISABLE_MULTIREGION_ACCESS_POINTS_CONFIG_VAR); + } + if (s3DisableMultiRegionAccessPoints == "true") + { + m_disableMultiRegionAccessPoints = true; + } + else + { + if (!s3DisableMultiRegionAccessPoints.empty() && s3DisableMultiRegionAccessPoints != "false") + { + AWS_LOGSTREAM_WARN("${className}", "AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS in environment variables or s3_disable_multiregion_access_points" + << "in config file should either be true of false if specified, otherwise turn off this flag by default."); + } + m_disableMultiRegionAccessPoints = false; + } +} +#end + +#set($clsWSpace = $className.replaceAll(".", " ")) +\#include +Aws::String ${className}::GeneratePresignedUrl(const Aws::String& bucket, + ${clsWSpace} const Aws::String& key, + ${clsWSpace} Aws::Http::HttpMethod method, + ${clsWSpace} uint64_t expirationInSeconds) +{ + return GeneratePresignedUrl(bucket, key, method, {}, expirationInSeconds); +} + +Aws::String ${className}::GeneratePresignedUrl(const Aws::String& bucket, + ${clsWSpace} const Aws::String& key, + ${clsWSpace} Aws::Http::HttpMethod method, + ${clsWSpace} const Http::HeaderValueCollection& customizedHeaders, + ${clsWSpace} uint64_t expirationInSeconds) +{ +#if(!$serviceModel.endpointRules) + ComputeEndpointOutcome computeEndpointOutcome = ComputeEndpointString(bucket); + if (!computeEndpointOutcome.IsSuccess()) + { + AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Presigned URL generating failed. Encountered error: " << computeEndpointOutcome.GetError()); + return {}; + } + URI uri(computeEndpointOutcome.GetResult().endpoint); + uri.SetPath(uri.GetPath() + "/" + key); + return AwsSmithyClientT::GeneratePresignedUrl(uri, method, computeEndpointOutcome.GetResult().signerRegion.c_str(), + computeEndpointOutcome.GetResult().signerServiceName.c_str(), expirationInSeconds, customizedHeaders, nullptr); +#else + if (!m_endpointProvider) + { + AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Presigned URL generating failed. Endpoint provider is not initialized."); + return {}; + } + ResolveEndpointOutcome computeEndpointOutcome = m_endpointProvider->ResolveEndpoint({{Aws::String("Bucket"), bucket}}); + if (!computeEndpointOutcome.IsSuccess()) + { + AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Presigned URL generating failed. Encountered error: " << computeEndpointOutcome.GetError().GetMessage()); + return {}; + } + Aws::Endpoint::AWSEndpoint& endpoint = computeEndpointOutcome.GetResult(); + endpoint.AddPathSegments(key); + Aws::Map params; + params.emplace("bucketName", bucket); + ServiceSpecificParameters serviceSpecificParameters{params}; + auto serviceParams = Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); + return AwsSmithyClientT::GeneratePresignedUrl(endpoint, method, {}, {}, expirationInSeconds, customizedHeaders, serviceParams); +#end +} + +Aws::String ${className}::GeneratePresignedUrlWithSSES3(const Aws::String& bucket, + ${clsWSpace} const Aws::String& key, + ${clsWSpace} Aws::Http::HttpMethod method, + ${clsWSpace} uint64_t expirationInSeconds) +{ + Aws::Http::HeaderValueCollection headers; + headers.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION, Aws::${serviceNamespace}::Model::ServerSideEncryptionMapper::GetNameForServerSideEncryption(Aws::${serviceNamespace}::Model::ServerSideEncryption::AES256)); + return GeneratePresignedUrl(bucket, key, method, headers, expirationInSeconds); +} + +Aws::String ${className}::GeneratePresignedUrlWithSSES3(const Aws::String& bucket, + ${clsWSpace} const Aws::String& key, + ${clsWSpace} Aws::Http::HttpMethod method, + ${clsWSpace} Http::HeaderValueCollection customizedHeaders, + ${clsWSpace} uint64_t expirationInSeconds) +{ + customizedHeaders.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION, Aws::${serviceNamespace}::Model::ServerSideEncryptionMapper::GetNameForServerSideEncryption(Aws::${serviceNamespace}::Model::ServerSideEncryption::AES256)); + return GeneratePresignedUrl(bucket, key, method, customizedHeaders, expirationInSeconds); +} + +Aws::String ${className}::GeneratePresignedUrlWithSSEKMS(const Aws::String& bucket, + ${clsWSpace} const Aws::String& key, + ${clsWSpace} Aws::Http::HttpMethod method, + ${clsWSpace} const Aws::String& kmsMasterKeyId, + ${clsWSpace} uint64_t expirationInSeconds) +{ + Aws::Http::HeaderValueCollection headers; + headers.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION, Aws::${serviceNamespace}::Model::ServerSideEncryptionMapper::GetNameForServerSideEncryption(Aws::${serviceNamespace}::Model::ServerSideEncryption::aws_kms)); + headers.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID, kmsMasterKeyId); + return GeneratePresignedUrl(bucket, key, method, headers, expirationInSeconds); +} + +Aws::String ${className}::GeneratePresignedUrlWithSSEKMS(const Aws::String& bucket, + ${clsWSpace} const Aws::String& key, + ${clsWSpace} Aws::Http::HttpMethod method, + ${clsWSpace} Http::HeaderValueCollection customizedHeaders, + ${clsWSpace} const Aws::String& kmsMasterKeyId, + ${clsWSpace} uint64_t expirationInSeconds) +{ + customizedHeaders.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION, Aws::${serviceNamespace}::Model::ServerSideEncryptionMapper::GetNameForServerSideEncryption(Aws::${serviceNamespace}::Model::ServerSideEncryption::aws_kms)); + customizedHeaders.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION_AWS_KMS_KEY_ID, kmsMasterKeyId); + return GeneratePresignedUrl(bucket, key, method, customizedHeaders, expirationInSeconds); +} + +Aws::String ${className}::GeneratePresignedUrlWithSSEC(const Aws::String& bucket, + ${clsWSpace} const Aws::String& key, + ${clsWSpace} Aws::Http::HttpMethod method, + ${clsWSpace} const Aws::String& base64EncodedAES256Key, + ${clsWSpace} uint64_t expirationInSeconds) +{ + Aws::Http::HeaderValueCollection headers; + headers.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM, Aws::${serviceNamespace}::Model::ServerSideEncryptionMapper::GetNameForServerSideEncryption(Aws::${serviceNamespace}::Model::ServerSideEncryption::AES256)); + headers.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY, base64EncodedAES256Key); + Aws::Utils::ByteBuffer buffer = Aws::Utils::HashingUtils::Base64Decode(base64EncodedAES256Key); + Aws::String strBuffer(reinterpret_cast(buffer.GetUnderlyingData()), buffer.GetLength()); + headers.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5, Aws::Utils::HashingUtils::Base64Encode(Aws::Utils::HashingUtils::CalculateMD5(strBuffer))); + return GeneratePresignedUrl(bucket, key, method, headers, expirationInSeconds); +} + +Aws::String ${className}::GeneratePresignedUrlWithSSEC(const Aws::String& bucket, + ${clsWSpace} const Aws::String& key, + ${clsWSpace} Aws::Http::HttpMethod method, + ${clsWSpace} Http::HeaderValueCollection customizedHeaders, + ${clsWSpace} const Aws::String& base64EncodedAES256Key, + ${clsWSpace} uint64_t expirationInSeconds) +{ + customizedHeaders.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM, Aws::${serviceNamespace}::Model::ServerSideEncryptionMapper::GetNameForServerSideEncryption(Aws::${serviceNamespace}::Model::ServerSideEncryption::AES256)); + customizedHeaders.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY, base64EncodedAES256Key); + Aws::Utils::ByteBuffer buffer = Aws::Utils::HashingUtils::Base64Decode(base64EncodedAES256Key); + Aws::String strBuffer(reinterpret_cast(buffer.GetUnderlyingData()), buffer.GetLength()); + customizedHeaders.emplace(Aws::${serviceNamespace}::SSEHeaders::SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5, Aws::Utils::HashingUtils::Base64Encode(Aws::Utils::HashingUtils::CalculateMD5(strBuffer))); + return GeneratePresignedUrl(bucket, key, method, customizedHeaders, expirationInSeconds); +} +#if(!$serviceModel.endpointRules) + +ComputeEndpointOutcome ${className}::ComputeEndpointString(const Aws::String& bucketOrArn) const +{ + if (m_useDualStack && m_useCustomEndpoint) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<${metadata.classNamePrefix}Errors>(${metadata.classNamePrefix}Errors::VALIDATION, "VALIDATION", + "Dual-stack endpoint is incompatible with a custom endpoint override.", false)); + } + + Aws::StringStream ss; + ss << m_scheme << "://"; + Aws::String bucket = bucketOrArn; + Aws::String signerRegion = Aws::Region::ComputeSignerRegion(m_region); + ${metadata.classNamePrefix}ARN arn(bucketOrArn); + + if (arn) + { + if (!m_useVirtualAddressing) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<${metadata.classNamePrefix}Errors>(${metadata.classNamePrefix}Errors::VALIDATION, "VALIDATION", + "Path style addressing is not compatible with Access Point ARN or Outposts ARN in Bucket field, please consider using virtual addressing for this client instead.", false)); + } + + bool useClientRegion = !m_useArnRegion || Aws::Region::IsFipsRegion(m_region); + ${metadata.classNamePrefix}ARNOutcome s3ArnOutcome = useClientRegion ? arn.Validate(m_region.c_str()) : arn.Validate(); + if (!s3ArnOutcome.IsSuccess()) + { + return ComputeEndpointOutcome(s3ArnOutcome.GetError()); + } + signerRegion = m_useArnRegion ? arn.GetRegion() : signerRegion; + // S3 Object Lambda Access Point ARN + if (arn.GetService() == ARNService::S3_OBJECT_LAMBDA) + { + if (m_useDualStack) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<${metadata.classNamePrefix}Errors>(${metadata.classNamePrefix}Errors::VALIDATION, "VALIDATION", + "S3 Object Lambda Access Point ARNs do not support dualstack right now.", false)); + } + ss << ${metadata.classNamePrefix}Endpoint::ForObjectLambdaAccessPointArn(arn, useClientRegion ? m_region : "", m_useDualStack, m_useCustomEndpoint ? m_baseUri : ""); + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), signerRegion, ARNService::S3_OBJECT_LAMBDA)); + } + // S3 Multi Region Access Point ARN + else if (arn.GetResourceType() == ARNResourceType::ACCESSPOINT && arn.GetRegion().empty()) + { + if (m_disableMultiRegionAccessPoints) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<${metadata.classNamePrefix}Errors>(${metadata.classNamePrefix}Errors::VALIDATION, "VALIDATION", + "Multi Region Access Point ARN is disabled explicitly. Unset AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS in environment variables and s3_disable_multiregion_access_points in config file, or set them to false.", false)); + } + if (m_useDualStack) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<${metadata.classNamePrefix}Errors>(${metadata.classNamePrefix}Errors::VALIDATION, "VALIDATION", + "S3 Multi Region Access Point ARNs do not support dualstack right now.", false)); + } + if (m_useCustomEndpoint) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<${metadata.classNamePrefix}Errors>(${metadata.classNamePrefix}Errors::VALIDATION, "VALIDATION", + "S3 Multi Region Access Point ARNs do not support custom endpoint override right now.", false)); + } + ss << ${metadata.classNamePrefix}Endpoint::ForMultiRegionAccessPointArn(arn, m_useDualStack, /*endpointOverride*/ ""); + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), "*", SERVICE_NAME, Aws::Auth::ASYMMETRIC_SIGV4_SIGNER)); + } + // Regular S3 Access Point ARN + else if (arn.GetResourceType() == ARNResourceType::ACCESSPOINT) + { + ss << ${metadata.classNamePrefix}Endpoint::ForAccessPointArn(arn, useClientRegion ? m_region : "", m_useDualStack, m_useCustomEndpoint ? m_baseUri : ""); + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), signerRegion, SERVICE_NAME)); + } + // S3 Outposts Access Point ARN + else if (arn.GetResourceType() == ARNResourceType::OUTPOST) + { + if (m_useDualStack) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<${metadata.classNamePrefix}Errors>(${metadata.classNamePrefix}Errors::VALIDATION, "VALIDATION", + "Outposts Access Points do not support dualstack right now.", false)); + } + ss << ${metadata.classNamePrefix}Endpoint::ForOutpostsArn(arn, useClientRegion ? m_region : "", m_useDualStack, m_useCustomEndpoint ? m_baseUri : ""); + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), signerRegion, ARNService::S3_OUTPOSTS)); + } + } + + // when using virtual hosting of buckets, the bucket name has to follow some rules. + // Mainly, it has to be a valid DNS label, and it must be lowercase. + // For more information see http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostingSpecifyBucket + if(m_useVirtualAddressing && Aws::Utils::IsValidDnsLabel(bucket) && + bucket == Aws::Utils::StringUtils::ToLower(bucket.c_str())) + { + ss << bucket << "." << m_baseUri; + } + else + { + ss << m_baseUri << "/" << bucket; + } + + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), signerRegion, SERVICE_NAME)); +} + +ComputeEndpointOutcome ${className}::ComputeEndpointString() const +{ + if (m_useDualStack && m_useCustomEndpoint) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<${metadata.classNamePrefix}Errors>(${metadata.classNamePrefix}Errors::VALIDATION, "VALIDATION", + "Dual-stack endpoint is incompatible with a custom endpoint override.", false)); + } + Aws::StringStream ss; + ss << m_scheme << "://" << m_baseUri; + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), Aws::Region::ComputeSignerRegion(m_region), SERVICE_NAME)); +} + +ComputeEndpointOutcome ${className}::ComputeEndpointStringWithServiceName(const Aws::String& serviceNameOverride) const +{ + if (serviceNameOverride.empty()) + { + return ComputeEndpointString(); + } + + if (m_useDualStack && m_useCustomEndpoint) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<${metadata.classNamePrefix}Errors>(${metadata.classNamePrefix}Errors::VALIDATION, "VALIDATION", + "Dual-stack endpoint is incompatible with a custom endpoint override.", false)); + } + + Aws::StringStream ss; + ss << m_scheme << "://"; + if (m_useCustomEndpoint) + { + ss << m_baseUri; + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), Aws::Region::ComputeSignerRegion(m_region), serviceNameOverride)); + } + else + { + if (m_useDualStack) + { + return ComputeEndpointOutcome(Aws::Client::AWSError<${metadata.classNamePrefix}Errors>(${metadata.classNamePrefix}Errors::VALIDATION, "VALIDATION", + "S3 Object Lambda endpoints do not support dualstack right now.", false)); + } + else + { + ss << ${metadata.classNamePrefix}Endpoint::ForRegion(m_region, m_useDualStack, true, serviceNameOverride); + return ComputeEndpointOutcome(ComputeEndpointResult(ss.str(), Aws::Region::ComputeSignerRegion(m_region), serviceNameOverride)); + } + } +} +#end + + +bool ${className}::MultipartUploadSupported() const +{ + return true; +} +#end diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressAuthSchemeResolverHeader.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressAuthSchemeResolverHeader.vm new file mode 100644 index 00000000000..8e9a8a0d513 --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressAuthSchemeResolverHeader.vm @@ -0,0 +1,65 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +#set($metadata = $serviceModel.metadata) +#set($rootNamespace = $serviceModel.namespace) +#set($serviceNamespace = $metadata.namespace) +#set($clientConfiguration = ${serviceNamespace} + "::" + ${metadata.classNamePrefix} + "ClientConfiguration") +#pragma once + +\#include +\#include +\#include +\#include + +namespace ${rootNamespace} { +namespace ${serviceNamespace} { + class ${CppViewHelper.computeExportValue($serviceNamespace)} S3ExpressAuthSchemeResolver : public smithy::SigV4MultiAuthSchemeResolver<${metadata.classNamePrefix}EndpointProvider, ${clientConfiguration}>{ + + public: + Aws::Vector resolveAuthScheme(const ServiceAuthSchemeParameters& identityProperties) override + { + //pack endpoint params from identityProperties + Aws::Endpoint::EndpointParameters epParams; + + for (auto& identParam : identityProperties.additionalProperties) { + if (identParam.second.template holds_alternative()) + { + epParams.emplace_back(Aws::Endpoint::EndpointParameter(identParam.first, identParam.second.template get())); + } + if (identParam.second.template holds_alternative()) + { + epParams.emplace_back(Aws::Endpoint::EndpointParameter(identParam.first ,identParam.second.template get())); + } + } + + //resolve endpoint first time to fetch auth schemes + if(m_endpointProviderForAuth) + { + auto epResolutionOutcome = m_endpointProviderForAuth->ResolveEndpoint(epParams); + if (epResolutionOutcome.IsSuccess()) + { + auto endpoint = std::move(epResolutionOutcome.GetResultWithOwnership()); + if (endpoint.GetAttributes()) + { + auto authSchemeName = endpoint.GetAttributes()->authScheme.GetName(); + if(strcmp(authSchemeName.c_str(),Aws::Auth::ASYMMETRIC_SIGV4_SIGNER) == 0) + { + return {smithy::SigV4aAuthSchemeOption::sigV4aAuthSchemeOption}; + } + else if(strcmp(authSchemeName.c_str(),Aws::Auth::SIGV4_SIGNER) == 0) + { + return {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption}; + } + else if(strcmp(authSchemeName.c_str(), S3::S3_EXPRESS_SIGNER_NAME) == 0) + { + return {S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption}; + } + } + } + } + + return {smithy::SigV4AuthSchemeOption::sigV4AuthSchemeOption}; + } + }; +} +} diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressIdentityProviderHeader.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressIdentityProviderHeader.vm new file mode 100644 index 00000000000..dc81c1f50c1 --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressIdentityProviderHeader.vm @@ -0,0 +1,176 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +#set($metadata = $serviceModel.metadata) +#set($rootNamespace = $serviceModel.namespace) +#set($serviceNamespace = $metadata.namespace) +#pragma once + +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include + +namespace ${rootNamespace} { + namespace Http { + struct ServiceSpecificParameters; + } + + namespace ${serviceNamespace} { + class ${serviceNamespace}Client; + class ${CppViewHelper.computeExportValue($serviceNamespace)} S3ExpressIdentityProvider : public smithy::IdentityResolverBase { + public: + explicit S3ExpressIdentityProvider(const S3Client& s3Client); + ResolveIdentityFutureOutcome getIdentity( + const IdentityProperties& identityProperties, + const AdditionalParameters& additionalParameters) override; + + virtual S3ExpressIdentity + GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) = 0; + + protected: + + S3ExpressIdentity GetCredentialsFromBucket(const Aws::String& bucketName) const; + + private: + const Aws::S3::S3Client& m_s3Client; + mutable std::mutex m_bucketNameMapMutex; + Aws::Map> m_bucketNameMutex; + + protected: + std::shared_ptr GetMutexForBucketName(const Aws::String& bucketName); + }; + + + class ${CppViewHelper.computeExportValue($serviceNamespace)} DefaultS3ExpressIdentityProvider : public S3ExpressIdentityProvider { + public: + explicit DefaultS3ExpressIdentityProvider(const S3Client& s3Client); + explicit DefaultS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache); + DefaultS3ExpressIdentityProvider(const DefaultS3ExpressIdentityProvider& other) = delete; + DefaultS3ExpressIdentityProvider(DefaultS3ExpressIdentityProvider&& other) noexcept = delete; + DefaultS3ExpressIdentityProvider& operator=(const DefaultS3ExpressIdentityProvider& other) = delete; + DefaultS3ExpressIdentityProvider& operator=(DefaultS3ExpressIdentityProvider&& other) noexcept = delete; + virtual ~DefaultS3ExpressIdentityProvider() override = default; + S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) override; + + private: + mutable std::shared_ptr> m_credentialsCache; + }; + + class ${CppViewHelper.computeExportValue($serviceNamespace)} DefaultAsyncS3ExpressIdentityProvider : public S3ExpressIdentityProvider { + public: + explicit DefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, + std::chrono::minutes refreshPeriod = std::chrono::minutes(1)); + + explicit DefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache, + std::chrono::minutes refreshPeriod = std::chrono::minutes(1)); + + DefaultAsyncS3ExpressIdentityProvider(const DefaultAsyncS3ExpressIdentityProvider& other) = delete; + DefaultAsyncS3ExpressIdentityProvider(DefaultAsyncS3ExpressIdentityProvider&& other) noexcept = delete; + DefaultAsyncS3ExpressIdentityProvider& operator=( + const DefaultAsyncS3ExpressIdentityProvider& other) = delete; + DefaultAsyncS3ExpressIdentityProvider& operator=(DefaultAsyncS3ExpressIdentityProvider&& other) noexcept = delete; + virtual ~DefaultAsyncS3ExpressIdentityProvider() override; + S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) override; + + private: + void refreshIdentities(std::chrono::minutes refreshPeriod); + void threadSafeKeyInsert(const Aws::String& key); + bool threadSafeKeyHas(const Aws::String& key); + void threadSafeKeyEmpty(); + + mutable std::shared_ptr> m_credentialsCache; + Aws::Set m_keysUsed; + mutable std::mutex m_keysUsedMutex; + mutable bool m_shouldStopBackgroundRefresh; + Aws::UniquePtr m_backgroundRefreshThread; + mutable std::mutex m_shutDownMutex; + mutable std::condition_variable m_shutdownCondition; + }; + + /*------ Smithy version -----*/ + class ${CppViewHelper.computeExportValue($serviceNamespace)} SmithyS3ExpressIdentityProvider : public smithy::IdentityResolverBase { + public: + explicit SmithyS3ExpressIdentityProvider(const S3Client& s3Client); + ResolveIdentityFutureOutcome getIdentity( + const IdentityProperties& identityProperties, + const AdditionalParameters& additionalParameters) override; + + protected: + + virtual smithy::AwsCredentialIdentity GetS3ExpressAwsIdentity(const std::shared_ptr &serviceSpecificParameters) = 0; + smithy::AwsCredentialIdentity GetCredentialsFromBucket(const Aws::String& bucketName) const; + + private: + const Aws::S3::S3Client& m_s3Client; + mutable std::mutex m_bucketNameMapMutex; + Aws::Map> m_bucketNameMutex; + + protected: + std::shared_ptr GetMutexForBucketName(const Aws::String& bucketName); + }; + + class ${CppViewHelper.computeExportValue($serviceNamespace)} SmithyDefaultS3ExpressIdentityProvider : public SmithyS3ExpressIdentityProvider { + public: + explicit SmithyDefaultS3ExpressIdentityProvider(const S3Client& s3Client); + explicit SmithyDefaultS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache); + SmithyDefaultS3ExpressIdentityProvider(const SmithyDefaultS3ExpressIdentityProvider& other) = delete; + SmithyDefaultS3ExpressIdentityProvider(SmithyDefaultS3ExpressIdentityProvider&& other) noexcept = delete; + SmithyDefaultS3ExpressIdentityProvider& operator=(const SmithyDefaultS3ExpressIdentityProvider& other) = delete; + SmithyDefaultS3ExpressIdentityProvider& operator=(SmithyDefaultS3ExpressIdentityProvider&& other) noexcept = delete; + virtual ~SmithyDefaultS3ExpressIdentityProvider() override = default; + + protected: + smithy::AwsCredentialIdentity GetS3ExpressAwsIdentity(const std::shared_ptr &serviceSpecificParameters) override; + + private: + mutable std::shared_ptr> m_credentialsCache; + }; + + class ${CppViewHelper.computeExportValue($serviceNamespace)} SmithyDefaultAsyncS3ExpressIdentityProvider : public SmithyS3ExpressIdentityProvider { + public: + explicit SmithyDefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, + std::chrono::minutes refreshPeriod = std::chrono::minutes(1)); + + explicit SmithyDefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache, + std::chrono::minutes refreshPeriod = std::chrono::minutes(1)); + + SmithyDefaultAsyncS3ExpressIdentityProvider(const SmithyDefaultAsyncS3ExpressIdentityProvider& other) = delete; + SmithyDefaultAsyncS3ExpressIdentityProvider(SmithyDefaultAsyncS3ExpressIdentityProvider&& other) noexcept = delete; + SmithyDefaultAsyncS3ExpressIdentityProvider& operator=( + const SmithyDefaultAsyncS3ExpressIdentityProvider& other) = delete; + SmithyDefaultAsyncS3ExpressIdentityProvider& operator=(SmithyDefaultAsyncS3ExpressIdentityProvider&& other) noexcept = delete; + virtual ~SmithyDefaultAsyncS3ExpressIdentityProvider() override; + protected: + smithy::AwsCredentialIdentity GetS3ExpressAwsIdentity(const std::shared_ptr &serviceSpecificParameters) override; + + private: + void refreshIdentities(std::chrono::minutes refreshPeriod); + void threadSafeKeyInsert(const Aws::String& key); + bool threadSafeKeyHas(const Aws::String& key); + void threadSafeKeyEmpty(); + + mutable std::shared_ptr> m_credentialsCache; + Aws::Set m_keysUsed; + mutable std::mutex m_keysUsedMutex; + mutable bool m_shouldStopBackgroundRefresh; + Aws::UniquePtr m_backgroundRefreshThread; + mutable std::mutex m_shutDownMutex; + mutable std::condition_variable m_shutdownCondition; + }; + } +} \ No newline at end of file diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressIdentityProviderSource.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressIdentityProviderSource.vm new file mode 100644 index 00000000000..2c55c21fe09 --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressIdentityProviderSource.vm @@ -0,0 +1,390 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +#set($metadata = $serviceModel.metadata) +#set($rootNamespace = $serviceModel.namespace) +#set($serviceNamespace = $metadata.namespace) +\#include +\#include +\#include +\#include +\#include +\#include +\#include + +using namespace ${rootNamespace}::${serviceNamespace}; +using namespace ${rootNamespace}::Utils; +using namespace ${rootNamespace}::Http; +using namespace std::chrono; +using namespace smithy; +using CacheValueType = typename Aws::Utils::Cache::Value; +using SmithyCacheValueType = typename Aws::Utils::Cache::Value; + +namespace{ +const char S3_EXPRESS_IDENTITY_PROVIDER[] = "S3ExpressIdentityProvider"; +const int DEFAULT_CACHE_SIZE = 100; +} +S3ExpressIdentityProvider::S3ExpressIdentityProvider(const S3Client& s3Client) : m_s3Client(s3Client){} + +S3ExpressIdentityProvider::ResolveIdentityFutureOutcome S3ExpressIdentityProvider::getIdentity( + const IdentityProperties& identityProperties, const AdditionalParameters& additionalParameters){ + const auto params = Aws::MakeShared(S3_EXPRESS_IDENTITY_PROVIDER); + for (const auto& paramMap: {identityProperties, additionalParameters}) + { + TransformAndInsert, String>(paramMap, + params->parameterMap, + [](const Aws::Crt::Variant& value) -> Aws::String + { + if (value.holds_alternative()) + { + return value.get() ? "true" : "false"; + } + if (value.holds_alternative()) + { + return value.get(); + } + return {}; + }); + } + + auto s3ExpressIdentity = GetS3ExpressIdentity(params); + + auto identity = Aws::MakeUnique("DefaultAwsCredentialIdentityResolver", s3ExpressIdentity.getAccessKeyId(), s3ExpressIdentity.getSecretKeyId(), + s3ExpressIdentity.getSessionToken() , + s3ExpressIdentity.getExpiration()); + + return ResolveIdentityFutureOutcome(std::move(identity)); +} + +std::shared_ptr S3ExpressIdentityProvider::GetMutexForBucketName(const Aws::String& bucketName) { + std::lock_guard lock(m_bucketNameMapMutex); + auto it = m_bucketNameMutex.find(bucketName); + if (it != m_bucketNameMutex.end()) { + return it->second; + } + auto bucketMutex = Aws::MakeShared(S3_EXPRESS_IDENTITY_PROVIDER); + m_bucketNameMutex.emplace(bucketName, bucketMutex); + return bucketMutex; +} + +S3ExpressIdentity S3ExpressIdentityProvider::GetCredentialsFromBucket(const Aws::String& bucketName) const { + auto outcome = m_s3Client.CreateSession(Model::CreateSessionRequest().WithBucket(bucketName)); + // If we fail the connect call return empty credentials and log an error message. + if (!outcome.IsSuccess()) { + AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "Failed to make S3Express Connect Call") + return {"", "", {""}, {}}; + } + auto result = outcome.GetResult(); + const auto &credentials = result.GetCredentials(); + // if expiry is present, use it, otherwise default to 5 minutes expiry + auto expiry = [&]() -> Aws::Utils::DateTime { + if (credentials.ExpirationHasBeenSet()) { + return credentials.GetExpiration(); + } + return Aws::Utils::DateTime::Now() + minutes(5); + }(); + return {credentials.GetAccessKeyId(), + credentials.GetSecretAccessKey(), + credentials.GetSessionToken(), + expiry}; +} + +DefaultS3ExpressIdentityProvider::DefaultS3ExpressIdentityProvider(const S3Client& s3Client) + : S3ExpressIdentityProvider{s3Client}, m_credentialsCache{Aws::MakeShared>(S3_EXPRESS_IDENTITY_PROVIDER, + DEFAULT_CACHE_SIZE)}{} + +DefaultS3ExpressIdentityProvider::DefaultS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache) + : S3ExpressIdentityProvider{s3Client}, m_credentialsCache{credentialsCache} {} + +S3ExpressIdentity DefaultS3ExpressIdentityProvider::GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters) +{ + auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName"); + if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) { + AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call") + return {"", "", {""}, {}}; + } + std::lock_guard lock(*GetMutexForBucketName(bucketNameIter->second)); + S3ExpressIdentity identity; + auto isInCache = m_credentialsCache->Get(bucketNameIter->second, identity); + if (!isInCache || (identity.expiration().has_value() && (identity.expiration().value() - minutes(1) < Aws::Utils::DateTime::Now())) ) { + identity = S3ExpressIdentityProvider::GetCredentialsFromBucket(bucketNameIter->second); + if (identity.expiration().has_value()) { + m_credentialsCache->Put(bucketNameIter->second, + identity, + std::chrono::milliseconds(identity.expiration().value().Millis() - Aws::Utils::DateTime::Now().Millis())); + } + } + return identity; +} + + +DefaultAsyncS3ExpressIdentityProvider::DefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, std::chrono::minutes refreshPeriod) + : DefaultAsyncS3ExpressIdentityProvider(s3Client, + Aws::MakeShared>( + S3_EXPRESS_IDENTITY_PROVIDER, DEFAULT_CACHE_SIZE), + refreshPeriod) {} + +DefaultAsyncS3ExpressIdentityProvider::DefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, std::shared_ptr> credentialsCache, + std::chrono::minutes refreshPeriod) + : S3ExpressIdentityProvider(s3Client), m_credentialsCache(std::move(credentialsCache)) { + // Start a thread to background refresh the keys currently in the cache. + m_shouldStopBackgroundRefresh = false; + m_backgroundRefreshThread = Aws::MakeUnique( + S3_EXPRESS_IDENTITY_PROVIDER, std::thread(&DefaultAsyncS3ExpressIdentityProvider::refreshIdentities, this, refreshPeriod)); +} + +DefaultAsyncS3ExpressIdentityProvider::~DefaultAsyncS3ExpressIdentityProvider(){ + { + std::unique_lock lock(m_shutDownMutex); + m_shouldStopBackgroundRefresh = true; + m_shutdownCondition.notify_all(); + } + m_backgroundRefreshThread->join(); +} + +S3ExpressIdentity DefaultAsyncS3ExpressIdentityProvider::GetS3ExpressIdentity(const std::shared_ptr &serviceSpecificParameters){ + auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName"); + if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) { + AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call") + return {"", "", {""}, {}}; + } + threadSafeKeyInsert(bucketNameIter->second); + std::lock_guard lock(*GetMutexForBucketName(bucketNameIter->second)); + S3ExpressIdentity identity; + auto isInCache = m_credentialsCache->Get(bucketNameIter->second, identity); + if (!isInCache || (identity.expiration().has_value() && (identity.expiration().value() - minutes(1) < Aws::Utils::DateTime::Now())) ) { + identity = S3ExpressIdentityProvider::GetCredentialsFromBucket(bucketNameIter->second); + if (identity.expiration().has_value()) { + m_credentialsCache->Put(bucketNameIter->second, + identity, + std::chrono::milliseconds(identity.expiration().value().Millis() - Aws::Utils::DateTime::Now().Millis())); + } + } + return identity; +} + +void DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyEmpty() { + std::lock_guard lock(m_keysUsedMutex); + m_keysUsed.clear(); +} + +bool DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyHas(const Aws::String& key) { + std::lock_guard lock(m_keysUsedMutex); + return m_keysUsed.find(key) != m_keysUsed.end(); +} + +void DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyInsert(const Aws::String& key) { + std::lock_guard lock(m_keysUsedMutex); + m_keysUsed.insert(key); +} + +void DefaultAsyncS3ExpressIdentityProvider::refreshIdentities(std::chrono::minutes refreshPeriod) { + auto filterUnusedKeys = [&](const Aws::String &bucketName, const CacheValueType &valueType) -> bool { + std::lock_guard lock(*GetMutexForBucketName(bucketName)); + AWS_UNREFERENCED_PARAM(valueType); + return !threadSafeKeyHas(bucketName); + }; + auto refreshIdentityWhenCloseToExpiry = [&](const Aws::String &bucketName, + const CacheValueType &valueType) -> CacheValueType { + std::lock_guard lock(*GetMutexForBucketName(bucketName)); + if ((!valueType.val.expiration().has_value()) || + (duration_cast(refreshPeriod).count() < valueType.val.expiration().value().Millis() && + valueType.val.expiration().value() - refreshPeriod < Aws::Utils::DateTime::Now())) { + auto updatedIdentity = this->S3ExpressIdentityProvider::GetCredentialsFromBucket(bucketName); + return {updatedIdentity.expiration().value(), updatedIdentity}; + } + return valueType; + }; + std::unique_lock lock(m_shutDownMutex); + while (!m_shouldStopBackgroundRefresh) { + m_credentialsCache->Filter(filterUnusedKeys); + m_credentialsCache->Transform(refreshIdentityWhenCloseToExpiry); + threadSafeKeyEmpty(); + m_shutdownCondition.wait_for(lock, refreshPeriod, [this] { return m_shouldStopBackgroundRefresh; }); + } +} + +/* Smithy version */ +SmithyS3ExpressIdentityProvider::SmithyS3ExpressIdentityProvider(const S3Client& s3Client) : m_s3Client(s3Client){} + + +SmithyS3ExpressIdentityProvider::ResolveIdentityFutureOutcome SmithyS3ExpressIdentityProvider::getIdentity( + const IdentityProperties& identityProperties, const AdditionalParameters& additionalParameters){ + const auto params = Aws::MakeShared(S3_EXPRESS_IDENTITY_PROVIDER); + for (const auto& paramMap: {identityProperties, additionalParameters}) + { + TransformAndInsert, String>(paramMap, + params->parameterMap, + [](const Aws::Crt::Variant& value) -> Aws::String + { + if (value.holds_alternative()) + { + return value.get() ? "true" : "false"; + } + if (value.holds_alternative()) + { + return value.get(); + } + return {}; + }); + } + + auto identity = Aws::MakeUnique("DefaultAwsCredentialIdentityResolver", GetS3ExpressAwsIdentity(params)); + + return ResolveIdentityFutureOutcome(std::move(identity)); +} + + +std::shared_ptr SmithyS3ExpressIdentityProvider::GetMutexForBucketName(const Aws::String& bucketName) { + std::lock_guard lock(m_bucketNameMapMutex); + auto it = m_bucketNameMutex.find(bucketName); + if (it != m_bucketNameMutex.end()) { + return it->second; + } + auto bucketMutex = Aws::MakeShared(S3_EXPRESS_IDENTITY_PROVIDER); + m_bucketNameMutex.emplace(bucketName, bucketMutex); + return bucketMutex; +} + +AwsCredentialIdentity SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(const Aws::String& bucketName) const { + auto outcome = m_s3Client.CreateSession(Model::CreateSessionRequest().WithBucket(bucketName)); + // If we fail the connect call return empty credentials and log an error message. + if (!outcome.IsSuccess()) { + AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "Failed to make S3Express Connect Call") + return {"", "", {""}, {}}; + } + auto result = outcome.GetResult(); + const auto &credentials = result.GetCredentials(); + // if expiry is present, use it, otherwise default to 5 minutes expiry + auto expiry = [&]() -> Aws::Utils::DateTime { + if (credentials.ExpirationHasBeenSet()) { + return credentials.GetExpiration(); + } + return Aws::Utils::DateTime::Now() + minutes(5); + }(); + return {credentials.GetAccessKeyId(), + credentials.GetSecretAccessKey(), + credentials.GetSessionToken(), + expiry}; +} + + +SmithyDefaultS3ExpressIdentityProvider::SmithyDefaultS3ExpressIdentityProvider(const S3Client& s3Client) + : SmithyS3ExpressIdentityProvider{s3Client}, m_credentialsCache{Aws::MakeShared>(S3_EXPRESS_IDENTITY_PROVIDER, + DEFAULT_CACHE_SIZE)}{} + +SmithyDefaultS3ExpressIdentityProvider::SmithyDefaultS3ExpressIdentityProvider( + const S3Client& s3Client, + std::shared_ptr> credentialsCache) + : SmithyS3ExpressIdentityProvider{s3Client}, m_credentialsCache{credentialsCache} {} + +AwsCredentialIdentity SmithyDefaultS3ExpressIdentityProvider::GetS3ExpressAwsIdentity(const std::shared_ptr &serviceSpecificParameters) { + auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName"); + if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) { + AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call") + return {"", "", {""}, {}}; + } + std::lock_guard lock(*GetMutexForBucketName(bucketNameIter->second)); + AwsCredentialIdentity identity; + auto isInCache = m_credentialsCache->Get(bucketNameIter->second, identity); + if (!isInCache || (identity.expiration().has_value() && (identity.expiration().value() - minutes(1) < Aws::Utils::DateTime::Now())) ) { + identity = SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(bucketNameIter->second); + if (identity.expiration().has_value()) { + m_credentialsCache->Put(bucketNameIter->second, + identity, + std::chrono::milliseconds(identity.expiration().value().Millis() - Aws::Utils::DateTime::Now().Millis())); + } + } + return identity; +} + +SmithyDefaultAsyncS3ExpressIdentityProvider::SmithyDefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, std::chrono::minutes refreshPeriod) + : SmithyDefaultAsyncS3ExpressIdentityProvider(s3Client, + Aws::MakeShared>( + S3_EXPRESS_IDENTITY_PROVIDER, DEFAULT_CACHE_SIZE), + refreshPeriod) {} + +SmithyDefaultAsyncS3ExpressIdentityProvider::SmithyDefaultAsyncS3ExpressIdentityProvider( + const S3Client& s3Client, std::shared_ptr> credentialsCache, + std::chrono::minutes refreshPeriod) + : SmithyS3ExpressIdentityProvider(s3Client), m_credentialsCache(std::move(credentialsCache)) { + // Start a thread to background refresh the keys currently in the cache. + m_shouldStopBackgroundRefresh = false; + m_backgroundRefreshThread = Aws::MakeUnique( + S3_EXPRESS_IDENTITY_PROVIDER, std::thread(&SmithyDefaultAsyncS3ExpressIdentityProvider::refreshIdentities, this, refreshPeriod)); +} + +SmithyDefaultAsyncS3ExpressIdentityProvider::~SmithyDefaultAsyncS3ExpressIdentityProvider(){ + { + std::unique_lock lock(m_shutDownMutex); + m_shouldStopBackgroundRefresh = true; + m_shutdownCondition.notify_all(); + } + m_backgroundRefreshThread->join(); +} + +AwsCredentialIdentity SmithyDefaultAsyncS3ExpressIdentityProvider::GetS3ExpressAwsIdentity(const std::shared_ptr &serviceSpecificParameters){ + auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName"); + if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) { + AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call") + return {"", "", {""}, {}}; + } + threadSafeKeyInsert(bucketNameIter->second); + std::lock_guard lock(*GetMutexForBucketName(bucketNameIter->second)); + AwsCredentialIdentity identity; + auto isInCache = m_credentialsCache->Get(bucketNameIter->second, identity); + if (!isInCache || (identity.expiration().has_value() && (identity.expiration().value() - minutes(1) < Aws::Utils::DateTime::Now())) ) { + identity = SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(bucketNameIter->second); + if (identity.expiration().has_value()) { + m_credentialsCache->Put(bucketNameIter->second, + identity, + std::chrono::milliseconds(identity.expiration().value().Millis() - Aws::Utils::DateTime::Now().Millis())); + } + } + return identity; +} + +void SmithyDefaultAsyncS3ExpressIdentityProvider::threadSafeKeyEmpty() { + std::lock_guard lock(m_keysUsedMutex); + m_keysUsed.clear(); +} + +bool SmithyDefaultAsyncS3ExpressIdentityProvider::threadSafeKeyHas(const Aws::String& key) { + std::lock_guard lock(m_keysUsedMutex); + return m_keysUsed.find(key) != m_keysUsed.end(); +} + +void SmithyDefaultAsyncS3ExpressIdentityProvider::threadSafeKeyInsert(const Aws::String& key) { + std::lock_guard lock(m_keysUsedMutex); + m_keysUsed.insert(key); +} + +void SmithyDefaultAsyncS3ExpressIdentityProvider::refreshIdentities(std::chrono::minutes refreshPeriod) { + auto filterUnusedKeys = [&](const Aws::String &bucketName, const SmithyCacheValueType &valueType) -> bool { + std::lock_guard lock(*GetMutexForBucketName(bucketName)); + AWS_UNREFERENCED_PARAM(valueType); + return !threadSafeKeyHas(bucketName); + }; + auto refreshIdentityWhenCloseToExpiry = [&](const Aws::String &bucketName, + const SmithyCacheValueType &valueType) -> SmithyCacheValueType { + std::lock_guard lock(*GetMutexForBucketName(bucketName)); + if ((!valueType.val.expiration().has_value()) || + (duration_cast(refreshPeriod).count() < valueType.val.expiration().value().Millis() && + valueType.val.expiration().value() - refreshPeriod < Aws::Utils::DateTime::Now())) { + auto updatedIdentity = this->SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(bucketName); + return {updatedIdentity.expiration().value(), updatedIdentity}; + } + return valueType; + }; + std::unique_lock lock(m_shutDownMutex); + while (!m_shouldStopBackgroundRefresh) { + m_credentialsCache->Filter(filterUnusedKeys); + m_credentialsCache->Transform(refreshIdentityWhenCloseToExpiry); + threadSafeKeyEmpty(); + m_shutdownCondition.wait_for(lock, refreshPeriod, [this] { return m_shouldStopBackgroundRefresh; }); + } +} \ No newline at end of file diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSigV4AuthSchemeHeader.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSigV4AuthSchemeHeader.vm new file mode 100644 index 00000000000..af8f22632bb --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSigV4AuthSchemeHeader.vm @@ -0,0 +1,54 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +#set($metadata = $serviceModel.metadata) +#set($rootNamespace = $serviceModel.namespace) +#set($serviceNamespace = $metadata.namespace) +#pragma once + +\#include +\#include +\#include +\#include +\#include + +namespace ${rootNamespace} { +namespace ${serviceNamespace} { + constexpr char SIGV4_EXPRESS[] = "sigv4-s3express"; + + class ${CppViewHelper.computeExportValue($serviceNamespace)} S3ExpressSigV4AuthScheme : public smithy::AuthScheme< smithy::AwsCredentialIdentityBase> + { + public: + using AwsCredentialIdentityResolverT = smithy::IdentityResolverBase; + using AwsCredentialSignerT = smithy::AwsSignerBase; + using S3ExpressSigV4AuthSchemeParameters = smithy::DefaultAuthSchemeResolverParameters; + + explicit S3ExpressSigV4AuthScheme(std::shared_ptr identityResolver, + const Aws::String& serviceName, + const Aws::String& region, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy, + bool urlEscapePath) + : AuthScheme(SIGV4_EXPRESS), + m_identityResolver{identityResolver}, + m_signer{Aws::MakeShared>("S3ExpressSigV4AuthScheme", serviceName, region, policy, urlEscapePath)} + { + assert(m_identityResolver); + assert(m_signer); + } + + virtual ~S3ExpressSigV4AuthScheme() = default; + + std::shared_ptr identityResolver() override + { + return m_identityResolver; + } + + std::shared_ptr signer() override + { + return m_signer; + } + protected: + std::shared_ptr m_identityResolver; + std::shared_ptr m_signer; + }; +} +} diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSigV4AuthSchemeOptionHeader.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSigV4AuthSchemeOptionHeader.vm new file mode 100644 index 00000000000..d434956a772 --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSigV4AuthSchemeOptionHeader.vm @@ -0,0 +1,23 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +#set($metadata = $serviceModel.metadata) +#set($rootNamespace = $serviceModel.namespace) +#set($serviceNamespace = $metadata.namespace) +#pragma once + +\#include +\#include + +namespace ${rootNamespace} { +namespace ${serviceNamespace} { + + struct ${CppViewHelper.computeExportValue($serviceNamespace)} S3ExpressSigV4AuthSchemeOption + { + static smithy::AuthSchemeOption s3ExpressSigV4AuthSchemeOption; + static smithy::AuthSchemeOption GetS3ExpressSigV4AuthSchemeOption() { + return s3ExpressSigV4AuthSchemeOption; + } + + }; +} +} diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSigV4AuthSchemeOptionSource.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSigV4AuthSchemeOptionSource.vm new file mode 100644 index 00000000000..75101d04cc3 --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSigV4AuthSchemeOptionSource.vm @@ -0,0 +1,10 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +\#include +namespace ${rootNamespace} { +namespace ${serviceNamespace} { + +${CppViewHelper.computeExportValue($serviceNamespace)} smithy::AuthSchemeOption S3ExpressSigV4AuthSchemeOption::s3ExpressSigV4AuthSchemeOption = smithy::AuthSchemeOption("sigv4-s3express"); + +} +} diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSignerHeader.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSignerHeader.vm new file mode 100644 index 00000000000..11dc855cb57 --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSignerHeader.vm @@ -0,0 +1,143 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +#set($metadata = $serviceModel.metadata) +#set($rootNamespace = $serviceModel.namespace) +#set($serviceNamespace = $metadata.namespace) +#pragma once + +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include + +namespace ${rootNamespace} { +namespace ${serviceNamespace} { + extern ${CppViewHelper.computeExportValue($serviceNamespace)} const char *S3_EXPRESS_SIGNER_NAME; + +namespace { + template + struct IsValidS3ExpressSigner : std::false_type {}; + + template <> + struct IsValidS3ExpressSigner : std::true_type {}; + + template <> + struct IsValidS3ExpressSigner : std::true_type {}; +} + + //Ensuring S3 Express Signer can use Sigv4 or Sigv4a signing algorithm + template + class S3ExpressSignerBase : public std::enable_if::value, BASECLASS>::type + { + public: + using SigningFutureOutcome = typename BASECLASS::SigningFutureOutcome; + using SigningProperties = typename BASECLASS::SigningProperties; + using SigningError = typename BASECLASS::SigningError; + explicit S3ExpressSignerBase(const Aws::String& serviceName, const Aws::String& region) + : BASECLASS(serviceName, region) + { + } + + explicit S3ExpressSignerBase(const Aws::String& serviceName, const Aws::String& region, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy policy, bool escapeUrl) + : BASECLASS(serviceName, region, policy, escapeUrl) + { + } + + template + explicit S3ExpressSignerBase(Args&&... args) + : BASECLASS(std::forward(args)...) + { + } + + + SigningFutureOutcome sign(std::shared_ptr httpRequest, const smithy::AwsCredentialIdentityBase& identity, SigningProperties properties) override; + + SigningFutureOutcome presign(std::shared_ptr httpRequest, const smithy::AwsCredentialIdentityBase& identity, SigningProperties properties, const Aws::String& region, const Aws::String& serviceName, long long expirationTimeInSeconds) override; + + protected: + + + inline bool hasRequestId(const Aws::String &requestId) const { + std::lock_guard lock(m_requestProcessing); + return m_requestsProcessing.find(requestId) != m_requestsProcessing.end(); + } + + inline void putRequestId(const Aws::String &requestId) const { + std::lock_guard lock(m_requestProcessing); + m_requestsProcessing.insert(requestId); + } + + inline void deleteRequestId(const Aws::String &requestId) const { + std::lock_guard lock(m_requestProcessing); + m_requestsProcessing.erase(requestId); + } + + mutable std::set m_requestsProcessing; + mutable std::mutex m_requestProcessing; + }; + + + class AWS_S3_API S3ExpressSigner : public Aws::Client::AWSAuthV4Signer { + public: + S3ExpressSigner(std::shared_ptr S3ExpressIdentityProvider, + const std::shared_ptr &credentialsProvider, + const Aws::String &serviceName, + const Aws::String ®ion, + PayloadSigningPolicy signingPolicy = PayloadSigningPolicy::RequestDependent, + bool urlEscapePath = true, + Aws::Auth::AWSSigningAlgorithm signingAlgorithm = Aws::Auth::AWSSigningAlgorithm::SIGV4); + + virtual ~S3ExpressSigner() {}; + + const char *GetName() const override; + + bool SignRequest(Aws::Http::HttpRequest &request, + const char *region, + const char *serviceName, + bool signBody + ) const override; + + bool PresignRequest(Aws::Http::HttpRequest& request, + const char* region, + const char* serviceName, + long long expirationInSeconds + ) const override; + + Aws::Auth::AWSCredentials GetCredentials(const std::shared_ptr &serviceSpecificParameters) const override; + + protected: + bool ServiceRequireUnsignedPayload(const String &serviceName) const override; + + private: + inline bool hasRequestId(const Aws::String &requestId) const { + std::lock_guard lock(m_requestProcessing); + return m_requestsProcessing.find(requestId) != m_requestsProcessing.end(); + } + + inline void putRequestId(const Aws::String &requestId) const { + std::lock_guard lock(m_requestProcessing); + m_requestsProcessing.insert(requestId); + } + + inline void deleteRequestId(const Aws::String &requestId) const { + std::lock_guard lock(m_requestProcessing); + m_requestsProcessing.erase(requestId); + } + + std::shared_ptr m_S3ExpressIdentityProvider; + std::shared_ptr m_credentialsProvider; + mutable std::set m_requestsProcessing; + mutable std::mutex m_requestProcessing; + const Aws::String m_serviceName; + const Aws::String m_region; + const Aws::String m_endpoint; + }; + +} +} diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSignerProviderSource.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSignerProviderSource.vm new file mode 100644 index 00000000000..47ec52cd1f6 --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSignerProviderSource.vm @@ -0,0 +1,32 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +#set($metadata = $serviceModel.metadata) +#set($rootNamespace = $serviceModel.namespace) +#set($serviceNamespace = $metadata.namespace) + +\#include +\#include + +static const char *CLASS_TAG = "S3ExpressSignerProvider"; + +${rootNamespace}::Auth::S3ExpressSignerProvider::S3ExpressSignerProvider( + const std::shared_ptr &credentialsProvider, + const std::shared_ptr<${serviceNamespace}::S3ExpressIdentityProvider> &S3ExpressIdentityProvider, + const ${rootNamespace}::String &serviceName, + const ${rootNamespace}::String ®ion, + ${rootNamespace}::Client::AWSAuthV4Signer::PayloadSigningPolicy signingPolicy, + bool urlEscapePath) : + DefaultAuthSignerProvider(credentialsProvider, + serviceName, + region, + signingPolicy, + urlEscapePath) { + m_signers.emplace_back(std::static_pointer_cast(Aws::MakeShared(CLASS_TAG, + S3ExpressIdentityProvider, + credentialsProvider, + serviceName.c_str(), + region, + signingPolicy, + urlEscapePath, + AWSSigningAlgorithm::SIGV4))); +} \ No newline at end of file diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSignerSource.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSignerSource.vm new file mode 100644 index 00000000000..f74565c086c --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSignerSource.vm @@ -0,0 +1,145 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +#set($metadata = $serviceModel.metadata) +#set($rootNamespace = $serviceModel.namespace) +#set($serviceNamespace = $metadata.namespace) +\#include +\#include +\#include +\#include +\#include + +\#include + +using namespace ${rootNamespace}::${serviceNamespace}; +using namespace ${rootNamespace}::Client; +using namespace ${rootNamespace}::Config; +using namespace ${rootNamespace}::Environment; +using namespace ${rootNamespace}::Utils; + +${CppViewHelper.computeExportValue($serviceNamespace)} const char *${rootNamespace}::${serviceNamespace}::S3_EXPRESS_SIGNER_NAME = "S3ExpressSigner"; +static const char *S3_EXPRESS_HEADER = "x-amz-s3session-token"; +static const char *S3_EXPRESS_QUERY_PARAM = "X-Amz-S3session-Token"; +static const char *S3_EXPRESS_SERVICE_NAME = "s3express"; + +S3ExpressSigner::S3ExpressSigner( + std::shared_ptr S3ExpressIdentityProvider, + const std::shared_ptr &credentialsProvider, + const Aws::String &serviceName, + const Aws::String ®ion, + AWSAuthV4Signer::PayloadSigningPolicy signingPolicy, + bool urlEscapePath, + Aws::Auth::AWSSigningAlgorithm signingAlgorithm) : + AWSAuthV4Signer(credentialsProvider, + serviceName.c_str(), + region, + signingPolicy, + urlEscapePath, + signingAlgorithm), + m_S3ExpressIdentityProvider(std::move(S3ExpressIdentityProvider)) { +} + +const char *S3ExpressSigner::GetName() const { + return S3_EXPRESS_SIGNER_NAME; +} + +bool S3ExpressSigner::SignRequest(Aws::Http::HttpRequest &request, + const char *region, + const char *serviceName, + bool signBody +) const { + const auto requestId = Aws::GetWithDefault(request.GetServiceSpecificParameters()->parameterMap, + Aws::String("dedupeId"), + Aws::String(UUID::RandomUUID())); + if(hasRequestId(requestId)) { + // We were already processing this request and are attempting to sign + // it again in infinite recursion + AWS_LOG_ERROR(S3_EXPRESS_SIGNER_NAME, "Refusing to sign request more than once") + return false; + } + putRequestId(requestId); + auto identity = m_S3ExpressIdentityProvider->GetS3ExpressIdentity(request.GetServiceSpecificParameters()); + request.SetHeaderValue(S3_EXPRESS_HEADER, identity.getSessionToken()); + auto isSigned = AWSAuthV4Signer::SignRequest(request, region, serviceName, signBody); + deleteRequestId(requestId); + return isSigned; +} + +bool S3ExpressSigner::PresignRequest(Aws::Http::HttpRequest &request, + const char *region, + const char *serviceName, + long long int expirationInSeconds +) const { + const auto requestId = Aws::GetWithDefault(request.GetServiceSpecificParameters()->parameterMap, + Aws::String("dedupeId"), + Aws::String(UUID::RandomUUID())); + if(hasRequestId(requestId)) { + // We were already processing this request and are attempting to sign + // it again in infinite recursion + AWS_LOG_ERROR(S3_EXPRESS_SIGNER_NAME, "Refusing to sign request more than once") + return false; + } + putRequestId(requestId); + auto identity = m_S3ExpressIdentityProvider->GetS3ExpressIdentity(request.GetServiceSpecificParameters()); + request.AddQueryStringParameter(S3_EXPRESS_QUERY_PARAM, identity.getSessionToken()); + auto isSigned = AWSAuthV4Signer::PresignRequest(request, region, serviceName, expirationInSeconds); + deleteRequestId(requestId); + return isSigned; +} + +bool S3ExpressSigner::ServiceRequireUnsignedPayload(const Aws::String &serviceName) const { + return S3_EXPRESS_SERVICE_NAME == serviceName || AWSAuthV4Signer::ServiceRequireUnsignedPayload(serviceName); +} + +Aws::Auth::AWSCredentials S3ExpressSigner::GetCredentials(const std::shared_ptr &serviceSpecificParameters) const { + auto identity = m_S3ExpressIdentityProvider->GetS3ExpressIdentity(serviceSpecificParameters); + return {identity.getAccessKeyId(), identity.getSecretKeyId()}; +} + +template +typename S3ExpressSignerBase::SigningFutureOutcome S3ExpressSignerBase::sign(std::shared_ptr httpRequest, const smithy::AwsCredentialIdentityBase& identity, S3ExpressSignerBase::SigningProperties properties) +{ + const auto requestId = Aws::GetWithDefault(httpRequest->GetServiceSpecificParameters()->parameterMap, + Aws::String("dedupeId"), + Aws::String(Aws::Utils::UUID::RandomUUID())); + if(hasRequestId(requestId)) { + return SigningError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, "", "Refusing to sign request more than once", + false /*retryable*/); + } + + if(!identity.sessionToken().has_value()) { + return SigningError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, "", "No session token present", + false /*retryable*/); + } + putRequestId(requestId); + httpRequest->SetHeaderValue(S3_EXPRESS_HEADER, identity.sessionToken().value()); + auto idCopy = smithy::AwsCredentialIdentity{identity.accessKeyId(), identity.secretAccessKey(), {}, identity.expiration()}; + auto isSigned = BASECLASS::sign(httpRequest, idCopy, properties); + deleteRequestId(requestId); + return SigningFutureOutcome(std::move(httpRequest)); +} + +template +typename S3ExpressSignerBase::SigningFutureOutcome S3ExpressSignerBase::presign(std::shared_ptr httpRequest, const smithy::AwsCredentialIdentityBase& identity, S3ExpressSignerBase::SigningProperties properties, const Aws::String& region, const Aws::String& serviceName, long long expirationTimeInSeconds) +{ + const auto requestId = Aws::GetWithDefault(httpRequest->GetServiceSpecificParameters()->parameterMap, + Aws::String("dedupeId"), + Aws::String(Aws::Utils::UUID::RandomUUID())); + if(hasRequestId(requestId)) { + return SigningError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, "", "Refusing to sign request more than once", + false /*retryable*/); + } + if(!identity.sessionToken().has_value()) { + return SigningError(Aws::Client::CoreErrors::CLIENT_SIGNING_FAILURE, "", "No session token present", + false /*retryable*/); + } + putRequestId(requestId); + httpRequest->AddQueryStringParameter(S3_EXPRESS_QUERY_PARAM, identity.sessionToken().value()); + auto isSigned = BASECLASS::presign(httpRequest, identity, properties, region, serviceName, expirationTimeInSeconds); + deleteRequestId(requestId); + return SigningFutureOutcome(std::move(httpRequest)); + +} + + +template class Aws::S3::S3ExpressSignerBase; \ No newline at end of file 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 91d3d8684b3..fe49e0e0392 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 @@ -1,4 +1,5 @@ #set($clientConfiguration = ${serviceNamespace} + "::" + ${metadata.classNamePrefix} + "ClientConfiguration") +#set($s3_express_auth = "sigv4-s3express") #if($serviceModel.hasOnlyBearerAuth()) ##BEARER TOKEN AUTH PROVIDER C-TOR ${className}::${className}(const Aws::Auth::BearerTokenAuthSignerProvider& bearerTokenProvider, @@ -47,10 +48,29 @@ ${className}::${className}(const ${clientConfiguration}& clientConfiguration, Aws::Http::CreateHttpClient(clientConfiguration), Aws::MakeShared<${metadata.classNamePrefix}ErrorMarshaller>(ALLOCATION_TAG), endpointProvider ? endpointProvider : Aws::MakeShared<${metadata.classNamePrefix}EndpointProvider>(ALLOCATION_TAG), +#if($serviceModel.metadata.serviceId == "S3") + Aws::MakeShared<${AuthSchemeResolver}>(ALLOCATION_TAG), +#else Aws::MakeShared>(ALLOCATION_TAG), +#end { +#if($serviceModel.metadata.serviceId == "S3") + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG); + return { +#foreach($entry in $AuthSchemeMapEntries) +#if($AuthSchemes && $AuthSchemes[$foreach.index] == $s3_express_auth) + {${entry}{clientConfiguration.smithyIdentityProviderSupplier(*this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, +#else + {${entry}{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, +#end +#end + }; + }() +#else #foreach($entry in $AuthSchemeMapEntries) {${entry}{GetServiceName(), clientConfiguration.region}}, +#end #end }) {} @@ -64,10 +84,29 @@ ${className}::${className}(const AWSCredentials& credentials, Aws::Http::CreateHttpClient(clientConfiguration), Aws::MakeShared<${metadata.classNamePrefix}ErrorMarshaller>(ALLOCATION_TAG), endpointProvider ? endpointProvider : Aws::MakeShared<${metadata.classNamePrefix}EndpointProvider>(ALLOCATION_TAG), +#if($serviceModel.metadata.serviceId == "S3") + Aws::MakeShared<${AuthSchemeResolver}>(ALLOCATION_TAG), +#else Aws::MakeShared>(ALLOCATION_TAG), +#end { +#if($serviceModel.metadata.serviceId == "S3") + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG, credentials ); + return { +#foreach($entry in $AuthSchemeMapEntries) +#if($AuthSchemes && $AuthSchemes[$foreach.index] == $s3_express_auth) + {${entry}{clientConfiguration.smithyIdentityProviderSupplier(*this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, +#else + {${entry}{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, +#end +#end + }; + }() +#else #foreach($entry in $AuthSchemeMapEntries) {${entry}{Aws::MakeShared(ALLOCATION_TAG, credentials), GetServiceName(), clientConfiguration.region}}, +#end #end }) {} @@ -81,15 +120,173 @@ ${className}::${className}(const std::shared_ptr& creden Aws::Http::CreateHttpClient(clientConfiguration), Aws::MakeShared<${metadata.classNamePrefix}ErrorMarshaller>(ALLOCATION_TAG), endpointProvider ? endpointProvider : Aws::MakeShared<${metadata.classNamePrefix}EndpointProvider>(ALLOCATION_TAG), +#if($serviceModel.metadata.serviceId == "S3") + Aws::MakeShared<${AuthSchemeResolver}>(ALLOCATION_TAG), +#else Aws::MakeShared>(ALLOCATION_TAG), +#end { +#if($serviceModel.metadata.serviceId == "S3") + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG, credentialsProvider ); + return { +#foreach($entry in $AuthSchemeMapEntries) +#if($AuthSchemes && $AuthSchemes[$foreach.index] == $s3_express_auth) + {${entry}{clientConfiguration.smithyIdentityProviderSupplier(*this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, +#else + {${entry}{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), clientConfiguration.payloadSigningPolicy, false}}, +#end +#end + }; + }() +#else #foreach($entry in $AuthSchemeMapEntries) {${entry}{ Aws::MakeShared(ALLOCATION_TAG, credentialsProvider), GetServiceName(), clientConfiguration.region}} +#end #end }) {} /* Legacy constructors due deprecation */ +#if($serviceModel.metadata.serviceId == "S3") +${className}::${className}(const Client::ClientConfiguration& clientConfiguration, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signPayloads /*= Never*/, + bool useVirtualAddressing /*= true*/, + Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption): + AwsSmithyClientT( + ${clientConfiguration}{clientConfiguration, signPayloads, useVirtualAddressing, USEast1RegionalEndPointOption}, + GetServiceName(), + "${metadata.serviceId}", + Aws::Http::CreateHttpClient(clientConfiguration), + Aws::MakeShared<${metadata.classNamePrefix}ErrorMarshaller>(ALLOCATION_TAG), + Aws::MakeShared<${metadata.classNamePrefix}EndpointProvider>(ALLOCATION_TAG), + Aws::MakeShared<${AuthSchemeResolver}>(ALLOCATION_TAG), + { + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG); + return { +#foreach($entry in $AuthSchemeMapEntries) +#if($AuthSchemes && $AuthSchemes[$foreach.index] == $s3_express_auth) + {${entry}{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, +#else + {${entry}{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, +#end +#end + }; + }() + }) +{} + +${className}::${className}( + const Aws::Auth::AWSCredentials& credentials, + const Client::ClientConfiguration& clientConfiguration, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signPayloads /*= Never*/, + bool useVirtualAddressing /*= true*/, + Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption): + AwsSmithyClientT( + ${clientConfiguration}{clientConfiguration, signPayloads, useVirtualAddressing, USEast1RegionalEndPointOption}, + GetServiceName(), + "${metadata.serviceId}", + Aws::Http::CreateHttpClient(clientConfiguration), + Aws::MakeShared<${metadata.classNamePrefix}ErrorMarshaller>(ALLOCATION_TAG), + Aws::MakeShared<${metadata.classNamePrefix}EndpointProvider>(ALLOCATION_TAG), + Aws::MakeShared<${AuthSchemeResolver}>(ALLOCATION_TAG), + { + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG, credentials ); + return { +#foreach($entry in $AuthSchemeMapEntries) +#if($AuthSchemes && $AuthSchemes[$foreach.index] == $s3_express_auth) + {${entry}{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, +#else + {${entry}{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, +#end +#end + }; + }() + }) +{} + +${className}::${className}( + const std::shared_ptr& credentialsProvider, + const Client::ClientConfiguration& clientConfiguration, + Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signPayloads /*= Never*/, + bool useVirtualAddressing /*= true*/, + Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION USEast1RegionalEndPointOption): + AwsSmithyClientT( + ${clientConfiguration}{clientConfiguration, signPayloads, useVirtualAddressing, USEast1RegionalEndPointOption}, + GetServiceName(), + "${metadata.serviceId}", + Aws::Http::CreateHttpClient(clientConfiguration), + Aws::MakeShared<${metadata.classNamePrefix}ErrorMarshaller>(ALLOCATION_TAG), + Aws::MakeShared<${metadata.classNamePrefix}EndpointProvider>(ALLOCATION_TAG), + Aws::MakeShared<${AuthSchemeResolver}>(ALLOCATION_TAG), + { + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG, credentialsProvider ); + return { +#foreach($entry in $AuthSchemeMapEntries) +#if($AuthSchemes && $AuthSchemes[$foreach.index] == $s3_express_auth) + {${entry}{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, +#else + {${entry}{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(clientConfiguration.region), signPayloads, false}}, +#end +#end + }; + }() + }) +{} + +${className}& ${className}::operator=(const ${className} &rhs) { + if (&rhs == this) { + return *this; + } + AwsSmithyClientT::operator=(rhs); + m_authSchemes = + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG); + return { +#foreach($entry in $AuthSchemeMapEntries) +#if($AuthSchemes && $AuthSchemes[$foreach.index] == $s3_express_auth) + {${entry}{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}}, +#else + {${entry}{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}}, +#end +#end + }; + }(); + return *this; +} + + +${className}& ${className}::operator=(${className} &&rhs) noexcept { + if (&rhs == this) { + return *this; + } + AwsSmithyClientT::operator=(std::move(rhs)); + return *this; +} +/* copy/move constructors */ +${className}::${className}(const ${className} &rhs) : + AwsSmithyClientT(rhs),Aws::Client::ClientWithAsyncTemplateMethods() { + m_authSchemes = + [&]() -> Aws::UnorderedMap > { + auto credsResolver = Aws::MakeShared(ALLOCATION_TAG); + return { +#foreach($entry in $AuthSchemeMapEntries) +#if($AuthSchemes && $AuthSchemes[$foreach.index] == $s3_express_auth) + {${entry}{Aws::MakeShared(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}}, +#else + {${entry}{credsResolver, GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false}}, +#end +#end + }; + }(); + } + +S3Client::S3Client(${className} &&rhs) noexcept : + AwsSmithyClientT(std::move(rhs)) {} +#else ${className}::${className}(const Client::ClientConfiguration& clientConfiguration) : AwsSmithyClientT(clientConfiguration, GetServiceName(), @@ -137,6 +334,7 @@ ${className}::${className}(const std::shared_ptr& creden }) {} #end +#end /* End of legacy constructors due deprecation */ ${className}::~${className}() diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyRestXmlServiceClientOperations.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyRestXmlServiceClientOperations.vm new file mode 100644 index 00000000000..4909dd06351 --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyRestXmlServiceClientOperations.vm @@ -0,0 +1,105 @@ +#foreach($operation in $serviceModel.operations) +#set($hasEndPointOverrides = false) +#if($serviceNamespace != "S3Crt" || !$operation.s3CrtEnabled) +#if($arnEndpointSupported) +#if($multiRegionAccessPointSupported) + #set($signerName = ", computeEndpointOutcome.GetResult().signerName.c_str() /*signerName*/") +#else + #set($signerName = ", Aws::Auth::SIGV4_SIGNER") +#end +#set($signerRegionOverride = ", computeEndpointOutcome.GetResult().signerRegion.c_str() /*signerRegionOverride*/") +#set($signerServiceNameOverride = ", computeEndpointOutcome.GetResult().signerServiceName.c_str() /*signerServiceNameOverride*/") +#else +#set($signerName = "") +#set($signerRegionOverride = "") +#set($signerServiceNameOverride = "") +#end +#if($serviceModel.endpointRules) +#set($signerName = "") +#set($signerRegionOverride = "") +#set($signerServiceNameOverride = "") +#end +#if($operation.result.shape.hasEventStreamMembers()) +#set($constText = "") +#set($refText = "&") +#else +#set($constText = "const ") +#set($refText = "") +#end +#if($operation.request) +${operation.name}Outcome ${className}::${operation.name}(${constText}${operation.request.shape.name}& request) const +{ + AWS_OPERATION_GUARD(${operation.name}); +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/common/ServiceClientOperationRequestRequiredMemberValidate.vm") + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ${operation.name}, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(meter, ${operation.name}, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + "." + request.GetServiceRequestName(), + {{ TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName() }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); + return TracingUtils::MakeCallWithTiming<${operation.name}Outcome>( + [&]()-> ${operation.name}Outcome { +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/common/ServiceClientOperationEndpointPrepareCommonBody.vm") +#if($operation.hasPreSignedUrl) + #set($requestText = "newRequest") +#else + #set($requestText = "request") +#end +#if($operation.result && $operation.result.shape.hasEventStreamMembers()) + request.SetResponseStreamFactory( + [&] { request.GetEventStreamDecoder().Reset(); return Aws::New(ALLOCATION_TAG, request.GetEventStreamDecoder()); } + ); + return ${operation.name}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") + })); +#elseif($operation.result && $operation.result.shape.hasStreamMembers()) + return ${operation.name}Outcome(MakeRequestWithUnparsedResponse(&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") + })); +#else + return ${operation.name}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") + })); +#end + }, + TracingUtils::SMITHY_CLIENT_DURATION_METRIC, + *meter, + {{TracingUtils::SMITHY_METHOD_DIMENSION, request.GetServiceRequestName()}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); +} + +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/common/operation/withrequest/OperationOutcomeCallable.vm") +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/common/operation/withrequest/OperationAsync.vm") +#else +${operation.name}Outcome ${className}::${operation.name}() const +{ + AWS_OPERATION_GUARD(${operation.name}); + AWS_OPERATION_CHECK_PTR(m_endpointProvider, ${operation.name}, CoreErrors, CoreErrors::ENDPOINT_RESOLUTION_FAILURE); + AWS_OPERATION_CHECK_PTR(m_clientConfiguration.telemetryProvider, ${operation.name}, CoreErrors, CoreErrors::NOT_INITIALIZED); + auto tracer = m_clientConfiguration.telemetryProvider->getTracer(this->GetServiceClientName(), {}); + auto meter = m_clientConfiguration.telemetryProvider->getMeter(this->GetServiceClientName(), {}); + AWS_OPERATION_CHECK_PTR(meter, ${operation.name}, CoreErrors, CoreErrors::NOT_INITIALIZED); + + auto span = tracer->CreateSpan(Aws::String(this->GetServiceClientName()) + ".${operation.name}", + {{ TracingUtils::SMITHY_METHOD_DIMENSION, "${operation.name}" }, { TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName() }, { TracingUtils::SMITHY_SYSTEM_DIMENSION, TracingUtils::SMITHY_METHOD_AWS_VALUE }}, + smithy::components::tracing::SpanKind::CLIENT); + return TracingUtils::MakeCallWithTiming<${operation.name}Outcome>( + [&]()-> ${operation.name}Outcome { + #parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/common/EndpointRulesNoRequestUriComputation.vm") + #if($operation.result && $operation.result.shape.hasStreamMembers()) + return ${operation.name}Outcome(MakeRequestWithUnparsedResponse(&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") + })); + #else + return ${operation.name}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") + })); + #end + }, + TracingUtils::SMITHY_CLIENT_DURATION_METRIC, + *meter, + {{TracingUtils::SMITHY_METHOD_DIMENSION, "${operation.name}"}, {TracingUtils::SMITHY_SERVICE_DIMENSION, this->GetServiceClientName()}}); +} +#end +#end +#end diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyRestXmlServiceClientSource.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyRestXmlServiceClientSource.vm new file mode 100644 index 00000000000..bfb38f16971 --- /dev/null +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyRestXmlServiceClientSource.vm @@ -0,0 +1,93 @@ +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/common/MacroParseOverrideOrDefault.vm") +#parse("com/amazonaws/util/awsclientgenerator/velocity/cfamily/Attribution.vm") + +#set($metadata = $serviceModel.metadata) +#set($rootNamespace = $serviceModel.namespace) +#set($serviceNamespace = $metadata.namespace) +#set($className = "${metadata.classNamePrefix}Client") +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +\#include +#if($serviceModel.endpointRules) +\#include +#end +\#include +\#include +\#include +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/ServiceClientSourceHeaders.vm") + +using namespace Aws; +using namespace Aws::Auth; +using namespace Aws::Client; +using namespace ${rootNamespace}::${serviceNamespace}; +using namespace ${rootNamespace}::${serviceNamespace}::Model; +using namespace Aws::Http; +using namespace Aws::Utils::Xml; +using namespace smithy::components::tracing; +#if($serviceModel.endpointRules) +using ResolveEndpointOutcome = Aws::Endpoint::ResolveEndpointOutcome; +#end +#if($serviceModel.metadata.namespace == "S3") +using namespace Aws::Utils; +#end + + +#if(!${onlyGeneratedOperations}) +namespace Aws +{ + namespace ${metadata.namespace} + { + const char SERVICE_NAME[] = "${metadata.signingName}"; + const char ALLOCATION_TAG[] = "${className}"; + } +} +const char* ${className}::GetServiceName() {return SERVICE_NAME;} +const char* ${className}::GetAllocationTag() {return ALLOCATION_TAG;} +#end +#set($hostOverrideString = '') +#if($metadata.globalEndpoint) +#set($hostOverrideString = ', "' + $metadata.globalEndpoint + '"') +#end + +#if(!${onlyGeneratedOperations}) +#parseOverrideOrDefault( "ServiceClientSourceInit_template" "com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyClientSourceInit.vm") + +#if($metadata.protocol == "query") +Aws::String ${className}::ConvertRequestToPresignedUrl(const AmazonSerializableWebServiceRequest& requestToConvert, const char* region) const +{ + if (!m_endpointProvider) + { + AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Presigned URL generating failed. Endpoint provider is not initialized."); + return ""; + } + Aws::Endpoint::EndpointParameters endpointParameters; + endpointParameters.emplace_back(Aws::Endpoint::EndpointParameter("Region", Aws::String(region))); + ResolveEndpointOutcome endpointResolutionOutcome = m_endpointProvider->ResolveEndpoint(endpointParameters); + if (!endpointResolutionOutcome.IsSuccess()) + { + AWS_LOGSTREAM_ERROR(ALLOCATION_TAG, "Endpoint resolution failed: " << endpointResolutionOutcome.GetError().GetMessage()); + return ""; + } + Aws::StringStream ss; + ss << "?" << requestToConvert.SerializePayload(); + endpointResolutionOutcome.GetResult().SetQueryString(ss.str()); + + return GeneratePresignedUrl(endpointResolutionOutcome.GetResult().GetURI(), Aws::Http::HttpMethod::HTTP_GET, region, 3600); +} + +#end +#end +#if($serviceNamespace == "S3Crt") +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/s3-crt/S3CrtSpecificOperations.vm") +#end +#parse("com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyRestXmlServiceClientOperations.vm") diff --git a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyUriRequestQueryParams.vm b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyUriRequestQueryParams.vm index a34fe92a0ca..053203a5644 100644 --- a/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyUriRequestQueryParams.vm +++ b/tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/smithy/SmithyUriRequestQueryParams.vm @@ -89,4 +89,13 @@ ${indent} resolvedEndpoint.AddPathSegments("$uriPartString"); #end## --------------------- for (parameter in request uri parameters) end --- #if($queryStart) ${indent} resolvedEndpoint.SetQueryString(ss.str()); +#end +#if(($serviceModel.metadata.namespace == "S3" || ($serviceModel.metadata.namespace == "S3Crt" && !$operation.s3CrtEnabled)) && $operation.shouldUsePropertyBag) +${indent} request.SetServiceSpecificParameters( +${indent} [&]() -> std::shared_ptr { +${indent} Aws::Map params; +${indent} params.emplace("bucketName", request.GetBucket()); +${indent} ServiceSpecificParameters serviceSpecificParameters{params}; +${indent} return Aws::MakeShared(ALLOCATION_TAG, serviceSpecificParameters); +${indent} }()); #end \ No newline at end of file diff --git a/tools/scripts/codegen/legacy_c2j_cpp_gen.py b/tools/scripts/codegen/legacy_c2j_cpp_gen.py index 72871a9a3d6..de16bd0c9de 100644 --- a/tools/scripts/codegen/legacy_c2j_cpp_gen.py +++ b/tools/scripts/codegen/legacy_c2j_cpp_gen.py @@ -19,7 +19,8 @@ from codegen.model_utils import ServiceModel SMITHY_SUPPORTED_CLIENTS = [ - "dynamodb" + "dynamodb", + "s3" ] # Default configuration variables