Skip to content

Commit 728b556

Browse files
committed
handle logic merge conflicts
1 parent f455f20 commit 728b556

File tree

6 files changed

+27
-91
lines changed

6 files changed

+27
-91
lines changed

generated/src/aws-cpp-sdk-s3/source/S3ExpressIdentityProvider.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <aws/core/auth/AWSCredentialsProviderChain.h>
1111
#include <utility>
1212
#include <thread>
13+
#include <aws/crt/Optional.h>
1314

1415
using namespace Aws::S3;
1516
using namespace Aws::Utils;
@@ -254,7 +255,7 @@ AwsCredentialIdentity SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(
254255
// If we fail the connect call return empty credentials and log an error message.
255256
if (!outcome.IsSuccess()) {
256257
AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "Failed to make S3Express Connect Call")
257-
return {"", "", {""}, {}};
258+
return {"", "", {""}, {}, Aws::Crt::Optional<Aws::String>()};
258259
}
259260
auto result = outcome.GetResult();
260261
const auto &credentials = result.GetCredentials();
@@ -268,7 +269,8 @@ AwsCredentialIdentity SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(
268269
return {credentials.GetAccessKeyId(),
269270
credentials.GetSecretAccessKey(),
270271
credentials.GetSessionToken(),
271-
expiry};
272+
expiry,
273+
Aws::Crt::Optional<Aws::String>()};
272274
}
273275

274276

@@ -285,7 +287,7 @@ AwsCredentialIdentity SmithyDefaultS3ExpressIdentityProvider::GetS3ExpressAwsIde
285287
auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName");
286288
if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) {
287289
AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call")
288-
return {"", "", {""}, {}};
290+
return {"", "", {""}, {}, Aws::Crt::Optional<Aws::String>()};
289291
}
290292
std::lock_guard<std::mutex> lock(*GetMutexForBucketName(bucketNameIter->second));
291293
AwsCredentialIdentity identity;
@@ -331,7 +333,7 @@ AwsCredentialIdentity SmithyDefaultAsyncS3ExpressIdentityProvider::GetS3ExpressA
331333
auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName");
332334
if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) {
333335
AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call")
334-
return {"", "", {""}, {}};
336+
return {"", "", {""}, {}, Aws::Crt::Optional<Aws::String>()};
335337
}
336338
threadSafeKeyInsert(bucketNameIter->second);
337339
std::lock_guard<std::mutex> lock(*GetMutexForBucketName(bucketNameIter->second));

generated/src/aws-cpp-sdk-s3/source/S3ExpressSigner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ typename S3ExpressSignerBase<BASECLASS>::SigningFutureOutcome S3ExpressSignerBas
113113
}
114114
putRequestId(requestId);
115115
httpRequest->SetHeaderValue(S3_EXPRESS_HEADER, identity.sessionToken().value());
116-
auto idCopy = smithy::AwsCredentialIdentity{identity.accessKeyId(), identity.secretAccessKey(), {}, identity.expiration()};
116+
auto idCopy = smithy::AwsCredentialIdentity{identity.accessKeyId(), identity.secretAccessKey(), {}, identity.expiration(),identity.accountId() };
117117
auto isSigned = BASECLASS::sign(httpRequest, idCopy, properties);
118118
deleteRequestId(requestId);
119119
return SigningFutureOutcome(std::move(httpRequest));

tests/aws-cpp-sdk-s3-integration-tests/S3ExpressTest.cpp

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -541,80 +541,6 @@ namespace {
541541

542542
}
543543

544-
class TestSmithyDefaultS3ExpressIdentityProvider : public SmithyDefaultS3ExpressIdentityProvider
545-
{
546-
public:
547-
TestSmithyDefaultS3ExpressIdentityProvider(const S3Client& s3Client):SmithyDefaultS3ExpressIdentityProvider(s3Client){}
548-
549-
550-
smithy::AwsCredentialIdentity GetS3ExpressAwsIdentity(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &) override
551-
{
552-
return m_creds;
553-
}
554-
555-
smithy::AwsCredentialIdentity m_creds{
556-
Aws::String("demo_access_key"),
557-
Aws::String("demo_secret_key"),
558-
Aws::String("demo_sessions_token"),
559-
DateTime::Now()
560-
};
561-
562-
};
563-
564-
565-
class S3TestClient : public S3Client {
566-
public:
567-
template<typename ...ARGS>
568-
explicit S3TestClient(ARGS... args) : S3Client(std::forward<ARGS>(args)...) {
569-
overrideIdentityProvider();
570-
}
571-
572-
S3TestClient(const S3TestClient&) = default;
573-
S3TestClient(S3TestClient&&) noexcept = default;
574-
S3TestClient& operator=(const S3TestClient&) = default;
575-
S3TestClient& operator=(S3TestClient&&) noexcept = default;
576-
577-
virtual ~S3TestClient() = default;
578-
579-
smithy::AwsCredentialIdentity getCreds() {
580-
581-
for(auto& auth : m_authSchemes) {
582-
if(auth.first == S3::S3ExpressSigV4AuthSchemeOption::GetS3ExpressSigV4AuthSchemeOption().schemeId)
583-
{
584-
smithy::IdentityResolverBase<smithy::AwsCredentialIdentity>::IdentityProperties props;
585-
auto tmp = auth.second.get<S3::S3ExpressSigV4AuthScheme>();
586-
auto outcome = tmp.identityResolver()->getIdentity(props,props);
587-
588-
return smithy::AwsCredentialIdentity(outcome.GetResult()->accessKeyId(), outcome.GetResult()->secretAccessKey(), outcome.GetResult()->sessionToken(),
589-
outcome.GetResult()->expiration());
590-
591-
}
592-
}
593-
return smithy::AwsCredentialIdentity{};
594-
595-
}
596-
private:
597-
FRIEND_TEST(S3ExpressTest, ExpressSignerBackwardCompatibility);
598-
599-
void overrideIdentityProvider()
600-
{
601-
for(auto& auth : m_authSchemes)
602-
{
603-
if(auth.first == S3::S3ExpressSigV4AuthSchemeOption::GetS3ExpressSigV4AuthSchemeOption().schemeId)
604-
{
605-
606-
auth.second = S3::S3ExpressSigV4AuthScheme{Aws::MakeShared<TestSmithyDefaultS3ExpressIdentityProvider>(ALLOCATION_TAG, *this), GetServiceName(), Aws::Region::ComputeSignerRegion(m_clientConfiguration.region), m_clientConfiguration.payloadSigningPolicy, false};
607-
608-
///auth.second.get<S3::S3ExpressSigV4AuthScheme>().identityResolver() = Aws::MakeShared<TestSmithyDefaultS3ExpressIdentityProvider>("TestSmithyDefaultS3ExpressIdentityProvider", *this);
609-
610-
break;
611-
}
612-
}
613-
}
614-
615-
616-
};
617-
618544
TEST_F(S3ExpressTest, TestAuthschemeCopy) {
619545
S3ClientConfiguration configuration;
620546
configuration.region = "us-east-1";

tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <aws/s3/S3Client.h>
77
#include <aws/s3/model/DeleteObjectsRequest.h>
88
#include <aws/s3/model/PutObjectRequest.h>
9+
#include <aws/s3/model/CreateBucketRequest.h>
910
#include <aws/s3/model/CopyObjectRequest.h>
1011
#include <aws/testing/mocks/http/MockHttpClient.h>
1112
#include <aws/testing/AwsTestHelpers.h>
@@ -282,15 +283,20 @@ TEST_F(S3UnitTest, S3EmbeddedErrorTestNonOKResponse) {
282283

283284
_mockHttpClient->AddResponseToReturn(mockResponse);
284285

285-
const auto response = _s3Client->MakeRequestDeserialize(&request,
286-
request.GetServiceRequestName(),
287-
Aws::Http::HttpMethod::HTTP_PUT,
288-
[](Aws::Endpoint::AWSEndpoint&) -> void {}
289-
);
286+
ClientConfiguration config;
287+
config.region = Aws::Region::US_EAST_1;
288+
config.scheme = Scheme::HTTPS;
289+
auto client = S3Client(config);
290290

291-
EXPECT_TRUE(response.GetError().GetExceptionName() == "InvalidAction");
292291

293-
EXPECT_FALSE(response.IsSuccess());
292+
CreateBucketRequest createBucketRequest;
293+
createBucketRequest.SetBucket("test");
294+
295+
auto outcome = client.CreateBucket(createBucketRequest);
296+
297+
ASSERT_FALSE(outcome.IsSuccess());
298+
299+
EXPECT_TRUE(outcome.GetError().GetExceptionName() == "InvalidAction");
294300
}
295301

296302
TEST_F(S3UnitTest, PutObjectShouldHaveCorrectUserAgent) {

tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressIdentityProviderSource.vm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
\#include <aws/core/auth/AWSCredentialsProviderChain.h>
1111
\#include <utility>
1212
\#include <thread>
13+
\#include <aws/crt/Optional.h>
1314

1415
using namespace ${rootNamespace}::${serviceNamespace};
1516
using namespace ${rootNamespace}::Utils;
@@ -254,7 +255,7 @@ AwsCredentialIdentity SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(
254255
// If we fail the connect call return empty credentials and log an error message.
255256
if (!outcome.IsSuccess()) {
256257
AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "Failed to make S3Express Connect Call")
257-
return {"", "", {""}, {}};
258+
return {"", "", {""}, {}, Aws::Crt::Optional<Aws::String>()};
258259
}
259260
auto result = outcome.GetResult();
260261
const auto &credentials = result.GetCredentials();
@@ -268,7 +269,8 @@ AwsCredentialIdentity SmithyS3ExpressIdentityProvider::GetCredentialsFromBucket(
268269
return {credentials.GetAccessKeyId(),
269270
credentials.GetSecretAccessKey(),
270271
credentials.GetSessionToken(),
271-
expiry};
272+
expiry,
273+
Aws::Crt::Optional<Aws::String>()};
272274
}
273275

274276

@@ -285,7 +287,7 @@ AwsCredentialIdentity SmithyDefaultS3ExpressIdentityProvider::GetS3ExpressAwsIde
285287
auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName");
286288
if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) {
287289
AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call")
288-
return {"", "", {""}, {}};
290+
return {"", "", {""}, {}, Aws::Crt::Optional<Aws::String>()};
289291
}
290292
std::lock_guard<std::mutex> lock(*GetMutexForBucketName(bucketNameIter->second));
291293
AwsCredentialIdentity identity;
@@ -331,7 +333,7 @@ AwsCredentialIdentity SmithyDefaultAsyncS3ExpressIdentityProvider::GetS3ExpressA
331333
auto bucketNameIter = serviceSpecificParameters->parameterMap.find("bucketName");
332334
if (bucketNameIter == serviceSpecificParameters->parameterMap.end()) {
333335
AWS_LOGSTREAM_ERROR(S3_EXPRESS_IDENTITY_PROVIDER, "property bucketName Required to make call")
334-
return {"", "", {""}, {}};
336+
return {"", "", {""}, {}, Aws::Crt::Optional<Aws::String>()};
335337
}
336338
threadSafeKeyInsert(bucketNameIter->second);
337339
std::lock_guard<std::mutex> lock(*GetMutexForBucketName(bucketNameIter->second));

tools/code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/s3/SmithyS3ExpressSignerSource.vm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ typename S3ExpressSignerBase<BASECLASS>::SigningFutureOutcome S3ExpressSignerBas
113113
}
114114
putRequestId(requestId);
115115
httpRequest->SetHeaderValue(S3_EXPRESS_HEADER, identity.sessionToken().value());
116-
auto idCopy = smithy::AwsCredentialIdentity{identity.accessKeyId(), identity.secretAccessKey(), {}, identity.expiration()};
116+
auto idCopy = smithy::AwsCredentialIdentity{identity.accessKeyId(), identity.secretAccessKey(), {}, identity.expiration(),identity.accountId() };
117117
auto isSigned = BASECLASS::sign(httpRequest, idCopy, properties);
118118
deleteRequestId(requestId);
119119
return SigningFutureOutcome(std::move(httpRequest));

0 commit comments

Comments
 (0)