diff --git a/generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/DynamoDBClientConfiguration.h b/generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/DynamoDBClientConfiguration.h index b84af66b0e5..d8586dde26c 100644 --- a/generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/DynamoDBClientConfiguration.h +++ b/generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/DynamoDBClientConfiguration.h @@ -21,13 +21,17 @@ namespace Aws DynamoDBClientConfiguration(const DynamoDBClientConfiguration& other) : Aws::Client::GenericClientConfiguration(other), - enableEndpointDiscovery(BaseClientConfigClass::enableEndpointDiscovery) + enableEndpointDiscovery(BaseClientConfigClass::enableEndpointDiscovery), + accountId{other.accountId}, + accountIdEndpointMode{other.accountIdEndpointMode} { } DynamoDBClientConfiguration(DynamoDBClientConfiguration&& other) noexcept : Aws::Client::GenericClientConfiguration(std::move(other)), - enableEndpointDiscovery(BaseClientConfigClass::enableEndpointDiscovery) + enableEndpointDiscovery(BaseClientConfigClass::enableEndpointDiscovery), + accountId{std::move(other.accountId)}, + accountIdEndpointMode{std::move(other.accountIdEndpointMode)} { } @@ -36,6 +40,8 @@ namespace Aws if (this == &other) return *this; Aws::Client::GenericClientConfiguration::operator =(other); + accountId = other.accountId; + accountIdEndpointMode = other.accountIdEndpointMode; return *this; } @@ -44,6 +50,8 @@ namespace Aws if (this == &other) return *this; Aws::Client::GenericClientConfiguration::operator =(std::move(other)); + accountId = std::move(other.accountId); + accountIdEndpointMode = std::move(other.accountIdEndpointMode); return *this; } diff --git a/generated/src/aws-cpp-sdk-s3control/include/aws/s3control/S3ControlClientConfiguration.h b/generated/src/aws-cpp-sdk-s3control/include/aws/s3control/S3ControlClientConfiguration.h index df85bba30c3..73bb1e63557 100644 --- a/generated/src/aws-cpp-sdk-s3control/include/aws/s3control/S3ControlClientConfiguration.h +++ b/generated/src/aws-cpp-sdk-s3control/include/aws/s3control/S3ControlClientConfiguration.h @@ -18,6 +18,36 @@ namespace Aws { using BaseClientConfigClass = Aws::Client::GenericClientConfiguration; + S3ControlClientConfiguration(const S3ControlClientConfiguration& other) + : Aws::Client::GenericClientConfiguration(other), + accountId{other.accountId} + { + } + + S3ControlClientConfiguration(S3ControlClientConfiguration&& other) noexcept + : Aws::Client::GenericClientConfiguration(std::move(other)), + accountId{std::move(other.accountId)} + { + } + + S3ControlClientConfiguration& operator=(const S3ControlClientConfiguration& other) + { + if (this == &other) + return *this; + Aws::Client::GenericClientConfiguration::operator =(other); + accountId = other.accountId; + return *this; + } + + S3ControlClientConfiguration& operator=(S3ControlClientConfiguration&& other) noexcept + { + if (this == &other) + return *this; + Aws::Client::GenericClientConfiguration::operator =(std::move(other)); + accountId = std::move(other.accountId); + return *this; + } + S3ControlClientConfiguration(const Client::ClientConfigurationInitValues &configuration = {}); /** diff --git a/tests/aws-cpp-sdk-dynamodb-unit-tests/DynamoDBUnitTests.cpp b/tests/aws-cpp-sdk-dynamodb-unit-tests/DynamoDBUnitTests.cpp index 1ffa3770a68..36e8b38d104 100644 --- a/tests/aws-cpp-sdk-dynamodb-unit-tests/DynamoDBUnitTests.cpp +++ b/tests/aws-cpp-sdk-dynamodb-unit-tests/DynamoDBUnitTests.cpp @@ -331,3 +331,29 @@ TEST_F(DynamoDBUnitTest, ListTablesShouldHaveCorrectUserAgent) EXPECT_TRUE(crtMetadata < archMetadata); EXPECT_TRUE(archMetadata < businessMetrics); } + +TEST_F(DynamoDBUnitTest, ShouldUseAccountIDEndpoint) +{ + // create client with account id configuration + AWSCredentials credentials{"mock", "credentials"}; + const auto epProvider = Aws::MakeShared(LOG_TAG); + DynamoDBClientConfiguration configuration; + configuration.accountId = "123456789012"; + configuration.region = "us-east-1"; + const auto accountIdClient = Aws::MakeShared(LOG_TAG, credentials, epProvider, configuration); + + // mock response + auto successStream = Aws::MakeShared(LOG_TAG, "the_grand_budapest.hotel/zero", HttpMethod::HTTP_GET); + successStream->SetResponseStreamFactory([]() -> IOStream* { + auto listTablesString = R"({"LastEvaluatedTableName": "Hotels","TableNames": ["Hotels"]}))"; + return Aws::New(LOG_TAG, listTablesString, std::ios_base::in | std::ios_base::binary); + }); + auto successResponse = Aws::MakeShared(LOG_TAG, successStream); + successResponse->SetResponseCode(HttpResponseCode::OK); + + mock_http_client_->AddResponseToReturn(successResponse); + const auto listTablesOutcome = accountIdClient->ListTables(); + EXPECT_TRUE(listTablesOutcome.IsSuccess()); + const auto requestSeen = mock_http_client_->GetMostRecentHttpRequest(); + EXPECT_EQ("https://123456789012.ddb.us-east-1.amazonaws.com", requestSeen.GetUri().GetURIString()); +} \ No newline at end of file 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 c353eb698fd..0ae5547c917 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 @@ -50,32 +50,68 @@ namespace ${rootNamespace} #end #end +#set($copyCtorStatements = []) +#set($moveCtorStatements = []) +#set($copyAssignmentStatements = []) +#set($moveAssignemntStatements = []) #if($metadata.hasEndpointDiscoveryTrait) +#set($addArgDummy = $copyCtorStatements.add("enableEndpointDiscovery(BaseClientConfigClass::enableEndpointDiscovery)")) +#set($addArgDummy = $moveCtorStatements.add("enableEndpointDiscovery(BaseClientConfigClass::enableEndpointDiscovery)")) +#end +#if($serviceModel.endpointRuleSetModel.parameters.containsKey("AccountId")) +#set($addArgDummy = $copyCtorStatements.add("accountId{other.accountId}")) +#set($addArgDummy = $moveCtorStatements.add("accountId{std::move(other.accountId)}")) +#set($addArgDummy = $copyAssignmentStatements.add("accountId = other.accountId;")) +#set($addArgDummy = $moveAssignemntStatements.add("accountId = std::move(other.accountId);")) +#end +#if($serviceModel.endpointRuleSetModel.parameters.containsKey("AccountIdEndpointMode")) +#set($addArgDummy = $copyCtorStatements.add("accountIdEndpointMode{other.accountIdEndpointMode}")) +#set($addArgDummy = $moveCtorStatements.add("accountIdEndpointMode{std::move(other.accountIdEndpointMode)}")) +#set($addArgDummy = $copyAssignmentStatements.add("accountIdEndpointMode = other.accountIdEndpointMode;")) +#set($addArgDummy = $moveAssignemntStatements.add("accountIdEndpointMode = std::move(other.accountIdEndpointMode);")) +#end +#if(!$copyCtorStatements.isEmpty()) ${metadata.classNamePrefix}ClientConfiguration(const ${metadata.classNamePrefix}ClientConfiguration& other) : Aws::Client::GenericClientConfiguration(other), - enableEndpointDiscovery(BaseClientConfigClass::enableEndpointDiscovery) + #foreach($statement in $copyCtorStatements)$statement#if($foreach.hasNext), + #end#end + { } +#end +#if(!$moveCtorStatements.isEmpty()) ${metadata.classNamePrefix}ClientConfiguration(${metadata.classNamePrefix}ClientConfiguration&& other) noexcept : Aws::Client::GenericClientConfiguration(std::move(other)), - enableEndpointDiscovery(BaseClientConfigClass::enableEndpointDiscovery) + #foreach($statement in $moveCtorStatements)$statement#if($foreach.hasNext), + #end#end + { } +#end +#if(!$copyAssignmentStatements.isEmpty() || $metadata.hasEndpointDiscoveryTrait) ${metadata.classNamePrefix}ClientConfiguration& operator=(const ${metadata.classNamePrefix}ClientConfiguration& other) { if (this == &other) return *this; Aws::Client::GenericClientConfiguration::operator =(other); +#foreach($statment in ${copyAssignmentStatements}) + ${statment} +#end return *this; } +#end +#if(!$moveAssignemntStatements.isEmpty() || $metadata.hasEndpointDiscoveryTrait) ${metadata.classNamePrefix}ClientConfiguration& operator=(${metadata.classNamePrefix}ClientConfiguration&& other) noexcept { if (this == &other) return *this; Aws::Client::GenericClientConfiguration::operator =(std::move(other)); +#foreach($statment in ${moveAssignemntStatements}) + ${statment} +#end return *this; }